1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package models
- type LoginLog struct {
- UserId string `json:"user_id"`
- LoginType int `json:"login_type"`
- LoginIP string `json:"login_ip"`
- Address string `json:"address"`
- Latitude float64 `json:"latitude"`
- Longitude float64 `json:"longitude"`
- }
- type TaskLog struct {
- TaskID int64 `json:"task_id"`
- TaskType int `json:"task_type"`
- UserId string `json:"user_id"`
- }
- type CustomerTmp struct {
- SourceType int `json:"source_type"`
- SourceID string `json:"source_id"`
- Extend string `json:"extend"`
- TotalPoint int64 `json:"total_point"`
- }
- /**
- 保存登录日志
- */
- /*
- func (log *LoginLog) Save(db *gorm.DB) error {
- // 先校验今天是否已经记录了登录日志
- var (
- sql string
- count int
- )
- sql = "SELECT COUNT(login_id) as count FROM user_login_log WHERE user_id = ? AND UNIX_TIMESTAMP(CAST(login_time AS DATE)) = UNIX_TIMESTAMP(CAST(SYSDATE() AS DATE))"
- db.Raw(sql, log.UserId).Count(&count)
- if count > 0 {
- return nil
- }
- sql = `INSERT INTO user_login_log(user_id, login_ip, address, login_type, latitude, longitude) VALUES(?,?,?,?,?,?)`
- err := db.Exec(sql, log.UserId, log.LoginIP, log.Address, log.LoginType, log.Latitude, log.Longitude).Error
- return err
- }
- */
|