|
@@ -4,6 +4,7 @@ import (
|
|
"context"
|
|
"context"
|
|
"fmt"
|
|
"fmt"
|
|
"reflect"
|
|
"reflect"
|
|
|
|
+ "time"
|
|
"youngee_b_api/model/common_model"
|
|
"youngee_b_api/model/common_model"
|
|
"youngee_b_api/model/gorm_model"
|
|
"youngee_b_api/model/gorm_model"
|
|
"youngee_b_api/model/http_model"
|
|
"youngee_b_api/model/http_model"
|
|
@@ -14,7 +15,7 @@ import (
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
)
|
|
|
|
|
|
-// 查询上传脚本的task list
|
|
|
|
|
|
+// GetTaskScriptList 查询上传脚本的task list
|
|
func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.TaskScriptInfo, int64, error) {
|
|
func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.TaskScriptInfo, int64, error) {
|
|
db := GetReadDB(ctx)
|
|
db := GetReadDB(ctx)
|
|
// 查询Task表信息
|
|
// 查询Task表信息
|
|
@@ -74,7 +75,7 @@ func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var ScriptInfos []gorm_model.YounggeeScriptInfo
|
|
var ScriptInfos []gorm_model.YounggeeScriptInfo
|
|
- db1 = db1.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id IN ? AND is_submit=? AND is_review=?", taskIds, 1, 0).Find(&ScriptInfos)
|
|
|
|
|
|
+ db1 = db1.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id IN ? AND is_submit=? ", taskIds, 1).Find(&ScriptInfos)
|
|
ScriptMap := make(map[int]gorm_model.YounggeeScriptInfo)
|
|
ScriptMap := make(map[int]gorm_model.YounggeeScriptInfo)
|
|
for _, ScriptInfo := range ScriptInfos {
|
|
for _, ScriptInfo := range ScriptInfos {
|
|
ScriptMap[conv.MustInt(ScriptInfo.TaskID)] = ScriptInfo
|
|
ScriptMap[conv.MustInt(ScriptInfo.TaskID)] = ScriptInfo
|
|
@@ -115,8 +116,40 @@ func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum
|
|
taskScripts = pack.TaskScriptToTaskInfo(TaskScripts)
|
|
taskScripts = pack.TaskScriptToTaskInfo(TaskScripts)
|
|
|
|
|
|
for _, v := range taskScripts {
|
|
for _, v := range taskScripts {
|
|
- fmt.Println("taskScript: \n", *v)
|
|
|
|
|
|
+ fmt.Printf("taskScript: %+v \n", *v)
|
|
}
|
|
}
|
|
// return fulltaskScript, total, nil
|
|
// return fulltaskScript, total, nil
|
|
return taskScripts, totalTask, nil
|
|
return taskScripts, totalTask, nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// 提交意见
|
|
|
|
+func ReviseOption(ctx context.Context, TaskID int, ReviseOpinion string) error {
|
|
|
|
+ db := GetReadDB(ctx)
|
|
|
|
+ err := db.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id = ?", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 0}).Error
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[Script db] call RevisieOption error,err:%+v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", TaskID).Updates(gorm_model.YoungeeTaskInfo{ScriptStatus: 3}).Error
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[Script db] call RevisieOption error,err:%+v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 同意脚本
|
|
|
|
+func AcceptScript(ctx context.Context, TaskID int) error {
|
|
|
|
+ db := GetReadDB(ctx)
|
|
|
|
+ err := db.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id = ?", TaskID).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1}).Error
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[Script db] call AcceptScript error,err:%+v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", TaskID).Updates(gorm_model.YoungeeTaskInfo{ScriptStatus: 5}).Error
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[Script db] call AcceptScript error,err:%+v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|