|
@@ -5,8 +5,11 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/caixw/lib.go/conv"
|
|
|
"github.com/sirupsen/logrus"
|
|
|
+ "github.com/tidwall/gjson"
|
|
|
+ "gorm.io/gorm"
|
|
|
"log"
|
|
|
"reflect"
|
|
|
+ "strconv"
|
|
|
"time"
|
|
|
"youngee_m_api/model/common_model"
|
|
|
"youngee_m_api/model/gorm_model"
|
|
@@ -310,6 +313,8 @@ func GetAutoReviewTask(contentType int32) error {
|
|
|
db := GetReadDB(context.Background())
|
|
|
var projectInfos []*gorm_model.ProjectInfo
|
|
|
if contentType == 2 {
|
|
|
+ // 项目内容形式为视频
|
|
|
+ // 1. 补全scriptInfo表中的自动审核脚本时间
|
|
|
err := db.Model(gorm_model.ProjectInfo{}).Where("project_type = ? AND content_type = ?", 1, contentType).Find(&projectInfos).Error
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -321,8 +326,6 @@ func GetAutoReviewTask(contentType int32) error {
|
|
|
projectIdToAutoTaskIdMap[projectInfo.ProjectID] = int(projectInfo.AutoTaskID)
|
|
|
}
|
|
|
//fmt.Println("projectIds:", projectIds)
|
|
|
- TaskIdToProjectId := make(map[int]int)
|
|
|
- var taskId []int
|
|
|
db1 := GetReadDB(context.Background())
|
|
|
for _, projectId := range projectIds {
|
|
|
// 获取 autoTaskId 及其对应的限制时间、
|
|
@@ -333,61 +336,65 @@ func GetAutoReviewTask(contentType int32) error {
|
|
|
//fmt.Println("t:", autoTaskInfo.ReviewInMv)
|
|
|
// 获取 projectId 对应的 taskId 及添加脚本自动审核时间
|
|
|
var taskInfos []gorm_model.YoungeeTaskInfo
|
|
|
- db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ?", projectId).Find(&taskInfos)
|
|
|
+ db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = 2", projectId).Find(&taskInfos)
|
|
|
for _, taskInfo := range taskInfos {
|
|
|
//fmt.Println("TaskID:", taskInfo.TaskId)
|
|
|
- taskId = append(taskId, taskInfo.TaskId)
|
|
|
- TaskIdToProjectId[taskInfo.TaskId] = int(projectId)
|
|
|
db2 := GetReadDB(context.Background())
|
|
|
var scriptInfos gorm_model.YounggeeScriptInfo
|
|
|
db2.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id = ? AND is_submit = ? AND is_review = ? ", taskInfo.TaskId, 1, 0).Find(&scriptInfos)
|
|
|
dd, _ := time.ParseDuration(conv.MustString(ReviewInMv, "") + "h")
|
|
|
- if scriptInfos.AutoAgreeAt.IsZero() && scriptInfos.IsSubmit == 1 {
|
|
|
+ if scriptInfos.AutoAgreeAt.IsZero() {
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
db3.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id = ?", taskInfo.TaskId).Updates(&gorm_model.YounggeeScriptInfo{AutoAgreeAt: scriptInfos.SubmitAt.Add(dd)})
|
|
|
fmt.Println("已添加脚本自动审核时间")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //fmt.Println("TaskIdToProjectId:", TaskIdToProjectId)
|
|
|
//fmt.Println("taskId:", taskId)
|
|
|
|
|
|
- var scriptInfos []gorm_model.YounggeeScriptInfo
|
|
|
+ // 2. 查询scriptInfo表中应该被自动审稿的脚本
|
|
|
+ var newScriptInfos []gorm_model.YounggeeScriptInfo
|
|
|
+ db3 := GetReadDB(context.Background())
|
|
|
+ err = db3.Model(gorm_model.YounggeeScriptInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Find(&newScriptInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoReviewTask error in script:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ // 记录其task_id
|
|
|
+ var taskIds []int
|
|
|
+ for _, scriptInfo := range newScriptInfos {
|
|
|
+ taskIds = append(taskIds, scriptInfo.TaskID)
|
|
|
+ }
|
|
|
+ // 3. 执行审核脚本操作
|
|
|
+ // 1). 更新scriptInfo表
|
|
|
db4 := GetReadDB(context.Background())
|
|
|
- err = db4.Model(gorm_model.YounggeeScriptInfo{}).Where("auto_agree_at <= ? AND task_id IN ?", time.Now(), taskId).Find(&scriptInfos).Error
|
|
|
+ err = db4.Model(gorm_model.YounggeeScriptInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Updates(
|
|
|
+ &gorm_model.YounggeeScriptInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1}).Error
|
|
|
if err != nil {
|
|
|
- log.Println("DB GetAutoReviewTask error in script :", err)
|
|
|
+ log.Println("DB GetAutoReviewTask error in script:", err)
|
|
|
return err
|
|
|
}
|
|
|
- //fmt.Println("scriptInfos:", scriptInfos)
|
|
|
- var scriptTaskIds []int
|
|
|
- for _, scriptInfo := range scriptInfos {
|
|
|
- scriptTaskIds = append(scriptTaskIds, scriptInfo.TaskID)
|
|
|
- scriptReviewNeedMod := gorm_model.YounggeeScriptInfo{}
|
|
|
- db5 := GetReadDB(context.Background())
|
|
|
- db5.Model(gorm_model.YounggeeScriptInfo{}).Where("script_id = ?", scriptInfo.ScriptID).Find(&scriptReviewNeedMod)
|
|
|
- if scriptInfo.AgreeAt.IsZero() && scriptInfo.IsSubmit == 1 {
|
|
|
- if scriptReviewNeedMod.IsReview != 1 {
|
|
|
- db7 := GetReadDB(context.Background())
|
|
|
- db7.Model(gorm_model.YounggeeScriptInfo{}).Where("script_id = ?", scriptInfo.ScriptID).Updates(&gorm_model.YounggeeScriptInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1})
|
|
|
- fmt.Println("已更新脚本同意时间 及脚本审核状态")
|
|
|
- }
|
|
|
- }
|
|
|
+ var num int64
|
|
|
+ db4.Model(gorm_model.YounggeeScriptInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Count(&num)
|
|
|
+ if num != 0 {
|
|
|
+ fmt.Println("自动审核脚本:已更新scriptInfo表")
|
|
|
}
|
|
|
- //fmt.Println("scriptTaskIds:", scriptTaskIds)
|
|
|
- for _, scriptTaskId := range scriptTaskIds {
|
|
|
- //fmt.Println("scriptTaskId", scriptTaskId)
|
|
|
- taskStatusNeedMod := gorm_model.YoungeeTaskInfo{}
|
|
|
- db6 := GetReadDB(context.Background())
|
|
|
- db6.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", scriptTaskId).Find(&taskStatusNeedMod)
|
|
|
- if (taskStatusNeedMod.ScriptStatus == 2 || taskStatusNeedMod.ScriptStatus == 4) && taskStatusNeedMod.TaskStage == 7 {
|
|
|
- db8 := GetReadDB(context.Background())
|
|
|
- db8.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", scriptTaskId).Updates(&gorm_model.YoungeeTaskInfo{ScriptStatus: 5, TaskStage: 9})
|
|
|
- fmt.Println("已更新任务阶段为待传初稿 及脚本上传状态为已通过")
|
|
|
- }
|
|
|
+ // 2).更新taskInfo表
|
|
|
+ db5 := GetReadDB(context.Background())
|
|
|
+ err = db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", taskIds).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{ScriptStatus: 5, TaskStage: 9}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoReviewTask error in script:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ if len(taskIds) != 0 {
|
|
|
+ fmt.Println("以下任务状态需要变更:", taskIds)
|
|
|
+ fmt.Println("自动审核脚本:已更新taskInfo表,任务阶段为待传链接 及脚本上传状态为已通过")
|
|
|
}
|
|
|
return nil
|
|
|
} else {
|
|
|
+ // 项目内容形式为图文
|
|
|
+ // 1. 补全sketchInfo表中的自动审核初稿时间
|
|
|
err := db.Model(gorm_model.ProjectInfo{}).Where("project_type = ? ", 1).Find(&projectInfos).Error
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -399,8 +406,6 @@ func GetAutoReviewTask(contentType int32) error {
|
|
|
projectIdToAutoTaskIdMap[projectInfo.ProjectID] = int(projectInfo.AutoTaskID)
|
|
|
}
|
|
|
//fmt.Println("projectIds:", projectIds)
|
|
|
- TaskIdToProjectId := make(map[int]int)
|
|
|
- var taskId []int
|
|
|
db1 := GetReadDB(context.Background())
|
|
|
for _, projectId := range projectIds {
|
|
|
// 获取 autoTaskId 及其对应的限制时间、
|
|
@@ -410,62 +415,66 @@ func GetAutoReviewTask(contentType int32) error {
|
|
|
dbStart.Model(gorm_model.InfoAutoTask{}).Select("review_unlimited").Where("auto_task_id = ?", autoTaskId).First(&ReviewUnlimited)
|
|
|
//fmt.Println("t:", autoTaskInfo.ReviewUnlimited)
|
|
|
var taskInfos []gorm_model.YoungeeTaskInfo
|
|
|
- db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ?", projectId).Find(&taskInfos)
|
|
|
+ db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = 2", projectId).Find(&taskInfos)
|
|
|
for _, taskInfo := range taskInfos {
|
|
|
- TaskIdToProjectId[taskInfo.TaskId] = int(projectId)
|
|
|
- taskId = append(taskId, taskInfo.TaskId)
|
|
|
db2 := GetReadDB(context.Background())
|
|
|
- var scriptInfos gorm_model.YounggeeSketchInfo
|
|
|
- db2.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? AND is_submit = ? AND is_review = ? ", taskInfo.TaskId, 1, 0).Find(&scriptInfos)
|
|
|
+ var sketchInfo gorm_model.YounggeeSketchInfo
|
|
|
+ db2.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? AND is_submit = ? AND is_review = ? ", taskInfo.TaskId, 1, 0).Find(&sketchInfo)
|
|
|
dd, _ := time.ParseDuration(conv.MustString(ReviewUnlimited, "") + "h")
|
|
|
- if scriptInfos.AutoAgreeAt.IsZero() && scriptInfos.IsSubmit == 1 {
|
|
|
+ if sketchInfo.AutoAgreeAt.IsZero() {
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- db3.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", scriptInfos.TaskID).Updates(&gorm_model.YounggeeSketchInfo{AutoAgreeAt: scriptInfos.SubmitAt.Add(dd)})
|
|
|
- fmt.Println("已添加脚本自动审核时间")
|
|
|
+ db3.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", sketchInfo.TaskID).Updates(&gorm_model.YounggeeSketchInfo{
|
|
|
+ AutoAgreeAt: sketchInfo.SubmitAt.Add(dd),
|
|
|
+ })
|
|
|
+ fmt.Println("已添加初稿自动审核时间")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //fmt.Println("TaskIdToProjectId:", TaskIdToProjectId)
|
|
|
- //fmt.Println("taskId:", taskId)
|
|
|
-
|
|
|
- var sketchInfos []gorm_model.YounggeeSketchInfo
|
|
|
+ // 2. 查询sketchInfo表中应该被自动审稿的初稿
|
|
|
+ var newSketchInfos []gorm_model.YounggeeSketchInfo
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err = db3.Model(gorm_model.YounggeeSketchInfo{}).Where("auto_agree_at <= ? AND task_id IN ?", time.Now(), taskId).Find(&sketchInfos).Error
|
|
|
+ err = db3.Model(gorm_model.YounggeeSketchInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Find(&newSketchInfos).Error
|
|
|
if err != nil {
|
|
|
log.Println("DB GetAutoReviewTask error in sketch:", err)
|
|
|
return err
|
|
|
}
|
|
|
- var sketchTaskIds []int
|
|
|
- for _, scriptInfo := range sketchInfos {
|
|
|
- sketchTaskIds = append(sketchTaskIds, scriptInfo.TaskID)
|
|
|
- sketchNeedMod := gorm_model.YounggeeSketchInfo{}
|
|
|
- db4 := GetReadDB(context.Background())
|
|
|
- db4.Model(gorm_model.YounggeeSketchInfo{}).Where("sketch_id = ?", scriptInfo.SketchID).Find(&sketchNeedMod)
|
|
|
- if scriptInfo.AgreeAt.IsZero() && scriptInfo.IsSubmit == 1 {
|
|
|
- if sketchNeedMod.IsReview != 1 {
|
|
|
- db6 := GetReadDB(context.Background())
|
|
|
- db6.Model(gorm_model.YounggeeSketchInfo{}).Where("sketch_id = ?", scriptInfo.SketchID).Updates(&gorm_model.YounggeeSketchInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1})
|
|
|
- fmt.Println("已更新初稿审核同意时间")
|
|
|
- }
|
|
|
- }
|
|
|
+ // 记录其task_id
|
|
|
+ var taskIds []int
|
|
|
+ for _, sketchInfo := range newSketchInfos {
|
|
|
+ taskIds = append(taskIds, sketchInfo.TaskID)
|
|
|
}
|
|
|
- for _, sketchTaskId := range sketchTaskIds {
|
|
|
- //fmt.Println("taskID", sketchTaskId)
|
|
|
- sketchNeedMod := gorm_model.YoungeeTaskInfo{}
|
|
|
- db5 := GetReadDB(context.Background())
|
|
|
- db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", sketchTaskId).Find(&sketchNeedMod)
|
|
|
- if (sketchNeedMod.SketchStatus == 2 || sketchNeedMod.SketchStatus == 4) && sketchNeedMod.TaskStage == 9 {
|
|
|
- db7 := GetReadDB(context.Background())
|
|
|
- db7.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", sketchTaskId).Updates(&gorm_model.YoungeeTaskInfo{SketchStatus: 5, TaskStage: 11})
|
|
|
- fmt.Println("已更新任务阶段为待传链接 及初稿上传状态为已通过")
|
|
|
- }
|
|
|
+ // 3. 执行审核初稿操作
|
|
|
+ // 1). 更新sketchInfo表
|
|
|
+ db4 := GetReadDB(context.Background())
|
|
|
+ err = db4.Model(gorm_model.YounggeeSketchInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Updates(
|
|
|
+ &gorm_model.YounggeeSketchInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoReviewTask error in sketch:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var num int64
|
|
|
+ db4.Model(gorm_model.YounggeeSketchInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Count(&num)
|
|
|
+ if num != 0 {
|
|
|
+ fmt.Println("自动审核初稿:已更新sketchInfo表")
|
|
|
+ }
|
|
|
+ // 2).更新taskInfo表
|
|
|
+ db5 := GetReadDB(context.Background())
|
|
|
+ err = db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", taskIds).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{SketchStatus: 5, TaskStage: 11}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoReviewTask error in sketch:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ if len(taskIds) != 0 {
|
|
|
+ fmt.Println("以下任务状态需要变更:", taskIds)
|
|
|
+ fmt.Println("自动审核初稿:已更新taskInfo表,任务阶段为待传链接 及初稿上传状态为已通过")
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func GetAutoPostReviewTask() error {
|
|
|
+ // 1. 补全linkInfo表中的自动审核链接时间
|
|
|
db := GetReadDB(context.Background())
|
|
|
var projectInfos []*gorm_model.ProjectInfo
|
|
|
err := db.Model(gorm_model.ProjectInfo{}).Where("project_type = ? ", 1).Find(&projectInfos).Error
|
|
@@ -479,8 +488,6 @@ func GetAutoPostReviewTask() error {
|
|
|
projectIdToAutoTaskIdMap[projectInfo.ProjectID] = int(projectInfo.AutoTaskID)
|
|
|
}
|
|
|
//fmt.Println("projectIds:", projectIds)
|
|
|
- TaskIdToProjectId := make(map[int]int)
|
|
|
- var taskId []int
|
|
|
db1 := GetReadDB(context.Background())
|
|
|
for _, projectId := range projectIds {
|
|
|
// 获取 autoTaskId 及其对应的限制时间、
|
|
@@ -490,10 +497,8 @@ func GetAutoPostReviewTask() error {
|
|
|
dbStart.Model(gorm_model.InfoAutoTask{}).Select("postreview").Where("auto_task_id = ?", autoTaskId).First(&Postreview)
|
|
|
//fmt.Println("t:", autoTaskInfo.Postreview)
|
|
|
var taskInfos []gorm_model.YoungeeTaskInfo
|
|
|
- db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ?", projectId).Find(&taskInfos)
|
|
|
+ db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = 2", projectId).Find(&taskInfos)
|
|
|
for _, taskInfo := range taskInfos {
|
|
|
- TaskIdToProjectId[taskInfo.TaskId] = int(projectId)
|
|
|
- taskId = append(taskId, taskInfo.TaskId)
|
|
|
db2 := GetReadDB(context.Background())
|
|
|
var linkInfos gorm_model.YounggeeLinkInfo
|
|
|
db2.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? AND is_submit = ? AND is_review = ? ", taskInfo.TaskId, 1, 0).Find(&linkInfos)
|
|
@@ -505,42 +510,51 @@ func GetAutoPostReviewTask() error {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- var linkInfos []gorm_model.YounggeeLinkInfo
|
|
|
+
|
|
|
+ // 2. 查询linkInfo表中应该被自动审稿的链接
|
|
|
+ var newLinkInfos []gorm_model.YounggeeLinkInfo
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err = db3.Model(gorm_model.YounggeeLinkInfo{}).Where("auto_agree_at <= ? AND task_id IN ?", time.Now(), taskId).Find(&linkInfos).Error
|
|
|
+ err = db3.Model(gorm_model.YounggeeLinkInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Find(&newLinkInfos).Error
|
|
|
if err != nil {
|
|
|
- log.Println("DB GetAutoPostReviewTask error in sketch:", err)
|
|
|
+ log.Println("DB GetAutoPostReviewTask error in link:", err)
|
|
|
return err
|
|
|
}
|
|
|
- var linkTaskIds []int
|
|
|
- for _, linkInfo := range linkInfos {
|
|
|
- linkTaskIds = append(linkTaskIds, linkInfo.TaskID)
|
|
|
- linkNeedMod := gorm_model.YounggeeLinkInfo{}
|
|
|
- db4 := GetReadDB(context.Background())
|
|
|
- db4.Model(gorm_model.YounggeeLinkInfo{}).Where("link_id = ?", linkInfo.LinkID).Find(&linkNeedMod)
|
|
|
- if linkInfo.AgreeAt.IsZero() && linkInfo.IsSubmit == 1 {
|
|
|
- if linkNeedMod.IsReview != 1 {
|
|
|
- db6 := GetReadDB(context.Background())
|
|
|
- db6.Model(gorm_model.YounggeeLinkInfo{}).Where("link_id = ?", linkInfo.LinkID).Updates(&gorm_model.YounggeeLinkInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1})
|
|
|
- fmt.Println("已更新链接审核同意时间")
|
|
|
- }
|
|
|
- }
|
|
|
+ // 记录其task_id
|
|
|
+ var taskIds []int
|
|
|
+ for _, linkInfo := range newLinkInfos {
|
|
|
+ taskIds = append(taskIds, linkInfo.TaskID)
|
|
|
+ }
|
|
|
+ // 3. 执行审核链接操作
|
|
|
+ // 1). 更新linkInfo表
|
|
|
+ db4 := GetReadDB(context.Background())
|
|
|
+ err = db4.Model(gorm_model.YounggeeLinkInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Updates(
|
|
|
+ &gorm_model.YounggeeLinkInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoPostReviewTask error in link:", err)
|
|
|
+ return err
|
|
|
}
|
|
|
- for _, linkTaskId := range linkTaskIds {
|
|
|
- //fmt.Println("taskID", linkTaskId)
|
|
|
- linkNeedMod := gorm_model.YoungeeTaskInfo{}
|
|
|
- db5 := GetReadDB(context.Background())
|
|
|
- db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", linkTaskId).Find(&linkNeedMod)
|
|
|
- if (linkNeedMod.LinkStatus == 2 || linkNeedMod.LinkStatus == 4) && linkNeedMod.TaskStage == 11 {
|
|
|
- db7 := GetReadDB(context.Background())
|
|
|
- db7.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", linkTaskId).Updates(&gorm_model.YoungeeTaskInfo{LinkStatus: 5, TaskStage: 13})
|
|
|
- fmt.Println("已更新任务阶段为待传数据 及 链接上传状态为已通过")
|
|
|
- }
|
|
|
+ var num int64
|
|
|
+ db4.Model(gorm_model.YounggeeLinkInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Count(&num)
|
|
|
+ if num != 0 {
|
|
|
+ fmt.Println("自动审核链接:已更新linkInfo表")
|
|
|
+ }
|
|
|
+ // 2).更新taskInfo表
|
|
|
+ db5 := GetReadDB(context.Background())
|
|
|
+ err = db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", taskIds).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{LinkStatus: 5, TaskStage: 13}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoPostReviewTask error in link:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ if len(taskIds) != 0 {
|
|
|
+ fmt.Println("以下任务状态需要变更:", taskIds)
|
|
|
+ fmt.Println("自动审核链接:已更新taskInfo表,任务阶段为待传链接 及链接上传状态为已通过")
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func GetAutoCaseCloseTask() error {
|
|
|
+ // 1. 补全dataInfo表中的自动审核数据时间
|
|
|
db := GetReadDB(context.Background())
|
|
|
var projectInfos []*gorm_model.ProjectInfo
|
|
|
err := db.Model(gorm_model.ProjectInfo{}).Where("project_type = ? ", 1).Find(&projectInfos).Error
|
|
@@ -554,8 +568,6 @@ func GetAutoCaseCloseTask() error {
|
|
|
projectIdToAutoTaskIdMap[projectInfo.ProjectID] = int(projectInfo.AutoTaskID)
|
|
|
}
|
|
|
//fmt.Println("projectIds:", projectIds)
|
|
|
- TaskIdToProjectId := make(map[int]int)
|
|
|
- var taskId []int
|
|
|
db1 := GetReadDB(context.Background())
|
|
|
for _, projectId := range projectIds {
|
|
|
// 获取 autoTaskId 及其对应的限制时间、
|
|
@@ -565,10 +577,8 @@ func GetAutoCaseCloseTask() error {
|
|
|
dbStart.Model(gorm_model.InfoAutoTask{}).Select("case_close").Where("auto_task_id = ?", autoTaskId).First(&CaseClose)
|
|
|
//fmt.Println("t:", autoTaskInfo.CaseClose)
|
|
|
var taskInfos []gorm_model.YoungeeTaskInfo
|
|
|
- db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ?", projectId).Find(&taskInfos)
|
|
|
+ db1.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = 2", projectId).Find(&taskInfos)
|
|
|
for _, taskInfo := range taskInfos {
|
|
|
- TaskIdToProjectId[taskInfo.TaskId] = int(projectId)
|
|
|
- taskId = append(taskId, taskInfo.TaskId)
|
|
|
db2 := GetReadDB(context.Background())
|
|
|
var dataInfos gorm_model.YounggeeDataInfo
|
|
|
db2.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? AND is_submit = ? AND is_review = ? ", taskInfo.TaskId, 1, 0).Find(&dataInfos)
|
|
@@ -576,39 +586,133 @@ func GetAutoCaseCloseTask() error {
|
|
|
if dataInfos.AutoAgreeAt.IsZero() && dataInfos.IsSubmit == 1 {
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
db3.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ?", dataInfos.TaskID).Updates(&gorm_model.YounggeeDataInfo{AutoAgreeAt: dataInfos.SubmitAt.Add(dd)})
|
|
|
- fmt.Println("已添加链接自动审核时间")
|
|
|
+ fmt.Println("已添加数据自动审核时间")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- var dataInfos []gorm_model.YounggeeDataInfo
|
|
|
+
|
|
|
+ // 2. 查询dataInfo表中应该被自动审稿的数据
|
|
|
+ var newDataInfos []gorm_model.YounggeeDataInfo
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err = db3.Model(gorm_model.YounggeeDataInfo{}).Where("auto_agree_at <= ? AND task_id IN ?", time.Now(), taskId).Find(&dataInfos).Error
|
|
|
+ err = db3.Model(gorm_model.YounggeeDataInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Find(&newDataInfos).Error
|
|
|
if err != nil {
|
|
|
- log.Println("DB GetAutoCaseCloseTask error in sketch:", err)
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
return err
|
|
|
}
|
|
|
- var dataTaskIds []int
|
|
|
- for _, dataInfo := range dataInfos {
|
|
|
- dataTaskIds = append(dataTaskIds, dataInfo.TaskID)
|
|
|
- dataNeedMod := gorm_model.YounggeeDataInfo{}
|
|
|
- db4 := GetReadDB(context.Background())
|
|
|
- db4.Model(gorm_model.YounggeeDataInfo{}).Where("data_id = ?", dataInfo.DataID).Find(&dataNeedMod)
|
|
|
- if dataInfo.AgreeAt.IsZero() && dataInfo.IsSubmit == 1 {
|
|
|
- if dataNeedMod.IsReview != 1 {
|
|
|
- db6 := GetReadDB(context.Background())
|
|
|
- db6.Model(gorm_model.YounggeeDataInfo{}).Where("data_id = ?", dataInfo.DataID).Updates(&gorm_model.YounggeeDataInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1})
|
|
|
- fmt.Println("已更新数据审核同意时间")
|
|
|
- }
|
|
|
+ // 记录其task_id
|
|
|
+ taskIdToDataInfoMap := map[int]gorm_model.YounggeeDataInfo{}
|
|
|
+ taskIdToTaskInfoMap := map[int]gorm_model.YoungeeTaskInfo{}
|
|
|
+ var taskIds []int
|
|
|
+ db6 := GetReadDB(context.Background())
|
|
|
+ for _, dataInfo := range newDataInfos {
|
|
|
+ taskIdToDataInfoMap[dataInfo.TaskID] = dataInfo
|
|
|
+ taskIds = append(taskIds, dataInfo.TaskID)
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ err = db6.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", dataInfo.TaskID).Find(&taskInfo).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
}
|
|
|
+ taskIdToTaskInfoMap[dataInfo.TaskID] = taskInfo
|
|
|
}
|
|
|
- for _, dataTaskId := range dataTaskIds {
|
|
|
- dataNeedMod := gorm_model.YoungeeTaskInfo{}
|
|
|
- db5 := GetReadDB(context.Background())
|
|
|
- db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", dataTaskId).Find(&dataNeedMod)
|
|
|
- if (dataNeedMod.DataStatus == 2 || dataNeedMod.DataStatus == 4) && dataNeedMod.TaskStage == 13 {
|
|
|
- db7 := GetReadDB(context.Background())
|
|
|
- db7.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", dataTaskId).Updates(&gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15})
|
|
|
- fmt.Println("已更新任务阶段为已结案 及 数据上传状态为已通过")
|
|
|
+ // 3. 执行审核数据操作
|
|
|
+ // 1). 更新dataInfo表
|
|
|
+ db4 := GetReadDB(context.Background())
|
|
|
+ err = db4.Model(gorm_model.YounggeeDataInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Updates(
|
|
|
+ &gorm_model.YounggeeDataInfo{AgreeAt: time.Now(), IsReview: 1, IsOk: 1}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var num int64
|
|
|
+ db4.Model(gorm_model.YounggeeDataInfo{}).Where("auto_agree_at <= ? AND is_submit = ? AND is_review = ? ", time.Now(), 1, 0).Count(&num)
|
|
|
+ if num != 0 {
|
|
|
+ fmt.Println("自动审核数据:已更新dataInfo表")
|
|
|
+ }
|
|
|
+ // 2).更新taskInfo表
|
|
|
+ db5 := GetReadDB(context.Background())
|
|
|
+ err = db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", taskIds).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ if len(taskIds) != 0 {
|
|
|
+ fmt.Println("以下任务状态需要变更:", taskIds)
|
|
|
+ fmt.Println("自动审核数据:已更新taskInfo表,任务阶段为待传数据 及数据上传状态为已通过")
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3). 更新recruitStrategy表
|
|
|
+ for _, taskId := range taskIds {
|
|
|
+ // 更新招募策略
|
|
|
+ taskInfo := taskIdToTaskInfoMap[taskId]
|
|
|
+ dataInfo := taskIdToDataInfoMap[taskId]
|
|
|
+ db7 := GetReadDB(context.Background())
|
|
|
+ db7 = db7.Model(gorm_model.RecruitStrategy{}).Where("project_id = ? and strategy_id = ?", taskInfo.ProjectId, taskInfo.StrategyId)
|
|
|
+ fansCount, _ := strconv.Atoi(conv.MustString(gjson.Get(taskInfo.TalentPlatformInfoSnap, "fans_count"), ""))
|
|
|
+ err = db.Updates(map[string]interface{}{
|
|
|
+ "fan_number": gorm.Expr("fan_number + ?", fansCount),
|
|
|
+ "play_number": gorm.Expr("play_number + ?", dataInfo.PlayNumber),
|
|
|
+ "like_number": gorm.Expr("like_number + ?", dataInfo.LikeNumber),
|
|
|
+ "collect_number": gorm.Expr("collect_number + ?", dataInfo.CollectNumber),
|
|
|
+ "comment_number": gorm.Expr("comment_number + ?", dataInfo.CommentNumber),
|
|
|
+ "finish_number": gorm.Expr("finish_number + 1"),
|
|
|
+ "total_offer": gorm.Expr("total_offer + ?", taskInfo.RealPayment)}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4. 判断是否全部任务已结案,若已全部结案则触发项目结案
|
|
|
+ // 查询 task_stage<15 的任务数量
|
|
|
+ for _, projectInfo := range projectInfos {
|
|
|
+ var unFinishedTaskNumber int64
|
|
|
+ db8 := GetReadDB(context.Background())
|
|
|
+ err = db8.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage < 15", projectInfo.ProjectID).Count(&unFinishedTaskNumber).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var finishedNum int64
|
|
|
+ db8.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage >= 15", projectInfo.ProjectID).Count(&finishedNum)
|
|
|
+ if unFinishedTaskNumber == 0 && finishedNum != 0 {
|
|
|
+ // 若为0则触发项目结案
|
|
|
+ db9 := GetReadDB(context.Background())
|
|
|
+ // 1. 更新项目状态为已结束
|
|
|
+ err := db9.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectInfo.ProjectID).Updates(map[string]interface{}{"project_status": 10}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ // 2. 释放企业账户因项目冻结的资金
|
|
|
+ // 1). 计算剩余资金
|
|
|
+ var allPayment float64
|
|
|
+ var realPayment float64
|
|
|
+ err = db9.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage >= 15", projectInfo.ProjectID).
|
|
|
+ Pluck("COALESCE(SUM(all_payment), 0) as allPayment", &allPayment).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ err = db9.Model(gorm_model.YoungeeTaskInfo{}).Where("project_id = ? and task_status = 2 and task_stage >= 15", projectInfo.ProjectID).
|
|
|
+ Pluck("COALESCE(SUM(real_payment), 0) as realPayment", &realPayment).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ fmt.Println("企业应支付金额总计:", allPayment, "实际支付总计:", realPayment)
|
|
|
+
|
|
|
+ // 2). 释放剩余资金
|
|
|
+ err = db9.Model(gorm_model.Enterprise{}).Where("enterprise_id = ?", projectInfo.EnterpriseID).Updates(
|
|
|
+ map[string]interface{}{
|
|
|
+ "frozen_balance": gorm.Expr("frozen_balance - ?", allPayment),
|
|
|
+ "balance": gorm.Expr("balance - ?", realPayment),
|
|
|
+ "available_balance": gorm.Expr("available_balance + ?", allPayment-realPayment)}).Error
|
|
|
+ if err != nil {
|
|
|
+ log.Println("DB GetAutoCaseCloseTask error in data:", err)
|
|
|
+ return err
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
@@ -628,7 +732,7 @@ func GetAutoInvalidTask() error {
|
|
|
projectIdToAutoTaskIdMap[projectInfo.ProjectID] = int(projectInfo.AutoTaskID)
|
|
|
}
|
|
|
for _, projectId := range projectIds {
|
|
|
- // 获取 autoTaskId 及其对应的限制时间、
|
|
|
+ // 获取 autoTaskId 及其对应的限制时间
|
|
|
autoTaskId := projectIdToAutoTaskIdMap[projectId]
|
|
|
dbStart := GetReadDB(context.Background())
|
|
|
var Invalid int32
|
|
@@ -648,6 +752,7 @@ func GetAutoInvalidTask() error {
|
|
|
dd, _ := time.ParseDuration(conv.MustString(Invalid, "") + "h")
|
|
|
project.RecruitDdl.Add(dd)
|
|
|
t := project.RecruitDdl.Add(dd)
|
|
|
+ fmt.Println("已存在的失效时间是否跟要添加的相等", project.AutoFailAt.Equal(t))
|
|
|
if project.AutoFailAt != &t {
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
db3.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{AutoFailAt: &t})
|
|
@@ -656,15 +761,18 @@ func GetAutoInvalidTask() error {
|
|
|
|
|
|
projectNeedMod := gorm_model.ProjectInfo{}
|
|
|
db2 := GetReadDB(context.Background())
|
|
|
- db2.Where("project_id = ?", projectId).First(&projectNeedMod)
|
|
|
+ db2 = db2.Where("project_id = ?", projectId).First(&projectNeedMod)
|
|
|
+ fmt.Println("失效自动处理时间为:", projectNeedMod.AutoFailAt)
|
|
|
if !projectNeedMod.AutoFailAt.IsZero() {
|
|
|
+ fmt.Printf("项目 %v 失效自动处理时间不为空\n", projectNeedMod.ProjectID)
|
|
|
+ fmt.Println("距离失效自动处理时间还有:,项目当前状态为", projectNeedMod.AutoFailAt.Sub(time.Now()), projectNeedMod.ProjectStatus)
|
|
|
if projectNeedMod.AutoFailAt.Sub(time.Now()) <= 0 && projectNeedMod.ProjectStatus < 8 {
|
|
|
db4 := GetReadDB(context.Background())
|
|
|
- err1 := db4.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{ProjectStatus: 8}).Error
|
|
|
+ err1 := db4.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Updates(&gorm_model.ProjectInfo{ProjectStatus: 8, FailReason: 1}).Error
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
- fmt.Println("已更新项目状态")
|
|
|
+ fmt.Println("已更新项目状态为超时未支付的失效状态")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -754,8 +862,16 @@ func GetAutoDraftDefaultInPicTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate})
|
|
|
+ db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount})
|
|
|
fmt.Println("已创建素材微原创的任务初稿违约记录")
|
|
|
}
|
|
|
}
|
|
@@ -827,8 +943,16 @@ func GetAutoDraftDefaultInPicTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskLogisticNeedMod2.TaskID).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db8 := GetReadDB(context.Background())
|
|
|
- db8.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskLogisticNeedMod2.TaskID).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate})
|
|
|
+ db8.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskLogisticNeedMod2.TaskID).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount})
|
|
|
fmt.Println("已创建图文类型的初稿违约记录")
|
|
|
}
|
|
|
}
|
|
@@ -861,8 +985,16 @@ func GetAutoDraftDefaultInPicTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
- db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ db5 := GetReadDB(context.Background())
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
+ err2 = db5.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -876,8 +1008,16 @@ func GetAutoDraftDefaultInPicTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -969,8 +1109,16 @@ func GetAutoDraftDefaultInMvTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -984,8 +1132,16 @@ func GetAutoDraftDefaultInMvTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1022,8 +1178,16 @@ func GetAutoDraftDefaultInMvTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1037,8 +1201,16 @@ func GetAutoDraftDefaultInMvTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitVideoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 3, SketchBreakRate: sketchDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1134,8 +1306,16 @@ func GetAutoScriptDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate})
|
|
|
+ db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", specialTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate, SettleAmount: settleAmount})
|
|
|
fmt.Println("已创建素材微原创的任务脚本违约记录")
|
|
|
}
|
|
|
}
|
|
@@ -1197,8 +1377,16 @@ func GetAutoScriptDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1212,8 +1400,16 @@ func GetAutoScriptDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", videoTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 1, ScriptBreakRate: scriptDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1359,8 +1555,16 @@ func GetAutoLinkBreachTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1374,8 +1578,16 @@ func GetAutoLinkBreachTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1413,8 +1625,16 @@ func GetAutoLinkBreachTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1428,8 +1648,16 @@ func GetAutoLinkBreachTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 5, LinkBreakRate: linkDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1523,8 +1751,16 @@ func GetAutoCaseCloseDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1538,8 +1774,16 @@ func GetAutoCaseCloseDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", taskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|
|
@@ -1577,8 +1821,16 @@ func GetAutoCaseCloseDefaultTask() error {
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
+ taskInfo := gorm_model.YoungeeTaskInfo{}
|
|
|
+ dbt := GetReadDB(context.Background())
|
|
|
+ err2 := dbt.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Find(&taskInfo).Error
|
|
|
+ if err2 != nil {
|
|
|
+ return err2
|
|
|
+ }
|
|
|
+ settleAmount := taskInfo.TaskReward * (1.0 - float64(taskInfo.SketchBreakRate+taskInfo.DataBreakRate+taskInfo.SketchBreakRate+taskInfo.ScriptBreakRate)/1000)
|
|
|
db3 := GetReadDB(context.Background())
|
|
|
- err2 := db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(&gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate}).Error
|
|
|
+ err2 = db3.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", submitTaskNeedModId).Updates(
|
|
|
+ &gorm_model.YoungeeTaskInfo{CurDefaultType: 7, DataBreakRate: dataDefaultRate, SettleAmount: settleAmount}).Error
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
|
}
|