|
@@ -33,9 +33,10 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
|
|
|
|
|
|
pageIndex := r.GetQueryInt("idx", -1)
|
|
|
cntPerPage := r.GetQueryInt("cnt", -1)
|
|
|
- platform := r.Get("platform")
|
|
|
+ //platform := r.Get("platform")
|
|
|
secForm := r.Get("secform")
|
|
|
taskForm := r.Get("taskform")
|
|
|
+ categoryForm := r.Get("categoryform")
|
|
|
searchValue := r.Get("searchvalue")
|
|
|
if pageIndex == -1 || cntPerPage == -1 || cntPerPage == 0 {
|
|
|
return &TalentHttpResult{Code: -1, Msg: "参数错误"}
|
|
@@ -63,21 +64,32 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
|
|
|
taskFormList = taskForm.([]interface{})
|
|
|
}
|
|
|
|
|
|
- // 如果有平台的过滤条件,则将平台列表保存于platformList
|
|
|
- var platformList []interface{}
|
|
|
- if platform != nil {
|
|
|
- if reflect.TypeOf(platform).Kind() != reflect.Slice {
|
|
|
- return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
|
|
|
+ // 如果有商品类目的过滤条件,则将过滤条件保存于categoryFormList
|
|
|
+ var categoryFormList []interface{}
|
|
|
+ if categoryForm != nil {
|
|
|
+ if reflect.TypeOf(categoryForm).Kind() != reflect.Slice {
|
|
|
+ return &TalentHttpResult{Code: -2, Msg: "搜索条件任务形式错误"}
|
|
|
}
|
|
|
|
|
|
- platformList = make([]interface{}, 0)
|
|
|
- platformList = platform.([]interface{})
|
|
|
+ categoryFormList = make([]interface{}, 0)
|
|
|
+ categoryFormList = categoryForm.([]interface{})
|
|
|
}
|
|
|
|
|
|
+ // 如果有平台的过滤条件,则将平台列表保存于platformList 弃用
|
|
|
+ /* var platformList []interface{}
|
|
|
+ if platform != nil {
|
|
|
+ if reflect.TypeOf(platform).Kind() != reflect.Slice {
|
|
|
+ return &TalentHttpResult{Code: -2, Msg: "搜索条件平台类型错误"}
|
|
|
+ }
|
|
|
+
|
|
|
+ platformList = make([]interface{}, 0)
|
|
|
+ platformList = platform.([]interface{})
|
|
|
+ }*/
|
|
|
+
|
|
|
// 构造查询的条件
|
|
|
startId := pageIndex * cntPerPage
|
|
|
whereStr := fmt.Sprintf("(selection_status >= %d)", selectionStatusInProgress)
|
|
|
- if platformList != nil {
|
|
|
+ /* if platformList != nil {
|
|
|
whereStr = whereStr + " and platform in ("
|
|
|
for _, v := range platformList {
|
|
|
whereStr += v.(string) + ", "
|
|
@@ -85,7 +97,7 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
|
|
|
|
|
|
whereStr = whereStr[0 : len(whereStr)-2]
|
|
|
whereStr += ")"
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
if taskFormList != nil {
|
|
|
whereStr += " and task_mode in ("
|
|
@@ -105,21 +117,36 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
|
|
|
whereStr = whereStr[0 : len(whereStr)-2]
|
|
|
whereStr += ")"
|
|
|
}
|
|
|
+
|
|
|
+ if categoryFormList != nil {
|
|
|
+ whereStr += " and product_category in ("
|
|
|
+ for _, v := range categoryFormList {
|
|
|
+ whereStr += v.(string) + ", "
|
|
|
+ }
|
|
|
+
|
|
|
+ whereStr = whereStr[0 : len(whereStr)-2]
|
|
|
+ whereStr += ")"
|
|
|
+ }
|
|
|
+
|
|
|
+ //搜索栏
|
|
|
if searchValue != nil {
|
|
|
whereStr += " and selection_name like '%" + searchValue.(string) + "%'"
|
|
|
}
|
|
|
|
|
|
// 查询所有selection
|
|
|
+ //YounggeeSelectionInfo含有表中的所有属性
|
|
|
var selectionList = []model.YounggeeSelectionInfo{}
|
|
|
- err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Scan(&selectionList)
|
|
|
+ //err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Scan(&selectionList)
|
|
|
+ //展示带货商品的排序规则 预估赚、ddl未处理
|
|
|
+ err := g.Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Order("commission_rate DESC , task_reward DESC ").Scan(&selectionList)
|
|
|
if err != nil {
|
|
|
return &TalentHttpResult{Code: -3, Msg: "查询数据库失败"}
|
|
|
}
|
|
|
- fmt.Println("searchValue:", searchValue)
|
|
|
- fmt.Println("secFormList:", secFormList)
|
|
|
- fmt.Println("taskFormList:", taskFormList)
|
|
|
+ fmt.Println("****searchValue:", searchValue)
|
|
|
+ fmt.Println("****secFormList:", secFormList)
|
|
|
+ fmt.Println("****taskFormList:", taskFormList)
|
|
|
|
|
|
- fmt.Println("whereStr: ", whereStr)
|
|
|
+ fmt.Println("****whereStr: ", whereStr)
|
|
|
|
|
|
// 判断请求页面是否超过最大页面
|
|
|
c, err := g.DB().Model(dao.YounggeeSelectionInfo.Table).Where(whereStr).Count()
|
|
@@ -139,8 +166,9 @@ func GetSelectionList(r *ghttp.Request) *TalentHttpResult {
|
|
|
var selectionInfoList = youngee_talent_model.SelectionInfoList{
|
|
|
Count: c,
|
|
|
}
|
|
|
+
|
|
|
err = g.DB().Model(dao.YounggeeSelectionInfo.Table).WithAll().Where(whereStr).
|
|
|
- Order("selection_status ASC,task_ddl DESC, selection_id").Limit(startId, cntPerPage).Scan(&selectionInfoList.SeletionInfos)
|
|
|
+ Order("selection_status ASC , task_ddl DESC , commission_rate DESC , task_reward DESC, selection_id").Limit(startId, cntPerPage).Scan(&selectionInfoList.SeletionInfos)
|
|
|
if err != nil {
|
|
|
return &TalentHttpResult{Code: -6, Msg: "查询数据库失败"}
|
|
|
}
|
|
@@ -173,7 +201,7 @@ func IsSignUpSecTask(r *ghttp.Request) *TalentHttpResult {
|
|
|
return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
}
|
|
|
selectionId := r.GetQueryInt("selection_id", -1)
|
|
|
-
|
|
|
+ //定义接口存该达人所有的报名任务
|
|
|
task := []model.YounggeeSecTaskInfo{}
|
|
|
err = g.Model(dao.YounggeeSecTaskInfo.Table).Where("selection_id = ? and talent_id = ?", selectionId, tid).Scan(&task)
|
|
|
if err != nil {
|
|
@@ -186,6 +214,7 @@ func IsSignUpSecTask(r *ghttp.Request) *TalentHttpResult {
|
|
|
} else {
|
|
|
isSign.IsSign = 0
|
|
|
}
|
|
|
+ fmt.Println("判断报名*********", isSign)
|
|
|
return &TalentHttpResult{Code: 0, Msg: "success", Data: isSign}
|
|
|
}
|
|
|
|