...
|
...
|
@@ -117,6 +117,14 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int |
|
|
if taskStatus, ok := queryOptions["taskStatus"]; ok && (taskStatus != 0) {
|
|
|
query = query.Where(`task.task_status = ?`, taskStatus)
|
|
|
}
|
|
|
if taskStates, ok := queryOptions["taskStates"]; ok && len(taskStates.([]int)) != 0 {
|
|
|
query = query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
|
for _, value := range taskStates.([]int) {
|
|
|
q = q.WhereOr("task.task_status = ?", value)
|
|
|
}
|
|
|
return q, nil
|
|
|
})
|
|
|
}
|
|
|
if taskType, ok := queryOptions["taskType"]; ok && (taskType != 0) {
|
|
|
query = query.Where(`task.task_type = ?`, taskType)
|
|
|
}
|
...
|
...
|
@@ -155,10 +163,16 @@ func (repository *TaskRepository) Find(queryOptions map[string]interface{}) (int |
|
|
if taskContentMatch, ok := queryOptions["taskContentMatch"]; ok && (taskContentMatch != "") {
|
|
|
query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskContentMatch.(string)))
|
|
|
}
|
|
|
if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") {
|
|
|
// 任务名称匹配(赚素币)
|
|
|
if taskNameMatch, ok := queryOptions["taskNameMatch"]; ok && (taskNameMatch != "") { //
|
|
|
query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskNameMatch.(string)))
|
|
|
query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2}))
|
|
|
//query = query.Where("task.task_type IN (?)", pg.In([]int{1, 2}))
|
|
|
}
|
|
|
//// 任务名称匹配(进行中和已完成),返回任务状态为进行中和已完成的任务
|
|
|
//if taskStatusMatch, ok := queryOptions["taskStatusMatch"]; ok && (taskStatusMatch != "") {
|
|
|
// query = query.Where("task.task_name LIKE ?", fmt.Sprintf("%%%s%%", taskStatusMatch.(string)))
|
|
|
// query = query.Where("task.task_status IN (?)", pg.In([]int{3, 5}))
|
|
|
//}
|
|
|
if isRewardTake, ok := queryOptions["isRewardTake"]; ok && (isRewardTake != false) {
|
|
|
query = query.Where(`task.is_reward_take = ?`, isRewardTake)
|
|
|
}
|
...
|
...
|
|