diff --git a/internal/api/mobile/users/my_info.go b/internal/api/mobile/users/my_info.go index 334eeaa..714a01f 100644 --- a/internal/api/mobile/users/my_info.go +++ b/internal/api/mobile/users/my_info.go @@ -128,17 +128,17 @@ func MyInfo(c *gin.Context) { // ------- 自购收益 var msData = myShoppingData(p.UserID) - cache.SetTmpData(p.UserID, cache.TMP_SELF_TYPE, msData) + cache.SetTmpData(p.UserID, cache.TmpSelfType, msData) juniors := tree.GetTheJuniorUsers(p.UserID) // ---- ShareIncome 分享收益 var siData = shareIncomeData(p.UserID) - cache.SetTmpData(p.UserID, cache.TMP_SHARE_TYPE, siData) + cache.SetTmpData(p.UserID, cache.TmpShareType, siData) // ---- TeamIncome 团队收益 var tiData = teamIncomeData(p.UserID, juniors) - cache.SetTmpData(p.UserID, cache.TMP_TEAM_TYPE, siData) + cache.SetTmpData(p.UserID, cache.TmpTeamType, siData) //dbc.DB.Model(&order.Information{}).Select("sum(goods_total_amount) as amount").Where("user_id in (?) and status = 4", juniors).Scan(&tiData) // @@ -569,7 +569,7 @@ func IncomeFromTeam(c *gin.Context) { var tiData TeamIncomeSub var tiDataTmp TeamIncome - if res, ok := cache.GetTmpData(p.UserID, cache.TMP_TEAM_TYPE); !ok { + if res, ok := cache.GetTmpData(p.UserID, cache.TmpTeamType); !ok { tiDataTmp = teamIncomeData(p.UserID, juniors) tiData.HistoryIncome = tiDataTmp.OrderNum //这个是销售额 tiData.TeamAmount = tiDataTmp.Amount //这个是累计收益 diff --git a/internal/cache/newer_tehui.go b/internal/cache/newer_tehui.go index e8d4841..4aa96ae 100644 --- a/internal/cache/newer_tehui.go +++ b/internal/cache/newer_tehui.go @@ -9,7 +9,7 @@ import ( const TeHuiCacheKey = "NewerTehuiGoodsID" -var EmptyError = errors.New("The newertehui table is empty") +var EmptyError = errors.New("The newertehui table is empty\n") // FlushNewerGoodsID 将特惠的good id放入缓存,形成集合, 然后在查找的时候可以快速查找,减少数据库负担 func FlushNewerGoodsID() error { @@ -38,7 +38,7 @@ func IsMemberOfNewerTehui(id string) (isMember bool, err error) { return } -// 删除集合 +// DelNewerTehuiSet 删除集合 func DelNewerTehuiSet() (int64, error) { return dbc.Rds.Del(TeHuiCacheKey).Result() } diff --git a/internal/cache/sms.go b/internal/cache/sms.go index b9d2d0a..b6ffd87 100755 --- a/internal/cache/sms.go +++ b/internal/cache/sms.go @@ -7,9 +7,7 @@ import ( "time" ) -/* ****************************************************** - *********** 缓存登录验证码 ******* -****************************************************** */ +// SetUserSMSCode 缓存登录验证码 func SetUserSMSCode(mobile string, code string) { k := fmt.Sprintf("login_sms_%v", mobile) e := dbc.Rds.Set(k, code, time.Minute*10).Err() diff --git a/internal/cache/sub_view.go b/internal/cache/sub_view.go index 5f79195..d31e9e2 100644 --- a/internal/cache/sub_view.go +++ b/internal/cache/sub_view.go @@ -8,12 +8,12 @@ import ( "time" ) -const TMPTIME = 60 -const TMP_USER_DATA = "MyInfo_" +const TmpTime = 60 +const TmpUserData = "MyInfo_" const ( - TMP_SELF_TYPE = TMP_USER_DATA + "Self_" - TMP_SHARE_TYPE = TMP_USER_DATA + "Share_" - TMP_TEAM_TYPE = TMP_USER_DATA + "Team_" + TmpSelfType = TmpUserData + "Self_" + TmpShareType = TmpUserData + "Share_" + TmpTeamType = TmpUserData + "Team_" ) func SetTmpData(userId uint, tmpType string, data interface{}) { @@ -23,7 +23,7 @@ func SetTmpData(userId uint, tmpType string, data interface{}) { return } - _, err = dbc.Rds.Set(tmpType+strconv.Itoa(int(userId)), tmpData, TMPTIME*time.Second).Result() + _, err = dbc.Rds.Set(tmpType+strconv.Itoa(int(userId)), tmpData, TmpTime*time.Second).Result() if err != nil { comFunc.PrintErr("setTmpData set error:", err) } diff --git a/internal/cache/user.go b/internal/cache/user.go index 9bfd870..c92f8c4 100755 --- a/internal/cache/user.go +++ b/internal/cache/user.go @@ -9,9 +9,7 @@ import ( user2 "recook/internal/v2/model/recook/user" ) -/* ****************************************************** - *********** 缓存登录令牌 ******* -****************************************************** */ +// SetUserLoginCache 缓存登录令牌 func SetUserLoginCache(l *user.Login) { k := fmt.Sprintf("login:%d:user_%d", l.DeviceType, l.ID) err := dbc.Rds.Set(k, l.Token, 0).Err() @@ -33,7 +31,7 @@ func GetUserLoginCache(id uint, deviceType int) string { return val } -// @Style 获取登录设备类型 +// GetDeviceType 获取登录设备类型 func GetDeviceType(c *gin.Context) int { deviceType := c.Request.Header.Get("Device-Type")