Documentation ¶
Index ¶
- Constants
- Variables
- func CheckExpressCode(code string) bool
- func CreateSearchLog(log *SearchLog) error
- func CreateUser(user *User) (int, error)
- func InitDatabase() *gorm.DB
- func ModifyUser(user *User) error
- func StatusOK(db *gorm.DB) *gorm.DB
- type ExpressCompany
- type PaginationDefaultParams
- type PaginationParams
- type SearchLog
- type User
Constants ¶
View Source
const FROM_API int8 = 1
View Source
const FROM_CACHE int8 = 2
View Source
const IN_LAND = 1 // 国内快递
View Source
const OUT_LAND = 2 // 国际快递
View Source
const REQUEST_FAIL int8 = 2
View Source
const REQUEST_SUCCESS int8 = 1
View Source
const STATUS_FAIL = 2 // 异常状态
View Source
const STATUS_OK = 1 // 正常状态
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func CreateSearchLog ¶
func CreateUser ¶
func InitDatabase ¶
func ModifyUser ¶
Types ¶
type ExpressCompany ¶
type ExpressCompany struct { // 通过制定json字段 能控制返回给前段的属性名,比如这里使用小写 // 注意不同字符串直接的空格 // `json:"id" gorm:"primaryKey; notNull; autoIncrement; comment:主键;"` ID int16 `gorm:"primaryKey; notNull; autoIncrement; comment:主键;"` Name string `gorm:"notNull; size:64; default:''; comment:快递公司名"` Code string `gorm:"notNull; size:24; default:''; comment:快递公司编码"` FirstCode string `gorm:"notNull; size:1; default:''; comment:快递公司编码的首字母"` FirstNameCode string `gorm:"notNull; size:1; default:''; comment:快递公司名的首字母"` Icon string `gorm:"notNull; size:256; default:''; comment:快递公司名的图标"` Tel string `gorm:"notNull; size:256; default:''; comment:快递公司名的联系电话"` Type int8 `gorm:"notNull; default:1; comment:快递公司类型 1=国内快递 2=国际快递"` Status int8 `gorm:"notNULL; default: 1; comment: 快递状态 1=正常 2=异常"` CreatedAt time.Time UpdatedAt time.Time }
type PaginationDefaultParams ¶
type PaginationParams ¶
type PaginationParams struct {
PaginationDefaultParams
}
type SearchLog ¶
type SearchLog struct { ID int16 `gorm:"primaryKey; notNull; autoIncrement; comment:主键;"` UserID int `gorm:"notNull; size:64; default:0; comment:所属用户"` ShipperCode string `gorm:"notNull; size:24; default:''; comment:查询的快递公司编码"` LogisticCode string `gorm:"notNull; size:24; default:''; comment:查询的快递单号"` IsCache int8 `gorm:"notNull; size:1; default:1; comment:结果是否来自缓存,1=来自第三方接口 2=来自缓存"` IsSuccess int8 `gorm:"notNull; size:1; default:1; comment:查询是否成功,1=成功 2=失败"` // 这里可以通过gorm的tags来改变数据库的映射字段类型 Result string `gorm:"type:text; notNull; comment:接口返回结果"` ErrorMsg string `gorm:"notNull; size:256; default:''; comment:接口失败返回信息"` Ip string `gorm:"notNULL; size:32; default: ''; comment: 用户的ip地址"` CreatedAt time.Time UpdatedAt time.Time }
快递查询日志表
type User ¶
type User struct { ID int `gorm:"primaryKey; notNull; autoIncrement; comment:主键"` Openid string `gorm:"unique; size:64; notNull; comment: 用户的openid"` Unionid string `gorm:"notNULL; size:64; default: ''; comment: 用户的unionid"` Platform string `gorm:"notNULL; size:64; default: 'wechat-mini'; comment: 用户的来源平台"` NickName string `gorm:"notNULL; size:128; default: ''; comment: 用户的昵称"` HeadImg string `gorm:"notNULL; default: ''; comment: 用户的头像地址"` Status int8 `gorm:"notNULL; default: 1; comment: 用户的状态 1=正常 2=异常"` Ip string `gorm:"notNULL; size:32; default: ''; comment: 用户的ip地址"` LastLoginAt time.Time `gorm:"notNULL; comment: 用户最后一次登录时间"` SessionKey string `gorm:"notNULL; default:''; comment: 小程序秘钥"` CreatedAt time.Time UpdatedAt time.Time // 定义和快递查询日志的1对多关系 SearchLogs []SearchLog }
func UserByOpenid ¶
Click to show internal directories.
Click to hide internal directories.