|
@@ -41,17 +41,8 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
if tag == "platform_nickname" {
|
|
|
platform_nickname = fmt.Sprintf("%v", value.Interface())
|
|
|
continue
|
|
|
- } else if tag == "project_id" {
|
|
|
+ } else if tag == "project_id" || tag == "strategy_id" {
|
|
|
db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
|
|
|
- } else if tag == "strategy_ids" {
|
|
|
- strategyIds := strings.Split(fmt.Sprintf("%v", value.Interface()), ",")
|
|
|
- var strategyIdList []int
|
|
|
- for _, strategyId := range strategyIds {
|
|
|
- strategyIdList = append(strategyIdList, conv.MustInt(strategyId, 0))
|
|
|
- }
|
|
|
- db = db.Where("strategy_id in ?", strategyIdList)
|
|
|
- } else {
|
|
|
- db = db.Where(fmt.Sprintf("%s like '%%%v%%'", tag, value.Interface()))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -60,7 +51,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
// 查询总数
|
|
|
var totalTask int64
|
|
|
if err := db.Count(&totalTask).Error; err != nil {
|
|
|
- logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
|
|
|
+ logrus.WithContext(ctx).Errorf("[GetTaskDataList] error query mysql total, err:%+v", err)
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
db.Order("task_id").Find(&taskInfos)
|
|
@@ -72,15 +63,37 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
taskIds = append(taskIds, taskInfo.TaskId)
|
|
|
taskMap[taskInfo.TaskId] = taskInfo
|
|
|
}
|
|
|
+
|
|
|
+ // 查询链接
|
|
|
db1 := GetReadDB(ctx)
|
|
|
- db1 = db1.Debug().Model(gorm_model.YounggeeDataInfo{})
|
|
|
+ // db1 = db1.Debug().Model(gorm_model.YounggeeDataInfo{})
|
|
|
+ var LinkInfos []gorm_model.YounggeeLinkInfo
|
|
|
+ db1 = db1.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id IN ? AND is_submit= 1 AND is_ok = 1", taskIds)
|
|
|
+ err := db1.Find(&LinkInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
|
|
|
+ return nil, 0, err
|
|
|
+ }
|
|
|
+ LinkMap := make(map[string]gorm_model.YounggeeLinkInfo)
|
|
|
+ for _, LinkInfo := range LinkInfos {
|
|
|
+ LinkMap[LinkInfo.TaskID] = LinkInfo
|
|
|
+ }
|
|
|
+
|
|
|
+ db2 := GetReadDB(ctx)
|
|
|
+ // db2 = db1.Debug().Model(gorm_model.YounggeeDataInfo{})
|
|
|
|
|
|
var DataInfos []gorm_model.YounggeeDataInfo
|
|
|
- db1 = db1.Model(gorm_model.YounggeeDataInfo{}).Where("task_id IN ? AND is_submit=? ", taskIds, 1)
|
|
|
+ db2 = db2.Model(gorm_model.YounggeeDataInfo{}).Where("task_id IN ? AND is_submit = 1", taskIds)
|
|
|
+ fmt.Printf("conditions %+v", conditions)
|
|
|
if conditions.DataStatus == int64(0) {
|
|
|
- db1 = db1.Where("is_review = 0").Find(&DataInfos)
|
|
|
+ db2 = db2.Where("is_review = 0")
|
|
|
} else {
|
|
|
- db1 = db1.Where("is_ok = 1").Find(&DataInfos)
|
|
|
+ db2 = db2.Where("is_ok = 1")
|
|
|
+ }
|
|
|
+ err = db2.Find(&DataInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
|
|
|
+ return nil, 0, err
|
|
|
}
|
|
|
DataMap := make(map[string]gorm_model.YounggeeDataInfo)
|
|
|
for _, DataInfo := range DataInfos {
|
|
@@ -88,7 +101,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
}
|
|
|
// 查询总数
|
|
|
var totalData int64
|
|
|
- if err := db1.Count(&totalData).Error; err != nil {
|
|
|
+ if err := db2.Count(&totalData).Error; err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
|
|
|
return nil, 0, err
|
|
|
}
|
|
@@ -103,10 +116,9 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
// 查询该页数据
|
|
|
limit := pageSize + misNum
|
|
|
offset := pageSize * pageNum // assert pageNum start with 0
|
|
|
- err := db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
|
|
|
-
|
|
|
+ err = db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
|
|
|
if err != nil {
|
|
|
- logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
|
|
|
+ logrus.WithContext(ctx).Errorf("[GetTaskDataList] error query mysql total, err:%+v", err)
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
|
|
@@ -117,6 +129,7 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
TaskData := new(http_model.TaskData)
|
|
|
TaskData.Talent = taskMap[taskId]
|
|
|
TaskData.Data = DataMap[taskId]
|
|
|
+ TaskData.Link = LinkMap[taskId]
|
|
|
TaskDatas = append(TaskDatas, TaskData)
|
|
|
}
|
|
|
|
|
@@ -127,6 +140,8 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
|
|
|
newTaskDatas = append(newTaskDatas, v)
|
|
|
} else if strings.Contains(v.PlatformNickname, platform_nickname) {
|
|
|
newTaskDatas = append(newTaskDatas, v)
|
|
|
+ } else if strings.Contains(conv.MustString(v.TaskID, ""), platform_nickname) {
|
|
|
+ newTaskDatas = append(newTaskDatas, v)
|
|
|
} else {
|
|
|
totalTask--
|
|
|
}
|