Procházet zdrojové kódy

新增物流信息

shenzekai před 2 roky
rodič
revize
e1e39a227e

+ 31 - 0
db/logistics.go

@@ -0,0 +1,31 @@
+package db
+
+import (
+	"context"
+	"gorm.io/gorm"
+	"youngee_b_api/model/gorm_model"
+)
+
+//实物邮寄
+func CreateLogistics(ctx context.Context, logistics gorm_model.YoungeeTaskLogistics, RecruitStrategyID int64) (*int64, error) {
+	db := GetReadDB(ctx)
+	err := db.Create(&logistics).Error
+	err1 := db.Model(gorm_model.RecruitStrategy{}).Where("recruit_strategy_id = ?", RecruitStrategyID).Updates(map[string]interface{}{"delivered_number": gorm.Expr("delivered_number + ?", 1), "waiting_number": gorm.Expr("waiting_number - ?", 1)}).Error
+	if err != nil {
+		return nil, err
+	}
+	if err1 != nil {
+		return nil, err1
+	}
+	return &logistics.LogisticsID, nil
+}
+
+//修改接口
+func UpdateLogistics(ctx context.Context, logistics gorm_model.YoungeeTaskLogistics) (*int64, error) {
+	db := GetReadDB(ctx)
+	err := db.Model(&logistics).Updates(logistics).Error
+	if err != nil {
+		return nil, err
+	}
+	return &logistics.LogisticsID, nil
+}

+ 131 - 2
db/project.go

@@ -3,6 +3,7 @@ package db
 import (
 	"context"
 	"fmt"
+	"github.com/issue9/conv"
 	"reflect"
 	"strconv"
 	"youngee_b_api/model/common_model"
@@ -105,8 +106,8 @@ func GetProjectTaskList(ctx context.Context, projectID string, pageSize, pageNum
 	var accountIds []int
 	taskMap := make(map[int]gorm_model.YoungeeTaskInfo)
 	for _, taskInfo := range taskInfos {
-		accountIds = append(accountIds, taskInfo.AccountId)
-		taskMap[taskInfo.AccountId] = taskInfo
+		accountIds = append(accountIds, taskInfo.AccountID)
+		taskMap[taskInfo.AccountID] = taskInfo
 	}
 	db1 := GetReadDB(ctx)
 	db1 = db1.Debug().Model(gorm_model.YoungeePlatformAccountInfo{})
@@ -228,3 +229,131 @@ func ChangeTaskStatus(ctx context.Context, data []string, taskStatus string) err
 	}
 	return nil
 }
+
+func GetProjectTalentList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TaskConditions) ([]*http_model.ProjectTalentInfo, 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 !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.YoungeeTaskLogistics{})
+	// 根据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		database:1,2,3    string
+			db1 = db1.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		}
+	}
+	var logisticsInfos []gorm_model.YoungeeTaskLogistics
+	db1 = db1.Model(gorm_model.YoungeeTaskLogistics{}).Where("task_id IN ?", taskIds).Find(&logisticsInfos)
+	logisticsMap := make(map[int]gorm_model.YoungeeTaskLogistics)
+	for _, logisticsInfo := range logisticsInfos {
+		logisticsMap[conv.MustInt(logisticsInfo.TaskID)] = logisticsInfo
+	}
+	/*
+		db1 := GetReadDB(ctx)
+		db1 = db1.Debug().Model(gorm_model.YoungeePlatformAccountInfo{})
+		// 根据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		database:1,2,3    string
+				db1 = db1.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+			}
+		}
+		var accountInfos []gorm_model.YoungeePlatformAccountInfo
+		db1 = db1.Model(gorm_model.YoungeePlatformAccountInfo{}).Where("account_id IN ?", accountIds).Find(&accountInfos)
+	*/
+	// 查询总数
+	var totalAccount int64
+	if err := db1.Count(&totalAccount).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTalentList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	var misNum int64
+	if totalAccount > totalTask {
+		misNum = totalAccount - totalTask
+	} else {
+		misNum = totalTask - totalAccount
+	}
+	logrus.Println("totalAccount,totalTalent,misNum:", totalAccount, totalTask, misNum)
+
+	// 查询该页数据
+	limit := pageSize + misNum
+	offset := pageSize * pageNum // assert pageNum start with 0
+	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
+	}
+	/*
+		accountMap := make(map[int]gorm_model.YoungeePlatformAccountInfo)
+		for _, accountInfo := range accountInfos {
+			accountMap[accountInfo.AccountID] = accountInfo
+		}
+	*/
+	var talentAccounts []*http_model.TalentAccount
+	var projectTalents []*http_model.ProjectTalentInfo
+	for _, taskId := range taskIds {
+		talentAccount := new(http_model.TalentAccount)
+		_, ok := taskMap[taskId]
+		_, ok2 := logisticsMap[taskId]
+		if ok && ok2 {
+			talentAccount.Talent = taskMap[taskId]
+			talentAccount.Logistics = logisticsMap[taskId]
+		}
+		talentAccounts = append(talentAccounts, talentAccount)
+	}
+
+	projectTalents = pack.TalentAccountToTaskInfo(talentAccounts)
+	var fullProjectTalents []*http_model.ProjectTalentInfo
+	// 删除只存在于一个表中的元素
+	for i := 0; i < len(projectTalents); i++ {
+		if projectTalents[i].TaskID != 0 {
+			fullProjectTalents = append(fullProjectTalents, projectTalents[i])
+		}
+	}
+	var total int64
+	if totalTask > totalAccount {
+		total = totalAccount
+	} else {
+		total = totalTask
+	}
+	return fullProjectTalents, total, nil
+}

