@@ -558,23 +558,13 @@ func TotalRate(c *gin.Context) {
// @Failure 400 {object} md.Response "具体错误"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/addFriend/myFans [GET]
// @Router /api/v1/addFriend/myFans [GET]
func MyFans(c *gin.Context) {
func MyFans(c *gin.Context) {
val, exists := c.Get("user")
if !exists {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
user, ok := val.(*model.User)
if !ok {
e.OutErr(c, e.ERR_USER_CHECK_ERR, nil)
return
}
// 找出公排中所有关联用户
userRelateDb := implement.NewUserRelateDb(db.Db)
total, err := userRelateDb.UserRelatesCountByParentUid(user.Id, 0)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
user := svc.GetUser(c)
// 找出公排网络中所有关联用户
uid := user.Id
sql := fmt.Sprintf("SELECT COUNT(*)AS total FROM `public_platoon_user_relation` WHERE father_uid1 = %d OR father_uid2= %d OR father_uid3= %d OR father_uid4= %d OR father_uid5= %d OR father_uid6= %d OR father_uid7= %d OR father_uid8= %d OR father_uid9= %d", uid, uid, uid, uid, uid, uid, uid, uid, uid)
nativeString1, _ := db.QueryNativeString(db.Db, sql)
hasUserCount := utils.StrToInt64(nativeString1[0]["total"])
session := db.Db.NewSession()
session := db.Db.NewSession()
defer session.Close()
defer session.Close()
now := time.Now()
now := time.Now()
@@ -591,7 +581,7 @@ func MyFans(c *gin.Context) {
nowTeamAssistanceReward = assistance.RewardScore
nowTeamAssistanceReward = assistance.RewardScore
}
}
resp := md.MyFansResp{
resp := md.MyFansResp{
NowTeamUser: total ,
NowTeamUser: hasUserCount ,
NowTeamAssistanceNum: nowTeamAssistanceNum,
NowTeamAssistanceNum: nowTeamAssistanceNum,
NowTeamAssistanceReward: nowTeamAssistanceReward,
NowTeamAssistanceReward: nowTeamAssistanceReward,
}
}