From aaa4ec501082fcedfe551f1ca615978b5eff1f7d Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 15 Sep 2025 10:31:40 +0800 Subject: [PATCH] 1 --- app/custom/svc/svc_my_task.go | 13 ++++--------- app/custom/svc/svc_order.go | 6 +++--- app/custom/svc/svc_task_list.go | 25 +++++++++++++++++++------ app/router/router.go | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/app/custom/svc/svc_my_task.go b/app/custom/svc/svc_my_task.go index 453f051..22e7d2b 100644 --- a/app/custom/svc/svc_my_task.go +++ b/app/custom/svc/svc_my_task.go @@ -23,8 +23,8 @@ func TaskIncomeList(c *gin.Context) { sql := `SELECT SUM(ctupor.amount) as amount,ctl.name FROM camp_task_user_promotion_order_relate ctupor LEFT JOIN camp_task_user_promotion_order ctupo on ctupo.oid=ctupor.oid LEFT JOIN camp_task_list ctl on ctl.id=ctupo.task_id -WHERE ctupor.uid=%d and ctupo.settle_time like '2025-09%' GROUP BY ctupo.task_id ORDER BY ctupo.settle_time desc,ctupo.id desc %s` - sql = fmt.Sprintf(sql, user.Info.Uid, "limit "+utils.IntToStr((utils.StrToInt(args["p"])-1)*10)+",10") +WHERE ctupor.uid=%d and ctupo.settle_time like '%s' GROUP BY ctupo.task_id ORDER BY ctupo.settle_time desc,ctupo.id desc %s` + sql = fmt.Sprintf(sql, user.Info.Uid, args["date"]+"%", "limit "+utils.IntToStr((utils.StrToInt(args["p"])-1)*10)+",10") nativeString, _ := db.QueryNativeString(svc.MasterDb(c), sql) list := make([]map[string]string, 0) for _, v := range nativeString { @@ -51,8 +51,8 @@ LEFT JOIN camp_task_list ctls on ctls.id=ct.task_id where ctls.first_cid in( SELECT ctl.first_cid FROM camp_task_user_promotion_qrcode ctupo LEFT JOIN camp_task_list ctl on ctl.id=ctupo.task_id -WHERE ctupo.uid=%d GROUP BY ctupo.task_id ) and ctls.up_down_state=1 and ctls.num>0 order by ctls.extend_num desc,ctls.id desc limit 5` - sql = fmt.Sprintf(sql, user.Info.Uid) +WHERE ctupo.uid=%d GROUP BY ctupo.task_id ) and ctls.up_down_state=1 and ctls.num>0 order by ctls.extend_num desc,ctls.id desc %s` + sql = fmt.Sprintf(sql, user.Info.Uid, "limit "+utils.IntToStr((utils.StrToInt(args["p"])-1)*10)+",10") nativeString, _ := db.QueryNativeString(svc.MasterDb(c), sql) list := make([]map[string]string, 0) for _, v := range nativeString { @@ -73,11 +73,6 @@ WHERE ctupo.uid=%d GROUP BY ctupo.task_id ) and ctls.up_down_state=1 and ctls.n return } func TaskIncome(c *gin.Context) { - var args map[string]string - if err := c.ShouldBindJSON(&args); err != nil { - e.OutErr(c, e.ERR_INVALID_ARGS) - return - } user := svc.GetUser(c) today := utils.GetTimeRange("today") sql := `SELECT SUM(ctupor.amount) as amount,SUM(IF(and ctupo.settle_time >= '%s',ctupor.amount,0) as today_amount FROM camp_task_user_promotion_order_relate ctupor diff --git a/app/custom/svc/svc_order.go b/app/custom/svc/svc_order.go index 736a586..c3fb035 100644 --- a/app/custom/svc/svc_order.go +++ b/app/custom/svc/svc_order.go @@ -286,11 +286,11 @@ func TaskQrcodeList(c *gin.Context) { } user := svc.GetUser(c) var data []models.CampTaskUserPromotionQrcode - size := utils.StrToInt(args["size"]) + size := 10 p := utils.StrToInt(args["p"]) sess := svc.MasterDb(c).Where("uid=?", user.Info.Uid) - if args["id"] != "" { - sess.And("task_id=?", args["id"]) + if args["task_id"] != "" { + sess.And("task_id=?", args["task_id"]) } sess.Limit(size, (p-1)*size).OrderBy("id desc").Find(&data) list := make([]map[string]string, 0) diff --git a/app/custom/svc/svc_task_list.go b/app/custom/svc/svc_task_list.go index 7532773..dd2a7db 100644 --- a/app/custom/svc/svc_task_list.go +++ b/app/custom/svc/svc_task_list.go @@ -11,12 +11,13 @@ import ( "encoding/json" "fmt" "github.com/gin-gonic/gin" + "strings" ) func TaskBase(c *gin.Context) { taskCate := make([]map[string]string, 0) taskCateList := make([]models.CampTaskCate, 0) - svc.MasterDb(c).Where("is_show_store=? and is_show=?", 1, 1).OrderBy("sort desc,id desc").Find(&taskCateList) + svc.MasterDb(c).Where(" is_show=?", 1).OrderBy("sort desc,id desc").Find(&taskCateList) taskAllCate := make([]map[string]interface{}, 0) for _, v := range taskCateList { if v.Pid > 0 { @@ -60,7 +61,6 @@ func IndexTaskList(c *gin.Context) { } hotTask := make([]map[string]interface{}, 0) args["sort"] = "camp_task_list.success_num desc,camp_task_list.id desc" - args["p"] = "1" args["size"] = "5" hotTaskList := CommTask(c, args) if hotTaskList != nil { @@ -68,10 +68,14 @@ func IndexTaskList(c *gin.Context) { basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price) label := make([]string, 0) json.Unmarshal([]byte(v.Label), &label) + labelStr := "" + if len(label) > 0 { + labelStr = strings.Join(label, " ") + } tmp := map[string]interface{}{ "id": utils.IntToStr(v.CampTaskOperatorTask.Id), "name": v.Name, - "label": label, + "label": labelStr, "base_price": basePrice, "remark": v.Remark, "first_price": "团长佣金: ¥" + secondPrice, @@ -102,10 +106,14 @@ func SearchTaskList(c *gin.Context) { basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price) label := make([]string, 0) json.Unmarshal([]byte(v.Label), &label) + labelStr := "" + if len(label) > 0 { + labelStr = strings.Join(label, " ") + } tmp := map[string]interface{}{ "id": utils.IntToStr(v.CampTaskOperatorTask.Id), "name": v.Name, - "label": label, + "label": labelStr, "base_price": basePrice, "remark": v.Remark, "first_price": "团长佣金: ¥" + secondPrice, @@ -137,6 +145,8 @@ func TaskDetail(c *gin.Context) { priceList := make([]map[string]string, 0) count, _ := svc.MasterDb(c).Where("task_id=?", CampTaskOperatorTask.TaskId).Count(&models.CampTaskNotice{}) noticeNum := utils.Int64ToStr(count) + labelStr := "" + tmp := map[string]interface{}{ "id": utils.IntToStr(CampTaskOperatorTask.Id), "name": hotTaskList.Name, @@ -145,7 +155,7 @@ func TaskDetail(c *gin.Context) { "icon": svc.ImageFormat(c, hotTaskList.Logo), "timer": hotTaskList.StartTime.Format("2006-01-02") + "至" + hotTaskList.EndTime.Format("2006-01-02"), "detail_info": DetailInfo, - "label": label, + "label": labelStr, "is_can_buy": "1", "buy_tip_str": "", "reward_list": reward, @@ -167,7 +177,10 @@ func TaskDetail(c *gin.Context) { tmp["instructions"] = taskDetail.Instructions } json.Unmarshal([]byte(hotTaskList.Label), &label) - tmp["label"] = label + if len(label) > 0 { + labelStr = strings.Join(label, " ") + } + tmp["label"] = labelStr user, _ := svc.GetDefaultUser(c, c.GetHeader("Authorization")) _, firstPrice, secondPrice, thirdPrice, _ := CommPrice(c, hotTaskList.Price) diff --git a/app/router/router.go b/app/router/router.go index 1c806f5..d37e884 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -138,7 +138,7 @@ func routeCustom(r *gin.RouterGroup) { r.POST("/taskQrcodeList", customHdl.TaskQrcodeList) r.POST("/taskMyList", customHdl.TaskMyList) r.POST("/taskMyTotal", customHdl.TaskMyTotal) - r.POST("/taskIncome", customHdl.TaskIncome) + r.GET("/taskIncome", customHdl.TaskIncome) r.POST("/taskIncomeList", customHdl.TaskIncomeList) r.POST("/taskIncomeTaskList", customHdl.TaskIncomeTaskList)