+ 13 - 0
db/recruit_strategy.go

@@ -23,6 +23,19 @@ func DeleteRecruitStrategyByProjectID(ctx context.Context, projectID int64) erro
 	return nil
 }
 
+func CalculateSelectedNumberByRecruitStrategyID(ctx context.Context, recruitstrategyID int64, selected_number int64) error {
+	db := GetReadDB(ctx)
+	err := db.Where("recruit_strategy_id = ?", recruitstrategyID).Update("selected_number", selected_number).Error
+	err1 := db.Where("recruit_strategy_id = ?", recruitstrategyID).Update("waiting_number", selected_number).Error
+	if err != nil {
+		return err
+	}
+	if err1 != nil {
+		return err
+	}
+	return nil
+}
+
 //func UpdateProject(ctx context.Context, project gorm_model.ProjectInfo) (*int64, error) {
 //	db := GetReadDB(ctx)
 //	err := db.Model(&project).Updates(project).Error

+ 1 - 0
go.mod

@@ -23,6 +23,7 @@ require (
 	github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2
 	github.com/swaggo/gin-swagger v1.4.1
 	github.com/swaggo/swag v1.8.1
+	github.com/tidwall/gjson v1.14.1 // indirect
 	github.com/ugorji/go v1.2.7 // indirect
 	golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
 	golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3 // indirect

+ 6 - 0
go.sum

@@ -175,6 +175,12 @@ github.com/swaggo/gin-swagger v1.4.1/go.mod h1:hmJ1vPn+XjUvnbzjCdUAxVqgraxELxk8x
 github.com/swaggo/swag v1.7.9/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU=
 github.com/swaggo/swag v1.8.1 h1:JuARzFX1Z1njbCGz+ZytBR15TFJwF2Q7fu8puJHhQYI=
 github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ=
+github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
+github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
+github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
+github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
+github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
+github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
 github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
 github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
 github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=

+ 71 - 0
handler/logistics_create.go

@@ -0,0 +1,71 @@
+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"
+)
+
+func WrapCreateLogisticsHandler(ctx *gin.Context) {
+	handler := newCreateLogisticsHandler(ctx)
+	baseRun(handler)
+}
+
+func newCreateLogisticsHandler(ctx *gin.Context) *CreateLogisticsHandler {
+	return &CreateLogisticsHandler{
+		req:  http_model.NewCreateLogisticsRequest(),
+		resp: http_model.NewCreateLogisticsResponse(),
+		ctx:  ctx,
+	}
+}
+
+type CreateLogisticsHandler struct {
+	req  *http_model.CreateLogisticsRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *CreateLogisticsHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *CreateLogisticsHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *CreateLogisticsHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *CreateLogisticsHandler) run() {
+	data := http_model.CreateLogisticsRequest{}
+	data = *h.req
+	isUpdate := data.IsUpdate
+	if isUpdate == 0 {
+		res, err := service.Logistics.Create(h.ctx, data)
+		if err != nil {
+			logrus.Errorf("[CreateLogisticsHandler] 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("[CreateLogisticsHandler] 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 *CreateLogisticsHandler) checkParam() error {
+	return nil
+}

+ 88 - 0
handler/project_talentlist.go

@@ -0,0 +1,88 @@
+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"
+)
+
+// WrapProjectTaskListHandler
+// @BasePath /youngee/m/
+// SendCode godoc
+// @Summary ProjectTalentList 项目达人列表
+// @Schemes
+// @Description 展示某个项目的已选达人列表
+// @Accept json
+// @Produce json
+// @Param req body http_model.ProjectTaskListRequest true "查询项目的任务列表的请求结构体"
+// @Success 200 {object} http_model.CommonResponse{data=http_model.ProjectTaskListData} "查询项目的任务列表相应结构体"
+// @Router /product/taskList [post]
+func WrapProjectTalentListHandler(ctx *gin.Context) {
+	handler := newProjectTalentListHandler(ctx)
+	baseRun(handler)
+}
+
+func newProjectTalentListHandler(ctx *gin.Context) *ProjectTalentListHandler {
+	return &ProjectTalentListHandler{
+		req:  http_model.NewProjectTalentListRequest(),
+		resp: http_model.NewProjectTalentListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type ProjectTalentListHandler struct {
+	req  *http_model.ProjectTalentListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *ProjectTalentListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *ProjectTalentListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *ProjectTalentListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *ProjectTalentListHandler) run() {
+	conditions := pack.HttpProjectTalentRequestToCondition(h.req)
+	data, err := service.Project.GetProjectTaskList(h.ctx, h.req.ProjectId, h.req.PageSize, h.req.PageNum, conditions)
+	if err != nil {
+		logrus.WithContext(h.ctx).Errorf("[ProjectTalentListHandler] error GetProjectTaskList, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	h.resp.Data = data
+}
+func (h *ProjectTalentListHandler) 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.TaskStatus = util.IsNull(h.req.TaskStatus)
+	if _, err := conv.Int64(h.req.TaskStatus); err != nil {
+		errs = append(errs, err)
+	}
+	if len(errs) != 0 {
+		return fmt.Errorf("check param errs:%+v", errs)
+	}
+	return nil
+}

+ 71 - 0
handler/recruitStrategy_number_calculate.go

@@ -0,0 +1,71 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+
+	"github.com/sirupsen/logrus"
+
+	"github.com/gin-gonic/gin"
+)
+
+// WrapProjectChangeTaskStatusHandler
+// @BasePath /youngee/m/
+// SendCode godoc
+// @Summary ProjectChangeTaskStatus 更改项目任务状态
+// @Schemes
+// @Description  更改项目任务的状态
+// @Accept json
+// @Produce json
+// @Param req body http_model.ProjectChangeTaskStatusRequest true "更改项目任务状态的请求结构体"
+// @Success 200 {object} http_model.CommonResponse{} "更改项目任务状态相应结构体"
+// @Router /product/changeTaskStatus [post]
+func WrapRecruitStrategyNumberCalculate(ctx *gin.Context) {
+	handler := newRecruitStrategyNumberCalculate(ctx)
+	baseRun(handler)
+}
+
+func newRecruitStrategyNumberCalculate(ctx *gin.Context) *RecruitStrategyNumberCalculateHandler {
+	return &RecruitStrategyNumberCalculateHandler{
+		req:  http_model.NewRecruitStrategyNumberCalculateRequst(),
+		resp: http_model.NewRecruitStrategyNumberCalculateResponse(),
+		ctx:  ctx,
+	}
+}
+
+type RecruitStrategyNumberCalculateHandler struct {
+	req  *http_model.RecruitStrategyNumberCalculateRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (p *RecruitStrategyNumberCalculateHandler) getContext() *gin.Context {
+	return p.ctx
+}
+
+func (p *RecruitStrategyNumberCalculateHandler) getResponse() interface{} {
+	return p.resp
+}
+
+func (p *RecruitStrategyNumberCalculateHandler) getRequest() interface{} {
+	return p.req
+}
+
+func (p *RecruitStrategyNumberCalculateHandler) run() {
+	data := http_model.RecruitStrategyNumberCalculateRequest{}
+	data = *p.req
+	err := service.Recruitstrategy.RecruitStrategyNumberCalculate(p.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ChangeTaskStatusHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(p.resp, consts.ErrorInternal, "")
+		logrus.Info("ChangeTaskStatus fail,req:%+v", p.req)
+		return
+	}
+	p.resp.Message = "已选数量变更成功"
+}
+
+func (p *RecruitStrategyNumberCalculateHandler) checkParam() error {
+	return nil
+}

+ 20 - 0
model/gorm_model/logistics.go

@@ -0,0 +1,20 @@
+package gorm_model
+
+
+// Code generated by sql2gorm. DO NOT EDIT.
+import (
+"time"
+)
+
+type YoungeeTaskLogistics struct {
+	LogisticsID           int64       `gorm:"column:logistics_id;primary_key;AUTO_INCREMENT"` // 货物-id
+	CompanyName           string    `gorm:"column:company_name"`                            // 实物商品-物流公司名称
+	LogisticsNumber       string    `gorm:"column:logistics_number"`                        // 实物商品-物流单号
+	ExplorestoreStarttime time.Time `gorm:"column:explorestore_starttime"`                  // 线下探店-探店开始时间
+	ExplorestoreEndtime   time.Time `gorm:"column:explorestore_endtime"`                    // 线下探店-探店结束时间
+	ExplorestorePeriod    string    `gorm:"column:explorestore_period"`                     // 线下探店-探店持续时间
+	CouponCodeInformation string    `gorm:"column:coupon_code_information"`                 // 虚拟产品-券码信息
+	TaskID                int64       `gorm:"column:task_id;NOT NULL"`                        // 任务id
+	DeliveryTime          time.Time `gorm:"column:delivery_time"`                           // 发货时间
+	ThingsType            int       `gorm:"column:things_type;NOT NULL"`                    // 任务类型:1 实物,2:线下探店,3:虚拟产品
+}

+ 24 - 23
model/gorm_model/project_task.go

@@ -2,32 +2,33 @@
 package gorm_model
 
 import (
-	"time"
+"time"
 )
 
 type YoungeeTaskInfo struct {
-	TaskId                 int       `gorm:"column:task_id;type:int(11);primary_key;AUTO_INCREMENT;comment:任务id" json:"task_id"`
-	ProjectId              int       `gorm:"column:project_id;type:int(11);comment:项目id;NOT NULL" json:"project_id"`
-	TalentId               string    `gorm:"column:talent_id;type:varchar(25);comment:达人id;NOT NULL" json:"talent_id"`
-	AccountId              int       `gorm:"column:account_id;type:int(11);comment:账号id;NOT NULL" json:"account_id"`
-	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;type:json;comment:达人平台信息快照;NOT NULL" json:"talent_platform_info_snap"`
-	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;type:json;comment:达人个人信息快照;NOT NULL" json:"talent_personal_info_snap"`
-	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;type:json;comment:收货地址快照;NOT NULL" json:"talent_post_addr_snap"`
-	StrategyId             int       `gorm:"column:strategy_id;type:int(11);comment:报名选择的招募策略id" json:"strategy_id"`
-	TaskReward             float64   `gorm:"column:task_reward;type:float;comment:达人报酬;NOT NULL" json:"task_reward"`
-	SettleAmount           float64   `gorm:"column:settle_amount;type:float;comment:达人实际所得(扣除违约扣款);NOT NULL" json:"settle_amount"`
-	AllPayment             float64   `gorm:"column:all_payment;type:float;comment:企业支付;NOT NULL" json:"all_payment"`
-	RealPayment            float64   `gorm:"column:real_payment;type:float;comment:企业实际支付(扣除违约扣款);NOT NULL" json:"real_payment"`
-	Penalty                int       `gorm:"column:penalty;type:int(11);comment:违约扣款比例,百分之;NOT NULL" json:"penalty"`
-	FeeForm                int       `gorm:"column:fee_form;type:tinyint(4);comment:稿费形式,1,2,3分别代表产品置换、固定稿费、自报价;NOT NULL" json:"fee_form"`
-	ServiceCharge          float64   `gorm:"column:service_charge;type:float;comment:服务费" json:"service_charge"`
-	ServiceRate            int       `gorm:"column:service_rate;type:int(11);comment:服务费率,千分之" json:"service_rate"`
-	TaskStatus             int       `gorm:"column:task_status;type:tinyint(4);default:1;comment:任务状态 1待选 2已选 3落选;NOT NULL" json:"task_status"`
-	TaskStage              int       `gorm:"column:task_stage;type:tinyint(1);comment:任务阶段;NOT NULL" json:"task_stage"`
-	CreateDate             time.Time `gorm:"column:create_date;type:datetime;comment:创建时间;NOT NULL" json:"create_date"`
-	SelectDate             time.Time `gorm:"column:select_date;type:datetime;comment:反选时间" json:"select_date"`
-	CompleteStatus         int       `gorm:"column:complete_status;type:tinyint(1);default:1;comment:结束方式 1未结束 2正常结束 3反选失败 4被解约;NOT NULL" json:"complete_status"`
-	CompleteDate           time.Time `gorm:"column:complete_date;type:datetime;comment:结束时间" json:"complete_date"`
+	TaskID                 int       `gorm:"column:task_id;primary_key;AUTO_INCREMENT"`             // 任务id
+	ProjectID              int       `gorm:"column:project_id;NOT NULL"`                            // 项目id
+	TalentID               string    `gorm:"column:talent_id;NOT NULL"`                             // 达人id
+	AccountID              int       `gorm:"column:account_id;NOT NULL"`                            // 账号id
+	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;NOT NULL"`             // 达人平台信息快照
+	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;NOT NULL"`             // 达人个人信息快照
+	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;NOT NULL"`                 // 收货地址快照
+	StrategyID             int       `gorm:"column:strategy_id"`                                    // 报名选择的招募策略id
+	TaskReward             float64   `gorm:"column:task_reward;NOT NULL"`                           // 达人报酬
+	SettleAmount           float64   `gorm:"column:settle_amount;NOT NULL"`                         // 达人实际所得(扣除违约扣款)
+	AllPayment             float64   `gorm:"column:all_payment;NOT NULL"`                           // 企业支付
+	RealPayment            float64   `gorm:"column:real_payment;NOT NULL"`                          // 企业实际支付(扣除违约扣款)
+	Penalty                int       `gorm:"column:penalty;NOT NULL"`                               // 违约扣款比例,百分之
+	FeeForm                int       `gorm:"column:fee_form;NOT NULL"`                              // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ServiceCharge          float64   `gorm:"column:service_charge"`                                 // 服务费
+	ServiceRate            int       `gorm:"column:service_rate"`                                   // 服务费率,千分之
+	TaskStatus             int       `gorm:"column:task_status;default:1;NOT NULL"`                 // 任务状态 1待选 2已选 3落选
+	TaskStage              int       `gorm:"column:task_stage;NOT NULL"`                            // 任务阶段
+	CreateDate             time.Time `gorm:"column:create_date;default:CURRENT_TIMESTAMP;NOT NULL"` // 创建时间
+	SelectDate             time.Time `gorm:"column:select_date"`                                    // 反选时间
+	CompleteStatus         int       `gorm:"column:complete_status;default:1;NOT NULL"`             // 结束方式 1未结束 2正常结束 3反选失败 4被解约
+	CompleteDate           time.Time `gorm:"column:complete_date"`                                  // 结束时间
+	LogisticsStatus        int       `gorm:"column:logistics_status"`                               // 发货状态 1 待发货 2已发货 3 已签收
 }
 
 func (m *YoungeeTaskInfo) TableName() string {

+ 13 - 9
model/gorm_model/recruit_strategy.go

@@ -1,16 +1,20 @@
 // Code generated by sql2gorm. DO NOT EDIT.
 package gorm_model
 
-
 type RecruitStrategy struct {
-	RecruitStrategyID int64 `gorm:"column:recruit_strategy_id;primary_key"` // 招募策略id
-	FeeForm           int64 `gorm:"column:fee_form"`                        // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
-	StrategyID        int64 `gorm:"column:strategy_id"`                     // 策略id
-	FollowersLow      int64 `gorm:"column:followers_low"`                   // 达人粉丝数下限
-	FollowersUp       int64 `gorm:"column:followers_up"`                    // 达人粉丝数上限
-	RecruitNumber     int64 `gorm:"column:recruit_number"`                  // 招募数量
-	Offer             int64 `gorm:"column:offer"`                           // 报价
-	ProjectID         int64 `gorm:"column:project_id"`                      // 所属项目id
+	RecruitStrategyID int64 `gorm:"column:recruit_strategy_id;primary_key;AUTO_INCREMENT"` // 招募策略id
+	FeeForm           int64 `gorm:"column:fee_form"`                                       // 稿费形式,1-3分别代表产品置换、固定稿费、自报价
+	StrategyID        int64 `gorm:"column:strategy_id"`                                    // 策略id
+	FollowersLow      int64 `gorm:"column:followers_low"`                                  // 达人粉丝数下限
+	FollowersUp       int64 `gorm:"column:followers_up"`                                   // 达人粉丝数上限
+	RecruitNumber     int64 `gorm:"column:recruit_number"`                                 // 招募数量
+	Offer             int64 `gorm:"column:offer"`                                          // 报价
+	ProjectID         int64 `gorm:"column:project_id"`                                     // 所属项目id
+	ServiceCharge     int64 `gorm:"column:service_charge"`                                 // 平台服务费,稿费形式为产品置换时必填
+	SelectedNumber    int64 `gorm:"column:selected_number"`                                // 已选数量,被企业选择的达人数量 应发货
+	WaitingNumber     int64 `gorm:"column:waiting_number"`                                 // 待发货
+	DeliveredNumber   int64 `gorm:"column:delivered_number"`                               // 已发货
+	SignedNumber      int64 `gorm:"column:signed_number"`                                  // 已签收
 }
 
 func (m *RecruitStrategy) TableName() string {

+ 31 - 0
model/http_model/logistics_create.go

@@ -0,0 +1,31 @@
+package http_model
+
+import "time"
+
+type CreateLogisticsRequest struct {
+	RecruitStrategyID     int64     `json:"recruit_strategy_id"`     //招募策略id
+	LogisticsID           int64     `json:"logistics_id"`            // 货物-id
+	CompanyName           string    `json:"company_name"`            // 实物商品-物流公司名称
+	LogisticsNumber       string    `json:"logistics_number"`        // 实物商品-物流单号
+	ExplorestoreStarttime time.Time `json:"explorestore_starttime"`  // 线下探店-探店开始时间
+	ExplorestoreEndtime   time.Time `json:"explorestore_endtime"`    // 线下探店-探店结束时间
+	ExplorestorePeriod    string    `json:"explorestore_period"`     // 线下探店-探店持续时间
+	CouponCodeInformation string    `json:"coupon_code_information"` // 虚拟产品-券码信息
+	TaskID                int64     `json:"task_id"`                 // 任务id
+	DeliveryTime          time.Time `json:"delivery_time"`           // 发货时间
+	ThingsType            int       `json:"things_type"`             //产品类型 1:实物, 2:线下探店,3:虚拟产品
+	IsUpdate              int       `json:"is_update"`               //更新标志位 0:不更新 1:更新
+}
+
+type CreateLogisticsData struct {
+	LogisticsID int64 `json:"logisitcs_id"` // 商品id
+}
+
+func NewCreateLogisticsRequest() *CreateLogisticsRequest {
+	return new(CreateLogisticsRequest)
+}
+func NewCreateLogisticsResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(CreateLogisticsData)
+	return resp
+}

+ 1 - 0
model/http_model/project_create.go

@@ -29,6 +29,7 @@ type CreateProjectRequest struct {
 	RecruitStrategys []CreateRecruitStrategy `json:"recruit_strategys"` // 定价策略
 	ProjectPhotos    []CreateProjectPhoto    `json:"project_photos"`    // 项目图片
 	ProductID        int64                   `json:"product_id"`        // 关联商品id
+
 }
 
 type CreateProjectData struct {

+ 61 - 0
model/http_model/project_talentlist.go

@@ -0,0 +1,61 @@
+package http_model
+
+import (
+	"time"
+	"youngee_b_api/model/gorm_model"
+)
+
+type ProjectTalentListRequest 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
+	TaskStatus       string `json:"task_status"`       // 任务状态
+	PlatformNickname string `json:"platform_nickname"` // 账号昵称
+}
+
+type ProjectTalentPreview struct {
+	TaskID             string `json:"task_id"`             // 任务ID
+	PlatformNickname   string `json:"platform_nickname"`   // 账号昵称
+	FansCount          string `json:"fans_count"`          // 粉丝数
+	StrategyID         string `json:"strategy_id"`         // 报名选择的招募策略id
+	DetailAddr         string `json:"detail_addr"`         // 物流信息
+	CompanyName        string `json:"company_name"`        // 物流公司
+	LogisticsNumber    string `json:"logistics_number"`    // 物流单号
+	DeliveryTime       string `json:"delivery_time"`       // 发货时间
+	ExplorestorePeriod string `json:"explorestore_period"` // 线下探店-探店持续时间
+}
+
+type ProjectTalentInfo struct {
+	TaskID             int       `json:"task_id"`             // 任务ID
+	PlatformNickname   string    `json:"platform_nickname"`   // 账号昵称
+	FansCount          string    `json:"fans_count"`          // 粉丝数
+	StrategyID         int       `json:"strategy_id"`         // 报名选择的招募策略id
+	DetailAddr         string    `json:"detail_addr"`         // 物流信息
+	CompanyName        string    `json:"company_name"`        // 物流公司
+	LogisticsNumber    string    `json:"logistics_number"`    // 物流单号
+	DeliveryTime       time.Time `json:"delivery_time"`       // 发货时间
+	ExplorestorePeriod string    `json:"explorestore_period"` // 线下探店-探店持续时间
+}
+
+type TalentAccount struct {
+	Talent    gorm_model.YoungeeTaskInfo
+	Logistics gorm_model.YoungeeTaskLogistics
+	//Account   gorm_model.YoungeePlatformAccountInfo
+}
+
+type ProjectTalentListData struct {
+	ProjectTalentPreview []*ProjectTalentPreview `json:"project_talent_pre_view"`
+	Total                string                  `json:"total"`
+}
+
+func NewProjectTalentListRequest() *ProjectTalentListRequest {
+	return new(ProjectTalentListRequest)
+}
+
+func NewProjectTalentListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectTaskListData)
+	return resp
+}

+ 21 - 0
model/http_model/recruitstrategy_number_calculate.go

@@ -0,0 +1,21 @@
+package http_model
+
+type RecruitStrategyNumberCalculateRequest struct {
+	RecruitStrategyID int64 `json:"recruitStrategy_id"`
+	SelectedNumber    int64 `json:"selected_number"`
+	AddSub            bool  `json:"add_sub"`
+}
+
+func NewRecruitStrategyNumberCalculateRequst() *RecruitStrategyNumberCalculateRequest {
+	return new(RecruitStrategyNumberCalculateRequest)
+}
+
+type RecruitStrategyNumberCalculateData struct {
+	RecruitStrategyID int64 `json:"recruitStrategy_id"`
+}
+
+func NewRecruitStrategyNumberCalculateResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RecruitStrategyNumberCalculateData)
+	return resp
+}

+ 0 - 7
pack/Project_Deatil.go

@@ -1,7 +0,0 @@
-package pack
-
-//func MGormProjectDeatilToHttpProjectDeatilPreview(gormProjectDeatil *gorm_model.ProjectInfo) *http_model.ShowProjectData {
-//	var httpProjectDetail *http_model.ShowProjectData
-//	httpProjectDetail=
-//	return httpProjectDetail
-//}

+ 58 - 0
pack/project._talent_list.go

@@ -0,0 +1,58 @@
+package pack
+
+import (
+	"github.com/tidwall/gjson"
+	"youngee_b_api/model/http_model"
+
+	"github.com/issue9/conv"
+)
+
+func MGormProjectTalentToHttpProjectTaskPreview(gormProjectTalentInfos []*http_model.ProjectTalentInfo) []*http_model.ProjectTalentPreview {
+	var httpProjectPreviews []*http_model.ProjectTalentPreview
+	for _, gormProjectTalentInfo := range gormProjectTalentInfos {
+		httpProjectTalentPreview := GormFullProjectToHttpProjectTalentPreview(gormProjectTalentInfo)
+		httpProjectPreviews = append(httpProjectPreviews, httpProjectTalentPreview)
+	}
+	return httpProjectPreviews
+}
+
+func GormFullProjectToHttpProjectTalentPreview(projectTalentInfo *http_model.ProjectTalentInfo) *http_model.ProjectTalentPreview {
+	deliveryTime := conv.MustString(projectTalentInfo.DeliveryTime)
+	deliveryTime = deliveryTime[0:19]
+	return &http_model.ProjectTalentPreview{
+		TaskID:             conv.MustString(projectTalentInfo.TaskID),
+		PlatformNickname:   conv.MustString(projectTalentInfo.PlatformNickname),
+		FansCount:          conv.MustString(projectTalentInfo.FansCount),
+		StrategyID:         conv.MustString(projectTalentInfo.StrategyID),
+		DetailAddr:         conv.MustString(projectTalentInfo.DetailAddr),
+		CompanyName:        conv.MustString(projectTalentInfo.CompanyName),
+		LogisticsNumber:    conv.MustString(projectTalentInfo.LogisticsNumber),
+		DeliveryTime:       deliveryTime,
+		ExplorestorePeriod: conv.MustString(projectTalentInfo.ExplorestorePeriod),
+	}
+}
+
+func TalentAccountToTaskInfo(talentAccounts []*http_model.TalentAccount) []*http_model.ProjectTalentInfo {
+	var projectTalents []*http_model.ProjectTalentInfo
+	for _, talentAccount := range talentAccounts {
+		projectTalent := GetTalentInfoStruct(talentAccount)
+		projectTalents = append(projectTalents, projectTalent)
+	}
+	return projectTalents
+}
+
+func GetTalentInfoStruct(talentAccount *http_model.TalentAccount) *http_model.ProjectTalentInfo {
+	TalentPlatformInfoSnap := talentAccount.Talent.TalentPlatformInfoSnap
+	TalentPostAddrSnap := talentAccount.Talent.TalentPostAddrSnap
+	return &http_model.ProjectTalentInfo{
+		TaskID:             talentAccount.Talent.TaskID,
+		PlatformNickname:   conv.MustString(gjson.Get(TalentPlatformInfoSnap, "PlatformInfo.platform_name")),
+		FansCount:          conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count")),
+		StrategyID:         talentAccount.Talent.StrategyID,
+		DetailAddr:         conv.MustString(gjson.Get(TalentPostAddrSnap, "detail_addr")),
+		CompanyName:        talentAccount.Logistics.CompanyName,
+		LogisticsNumber:    talentAccount.Logistics.LogisticsNumber,
+		DeliveryTime:       talentAccount.Logistics.DeliveryTime,
+		ExplorestorePeriod: talentAccount.Logistics.ExplorestorePeriod,
+	}
+}

+ 18 - 0
pack/project_talentlist_conditions.go

@@ -0,0 +1,18 @@
+package pack
+
+import (
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/http_model"
+
+	"github.com/issue9/conv"
+)
+
+func HttpProjectTalentRequestToCondition(req *http_model.ProjectTalentListRequest) *common_model.TaskConditions {
+	return &common_model.TaskConditions{
+		ProjectId:        conv.MustInt64(req.ProjectId),
+		TaskStatus:       conv.MustInt64(req.TaskStatus),
+		StrategyId:       conv.MustInt64(req.StrategyId),
+		TaskId:           conv.MustString(req.TaskId),
+		PlatformNickname: conv.MustString(req.PlatformNickname),
+	}
+}

+ 4 - 2
pack/project_task_list.go

@@ -1,6 +1,7 @@
 package pack
 
 import (
+	"fmt"
 	"youngee_b_api/model/http_model"
 
 	"github.com/issue9/conv"
@@ -41,8 +42,9 @@ func TaskAccountToTaskInfo(taskAccounts []*http_model.TaskAccount) []*http_model
 }
 
 func GetTaskInfoStruct(taskAccount *http_model.TaskAccount) *http_model.ProjectTaskInfo {
+	fmt.Printf("任务-账户关联 %+v", taskAccount)
 	return &http_model.ProjectTaskInfo{
-		TaskID:             taskAccount.Task.TaskId,
+		TaskID:             taskAccount.Task.TaskID,
 		TaskReward:         taskAccount.Task.TaskReward,
 		PlatformNickname:   taskAccount.Account.PlatformNickname,
 		CreateDate:         taskAccount.Task.CreateDate,
@@ -50,6 +52,6 @@ func GetTaskInfoStruct(taskAccount *http_model.TaskAccount) *http_model.ProjectT
 		HomePageCaptureUrl: taskAccount.Account.HomePageCaptureUrl,
 		FansCount:          taskAccount.Account.FansCount,
 		TaskStatus:         string(rune(taskAccount.Task.TaskStatus)),
-		StrategyID:         taskAccount.Task.StrategyId,
+		StrategyID:         taskAccount.Task.StrategyID,
 	}
 }

+ 3 - 1
route/init.go

@@ -54,7 +54,9 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/project/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler)
 		m.POST("/pay/paysum", handler.WrapPaySumHandler)
 		m.POST("/enterprise/balance", handler.WrapEnterpriseBalanceHandler)
-
+		m.POST("/project/recruitstrategycalculate", handler.WrapRecruitStrategyNumberCalculate)
+		m.POST("/project/talentList", handler.WrapProjectTalentListHandler)
+		m.POST("/project/createlogistics", handler.WrapCreateLogisticsHandler)
 	}
 
 }

