From 4de9e62c8faa471580f92b55e828da758ed069ac Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 11 Nov 2024 21:02:29 +0800 Subject: [PATCH] update --- .../public_platoon/hdl_basic.go | 21 +++---------------- .../public_platoon/svc_relation_ship_map.go | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index 468ddb4..e884618 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -585,35 +585,20 @@ func UserDailyActivityAnalysis(c *gin.Context) { return } - var activityUserCount int64 + var activityCount, activityUserCount int64 for _, value := range res1 { - tempCount, err := strconv.ParseInt(fmt.Sprintf("%v", value), 10, 64) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - } - activityUserCount += tempCount - } - - sql2 := "SELECT COUNT(1) AS total FROM `egg_enery_user_activity` WHERE uid IN (SELECT uid FROM `user_relate` WHERE parent_uid = ?)" - res2, err := db.Db.QueryInterface(sql2, parentRelation.Uid) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - - var activityCount int64 - for _, value := range res2 { tempCount, err := strconv.ParseInt(fmt.Sprintf("%v", value), 10, 64) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) } activityCount += tempCount + activityUserCount++ } topData := md.DailyActivityAnalysisTopData{ TeamUserCount: total, - TeamActivityUserCount: activityUserCount, ActivityCount: activityCount, + TeamActivityUserCount: activityUserCount, } if sons == nil { diff --git a/app/svc/public_platoon/svc_relation_ship_map.go b/app/svc/public_platoon/svc_relation_ship_map.go index a457b77..bd2a0d8 100644 --- a/app/svc/public_platoon/svc_relation_ship_map.go +++ b/app/svc/public_platoon/svc_relation_ship_map.go @@ -171,7 +171,7 @@ func GetSonUserDailyActivity(engine *xorm.Engine, fatherUID int64, startDate, en return 0, nil, zhios_order_relate_logx.Error(err) } - sql1 := "SELECT COUNT(*) AS total, uid FROM `egg_enery_user_activity` WHERE uid IN ? AND date > ? AND date < ? GROUP BY uid" + sql1 := "SELECT COUNT(*) AS total, uid FROM `egg_enery_user_activity` WHERE uid IN ? AND date >= ? AND date <= ? GROUP BY uid" res, err := engine.QueryInterface(sql1, utils.AnyToString(userIDs), startDate, endDate) if err != nil { return 0, nil, zhios_order_relate_logx.Error(err)