master
howell 4 years ago
parent 93faac26cd
commit edbc81f1b4

@ -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 //这个是累计收益

@ -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()
}

@ -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()

@ -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)
}

@ -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")

Loading…
Cancel
Save