+ 70 - 0
service/logistics.go

@@ -0,0 +1,70 @@
+package service
+
+import (
+	"context"
+	"youngee_b_api/db"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+)
+
+var Logistics *logistics
+
+type logistics struct {
+}
+
+func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogisticsRequest) (*http_model.CreateLogisticsData, error) {
+	ThingsType := newLogistics.ThingsType
+	RecruitStrategyID := newLogistics.RecruitStrategyID
+	Logistics := gorm_model.YoungeeTaskLogistics{
+		LogisticsID: newLogistics.LogisticsID,
+		TaskID:      newLogistics.TaskID,
+		ThingsType:  ThingsType,
+	}
+	//实物
+	if ThingsType == 1 {
+		Logistics.CompanyName = newLogistics.CompanyName
+		Logistics.DeliveryTime = newLogistics.DeliveryTime
+	} else if ThingsType == 2 {
+		Logistics.ExplorestoreStarttime = newLogistics.ExplorestoreStarttime
+		Logistics.ExplorestoreEndtime = newLogistics.ExplorestoreEndtime
+		Logistics.ExplorestorePeriod = newLogistics.ExplorestorePeriod
+	} else {
+		Logistics.CouponCodeInformation = newLogistics.CouponCodeInformation
+	}
+	logisticsID, err := db.CreateLogistics(ctx, Logistics, RecruitStrategyID)
+	if err != nil {
+		return nil, err
+	}
+	res := &http_model.CreateLogisticsData{
+		LogisticsID: *logisticsID,
+	}
+	return res, nil
+}
+
+func (*logistics) Update(ctx context.Context, newLogistics http_model.CreateLogisticsRequest) (*http_model.CreateLogisticsData, error) {
+	ThingsType := newLogistics.ThingsType
+	Logistics := gorm_model.YoungeeTaskLogistics{
+		LogisticsID: newLogistics.LogisticsID,
+		TaskID:      newLogistics.TaskID,
+		ThingsType:  ThingsType,
+	}
+	//实物
+	if ThingsType == 1 {
+		Logistics.CompanyName = newLogistics.CompanyName
+		Logistics.DeliveryTime = newLogistics.DeliveryTime
+	} else if ThingsType == 2 {
+		Logistics.ExplorestoreStarttime = newLogistics.ExplorestoreStarttime
+		Logistics.ExplorestoreEndtime = newLogistics.ExplorestoreEndtime
+		Logistics.ExplorestorePeriod = newLogistics.ExplorestorePeriod
+	} else {
+		Logistics.CouponCodeInformation = newLogistics.CouponCodeInformation
+	}
+	logisticsID, err := db.UpdateLogistics(ctx, Logistics)
+	if err != nil {
+		return nil, err
+	}
+	res := &http_model.CreateLogisticsData{
+		LogisticsID: *logisticsID,
+	}
+	return res, nil
+}

