|
|
@@ -565,21 +565,35 @@ func MyFans(c *gin.Context) { |
|
|
|
nativeString1, _ := db.QueryNativeString(db.Db, sql) |
|
|
|
hasUserCount := utils.StrToInt64(nativeString1[0]["total"]) |
|
|
|
|
|
|
|
session := db.Db.NewSession() |
|
|
|
defer session.Close() |
|
|
|
now := time.Now() |
|
|
|
assistanceDb := implement.NewEggEnergyTeamAssistanceDb(db.Db) |
|
|
|
assistance, err := assistanceDb.EggEnergyTeamAssistanceGetOneBySession(session, user.Id, now.Format("2006-01-02")) |
|
|
|
nowStr := time.Now().Format("2006-01-02 15:04:05") |
|
|
|
signInDb := implement.NewEggSignInDb(db.Db) |
|
|
|
has, signIn, err := signInDb.EggSignINGetOneByTimeAndUid("", nowStr, user.Id, 0) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
var nowTeamAssistanceNum int |
|
|
|
var nowTeamAssistanceReward string |
|
|
|
if assistance != nil { |
|
|
|
nowTeamAssistanceNum = assistance.AssistedNum |
|
|
|
nowTeamAssistanceReward = assistance.RewardScore |
|
|
|
if !has { |
|
|
|
nowTeamAssistanceNum = 0 |
|
|
|
nowTeamAssistanceReward = "0" |
|
|
|
} else { |
|
|
|
session := db.Db.Where("") |
|
|
|
assistanceDb := implement.NewEggEnergyTeamAssistanceDb(db.Db) |
|
|
|
assistance, err := assistanceDb.EggEnergyTeamAssistanceGetOneByParamsBySession(session, map[string]interface{}{ |
|
|
|
"key": "sign_id", |
|
|
|
"value": signIn.Id, |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
return |
|
|
|
} |
|
|
|
if assistance != nil { |
|
|
|
nowTeamAssistanceNum = assistance.AssistedNum |
|
|
|
nowTeamAssistanceReward = assistance.RewardScore |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resp := md.MyFansResp{ |
|
|
|
NowTeamUser: hasUserCount, |
|
|
|
NowTeamAssistanceNum: nowTeamAssistanceNum, |
|
|
|