Documentation
¶
Overview ¶
*
- 日期处理类
- @author
- @since 2021/11/12
- @File : date
*
- 数据库连接工具
- @author
- @since 2021/9/8
- @File : db
*
- 支付工具类
- @author
- @since 2021/8/12
- @File : pay
*
- Jwt工具类
- @author
- @since 2021/8/12
- @File : jwt
*
- 支付工具类
- @author
- @since 2021/8/12
- @File : pay
*
- 数据库连接工具
- @author
- @since 2021/9/8
- @File : db
*
- 常规常量
- @author
- @since 2021/11/12
- @File : user
*
- 系统工具类
- @author
- @since 2021/8/25
- @File : utils
Index ¶
- Constants
- Variables
- func AppDebug() bool
- func CheckDirExist(dir string) (bool, error)
- func CheckDirWithCreate(dir string) error
- func CheckSign(ctx *gin.Context) bool
- func CreateDir(path string) bool
- func FilePath() string
- func FloatToInt(f float64) int
- func GenerateToken(userId int, username, password string) (string, error)
- func GetAppSecret(ctx *gin.Context, appId string) string
- func GetClientIp(ctx *gin.Context) string
- func GetDatabase() (string, error)
- func GetDir(fp string) string
- func GetImageUrl(path string) string
- func GetLogDir(s string) string
- func GetNewSign(dataMap map[string]string, keyArray *garray.StrArray, secret string) string
- func GetProductId(goodsId int64, amount float64) string
- func GetReq(url string) (string, bool)
- func GetUrl(url string, data map[string]string) string
- func ImagePath() string
- func ImageUrl() string
- func InArray(value string, array []interface{}) bool
- func InStringArray(value string, array []string) bool
- func IsExist(path string) bool
- func IsLogin(ctx *gin.Context) bool
- func Md5(password string) (string, error)
- func MkdirAll(dir string) error
- func NewLogRusLogger(logfile, logLevel string) (*logrus.Logger, error)
- func NewRedisHelper() *redis.Client
- func OrderDirectAdd(mobile, outTradeNo, host string, goodsId int64, amount float64) (string, bool)
- func PostReq(reqMap map[string]interface{}, url string) (string, bool)
- func PostReqJson(reqMap map[string]interface{}, url string) (string, bool)
- func PostReqJsonHeader(reqMap map[string]string, url string, header map[string]string) (string, bool)
- func PostReqJsonV2(reqMap map[string]string, url string) (string, bool)
- func PostReqV2(reqMap map[string]string, url string) (string, bool)
- func Reverse(arr *[]string)
- func SaveImage(url string, dirname string) (string, error)
- func SaveImageContent(content string, title string, dirname string) string
- func SubStr(str string, start int, length int) (result string)
- func TempPath() string
- func Uid(ctx *gin.Context) int
- func UploadPath() string
- type Claims
- type LocalTime
- type Lock
- type PbSettingAppUtils
- type RedisHelper
- type Rsp
Constants ¶
View Source
const ( LQAppKey = "2838498" LQAppSecret = "f988a360af90413d8f0dd2b43d70501f" MethodOrderDirectAdd = "order.direct.add" TimeFormat = "2006-01-02 15:04:05" Version = "2.0" Format = "json" Charset = "utf-8" SignType = "md5" HostTest = "https://api.lqivip.net/api/getway" Host = "https://api.lqivip.com/api/getway" )
View Source
const LocalDateTimeFormat string = "2006-01-02 15:04:05"
Variables ¶
View Source
var GENDER_LIST = map[int]string{
1: "男",
2: "女",
3: "保密",
}
性别
View Source
var HttpClient *http.Client
View Source
var Mongodb *mongo.Database
View Source
var SelfNetTransport *http.Transport
View Source
var XormDb *xorm.Engine
Functions ¶
func CheckDirExist ¶
func CheckDirWithCreate ¶
CheckDirWithCreate 检查目录是否存在,不存在创建
func FloatToInt ¶
func GenerateToken ¶
根据用户的用户名和密码产生token
func GetNewSign ¶
获取签名
func GetProductId ¶
获取产品id goodsId 类型:1移动 2电信 3联通
func InStringArray ¶
func NewLogRusLogger ¶
NewLogRusLogger New LogRus l
func NewRedisHelper ¶
func NewRedisHelper() *redis.Client
func PostReqJsonHeader ¶
func SaveImageContent ¶
处理富文本
Types ¶
type Claims ¶
type Claims struct { UserId int `json:"id"` Username string `json:"username"` Password string `json:"password"` jwt.StandardClaims }
Claim是一些实体(通常指的用户)的状态和额外的元数据
func GetLoginUserInfo ¶
根据传入的token值获取到Claims对象信息,(进而获取其中的用户名和密码)
func ParseToken ¶
根据传入的token值获取到Claims对象信息,(进而获取其中的用户名和密码)
type PbSettingAppUtils ¶
type PbSettingAppUtils struct { Id int `json:"id" xorm:"not null pk autoincr comment('主键ID') INT(10)"` AppId string `json:"app_id"` AppName string `json:"app_name"` Phone string `json:"phone"` AppKey string `json:"app_key"` Status int64 `json:"status"` CouponSmsContent string `json:"coupon_sms_content"` ServiceAddress string `json:"service_address"` ComName string `json:"com_name"` FilingNo string `json:"filing_no"` }
func GetAppInfo ¶
func GetAppInfo(ctx *gin.Context, appId string) PbSettingAppUtils
根据 appid 获取 appSecret
func (*PbSettingAppUtils) TableName ¶
func (r *PbSettingAppUtils) TableName() string
type RedisHelper ¶
type RedisHelper struct {
*redis.Client
}
func GetRedisHelper ¶
func GetRedisHelper() *RedisHelper
Source Files
¶
Click to show internal directories.
Click to hide internal directories.