+ 1 - 1
service/pay.go

@@ -28,7 +28,7 @@ func (*pay) GetPaysum(ctx context.Context, project http_model.PaySumRequest) (*h
 	PaySum := http_model.PaySumResponce{}
 	if tasks != nil {
 		for _, task := range tasks {
-			payMap[task.StrategyId] += task.AllPayment
+			payMap[task.StrategyID] += task.AllPayment
 		}
 		for k, v := range payMap {
 			ps := http_model.PaySum{k, v}

+ 15 - 4
service/project.go

@@ -3,6 +3,7 @@ package service
 import (
 	"context"
 	"fmt"
+	"github.com/gin-gonic/gin"
 	"strconv"
 	"strings"
 	"youngee_b_api/db"
@@ -11,8 +12,6 @@ import (
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/pack"
 
-	"github.com/gin-gonic/gin"
-
 	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 )
@@ -110,7 +109,7 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
 		ProjectDetail: newProject.ProjectDetail,
 		ProjectForm:   conv.MustInt64(newProject.ProjectForm),
 		EnterpriseID:  enterpriseID,
-		ProjectStatus: 2,
+		ProjectStatus: 4,
 	}
 	projectID, err := db.UpdateProject(ctx, project)
 	if err != nil {
@@ -143,7 +142,7 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
 	if err != nil {
 		return nil, err
 	}
-	fmt.Printf("策略:\t %+v", newProject.RecruitStrategys)
+	//fmt.Printf("策略:\t %+v", newProject.RecruitStrategys)
 	if newProject.RecruitStrategys != nil {
 		// 新增策略
 		RecruitStrategys := []gorm_model.RecruitStrategy{}
@@ -264,6 +263,18 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_mo
 	return &ProjectDetail, nil
 }
 
+func (*project) GetProjectTalentList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TaskConditions) (*http_model.ProjectTalentListData, error) {
+	projectTalents, total, err := db.GetProjectTalentList(ctx, projectID, pageSize, pageNum, conditions)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[project service] call GetProjectTalentList error,err:%+v", err)
+		return nil, err
+	}
+	projectTalentListData := new(http_model.ProjectTalentListData)
+	projectTalentListData.ProjectTalentPreview = pack.MGormProjectTalentToHttpProjectTaskPreview(projectTalents)
+	projectTalentListData.Total = conv.MustString(total)
+	return projectTalentListData, nil
+}
+
 func (*project) ChangeTaskStatus(ctx *gin.Context, data http_model.ProjectChangeTaskStatusRequest) interface{} {
 	err := db.ChangeTaskStatus(ctx, data.TaskIds, data.TaskStatus)
 	if err != nil {

+ 29 - 0
service/recruitstrategy.go

@@ -0,0 +1,29 @@
+package service
+
+import (
+	"context"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/db"
+	"youngee_b_api/model/http_model"
+)
+
+var Recruitstrategy *recruitstrategy
+
+type recruitstrategy struct {
+}
+
+func (*recruitstrategy) RecruitStrategyNumberCalculate(ctx context.Context, recruitstrategy http_model.RecruitStrategyNumberCalculateRequest) error {
+	AddSub := recruitstrategy.AddSub
+	selected_number := recruitstrategy.SelectedNumber
+	if AddSub {
+		selected_number += 1
+	} else {
+		selected_number -= 1
+	}
+	err := db.CalculateSelectedNumberByRecruitStrategyID(ctx, recruitstrategy.RecruitStrategyID, selected_number)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[RecruitStrategy] call RecruitStrategyNumberCalculate error,err:%+v", err)
+		return err
+	}
+	return nil
+}