Pārlūkot izejas kodu

审稿管理and部分链接管理

shenzekai 2 gadi atpakaļ
vecāks
revīzija
16f6de7696

+ 1 - 1
db/logistics.go

@@ -95,7 +95,7 @@ func GetTaskLogisticsList(ctx context.Context, projectID string, pageSize, pageN
 		field := conditionType2.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue2.FieldByName(field.Name)
-		fmt.Printf("过滤展示 %+v %+v \n", value, tag)
+		//fmt.Printf("过滤展示 %+v %+v \n", value, tag)
 		if !util.IsBlank(value) && tag == "platform_nickname" { // input:1		taskIdsbase:1,2,3    string
 			db1 = db1.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
 		}

+ 6 - 6
db/script.go

@@ -122,26 +122,26 @@ func GetTaskScriptList(ctx context.Context, projectID string, pageSize, pageNum
 	return taskScripts, totalTask, nil
 }
 
-// 提交意见
-func ReviseOption(ctx context.Context, TaskID int, ReviseOpinion string) error {
+// ScriptOpinion 提交意见
+func ScriptOpinion(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)
+		logrus.WithContext(ctx).Errorf("[Script db] call RevisieOpinion 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)
+		logrus.WithContext(ctx).Errorf("[Script db] call RevisieOpinion error,err:%+v", err)
 		return err
 	}
 	return nil
 }
 
-// 同意脚本
+// AcceptScript 同意脚本
 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
+	err := db.Model(gorm_model.YounggeeScriptInfo{}).Where("task_id = ?", TaskID).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now()}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Script db] call AcceptScript error,err:%+v", err)
 		return err

+ 170 - 0
db/sketch.go

@@ -0,0 +1,170 @@
+package db
+
+import (
+	"context"
+	"fmt"
+	"reflect"
+	"time"
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/pack"
+	"youngee_b_api/util"
+
+	"github.com/issue9/conv"
+	"github.com/sirupsen/logrus"
+)
+
+// GetTaskSketchList 查询上传初稿的task list
+func GetTaskSketchList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.TaskSketchInfo, int64, error) {
+	db := GetReadDB(ctx)
+	// 查询Task表信息
+	db = db.Debug().Model(gorm_model.YoungeeTaskInfo{})
+	// 根据Project条件过滤
+	conditionType := reflect.TypeOf(conditions).Elem()
+	conditionValue := reflect.ValueOf(conditions).Elem()
+	for i := 0; i < conditionType.NumField(); i++ {
+		field := conditionType.Field(i)
+		tag := field.Tag.Get("condition")
+		value := conditionValue.FieldByName(field.Name)
+		if tag == "sketch_status" {
+			fmt.Printf("sketch %+v", value.Interface() == int64(0))
+			if value.Interface() == int64(0) {
+				db = db.Where("sketch_status>=? AND sketch_status < ?", 2, 5)
+			} else {
+				db = db.Where("sketch_status =? ", 5)
+			}
+			continue
+		}
+		if !util.IsBlank(value) && tag != "platform_nickname" {
+			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		} else if tag == "platform_nickname" {
+			continue
+		}
+	}
+	var taskInfos []gorm_model.YoungeeTaskInfo
+	db = db.Model(gorm_model.YoungeeTaskInfo{})
+	// 查询总数
+	var totalTask int64
+	if err := db.Count(&totalTask).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	db.Order("task_id").Find(&taskInfos)
+
+	// 查询任务id
+	var taskIds []int
+	taskMap := make(map[int]gorm_model.YoungeeTaskInfo)
+	for _, taskInfo := range taskInfos {
+		taskIds = append(taskIds, taskInfo.TaskID)
+		taskMap[taskInfo.TaskID] = taskInfo
+	}
+	db1 := GetReadDB(ctx)
+	db1 = db1.Debug().Model(gorm_model.YounggeeSketchInfo{})
+
+	// 根据Project条件过滤
+	conditionType2 := reflect.TypeOf(conditions).Elem()
+	conditionValue2 := reflect.ValueOf(conditions).Elem()
+	for i := 0; i < conditionType2.NumField(); i++ {
+		field := conditionType2.Field(i)
+		tag := field.Tag.Get("condition")
+		value := conditionValue2.FieldByName(field.Name)
+		if !util.IsBlank(value) && tag == "platform_nickname" { // input:1		taskIdsbase:1,2,3    string
+			fmt.Printf("Test %s = ?\n", tag)
+			db1 = db1.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		}
+	}
+	var SketchInfos []gorm_model.YounggeeSketchInfo
+	db1 = db1.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id IN ? AND is_submit=? ", taskIds, 1).Find(&SketchInfos)
+	fmt.Printf("初稿查询:%+v", SketchInfos)
+	SketchMap := make(map[int]gorm_model.YounggeeSketchInfo)
+	for _, SketchInfo := range SketchInfos {
+		SketchMap[conv.MustInt(SketchInfo.TaskID)] = SketchInfo
+	}
+	// 查询总数
+	var totalSketch int64
+	if err := db1.Count(&totalSketch).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	var misNum int64
+	if totalSketch > totalTask {
+		misNum = totalSketch - totalTask
+	} else {
+		misNum = totalTask - totalSketch
+	}
+	logrus.Println("totalSketch,totalTalent,misNum:", totalSketch, totalTask, misNum)
+
+	// 查询该页数据
+	limit := pageSize + misNum
+	offset := pageSize * pageNum // assert pageNum start with 0
+	//fmt.Printf("limit %+v  offset %+v \n", limit, offset)
+	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)
+		return nil, 0, err
+	}
+
+	var TaskSketches []*http_model.TaskSketch
+	var taskSketches []*http_model.TaskSketchInfo
+	for _, taskId := range taskIds {
+		TaskSketch := new(http_model.TaskSketch)
+		TaskSketch.Talent = taskMap[taskId]
+		TaskSketch.Sketch = SketchMap[taskId]
+		TaskSketches = append(TaskSketches, TaskSketch)
+	}
+
+	taskSketches = pack.TaskSketchToTaskInfo(TaskSketches)
+
+	for _, v := range taskSketches {
+		fmt.Printf("taskSketch: %+v \n", *v)
+	}
+	// return fulltaskSketch, total, nil
+	return taskSketches, totalTask, nil
+}
+
+// SketchOption 提交意见
+func SketchOption(ctx context.Context, TaskID int, ReviseOpinion string) error {
+	db := GetReadDB(ctx)
+	fmt.Printf("初稿意见 %d %+v", TaskID, ReviseOpinion)
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] call RevisieOption error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", TaskID).Updates(gorm_model.YoungeeTaskInfo{SketchStatus: 3}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] call RevisieOption error,err:%+v", err)
+		return err
+	}
+	return nil
+}
+
+// AcceptSketch 同意初稿
+func AcceptSketch(ctx context.Context, TaskID int) error {
+	db := GetReadDB(ctx)
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", TaskID).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now()}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] call AcceptSketch error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", TaskID).Updates(gorm_model.YoungeeTaskInfo{SketchStatus: 5}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] call AcceptSketch  error,err:%+v", err)
+		return err
+	}
+	return nil
+}
+
+// FindPhoto
+func FindPhoto(ctx context.Context, SketchID int64) ([]gorm_model.YounggeeSketchPhoto, error) {
+	db := GetReadDB(ctx)
+	var SketchPhotos []gorm_model.YounggeeSketchPhoto
+	err := db.Model(gorm_model.YounggeeSketchPhoto{}).Where("sketch_id=?", SketchID).Find(&SketchPhotos).Error
+	if err != nil {
+		return nil, err
+	}
+	return SketchPhotos, nil
+
+}

