@@ -11,12 +11,13 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"strings"
)
)
func TaskBase(c *gin.Context) {
func TaskBase(c *gin.Context) {
taskCate := make([]map[string]string, 0)
taskCate := make([]map[string]string, 0)
taskCateList := make([]models.CampTaskCate, 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)
taskAllCate := make([]map[string]interface{}, 0)
for _, v := range taskCateList {
for _, v := range taskCateList {
if v.Pid > 0 {
if v.Pid > 0 {
@@ -60,7 +61,6 @@ func IndexTaskList(c *gin.Context) {
}
}
hotTask := make([]map[string]interface{}, 0)
hotTask := make([]map[string]interface{}, 0)
args["sort"] = "camp_task_list.success_num desc,camp_task_list.id desc"
args["sort"] = "camp_task_list.success_num desc,camp_task_list.id desc"
args["p"] = "1"
args["size"] = "5"
args["size"] = "5"
hotTaskList := CommTask(c, args)
hotTaskList := CommTask(c, args)
if hotTaskList != nil {
if hotTaskList != nil {
@@ -68,10 +68,14 @@ func IndexTaskList(c *gin.Context) {
basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price)
basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price)
label := make([]string, 0)
label := make([]string, 0)
json.Unmarshal([]byte(v.Label), &label)
json.Unmarshal([]byte(v.Label), &label)
labelStr := ""
if len(label) > 0 {
labelStr = strings.Join(label, " ")
}
tmp := map[string]interface{}{
tmp := map[string]interface{}{
"id": utils.IntToStr(v.CampTaskOperatorTask.Id),
"id": utils.IntToStr(v.CampTaskOperatorTask.Id),
"name": v.Name,
"name": v.Name,
"label": label,
"label": labelStr ,
"base_price": basePrice,
"base_price": basePrice,
"remark": v.Remark,
"remark": v.Remark,
"first_price": "团长佣金: ¥" + secondPrice,
"first_price": "团长佣金: ¥" + secondPrice,
@@ -102,10 +106,14 @@ func SearchTaskList(c *gin.Context) {
basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price)
basePrice, _, secondPrice, thirdPrice, _ := CommPrice(c, v.Price)
label := make([]string, 0)
label := make([]string, 0)
json.Unmarshal([]byte(v.Label), &label)
json.Unmarshal([]byte(v.Label), &label)
labelStr := ""
if len(label) > 0 {
labelStr = strings.Join(label, " ")
}
tmp := map[string]interface{}{
tmp := map[string]interface{}{
"id": utils.IntToStr(v.CampTaskOperatorTask.Id),
"id": utils.IntToStr(v.CampTaskOperatorTask.Id),
"name": v.Name,
"name": v.Name,
"label": label,
"label": labelStr ,
"base_price": basePrice,
"base_price": basePrice,
"remark": v.Remark,
"remark": v.Remark,
"first_price": "团长佣金: ¥" + secondPrice,
"first_price": "团长佣金: ¥" + secondPrice,
@@ -137,6 +145,8 @@ func TaskDetail(c *gin.Context) {
priceList := make([]map[string]string, 0)
priceList := make([]map[string]string, 0)
count, _ := svc.MasterDb(c).Where("task_id=?", CampTaskOperatorTask.TaskId).Count(&models.CampTaskNotice{})
count, _ := svc.MasterDb(c).Where("task_id=?", CampTaskOperatorTask.TaskId).Count(&models.CampTaskNotice{})
noticeNum := utils.Int64ToStr(count)
noticeNum := utils.Int64ToStr(count)
labelStr := ""
tmp := map[string]interface{}{
tmp := map[string]interface{}{
"id": utils.IntToStr(CampTaskOperatorTask.Id),
"id": utils.IntToStr(CampTaskOperatorTask.Id),
"name": hotTaskList.Name,
"name": hotTaskList.Name,
@@ -145,7 +155,7 @@ func TaskDetail(c *gin.Context) {
"icon": svc.ImageFormat(c, hotTaskList.Logo),
"icon": svc.ImageFormat(c, hotTaskList.Logo),
"timer": hotTaskList.StartTime.Format("2006-01-02") + "至" + hotTaskList.EndTime.Format("2006-01-02"),
"timer": hotTaskList.StartTime.Format("2006-01-02") + "至" + hotTaskList.EndTime.Format("2006-01-02"),
"detail_info": DetailInfo,
"detail_info": DetailInfo,
"label": label,
"label": labelStr ,
"is_can_buy": "1",
"is_can_buy": "1",
"buy_tip_str": "",
"buy_tip_str": "",
"reward_list": reward,
"reward_list": reward,
@@ -167,7 +177,10 @@ func TaskDetail(c *gin.Context) {
tmp["instructions"] = taskDetail.Instructions
tmp["instructions"] = taskDetail.Instructions
}
}
json.Unmarshal([]byte(hotTaskList.Label), &label)
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"))
user, _ := svc.GetDefaultUser(c, c.GetHeader("Authorization"))
_, firstPrice, secondPrice, thirdPrice, _ := CommPrice(c, hotTaskList.Price)
_, firstPrice, secondPrice, thirdPrice, _ := CommPrice(c, hotTaskList.Price)