Quellcode durchsuchen

Merge branch 'refs/heads/develop' into develop-zhou

Ethan vor 1 Woche
Ursprung
Commit
f91a275d47

+ 5 - 7
db/sectask.go

@@ -30,7 +30,7 @@ func GetSecTaskById(ctx context.Context, secTaskId string) (*gorm_model.Younggee
 	return &secTaskInfo, nil
 }
 
-func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, saleNumMin int, saleNumMax int, pageSize, pageNum int64, orderBy []string, orderDesc []int) ([]*http_model.SecTaskInfo, int64, error) {
+func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, saleNumMin int, saleNumMax int, pageSize, pageNum int64, orderBy []string, orderDesc []string) ([]*http_model.SecTaskInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// var taskStages []int
 	var freeStages []int
@@ -85,7 +85,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 	if len(orderBy) > 0 && len(orderDesc) > 0 && len(orderBy) == len(orderDesc) {
 		for i := 0; i < len(orderBy); i++ {
 			orderField := orderBy[i]
-			isDesc := orderDesc[i] == 1 // 1=降序,其他值=升序
+			isDesc := orderDesc[i] == "desc" // 1=降序,其他值=升序
 
 			switch orderField {
 			case "sale_num":
@@ -124,9 +124,9 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		return nil, 0, err
 	}
 
-	fmt.Printf("secTaskInfoList:%+v", secTaskInfoList)
+	// fmt.Printf("secTaskInfoList:%+v", secTaskInfoList)
 	newSecTaskInfoList := pack.GormSecTaskListToHttpSecTaskList(secTaskInfoList)
-	fmt.Printf("newSecTaskInfoList:%+v", newSecTaskInfoList)
+	// fmt.Printf("newSecTaskInfoList:%+v", newSecTaskInfoList)
 
 	//for i, secTask := range newSecTaskInfoList {
 	//	if secTask.RegionCode != 0 {
@@ -227,9 +227,7 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string,
 		return false, err
 	}
 	if int64(selection.RemainNum) < count {
-		if int64(len(taskIds)) == 0 || count != int64(len(taskIds)) {
-			return true, errors.New("剩余选品数量不足")
-		}
+		return true, errors.New("剩余样品数量不足")
 	}
 
 	err = db.Transaction(func(tx *gorm.DB) error {

+ 12 - 3
db/sketch.go

@@ -327,7 +327,7 @@ func LocalAcceptSketch(ctx context.Context, TaskIDs []string, operatorid string,
 	}
 
 	var project gorm_model.YounggeeLocalLifeInfo
-	err = db.Model(gorm_model.YounggeeLocalLifeInfo{}).Where("LocalId = ?", projectid).Find(&project).Error
+	err = db.Model(gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", projectid).Find(&project).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Find ProjectInfo error,err:%+v", err)
 		return err
@@ -451,7 +451,7 @@ func LocalRejectSketch(ctx context.Context, TaskIDs []string, operatorid string,
 	}
 
 	var project gorm_model.YounggeeLocalLifeInfo
-	err = db.Model(gorm_model.YounggeeLocalLifeInfo{}).Where("LocalId = ?", projectid).Find(&project).Error
+	err = db.Model(gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", projectid).Find(&project).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeLocalLifeInfo error,err:%+v", err)
 		return err
@@ -481,12 +481,21 @@ func LocalRejectSketch(ctx context.Context, TaskIDs []string, operatorid string,
 func FindSketchInfo(ctx context.Context, TaskID string) (*gorm_model.YounggeeSketchInfo, error) {
 	db := GetReadDB(ctx)
 	var SketchInfo gorm_model.YounggeeSketchInfo
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_ok = 1", TaskID).Find(&SketchInfo).Error
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", TaskID).Find(&SketchInfo).Error
 	if err != nil {
 		return nil, err
 	}
 	return &SketchInfo, nil
+}
 
+func FindAllSketchInfo(ctx context.Context, taskid string) ([]gorm_model.YounggeeSketchInfo, error) {
+	db := GetReadDB(ctx)
+	var SketchInfo []gorm_model.YounggeeSketchInfo
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 1", taskid).Find(&SketchInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return SketchInfo, nil
 }
 
 // FindPhoto

+ 6 - 1
handler/PassSecTaskCoop.go

@@ -37,11 +37,16 @@ func (c PassSecTaskCoop) run() {
 	data = *c.req
 	//auth := middleware.GetSessionAuth(c.ctx)
 	//enterpriseID := auth.EnterpriseID
-	res, err := sectask_service.SelectionTask.PassCoop(c.ctx, data)
+	res, tag, err := sectask_service.SelectionTask.PassCoop(c.ctx, data)
 	if err != nil {
 		logrus.Errorf("[PassSecTaskCoop] call PassSecTaskCoop err:%+v\n", err)
 		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
 		logrus.Info("PassSecTaskCoop fail,req:%+v", c.req)
+		if tag == 1 {
+			c.resp.Message = err.Error()
+			c.resp.Status = 33000
+			return
+		}
 		c.resp.Message = err.Error()
 		c.resp.Status = 40000
 		return

+ 60 - 0
handler/getsketchrecordlist.go

@@ -0,0 +1,60 @@
+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"
+)
+
+// WrapGetSketchRecordListHandler
+
+func WrapGetSketchRecordListHandler(ctx *gin.Context) {
+	handler := newGetSketchRecordListHandler(ctx)
+	baseRun(handler)
+}
+
+func newGetSketchRecordListHandler(ctx *gin.Context) *GetSketchRecordListHandler {
+	return &GetSketchRecordListHandler{
+		req:  http_model.NewGetSketchRecordListRequest(),
+		resp: http_model.NewGetSketchRecordListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type GetSketchRecordListHandler struct {
+	req  *http_model.GetSketchRecordListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *GetSketchRecordListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *GetSketchRecordListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *GetSketchRecordListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *GetSketchRecordListHandler) run() {
+	data := *&http_model.GetSketchRecordListRequest{}
+	data = *h.req
+	res, err := service.Sketch.GetSketchRecordList(h.ctx, data)
+	if err != nil {
+		// 数据库查询失败,返回5001
+		logrus.Errorf("[GetSketchRecordListHandler] call GetByID err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorParamCheck, "")
+		log.Info("GetProduct fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Data = res
+	h.resp.Status = consts.ErrorSuccess
+}
+func (h *GetSketchRecordListHandler) checkParam() error {
+	return nil
+}

+ 5 - 3
model/http_model/GetSecTaskList.go

@@ -4,7 +4,7 @@ import "time"
 
 type GetSecTaskListRequest struct {
 	PageSize      int64    `json:"page_size"`
-	PageNum       int64    `json:"page_num"`
+	PageNum       int64    `json:"page"`
 	SelectionId   string   `json:"selection_id"`
 	SecTaskStatus int      `json:"sec_task_status"`
 	SearchValue   string   `json:"search_value"`
@@ -14,8 +14,8 @@ type GetSecTaskListRequest struct {
 	RewardStage   int      `json:"reward_stage"`   // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
 	SaleNumMin    int      `json:"sale_num_min"`   // 30天橱窗销量区间最小值
 	SaleNumMax    int      `json:"sale_num_max"`   // 30天橱窗销量区间最大值
-	OrderBy       []string `json:"order_by"`       // 排序条件
-	OrderDesc     []int    `json:"order_desc"`     // 是否降序
+	OrderBy       []string `json:"sort_field"`     // 排序条件
+	OrderDesc     []string `json:"sort_order"`     // 是否降序
 }
 
 type GetSecTaskListData struct {
@@ -66,6 +66,8 @@ type SecTaskInfo struct {
 	ChooseTalentUserId     string    `json:"choose_talent_user_id"`     // 同意/拒绝达人操作人ID
 	ChooseTalentUserType   int       `json:"choose_talent_user_type"`   // 同意/拒绝达人操作人类型,1商家,2子账号
 	ChooseTalentUserName   string    `json:"choose_talent_user_name"`   // 同意/拒绝达人操作人名称
+	TalentOrigin           string    `json:"talent_origin"`             // 达人来源,"公海"
+	SupplierType           int       `json:"supplier_type"`             // 服务商类型,0达人来自公海,1为个人服务商,2为企业服务商
 }
 
 func NewGetSecTaskListRequest() *GetSecTaskListRequest {

+ 1 - 1
model/http_model/PreLinkList.go

@@ -2,7 +2,7 @@ package http_model
 
 type PreLinkListRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	LinkStatus   string   `json:"link_status"` // 链接状态,11待传链接
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/getlocaltasklist.go

@@ -2,7 +2,7 @@ package http_model
 
 type GetLocalTaskListRequest struct {
 	PageSize       int      `json:"page_size"`
-	PageNum        int      `json:"page_num"`
+	PageNum        int      `json:"page"`
 	TalentFromList string   `json:"talent_from_list"`
 	FeeFrom        *int     `json:"fee_from,omitempty"`
 	Type           *int     `json:"type,omitempty"` // 查询类型,1、2分别表示达人来源于公海(商家端),服务商

+ 18 - 0
model/http_model/getsketchrecordlistrequest.go

@@ -0,0 +1,18 @@
+package http_model
+
+type GetSketchRecordListRequest struct {
+	TaskID string `json:"task_id"`
+}
+
+type GetSketchRecordListResponse struct {
+	SketchData []GetSketchInfoData `json:"sketch_data"`
+}
+
+func NewGetSketchRecordListRequest() *GetSketchRecordListRequest {
+	return new(GetSketchRecordListRequest)
+}
+func NewGetSketchRecordListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchRecordListResponse)
+	return resp
+}

+ 1 - 1
model/http_model/gettasklist.go

@@ -2,7 +2,7 @@ package http_model
 
 type GetTaskListRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	FeeFrom      *int     `json:"fee_from,omitempty"`
 	Type         *int     `json:"type,omitempty"` // 查询类型,1、2分别表示达人来源于公海(商家端),服务商
 	ProjectId    string   `json:"project_id"`

+ 1 - 1
model/http_model/localpredatalist.go

@@ -2,7 +2,7 @@ package http_model
 
 type LocalPreDataListRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	DataStatus   string   `json:"data_status"` // 数据状态,13待传数据
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/localtaskdatalist.go

@@ -2,7 +2,7 @@ package http_model
 
 type LocalTaskDatalistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	DataStatus   string   `json:"data_status"` // 链接状态,14
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/localtasklinklist.go

@@ -2,7 +2,7 @@ package http_model
 
 type LocalTaskLinklistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	LinkStatus   string   `json:"link_status"` // 链接状态,12待审
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/localtasksketchlist.go

@@ -2,7 +2,7 @@ package http_model
 
 type LocalTasksketchlistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`    // 项目ID
 	ScriptStatus int      `json:"script_status"` // 稿件状态
 	SortField    []string `json:"sort_field,omitempty"`

+ 1 - 1
model/http_model/predatalist.go

@@ -2,7 +2,7 @@ package http_model
 
 type PreDataListRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	DataStatus   string   `json:"data_status"` // 数据状态,13待传数据
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/presketchlist.go

@@ -2,7 +2,7 @@ package http_model
 
 type PreSketchListRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`    // 项目ID
 	ScriptStatus int      `json:"script_status"` // 稿件状态,10初稿待审
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/taskdatalist.go

@@ -2,7 +2,7 @@ package http_model
 
 type TaskDatalistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	DataStatus   string   `json:"data_status"` // 链接状态,14
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/tasklinklist.go

@@ -2,7 +2,7 @@ package http_model
 
 type TaskLinklistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`  // 项目ID
 	LinkStatus   string   `json:"link_status"` // 链接状态,12待审
 	EnterpriseId string   `json:"enterprise_id"`

+ 1 - 1
model/http_model/tasksketchlist.go

@@ -2,7 +2,7 @@ package http_model
 
 type TasksketchlistRequest struct {
 	PageSize     int      `json:"page_size"`
-	PageNum      int      `json:"page_num"`
+	PageNum      int      `json:"page"`
 	ProjectId    string   `json:"project_id"`    // 项目ID
 	ScriptStatus int      `json:"script_status"` // 稿件状态
 	SortField    []string `json:"sort_field,omitempty"`

+ 2 - 0
pack/sec_task_list.go

@@ -47,6 +47,8 @@ func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_mod
 		ChooseTalentUserId:     secTask.ChooseTalentUserId,
 		ChooseTalentUserType:   secTask.ChooseTalentUserType,
 		ChooseTalentUserName:   secTask.ChooseTalentUserId,
+		SupplierType:           0,
+		TalentOrigin:           "公海",
 	}
 }
 

+ 1 - 0
route/init.go

@@ -249,6 +249,7 @@ func InitRoute(r *gin.Engine) {
 		task.POST("/project/rejectsketch", handler.WrapRejectSketchHandler)                 //种草拒绝初稿
 		task.POST("/project/findsketchphoto", handler.WrapFindSketchPhotoHandler)           //种草查询脚本配图和视频demo
 		task.POST("/project/getsketchinfo", handler.WrapGetSketchInfoHandler)               //种草获取初稿
+		task.POST("/project/getsketchrecordlist", handler.WrapGetSketchRecordListHandler)   //初稿审核记录
 
 		task.POST("/project/prelinklist", handler.WrapPreLinkListHandler)   //种草待传链接列表
 		task.POST("/project/tasklinklist", handler.WrapTaskLinklistHandler) //种草链接待审列表,通过

+ 7 - 4
service/sectask_service/sectask.go

@@ -69,16 +69,19 @@ func (*selectionTask) GetList(ctx context.Context, request http_model.GetSecTask
 	return &selectionListData, nil
 }
 
-func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTaskCoopRequest) (*http_model.PassSecTaskCoopData, error) {
-	_, err := db.PassSecTaskCoop(ctx, request.SelectionId, request.TaskIds, request.EnterpriseId, request.SubAccountId)
+func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTaskCoopRequest) (*http_model.PassSecTaskCoopData, int, error) {
+	tag, err := db.PassSecTaskCoop(ctx, request.SelectionId, request.TaskIds, request.EnterpriseId, request.SubAccountId)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[sectask_service service] call PassCoop error,err:%+v", err)
-		return nil, err
+		if tag == true {
+			return nil, 1, err
+		}
+		return nil, 2, err
 	}
 
 	selectionListData := http_model.PassSecTaskCoopData{}
 
-	return &selectionListData, nil
+	return &selectionListData, 0, nil
 }
 
 func (*selectionTask) RefuseCoop(ctx context.Context, request http_model.RefuseSecTaskCoopRequest) (*http_model.RefuseSecTaskCoopData, error) {

+ 45 - 1
service/sketch.go

@@ -191,12 +191,56 @@ func (*sketch) GetSketchInfo(ctx context.Context, request http_model.GetSketchIn
 		Content:        SketchInfo.Content,
 		SketchPhotos:   SketchPhotos,
 		Agreeat:        SketchInfo.AgreeAt.Format("2006-01-02 15:04:05"),
-		Submitat:       SketchInfo.SubmitAt.Format("2006-01-02 15:04:05"),
+		Submitat:       SketchInfo.CreateAt.Format("2006-01-02 15:04:05"),
 		ReverseOpinion: SketchInfo.ReviseOpinion,
 	}
 	return &SketchInfoData, nil
 }
 
+func (*sketch) GetSketchRecordList(ctx context.Context, request http_model.GetSketchRecordListRequest) (*http_model.GetSketchRecordListResponse, error) {
+	var data []http_model.GetSketchInfoData
+	sketchInfo, err := db.FindAllSketchInfo(ctx, request.TaskID)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch service] call GetSketchRecordList error,err:%+v", err)
+		return nil, err
+	}
+	for _, sketchinfo := range sketchInfo {
+		var SketchPhotos []http_model.SketchPhotoInfo
+		res, err := db.FindPhoto(ctx, int64(sketchinfo.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.SketchPhotoInfo{
+				PhotoUrl: photo.PhotoUrl,
+				PhotoUid: photo.PhotoUid,
+				Symbol:   conv.MustInt64(photo.Symbol),
+			}
+			SketchPhotos = append(SketchPhotos, sketchPhoto)
+		}
+		var reviewat string
+		if sketchinfo.IsOk == 0 {
+			reviewat = sketchinfo.RejectAt.Format("2006-01-02 15:04:05")
+		} else {
+			reviewat = sketchinfo.AgreeAt.Format("2006-01-02 15:04:05")
+		}
+		SketchInfoData := http_model.GetSketchInfoData{
+			Title:          sketchinfo.Title,
+			Content:        sketchinfo.Content,
+			SketchPhotos:   SketchPhotos,
+			Agreeat:        reviewat,
+			Submitat:       sketchinfo.CreateAt.Format("2006-01-02 15:04:05"),
+			ReverseOpinion: sketchinfo.ReviseOpinion,
+		}
+		data = append(data, SketchInfoData)
+	}
+	sketchdata := http_model.GetSketchRecordListResponse{
+		SketchData: data,
+	}
+	return &sketchdata, nil
+}
+
 // AcceptSketch 不同意初稿
 func (*sketch) RejectSketch(ctx context.Context, request http_model.RejectSketchRequest) (*http_model.RejectSketchData, error) {
 	var TaskIDList []string