+ 16 - 0
db/sketch_photo.go

@@ -0,0 +1,16 @@
+package db
+
+import (
+	"context"
+	"youngee_b_api/model/gorm_model"
+)
+
+func GetSketchPhotoBySketchID(ctx context.Context, productID int64) ([]gorm_model.YounggeeSketchPhoto, error) {
+	db := GetReadDB(ctx)
+	SketchPhotos := []gorm_model.YounggeeSketchPhoto{}
+	err := db.Where("product_id = ?", productID).Find(&SketchPhotos).Error
+	if err != nil {
+		return nil, err
+	}
+	return SketchPhotos, nil
+}

+ 20 - 20
handler/revise_opinion.go → handler/accept_sketch.go

@@ -10,60 +10,60 @@ import (
 	"youngee_b_api/util"
 )
 
-func WrapReviseOptionHandler(ctx *gin.Context) {
-	handler := newReviseOptionHandler(ctx)
+func WrapAcceptSketchHandler(ctx *gin.Context) {
+	handler := newAcceptSketchHandler(ctx)
 	baseRun(handler)
 }
 
-func newReviseOptionHandler(ctx *gin.Context) *ReviseOptionHandler {
-	return &ReviseOptionHandler{
-		req:  http_model.NewReviseOptionRequest(),
-		resp: http_model.NewReviseOptionResponse(),
+func newAcceptSketchHandler(ctx *gin.Context) *AcceptSketchHandler {
+	return &AcceptSketchHandler{
+		req:  http_model.NewAcceptSketchRequest(),
+		resp: http_model.NewAcceptSketchResponse(),
 		ctx:  ctx,
 	}
 }
 
-type ReviseOptionHandler struct {
-	req  *http_model.ReviseOptionRequest
+type AcceptSketchHandler struct {
+	req  *http_model.AcceptSketchRequest
 	resp *http_model.CommonResponse
 	ctx  *gin.Context
 }
 
-func (h *ReviseOptionHandler) getRequest() interface{} {
+func (h *AcceptSketchHandler) getRequest() interface{} {
 	return h.req
 }
-func (h *ReviseOptionHandler) getContext() *gin.Context {
+func (h *AcceptSketchHandler) getContext() *gin.Context {
 	return h.ctx
 }
-func (h *ReviseOptionHandler) getResponse() interface{} {
+func (h *AcceptSketchHandler) getResponse() interface{} {
 	return h.resp
 }
 
-func (h *ReviseOptionHandler) run() {
-	data := http_model.ReviseOptionRequest{}
+func (h *AcceptSketchHandler) run() {
+	data := http_model.AcceptSketchRequest{}
 	data = *h.req
-	res, err := service.Script.ReviseOption(h.ctx, data)
+	res, err := service.Sketch.AcceptSketch(h.ctx, data)
 	if err != nil {
 		logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
 		log.Info("CreateProject fail,req:%+v", h.req)
 		return
 	}
-	h.resp.Message = "通过脚本"
+	h.resp.Message = "成功通过初稿"
 	h.resp.Data = res
 	h.resp.Data = data
 }
 
 /***
-func (h *ReviseOptionHandler) run() {
-	data := http_model.ReviseOptionRequest{}
+func (h *AcceptSketchHandler) run() {
+	data := http_model.AcceptSketchRequest{}
 	data = *h.req
 	isRefuse := data.IsRefuse
 	if isRefuse== 0 {
 		fmt.Println("Create in")
 		res, err := service.Project.Create(h.ctx, data)
 		if err != nil {
-			logrus.Errorf("[ReviseOptionHandler] call Create err:%+v\n", err)
+			logrus.Errorf("[AcceptSketchHandler] call Create err:%+v\n", err)
 			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
 			log.Info("CreateProject fail,req:%+v", h.req)
 			return
@@ -73,7 +73,7 @@ func (h *ReviseOptionHandler) run() {
 	} else {
 		res, err := service.Logistics.Update(h.ctx, data)
 		if err != nil {
-			logrus.Errorf("[ReviseOptionHandler] call Create err:%+v\n", err)
+			logrus.Errorf("[AcceptSketchHandler] call Create err:%+v\n", err)
 			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
 			log.Info("CreateProject fail,req:%+v", h.req)
 			return
@@ -84,6 +84,6 @@ func (h *ReviseOptionHandler) run() {
 
 }
 ***/
-func (h *ReviseOptionHandler) checkParam() error {
+func (h *AcceptSketchHandler) checkParam() error {
 	return nil
 }

+ 89 - 0
handler/script_opinion.go

@@ -0,0 +1,89 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapScriptOpinionHandler(ctx *gin.Context) {
+	handler := newScriptOpinionHandler(ctx)
+	baseRun(handler)
+}
+
+func newScriptOpinionHandler(ctx *gin.Context) *ScriptOpinionHandler {
+	return &ScriptOpinionHandler{
+		req:  http_model.NewScriptOpinionRequest(),
+		resp: http_model.NewScriptOpinionResponse(),
+		ctx:  ctx,
+	}
+}
+
+type ScriptOpinionHandler struct {
+	req  *http_model.ScriptOpinionRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *ScriptOpinionHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *ScriptOpinionHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *ScriptOpinionHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *ScriptOpinionHandler) run() {
+	data := http_model.ScriptOpinionRequest{}
+	data = *h.req
+	res, err := service.Script.ScriptOpinion(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ScriptOpinionHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("CreateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "提交脚本修改意见成功"
+	h.resp.Data = res
+	h.resp.Data = data
+}
+
+/***
+func (h *ScriptOpinionHandler) run() {
+	data := http_model.ScriptOpinionRequest{}
+	data = *h.req
+	isRefuse := data.IsRefuse
+	if isRefuse== 0 {
+		fmt.Println("Create in")
+		res, err := service.Project.Create(h.ctx, data)
+		if err != nil {
+			logrus.Errorf("[ScriptOpinionHandler] call Create err:%+v\n", err)
+			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			log.Info("CreateProject fail,req:%+v", h.req)
+			return
+		}
+		h.resp.Message = "成功添加修改意见"
+		h.resp.Data = res
+	} else {
+		res, err := service.Logistics.Update(h.ctx, data)
+		if err != nil {
+			logrus.Errorf("[ScriptOpinionHandler] call Create err:%+v\n", err)
+			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			log.Info("CreateProject fail,req:%+v", h.req)
+			return
+		}
+		h.resp.Message = "成功修改物流信息"
+		h.resp.Data = res
+	}
+
+}
+***/
+func (h *ScriptOpinionHandler) checkParam() error {
+	return nil
+}

+ 89 - 0
handler/sketch_opinion.go

@@ -0,0 +1,89 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapSketchOpinionHandler(ctx *gin.Context) {
+	handler := newSketchOpinionHandler(ctx)
+	baseRun(handler)
+}
+
+func newSketchOpinionHandler(ctx *gin.Context) *SketchOpinionHandler {
+	return &SketchOpinionHandler{
+		req:  http_model.NewSketchOpinionRequest(),
+		resp: http_model.NewSketchOpinionResponse(),
+		ctx:  ctx,
+	}
+}
+
+type SketchOpinionHandler struct {
+	req  *http_model.SketchOpinionRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *SketchOpinionHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *SketchOpinionHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *SketchOpinionHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *SketchOpinionHandler) run() {
+	data := http_model.SketchOpinionRequest{}
+	data = *h.req
+	res, err := service.Sketch.SketchOption(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[SketchOpinionHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("CreateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "提交初稿修改意见成功"
+	h.resp.Data = res
+	h.resp.Data = data
+}
+
+/***
+func (h *SketchOpinionHandler) run() {
+	data := http_model.SketchOpinionRequest{}
+	data = *h.req
+	isRefuse := data.IsRefuse
+	if isRefuse== 0 {
+		fmt.Println("Create in")
+		res, err := service.Project.Create(h.ctx, data)
+		if err != nil {
+			logrus.Errorf("[SketchOpinionHandler] call Create err:%+v\n", err)
+			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			log.Info("CreateProject fail,req:%+v", h.req)
+			return
+		}
+		h.resp.Message = "成功添加修改意见"
+		h.resp.Data = res
+	} else {
+		res, err := service.Logistics.Update(h.ctx, data)
+		if err != nil {
+			logrus.Errorf("[SketchOpinionHandler] call Create err:%+v\n", err)
+			util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+			log.Info("CreateProject fail,req:%+v", h.req)
+			return
+		}
+		h.resp.Message = "成功修改物流信息"
+		h.resp.Data = res
+	}
+
+}
+***/
+func (h *SketchOpinionHandler) checkParam() error {
+	return nil
+}

+ 59 - 0
handler/sketch_photo.go

@@ -0,0 +1,59 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+)
+
+// WrapFindSketchPhotoHandler
+
+func WrapFindSketchPhotoHandler(ctx *gin.Context) {
+	handler := newFindSketchPhotoHandler(ctx)
+	baseRun(handler)
+}
+
+func newFindSketchPhotoHandler(ctx *gin.Context) *FindSketchPhotoHandler {
+	return &FindSketchPhotoHandler{
+		req:  http_model.NewFindSketchPhotoRequest(),
+		resp: http_model.NewFindSketchPhotoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FindSketchPhotoHandler struct {
+	req  *http_model.FindSketchPhotoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FindSketchPhotoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FindSketchPhotoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FindSketchPhotoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FindSketchPhotoHandler) run() {
+	data := *&http_model.FindSketchPhotoRequest{}
+	data = *h.req
+	res, err := service.Sketch.FindPhoto(h.ctx, data)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[FindSketchPhotoHandler] call FindByID err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("FindProduct fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Data = res
+}
+func (h *FindSketchPhotoHandler) checkParam() error {
+	return nil
+}

+ 77 - 0
handler/task_link_list.go

@@ -0,0 +1,77 @@
+package handler
+
+import (
+	"errors"
+	"fmt"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/pack"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/issue9/conv"
+	"github.com/sirupsen/logrus"
+)
+
+func WrapTaskLinkListHandler(ctx *gin.Context) {
+	handler := newTaskLinkListHandler(ctx)
+	baseRun(handler)
+}
+
+func newTaskLinkListHandler(ctx *gin.Context) *TaskLinkListHandler {
+	return &TaskLinkListHandler{
+		req:  http_model.NewTaskLinkListRequest(),
+		resp: http_model.NewTaskLinkListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type TaskLinkListHandler struct {
+	req  *http_model.TaskLinkListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *TaskLinkListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *TaskLinkListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *TaskLinkListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *TaskLinkListHandler) run() {
+	conditions := pack.HttpTaskLinkListRequestToCondition(h.req)
+	data, err := service.Project.GetTaskLinkList(h.ctx, h.req.ProjectId, h.req.PageSize, h.req.PageNum, conditions)
+	if err != nil {
+		logrus.WithContext(h.ctx).Errorf("[TaskLogisticsListHandler] error GetProjectTaskList, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	h.resp.Data = data
+}
+func (h *TaskLinkListHandler) checkParam() error {
+	var errs []error
+	if h.req.PageNum < 0 || h.req.PageSize <= 0 {
+		errs = append(errs, errors.New("page param error"))
+	}
+	h.req.PageNum--
+	h.req.ProjectId = util.IsNull(h.req.ProjectId)
+	if _, err := conv.Int64(h.req.ProjectId); err != nil {
+		errs = append(errs, err)
+	}
+	h.req.StrategyId = util.IsNull(h.req.StrategyId)
+	if _, err := conv.Int64(h.req.StrategyId); err != nil {
+		errs = append(errs, err)
+	}
+	h.req.LinkStatus = util.IsNull(h.req.LinkStatus)
+	if _, err := conv.Int64(h.req.LinkStatus); err != nil {
+		errs = append(errs, err)
+	}
+	if len(errs) != 0 {
+		return fmt.Errorf("check param errs:%+v", errs)
+	}
+	return nil
+}

+ 77 - 0
handler/task_sketch_list.go

@@ -0,0 +1,77 @@
+package handler
+
+import (
+	"errors"
+	"fmt"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/pack"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/gin-gonic/gin"
+	"github.com/issue9/conv"
+	"github.com/sirupsen/logrus"
+)
+
+func WrapTaskSketchListHandler(ctx *gin.Context) {
+	handler := newTaskSketchListHandler(ctx)
+	baseRun(handler)
+}
+
+func newTaskSketchListHandler(ctx *gin.Context) *TaskSketchListHandler {
+	return &TaskSketchListHandler{
+		req:  http_model.NewTaskSketchListRequest(),
+		resp: http_model.NewTaskSketchListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type TaskSketchListHandler struct {
+	req  *http_model.TaskSketchListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *TaskSketchListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *TaskSketchListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *TaskSketchListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *TaskSketchListHandler) run() {
+	conditions := pack.HttpTaskSketchListRequestToCondition(h.req)
+	data, err := service.Project.GetTaskSketchList(h.ctx, h.req.ProjectId, h.req.PageSize, h.req.PageNum, conditions)
+	if err != nil {
+		logrus.WithContext(h.ctx).Errorf("[TaskLogisticsListHandler] error GetProjectTaskList, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	h.resp.Data = data
+}
+func (h *TaskSketchListHandler) checkParam() error {
+	var errs []error
+	if h.req.PageNum < 0 || h.req.PageSize <= 0 {
+		errs = append(errs, errors.New("page param error"))
+	}
+	h.req.PageNum--
+	h.req.ProjectId = util.IsNull(h.req.ProjectId)
+	if _, err := conv.Int64(h.req.ProjectId); err != nil {
+		errs = append(errs, err)
+	}
+	h.req.StrategyId = util.IsNull(h.req.StrategyId)
+	if _, err := conv.Int64(h.req.StrategyId); err != nil {
+		errs = append(errs, err)
+	}
+	h.req.SketchStatus = util.IsNull(h.req.SketchStatus)
+	if _, err := conv.Int64(h.req.SketchStatus); err != nil {
+		errs = append(errs, err)
+	}
+	if len(errs) != 0 {
+		return fmt.Errorf("check param errs:%+v", errs)
+	}
+	return nil
+}

+ 1 - 0
model/common_model/talent_condition.go

@@ -4,6 +4,7 @@ type TalentConditions struct {
 	ProjectId        int64  `condition:"project_id"`        // 项目ID
 	LogisticsStatus  int64  `condition:"logistics_status"`  // 物流状态
 	ScriptStatus     int64  `condition:"script_status"`     // 脚本状态
+	SketchStatus     int64  `condition:"sketch_status"`     //初稿状态
 	StrategyId       int64  `condition:"strategy_id"`       // 策略ID
 	TaskId           string `condition:"task_id"`           // 任务ID
 	PlatformNickname string `condition:"platform_nickname"` // 账号昵称

+ 30 - 0
model/gorm_model/link.go

@@ -0,0 +1,30 @@
+package gorm_model
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+import (
+"time"
+)
+
+type YounggeeLinkInfo struct {
+	LinkID  int    `gorm:"column:link_id;primary_key;AUTO_INCREMENT"` // 链接id
+	TaskID  int    `gorm:"column:task_id;NOT NULL"`                   // 任务id
+	LinkUrl string `gorm:"column:link_url;NOT NULL"`                  // 上传链接url
+
+	PhotoUrl        string    `gorm:"column:photo_url;NOT NULL"`           // 上传截图url
+	ReviseOpinion   string    `gorm:"column:revise_opinion"`               // 审核意见
+	IsSubmit        int       `gorm:"column:is_submit;NOT NULL"`           // 是否提交
+	IsReview        int       `gorm:"column:is_review;default:0;NOT NULL"` // 是否审核
+	IsOk            int       `gorm:"column:is_ok;NOT NULL"`               // 是否合格
+	CreateAt        time.Time `gorm:"column:create_at"`                    // 创建时间
+	SubmitAt        time.Time `gorm:"column:submit_at"`                    // 提交时间
+	AgreeAt         time.Time `gorm:"column:agree_at"`                     // 同意时间
+	RejectAt        time.Time `gorm:"column:reject_at"`                    // 驳回时间
+	AutoAgreeAt     time.Time `gorm:"column:auto_agree_at"`                // 发布审核自动处理时间
+	AutoDataBreakAt time.Time `gorm:"column:auto_data_break_at"`           // 结案违约自动处理时间
+	AutoLinkBreakAt time.Time `gorm:"column:auto_link_break_at"`           // 链接违约自动处理时间
+}
+
+func (m *YounggeeLinkInfo) TableName() string {
+	return "younggee_link_info"
+}

+ 22 - 10
model/gorm_model/sketch.go

@@ -1,19 +1,31 @@
 package gorm_model
 
-import "time"
+// Code generated by sql2gorm. DO NOT EDIT.
+
+import (
+"time"
+)
 
 type YounggeeSketchInfo struct {
-	SketchID      int       `gorm:"column:sketch_id;primary_key;AUTO_INCREMENT"` // 初稿id
-	TaskID        int       `gorm:"column:task_id;NOT NULL"`                     // 任务id
-	ReviseOpinion string    `gorm:"column:revise_opinion"`
-	CreateAt      time.Time `gorm:"column:create_at;NOT NULL"`
-	AgreeAt       time.Time `gorm:"column:agree_at"`
-	RejectAt      time.Time `gorm:"column:reject_at"`
-	IsSubmit      int       `gorm:"column:is_submit;NOT NULL"`           // 是否提交
-	IsReview      int       `gorm:"column:is_review;default:0;NOT NULL"` // 是否审核
-	IsOk          int       `gorm:"column:is_ok;NOT NULL"`               // 是否合格
+	SketchID          int       `gorm:"column:sketch_id;primary_key;AUTO_INCREMENT"` // 初稿id
+	TaskID            int       `gorm:"column:task_id;NOT NULL"`                     // 任务id
+	Title             string    `gorm:"column:title"`                                // 标题
+	Type              int       `gorm:"column:type"`                                 // 初稿形式,1为图片,2为视频
+	Content           string    `gorm:"column:content"`                              // 正文
+	ReviseOpinion     string    `gorm:"column:revise_opinion"`                       // 反馈意见
+	IsSubmit          int       `gorm:"column:is_submit;NOT NULL"`                   // 是否提交
+	IsReview          int       `gorm:"column:is_review;default:0;NOT NULL"`         // 是否审核
+	IsOk              int       `gorm:"column:is_ok;NOT NULL"`                       // 是否合格
+	CreateAt          time.Time `gorm:"column:create_at;NOT NULL"`                   // 创建时间
+	AgreeAt           time.Time `gorm:"column:agree_at"`                             // 同意时间
+	RejectAt          time.Time `gorm:"column:reject_at"`                            // 驳回时间
+	SubmitAt          time.Time `gorm:"column:submit_at"`                            // 提交时间
+	AutoAgreeAt       time.Time `gorm:"column:auto_agree_at"`                        // 初稿自动审核时间
+	AutoLinkBreakAt   time.Time `gorm:"column:auto_link_break_at"`                   // 链接违约自动处理时间
+	AutoSketchBreakAt time.Time `gorm:"column:auto_sketch_break_at"`                 // 初稿违约自动处理时间
 }
 
 func (m *YounggeeSketchInfo) TableName() string {
 	return "younggee_sketch_info"
 }
+

+ 20 - 0
model/gorm_model/sketch_photo.go

@@ -0,0 +1,20 @@
+package gorm_model
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+import (
+"time"
+)
+
+type YounggeeSketchPhoto struct {
+	ID       int       `gorm:"column:id;primary_key;AUTO_INCREMENT"` // 初稿id
+	SketchID int       `gorm:"column:sketch_id"`
+	PhotoUrl string    `gorm:"column:photo_url"`
+	PhotoUid string    `gorm:"column:photo_uid"`
+	Symbol   int       `gorm:"column:symbol"` // 1是图片,2是视频
+	CreateAt time.Time `gorm:"column:create_at"`
+}
+
+func (m *YounggeeSketchPhoto) TableName() string {
+	return "younggee_sketch_photo"
+}

+ 0 - 20
model/http_model/revise_option.go

@@ -1,20 +0,0 @@
-package http_model
-
-type ReviseOptionRequest struct {
-	StrategyID    int64  `json:"strategy_id"`    //招募策略id
-	TaskID        int64  `json:"task_id"`        //任务-id
-	ReviseOpinion string `json:"revise_opinion"` //脚本内容
-}
-
-type ReviseOptionData struct {
-	TaskID int64 `json:"task_id"` // 脚本ID
-}
-
-func NewReviseOptionRequest() *ReviseOptionRequest {
-	return new(ReviseOptionRequest)
-}
-func NewReviseOptionResponse() *CommonResponse {
-	resp := new(CommonResponse)
-	resp.Data = new(ReviseOptionData)
-	return resp
-}

+ 0 - 0
model/http_model/accept_script.go → model/http_model/script_accept.go


+ 20 - 0
model/http_model/script_opinion.go

@@ -0,0 +1,20 @@
+package http_model
+
+type ScriptOpinionRequest struct {
+	StrategyID    int64  `json:"strategy_id"`    //招募策略id
+	TaskID        int64  `json:"task_id"`        //任务-id
+	ScriptOpinion string `json:"script_opinion"` //初稿意见
+}
+
+type ScriptOpinionData struct {
+	TaskID int64 `json:"task_id"` // 脚本ID
+}
+
+func NewScriptOpinionRequest() *ScriptOpinionRequest {
+	return new(ScriptOpinionRequest)
+}
+func NewScriptOpinionResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ScriptOpinionData)
+	return resp
+}

+ 19 - 0
model/http_model/sketch_accept.go

@@ -0,0 +1,19 @@
+package http_model
+
+type AcceptSketchRequest struct {
+	StrategyID int64 `json:"strategy_id"` //招募策略id
+	TaskID     int64 `json:"task_id"`     //任务-id
+}
+
+type AcceptSketchData struct {
+	TaskID int64 `json:"task_id"` // 脚本ID
+}
+
+func NewAcceptSketchRequest() *AcceptSketchRequest {
+	return new(AcceptSketchRequest)
+}
+func NewAcceptSketchResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(AcceptSketchData)
+	return resp
+}

+ 20 - 0
model/http_model/sketch_opinion.go

@@ -0,0 +1,20 @@
+package http_model
+
+type SketchOpinionRequest struct {
+	StrategyID    int64  `json:"strategy_id"`    //招募策略id
+	TaskID        int64  `json:"task_id"`        //任务-id
+	SketchOpinion string `json:"sketch_opinion"` //初稿意见
+}
+
+type SketchOpinionData struct {
+	TaskID int64 `json:"task_id"` // 脚本ID
+}
+
+func NewSketchOpinionRequest() *SketchOpinionRequest {
+	return new(SketchOpinionRequest)
+}
+func NewSketchOpinionResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(SketchOpinionData)
+	return resp
+}

+ 24 - 0
model/http_model/sketch_photo.go

@@ -0,0 +1,24 @@
+package http_model
+
+type FindSketchPhotoRequest struct {
+	SketchID int64 `json:"sketch_id"`
+}
+
+type SketchPhoto struct {
+	PhotoUrl string `json:"photo_url"` // 图片或视频url
+	PhotoUid string `json:"photo_uid"`
+	Symbol   int64  `json:"symbol"` // 标志位,1为详情图,2为视频
+}
+
+type FindSketchPhotoData struct {
+	SketchPhotos []SketchPhoto `json:"sketch_photos"` //初稿图片以及视频
+}
+
+func NewFindSketchPhotoRequest() *FindSketchPhotoRequest {
+	return new(FindSketchPhotoRequest)
+}
+func NewFindSketchPhotoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FindSketchPhotoData)
+	return resp
+}

+ 26 - 0
model/http_model/task_link.go

@@ -0,0 +1,26 @@
+package http_model
+
+type TaskLinkListRequest struct {
+	PageSize         int64  `json:"page_size"`
+	PageNum          int64  `json:"page_num"`
+	ProjectId        string `json:"project_id"`        // 项目ID
+	TaskId           string `json:"task_id"`           // 任务ID
+	StrategyId       string `json:"strategy_id"`       // 策略ID
+	SketchStatus     string `json:"sketch_status"`     // 稿件状态
+	PlatformNickname string `json:"platform_nickname"` // 账号昵称
+}
+
+type TaskLinkListData struct {
+	TaskLinkPreview []*TaskLinkPreview `json:"project_link_pre_view"`
+	Total           string             `json:"total"`
+}
+
+func NewTaskLinkListRequest() *TaskLinkListRequest {
+	return new(TaskLinkListRequest)
+}
+
+func NewTaskLinkListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectTaskListData)
+	return resp
+}

+ 1 - 6
model/http_model/task_script.go

@@ -23,6 +23,7 @@ type TaskScriptPreview struct {
 	StrategyID        string `json:"strategy_id"`         // 报名选择的招募策略id
 	Submit            string `json:"script_upload_time"`  //创建时间
 	Title             string `json:"title"`               //脚本标题
+	AgreeAt           string `json:"agree_at"`            //同意时间
 	Content           string `json:"content"`             //脚本内容
 	ReviseOpinion     string `json:"revise_opinion"`      //审稿意见
 
@@ -51,12 +52,6 @@ type TaskScript struct {
 	//Account   gorm_model.YoungeePlatformAccountInfo
 }
 
-type TaskSketch struct {
-	Talent gorm_model.YoungeeTaskInfo
-	Sketch gorm_model.YounggeeSketchInfo
-	//Account   gorm_model.YoungeePlatformAccountInfo
-}
-
 type TaskScriptListData struct {
 	TaskScriptPreview []*TaskScriptPreview `json:"project_script_pre_view"`
 	Total             string               `json:"total"`

+ 70 - 0
model/http_model/task_sketch.go

@@ -0,0 +1,70 @@
+package http_model
+
+import (
+	"time"
+	"youngee_b_api/model/gorm_model"
+)
+
+type TaskSketchListRequest struct {
+	PageSize         int64  `json:"page_size"`
+	PageNum          int64  `json:"page_num"`
+	ProjectId        string `json:"project_id"`        // 项目ID
+	TaskId           string `json:"task_id"`           // 任务ID
+	StrategyId       string `json:"strategy_id"`       // 策略ID
+	SketchStatus     string `json:"sketch_status"`     // 稿件状态
+	PlatformNickname string `json:"platform_nickname"` // 账号昵称
+}
+
+type TaskSketchPreview struct {
+	TaskID            string `json:"task_id"`             // 任务ID
+	SketchID          string `json:"sketch_id"`           //初稿ID
+	PlatformNickname  string `json:"platform_nickname"`   // 账号昵称
+	FansCount         string `json:"fans_count"`          // 粉丝数
+	RecruitStrategyID string `json:"recruit_strategy_id"` //招募策略ID
+	StrategyID        string `json:"strategy_id"`         // 报名选择的招募策略id
+	Submit            string `json:"sketch_upload_time"`  //创建时间
+	AgreeAt           string `json:"argee_at"`            //同意时间
+	Title             string `json:"title"`               //初稿标题
+	Content           string `json:"content"`             //初稿内容
+	ReviseOpinion     string `json:"revise_opinion"`      //审稿意见
+	//SketchPhotos      []SketchPhoto `json:"sketch_photos"`       //初稿图片以及视频
+}
+
+type TaskSketchInfo struct {
+	TaskID            int       `json:"task_id"`           // 任务ID
+	PlatformNickname  string    `json:"platform_nickname"` // 账号昵称
+	FansCount         string    `json:"fans_count"`        // 粉丝数
+	RecruitStrategyID int       `json:"recruit_strategy_id"`
+	StrategyID        int       `json:"strategy_id"`    // 报名选择的招募策略id
+	SketchId          int       `json:"sketch_id"`      //初稿ID
+	Title             string    `json:"title"`          //初稿标题
+	Content           string    `json:"content"`        //初稿内容
+	ReviseOpinion     string    `json:"revise_opinion"` //审稿意见
+	CreateAt          time.Time `json:"create_at"`      //创建时间
+	SubmitAt          time.Time `json:"submit_at"`      // 提交时间
+	AgreeAt           time.Time `json:"agree_at"`       //同意时间
+	RejectAt          time.Time `json:"reject_at"`      //拒绝时间
+	IsReview          int       `json:"is_review"`      //是否审核
+	//SketchPhotos      []SketchPhoto `json:"sketch_photos"`  //初稿图片以及视频
+}
+
+type TaskSketch struct {
+	Talent gorm_model.YoungeeTaskInfo
+	Sketch gorm_model.YounggeeSketchInfo
+	//Account   gorm_model.YoungeePlatformAccountInfo
+}
+
+type TaskSketchListData struct {
+	TaskSketchPreview []*TaskSketchPreview `json:"project_sketch_pre_view"`
+	Total             string               `json:"total"`
+}
+
+func NewTaskSketchListRequest() *TaskSketchListRequest {
+	return new(TaskSketchListRequest)
+}
+
+func NewTaskSketchListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectTaskListData)
+	return resp
+}

+ 1 - 0
pack/task_script_list.go

@@ -30,6 +30,7 @@ func MGormTaskScriptInfoToHttpTaskScriptPreview(TaskScriptInfo *http_model.TaskS
 		Content:           TaskScriptInfo.Content,
 		ReviseOpinion:     TaskScriptInfo.ReviseOpinion,
 		Submit:            conv.MustString(TaskScriptInfo.SubmitAt)[0:19],
+		AgreeAt:           conv.MustString(TaskScriptInfo.AgreeAt)[0:19],
 	}
 }
 

+ 65 - 0
pack/task_sketch_list.go

@@ -0,0 +1,65 @@
+package pack
+
+import (
+	"youngee_b_api/model/http_model"
+
+	"github.com/tidwall/gjson"
+
+	"github.com/issue9/conv"
+)
+
+func MGormTaskSketchInfoListToHttpTaskSketchPreviewList(gormTaskSketchInfos []*http_model.TaskSketchInfo) []*http_model.TaskSketchPreview {
+	var httpProjectPreviews []*http_model.TaskSketchPreview
+	for _, gormTaskSketchInfo := range gormTaskSketchInfos {
+		httpTaskSketchPreview := MGormTaskSketchInfoToHttpTaskSketchPreview(gormTaskSketchInfo)
+		httpProjectPreviews = append(httpProjectPreviews, httpTaskSketchPreview)
+	}
+	return httpProjectPreviews
+}
+
+func MGormTaskSketchInfoToHttpTaskSketchPreview(TaskSketchInfo *http_model.TaskSketchInfo) *http_model.TaskSketchPreview {
+	//deliveryTime := conv.MustString(TaskSketchInfo.DeliveryTime)
+	//deliveryTime = deliveryTime[0:19]
+	return &http_model.TaskSketchPreview{
+		TaskID:            conv.MustString(TaskSketchInfo.TaskID),
+		SketchID:          conv.MustString(TaskSketchInfo.SketchId),
+		PlatformNickname:  conv.MustString(TaskSketchInfo.PlatformNickname),
+		FansCount:         conv.MustString(TaskSketchInfo.FansCount),
+		RecruitStrategyID: conv.MustString(TaskSketchInfo.RecruitStrategyID),
+		StrategyID:        conv.MustString(TaskSketchInfo.StrategyID),
+		Title:             TaskSketchInfo.Title,
+		Content:           TaskSketchInfo.Content,
+		ReviseOpinion:     TaskSketchInfo.ReviseOpinion,
+		Submit:            conv.MustString(TaskSketchInfo.SubmitAt)[0:19],
+		AgreeAt:           conv.MustString(TaskSketchInfo.AgreeAt)[0:19],
+		//SketchPhotos:      TaskSketchInfo.SketchPhotos,
+	}
+}
+
+func TaskSketchToTaskInfo(TaskSketchs []*http_model.TaskSketch) []*http_model.TaskSketchInfo {
+	var TaskSketchInfos []*http_model.TaskSketchInfo
+	for _, TaskSketch := range TaskSketchs {
+		TaskSketch := GetSketchInfoStruct(TaskSketch)
+		TaskSketchInfos = append(TaskSketchInfos, TaskSketch)
+	}
+	return TaskSketchInfos
+}
+
+func GetSketchInfoStruct(TaskSketch *http_model.TaskSketch) *http_model.TaskSketchInfo {
+	TalentPlatformInfoSnap := TaskSketch.Talent.TalentPlatformInfoSnap
+	return &http_model.TaskSketchInfo{
+		TaskID:           TaskSketch.Talent.TaskID,
+		PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "PlatformInfo.platform_name")),
+		FansCount:        conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count")),
+		StrategyID:       TaskSketch.Talent.StrategyID,
+		SketchId:         TaskSketch.Sketch.SketchID,
+		Title:            TaskSketch.Sketch.Title,
+		Content:          TaskSketch.Sketch.Content,
+		ReviseOpinion:    TaskSketch.Sketch.ReviseOpinion,
+		CreateAt:         TaskSketch.Sketch.CreateAt,
+		SubmitAt:         TaskSketch.Sketch.SubmitAt,
+		AgreeAt:          TaskSketch.Sketch.AgreeAt,
+		RejectAt:         TaskSketch.Sketch.RejectAt,
+		IsReview:         TaskSketch.Sketch.IsReview,
+	}
+}

+ 19 - 0
pack/task_sketch_list_conditions.go

@@ -0,0 +1,19 @@
+package pack
+
+import (
+	"fmt"
+	"github.com/issue9/conv"
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/http_model"
+)
+
+func HttpTaskSketchListRequestToCondition(req *http_model.TaskSketchListRequest) *common_model.TalentConditions {
+	fmt.Printf("初稿转换 %+v", req)
+	return &common_model.TalentConditions{
+		ProjectId:        conv.MustInt64(req.ProjectId),
+		SketchStatus:     conv.MustInt64(req.SketchStatus),
+		StrategyId:       conv.MustInt64(req.StrategyId),
+		TaskId:           conv.MustString(req.TaskId),
+		PlatformNickname: conv.MustString(req.PlatformNickname),
+	}
+}

+ 9 - 4
route/init.go

@@ -59,10 +59,15 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/tasklogisticslist", handler.WrapTaskLogisticsListHandler) //物流信息查询
 		m.POST("/project/createlogistics", handler.WrapCreateLogisticsHandler)     //创建物流信息
 		m.POST("/project/signforreceipt", handler.WrapSignForReceiptHandler)
-		m.POST("/project/taskscriptlist", handler.WrapTaskScriptListHandler) //查询脚本列表
-		m.POST("/project/reviseopinion", handler.WrapReviseOptionHandler)    //审核意见提交
-		m.POST("/project/acceptscript", handler.WrapAcceptScriptHandler)     //同意脚本
-		m.POST("/project/", handler.WrapAcceptScriptHandler)                 //同意脚本
+		m.POST("/project/taskscriptlist", handler.WrapTaskScriptListHandler)   //查询脚本列表
+		m.POST("/project/scriptopinion", handler.WrapScriptOpinionHandler)     //脚本审核意见提交
+		m.POST("/project/acceptscript", handler.WrapAcceptScriptHandler)       //同意脚本
+		m.POST("/project/tasksketchlist", handler.WrapTaskSketchListHandler)   //查询初稿列表
+		m.POST("/project/findsketchphoto", handler.WrapFindSketchPhotoHandler) //查询脚本配图和视频demo
+		m.POST("/project/sketchopinion", handler.WrapSketchOpinionHandler)     //脚本审核意见提交
+		m.POST("/project/acceptsketch", handler.WrapAcceptSketchHandler)       //同意脚本
+		m.POST("/project/tasklinklist", handler.WrapTaskLinkListHandler)       //查询脚本列表
+		//m.POST("/project/acceptsketch", handler.WrapAcceptSketchHandler)       //链接合格
 		//m.POST("/project/tasksketchlist", handler.WrapTaskSketchListHandler)
 	}
 }

+ 5 - 7
service/project.go

@@ -316,16 +316,14 @@ func (p *project) GetTaskScriptList(ctx *gin.Context, projectID string, pageSize
 	return TaskScriptListData, nil
 }
 
-/*
-func (p *project) GetTaskSketchList(ctx *gin.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) (*http_model.TaskScript, error) {
-	TaskSketch, total, err := db.GetTaskSketchList(ctx, projectID, pageSize, pageNum, conditions)
+func (p *project) GetTaskSketchList(ctx *gin.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) (*http_model.TaskSketchListData, error) {
+	TaskSketchs, total, err := db.GetTaskSketchList(ctx, projectID, pageSize, pageNum, conditions)
 	if err != nil {
-		logrus.WithContext(ctx).Errorf("[project service] call GetTaskScriptList error,err:%+v", err)
+		logrus.WithContext(ctx).Errorf("[project service] call GetTaskSketchList error,err:%+v", err)
 		return nil, err
 	}
-	TaskSketchListData := new(http_model.TaskLogisticsListData)
-	TaskSketchListData.TaskLogisticsPreview = pack.MGormTaskLogisticsInfoListToHttpTaskLogisticsPreviewList(TaskLogisticss)
+	TaskSketchListData := new(http_model.TaskSketchListData)
+	TaskSketchListData.TaskSketchPreview = pack.MGormTaskSketchInfoListToHttpTaskSketchPreviewList(TaskSketchs)
 	TaskSketchListData.Total = conv.MustString(total)
 	return TaskSketchListData, nil
 }
-*/

+ 5 - 5
service/script.go

@@ -16,19 +16,19 @@ var Script *script
 type script struct {
 }
 
-// ReviseOption 在上传脚本表上提交修改意见
-func (*script) ReviseOption(ctx context.Context, request http_model.ReviseOptionRequest) (*http_model.ReviseOptionData, error) {
+// ScriptOpinion 在上传脚本表上提交修改意见
+func (*script) ScriptOpinion(ctx context.Context, request http_model.ScriptOpinionRequest) (*http_model.ScriptOpinionData, error) {
 	Script := gorm_model.YounggeeScriptInfo{
 		TaskID:        conv.MustInt(request.TaskID),
-		ReviseOpinion: request.ReviseOpinion,
+		ReviseOpinion: request.ScriptOpinion,
 	}
-	err := db.ReviseOption(ctx, Script.TaskID, Script.ReviseOpinion)
+	err := db.ScriptOpinion(ctx, Script.TaskID, Script.ReviseOpinion)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Script service] call CreateScript error,err:%+v", err)
 		return nil, err
 	}
 
-	res := &http_model.ReviseOptionData{
+	res := &http_model.ScriptOpinionData{
 		TaskID: int64(Script.TaskID),
 	}
 	return res, nil

+ 72 - 0
service/sketch.go

@@ -0,0 +1,72 @@
+package service
+
+import (
+	"context"
+	"fmt"
+	"github.com/issue9/conv"
+	"youngee_b_api/db"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+
+	"github.com/sirupsen/logrus"
+)
+
+var Sketch *sketch
+
+type sketch struct {
+}
+
+// ReviseOption 在上传初稿表上提交修改意见
+func (*sketch) SketchOption(ctx context.Context, request http_model.SketchOpinionRequest) (*http_model.SketchOpinionData, error) {
+	Sketch := gorm_model.YounggeeSketchInfo{
+		TaskID:        conv.MustInt(request.TaskID),
+		ReviseOpinion: request.SketchOpinion,
+	}
+	err := db.SketchOption(ctx, Sketch.TaskID, Sketch.ReviseOpinion)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch service] call CreateSketch error,err:%+v", err)
+		return nil, err
+	}
+
+	res := &http_model.SketchOpinionData{
+		TaskID: int64(Sketch.TaskID),
+	}
+	return res, nil
+}
+
+// AcceptSketch 同意初稿
+func (*sketch) AcceptSketch(ctx context.Context, request http_model.AcceptSketchRequest) (*http_model.AcceptSketchData, error) {
+
+	TaskID := conv.MustInt(request.TaskID)
+
+	fmt.Printf("acc request %+v", TaskID)
+	err := db.AcceptSketch(ctx, TaskID)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch service] call CreateSketch error,err:%+v", err)
+		return nil, err
+	}
+
+	res := &http_model.AcceptSketchData{
+		TaskID: int64(TaskID),
+	}
+	return res, nil
+}
+
+// FindPhoto 查找初稿图片以及视频
+func (*sketch) FindPhoto(ctx context.Context, request http_model.FindSketchPhotoRequest) ([]http_model.SketchPhoto, error) {
+	var SketchPhotos []http_model.SketchPhoto
+	res, err := db.FindPhoto(ctx, request.SketchID)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch service] call CreateSketch error,err:%+v", err)
+		return nil, err
+	}
+	for _, photo := range res {
+		sketchPhoto := http_model.SketchPhoto{
+			PhotoUrl: photo.PhotoUrl,
+			PhotoUid: photo.PhotoUid,
+			Symbol:   conv.MustInt64(photo.Symbol),
+		}
+		SketchPhotos = append(SketchPhotos, sketchPhoto)
+	}
+	return SketchPhotos, nil
+}