no message
This commit is contained in:
parent
696267d954
commit
142b2f0ba5
|
|
@ -12,10 +12,10 @@ type LogLogin struct {
|
|||
ID uint `gorm:"primaryKey"`
|
||||
Snid int `gorm:"index"`
|
||||
OnlineType int `gorm:"index"`
|
||||
//OnlineTs int `gorm:"index"`
|
||||
OnlineTs int64 `gorm:"index"`
|
||||
OnlineTime time.Time `gorm:"index"`
|
||||
OfflineType int `gorm:"index"`
|
||||
//OfflineTs int `gorm:"index"`
|
||||
OfflineTs int64 `gorm:"index"`
|
||||
OfflineTime time.Time `gorm:"index"`
|
||||
ChannelId string `gorm:"index"` // 推广渠道
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ var Tables = []interface{}{
|
|||
&LogLogin{},
|
||||
&LogLoginMid{},
|
||||
&UserAccount{},
|
||||
&UserLogin{},
|
||||
&UserID{},
|
||||
//&UserLogin{},
|
||||
//&UserID{},
|
||||
&LogInviteScoreMid{},
|
||||
&LogInviteScore{},
|
||||
&LogInviteUser{},
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ type UserAccount struct {
|
|||
Snid int `gorm:"index"`
|
||||
//RegisterTs int `gorm:"index"`
|
||||
RegisterTime time.Time `gorm:"index"`
|
||||
RegisterTs int64 `gorm:"index"`
|
||||
ChannelId string `gorm:"index"` // 推广渠道
|
||||
|
||||
DeviceName string `gorm:"index"`
|
||||
|
|
|
|||
|
|
@ -93,10 +93,10 @@ func LogLogin(platform string, batchSize int) ([]*mysqlmodel.LogLogin, error) {
|
|||
e = &mysqlmodel.LogLogin{
|
||||
Snid: int(v.SnId),
|
||||
OnlineType: onlineType,
|
||||
//OnlineTs: int(v.Ts),
|
||||
OnlineTs: v.Time.Unix(),
|
||||
OnlineTime: v.Time,
|
||||
OfflineType: 0,
|
||||
//OfflineTs: 0,
|
||||
OfflineTs: 0,
|
||||
OfflineTime: v.Time,
|
||||
DeviceName: v.DeviceName,
|
||||
AppVersion: v.AppVersion,
|
||||
|
|
@ -132,7 +132,7 @@ func LogLogin(platform string, batchSize int) ([]*mysqlmodel.LogLogin, error) {
|
|||
}
|
||||
|
||||
e.OfflineType = mysqlmodel.LogTypeOffline
|
||||
//e.OfflineTs = int(v.Ts)
|
||||
e.OfflineTs = v.Time.Unix()
|
||||
e.OfflineTime = v.Time
|
||||
if err = db.Model(e).Select("OfflineType", "OfflineTime").Updates(e).Error; err != nil {
|
||||
logger.Logger.Errorf("mysql: SyncLogLogin failed to update log_login: %v", err)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ func UserAccount(platform string, batchSize int) ([]*mysqlmodel.UserAccount, err
|
|||
a := &mysqlmodel.UserAccount{
|
||||
MID: v.AccountId.Hex(),
|
||||
Snid: int(v.SnId),
|
||||
//RegisterTs: int(v.RegisterTs),
|
||||
RegisterTs: v.RegisteTime.Unix(),
|
||||
RegisterTime: v.RegisteTime,
|
||||
Tel: v.Tel,
|
||||
ChannelId: v.ChannelId,
|
||||
|
|
@ -81,17 +81,17 @@ func UserAccount(platform string, batchSize int) ([]*mysqlmodel.UserAccount, err
|
|||
return err
|
||||
}
|
||||
|
||||
if err = tx.First(&mysqlmodel.UserID{}, "snid = ?", v.SnId).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
logger.Logger.Errorf("mysql: UserAccount failed to find user_id: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
if err = tx.Create(&mysqlmodel.UserID{Snid: int(v.SnId)}).Error; err != nil {
|
||||
logger.Logger.Errorf("mysql: UserAccount failed to create user_id: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
//if err = tx.First(&mysqlmodel.UserID{}, "snid = ?", v.SnId).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
// logger.Logger.Errorf("mysql: UserAccount failed to find user_id: %v", err)
|
||||
// return err
|
||||
//}
|
||||
//
|
||||
//if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
// if err = tx.Create(&mysqlmodel.UserID{Snid: int(v.SnId)}).Error; err != nil {
|
||||
// logger.Logger.Errorf("mysql: UserAccount failed to create user_id: %v", err)
|
||||
// return err
|
||||
// }
|
||||
//}
|
||||
|
||||
as = append(as, a)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue