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