|
@@ -7,6 +7,7 @@ import (
|
|
|
"youngmini_server/app/dao"
|
|
|
"youngmini_server/app/model"
|
|
|
"youngmini_server/app/model/youngee_talent_model"
|
|
|
+ "youngmini_server/app/service/youngee_talent_service"
|
|
|
"youngmini_server/app/utils"
|
|
|
|
|
|
"github.com/gogf/gf/database/gdb"
|
|
@@ -17,204 +18,204 @@ import (
|
|
|
)
|
|
|
|
|
|
// 新建任务service
|
|
|
-func SignUpTask(r *ghttp.Request) *TalentHttpResult {
|
|
|
- tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
- }
|
|
|
-
|
|
|
- var signTaskInfo *youngee_talent_model.SignTaskInfo
|
|
|
- err = r.ParseForm(&signTaskInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -2, Msg: "data query failed"}
|
|
|
- }
|
|
|
- var projectDetail *youngee_talent_model.ProjectDetail
|
|
|
- err = g.DB().Model(youngee_talent_model.ProjectDetail{}).WithAll().Where("project_id", signTaskInfo.ProjectId).Scan(&projectDetail)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -3, Msg: err.Error()}
|
|
|
- }
|
|
|
-
|
|
|
- var talentInfo *youngee_talent_model.TalentInfo
|
|
|
- err = g.DB().Model("youngee_talent_info").WithAll().Where("id", tid).Scan(&talentInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -4, Msg: "Get talent info failed"}
|
|
|
- }
|
|
|
-
|
|
|
- var accountInfo *youngee_talent_model.PlatformAccountInfo
|
|
|
- err = g.DB().Model("youngee_platform_account_info").WithAll().Where("talent_id = ? and platform_id = ?", tid, projectDetail.ProjectPlatform).Scan(&accountInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -5, Msg: err.Error()}
|
|
|
- }
|
|
|
-
|
|
|
- address, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).One("talent_id = ? and address_id = ?", tid, signTaskInfo.AddressId)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -6, Msg: err.Error()}
|
|
|
- }
|
|
|
-
|
|
|
- var newTaskId string
|
|
|
- // 首先生成任务id
|
|
|
- newTaskId = utils.GetUuid.GetTaskId(projectDetail.ProjectId, projectDetail.EnterpriseId, tid)
|
|
|
-
|
|
|
- // 生成达人平台账号信息快照
|
|
|
- accountSnap, err := gjson.Encode(accountInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -7, Msg: "encode platform snap failed"}
|
|
|
- }
|
|
|
-
|
|
|
- // 生成达人信息快照
|
|
|
- talentSnap, err := gjson.Encode(talentInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -8, Msg: "encode talent info snap failed"}
|
|
|
- }
|
|
|
-
|
|
|
- // 生成收货地址快照
|
|
|
- addrSnap, err := gjson.Encode(address)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
|
- }
|
|
|
- taskInfo := model.YoungeeTaskInfo{}
|
|
|
- if projectDetail.ProjectType == 1 {
|
|
|
- // 全流程任务
|
|
|
-
|
|
|
- // 计算平台服务费
|
|
|
- // 1. 先获取稿费形式
|
|
|
- var strategy *youngee_talent_model.RecruitStrategy
|
|
|
- err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
- }
|
|
|
-
|
|
|
- // 2. 根据稿费形式、平台、粉丝数获取服务费最高的定价策略
|
|
|
- // 2.1 查询所有对应定价策略
|
|
|
- whereStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up > %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersLow)
|
|
|
- orStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low < %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersUp, strategy.FollowersUp)
|
|
|
- orStr2 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low >= %d and fans_up <= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
|
|
|
- orStr3 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
|
|
|
- var pricings []*model.InfoPricingStrategy
|
|
|
- err = g.DB().Model("info_pricing_strategy").WithAll().Where(whereStr1).Or(orStr1).Or(orStr2).Or(orStr3).Scan(&pricings)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -11, Msg: err.Error()}
|
|
|
- } else if pricings == nil {
|
|
|
- return &TalentHttpResult{Code: -12, Msg: "无相关定价策略"}
|
|
|
- }
|
|
|
- var pricing *model.InfoPricingStrategy
|
|
|
- // 2.2 从对应定价策略中选取服务费率最高
|
|
|
- if strategy.FeeForm == 1 {
|
|
|
- var maxCharge float64 = 0
|
|
|
- for _, v := range pricings {
|
|
|
- if v.ServiceCharge >= maxCharge {
|
|
|
- maxCharge = v.ServiceCharge
|
|
|
- pricing = v
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- var maxRate int = 0
|
|
|
- for _, v := range pricings {
|
|
|
- if v.ServiceRate >= maxRate {
|
|
|
- maxRate = v.ServiceRate
|
|
|
- pricing = v
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- var serviceCharge = 0.0
|
|
|
- var serviceRate = 0
|
|
|
- var allReward = 0.0
|
|
|
- var allPayment = 0.0
|
|
|
- switch strategy.FeeForm {
|
|
|
- case 1: // 产品置换,服务费固定,在项目生成时确定
|
|
|
- serviceCharge = float64(strategy.ServiceCharge)
|
|
|
- allPayment = serviceCharge
|
|
|
- break
|
|
|
- case 2: // 固定稿费,m2 = y2 * r2
|
|
|
- allPayment = float64(strategy.Offer)
|
|
|
- serviceRate = pricing.ServiceRate
|
|
|
- serviceCharge = allPayment * float64(serviceRate) / 1000
|
|
|
- allReward = allPayment - serviceCharge
|
|
|
- break
|
|
|
- case 3: // 自报价,m3 = x3 * r3
|
|
|
- allReward = float64(signTaskInfo.Offer)
|
|
|
- serviceRate = pricing.ServiceRate
|
|
|
- var tmpRate = float64(1000-serviceRate) / 1000
|
|
|
- allPayment = allReward / tmpRate
|
|
|
- serviceCharge = allPayment - allReward
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
- taskInfo = model.YoungeeTaskInfo{
|
|
|
- TaskId: newTaskId,
|
|
|
- ProjectId: signTaskInfo.ProjectId,
|
|
|
- TalentId: tid,
|
|
|
- AccountId: accountInfo.AccountId,
|
|
|
- TalentPlatformInfoSnap: string(accountSnap),
|
|
|
- TalentPersonalInfoSnap: string(talentSnap),
|
|
|
- TalentPostAddrSnap: string(addrSnap),
|
|
|
- StrategyId: signTaskInfo.StrategyId,
|
|
|
- TaskReward: allReward,
|
|
|
- SettleAmount: allReward,
|
|
|
- AllPayment: allPayment,
|
|
|
- TaskStage: 1,
|
|
|
- RealPayment: allPayment,
|
|
|
- FeeForm: strategy.FeeForm,
|
|
|
- ServiceCharge: serviceCharge,
|
|
|
- ServiceRate: serviceRate,
|
|
|
- CreateDate: gtime.Now(),
|
|
|
- TaskStatus: 1,
|
|
|
- LogisticsStatus: 1,
|
|
|
- LinkStatus: 1,
|
|
|
- DataStatus: 1,
|
|
|
- ScriptStatus: 1,
|
|
|
- SketchStatus: 1,
|
|
|
- CompleteStatus: 1,
|
|
|
- CurDefaultType: 0,
|
|
|
- WithdrawStatus: 1,
|
|
|
- SettleStatus: 1,
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 专项任务
|
|
|
- taskInfo = model.YoungeeTaskInfo{
|
|
|
- TaskId: newTaskId,
|
|
|
- ProjectId: signTaskInfo.ProjectId,
|
|
|
- TalentId: tid,
|
|
|
- AccountId: accountInfo.AccountId,
|
|
|
- TalentPlatformInfoSnap: string(accountSnap),
|
|
|
- TalentPersonalInfoSnap: string(talentSnap),
|
|
|
- TalentPostAddrSnap: string(addrSnap),
|
|
|
- TaskStage: 1,
|
|
|
- CreateDate: gtime.Now(),
|
|
|
- TaskStatus: 1,
|
|
|
- LogisticsStatus: 1,
|
|
|
- LinkStatus: 1,
|
|
|
- DataStatus: 1,
|
|
|
- ScriptStatus: 1,
|
|
|
- SketchStatus: 1,
|
|
|
- CompleteStatus: 1,
|
|
|
- CurDefaultType: 0,
|
|
|
- WithdrawStatus: 1,
|
|
|
- }
|
|
|
- }
|
|
|
- err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
- // 在task_info表中插入任务
|
|
|
- _, err = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(&taskInfo).Insert()
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
-
|
|
|
- // 对应项目的报名人数自增
|
|
|
- _, err = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.ProjectId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- }
|
|
|
- return nil
|
|
|
- })
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
|
|
|
- }
|
|
|
-
|
|
|
- return &TalentHttpResult{Code: 0, Msg: "success", Data: newTaskId}
|
|
|
-}
|
|
|
-
|
|
|
-// 判断是否已报名任务
|
|
|
+//func SignUpTask(r *ghttp.Request) *TalentHttpResult {
|
|
|
+// tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// var signTaskInfo *youngee_talent_model.SignTaskInfo
|
|
|
+// err = r.ParseForm(&signTaskInfo)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -2, Msg: "data query failed"}
|
|
|
+// }
|
|
|
+// var projectDetail *youngee_talent_model.ProjectDetail
|
|
|
+// err = g.DB().Model(youngee_talent_model.ProjectDetail{}).WithAll().Where("project_id", signTaskInfo.ProjectId).Scan(&projectDetail)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -3, Msg: err.Error()}
|
|
|
+// }
|
|
|
+//
|
|
|
+// var talentInfo *youngee_talent_model.TalentInfo
|
|
|
+// err = g.DB().Model("youngee_talent_info").WithAll().Where("id", tid).Scan(&talentInfo)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -4, Msg: "Get talent info failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// var accountInfo *youngee_talent_model.PlatformAccountInfo
|
|
|
+// err = g.DB().Model("youngee_platform_account_info").WithAll().Where("talent_id = ? and platform_id = ?", tid, projectDetail.ProjectPlatform).Scan(&accountInfo)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -5, Msg: err.Error()}
|
|
|
+// }
|
|
|
+//
|
|
|
+// address, err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).One("talent_id = ? and address_id = ?", tid, signTaskInfo.AddressId)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -6, Msg: err.Error()}
|
|
|
+// }
|
|
|
+//
|
|
|
+// var newTaskId string
|
|
|
+// // 首先生成任务id
|
|
|
+// newTaskId = utils.GetUuid.GetTaskId(projectDetail.ProjectId, projectDetail.EnterpriseId, tid)
|
|
|
+//
|
|
|
+// //// 生成达人平台账号信息快照
|
|
|
+// accountSnap, err := gjson.Encode(accountInfo)
|
|
|
+// //if err != nil {
|
|
|
+// // return &TalentHttpResult{Code: -7, Msg: "encode platform snap failed"}
|
|
|
+// //}
|
|
|
+//
|
|
|
+// // 生成达人信息快照
|
|
|
+// talentSnap, err := gjson.Encode(talentInfo)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -8, Msg: "encode talent info snap failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 生成收货地址快照
|
|
|
+// addrSnap, err := gjson.Encode(address)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
|
+// }
|
|
|
+// taskInfo := model.YoungeeTaskInfo{}
|
|
|
+// if projectDetail.ProjectType == 1 {
|
|
|
+// // 全流程任务
|
|
|
+//
|
|
|
+// // 计算平台服务费
|
|
|
+// // 1. 先获取稿费形式
|
|
|
+// var strategy *youngee_talent_model.RecruitStrategy
|
|
|
+// err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 2. 根据稿费形式、平台、粉丝数获取服务费最高的定价策略
|
|
|
+// // 2.1 查询所有对应定价策略
|
|
|
+// whereStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up > %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersLow)
|
|
|
+// orStr1 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low < %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersUp, strategy.FollowersUp)
|
|
|
+// orStr2 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low >= %d and fans_up <= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
|
|
|
+// orStr3 := fmt.Sprintf("fee_form = %d and platform = %d and fans_low <= %d and fans_up >= %d", strategy.FeeForm, projectDetail.ProjectPlatform, strategy.FollowersLow, strategy.FollowersUp)
|
|
|
+// var pricings []*model.InfoPricingStrategy
|
|
|
+// err = g.DB().Model("recruit_strategy").WithAll().Where(whereStr1).Or(orStr1).Or(orStr2).Or(orStr3).Scan(&pricings)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -11, Msg: err.Error()}
|
|
|
+// } else if pricings == nil {
|
|
|
+// return &TalentHttpResult{Code: -12, Msg: "无相关定价策略"}
|
|
|
+// }
|
|
|
+// var pricing *model.InfoPricingStrategy
|
|
|
+// // 2.2 从对应定价策略中选取服务费率最高
|
|
|
+// if strategy.FeeForm == 1 {
|
|
|
+// var maxCharge float64 = 0
|
|
|
+// for _, v := range pricings {
|
|
|
+// if v.ServiceCharge >= maxCharge {
|
|
|
+// maxCharge = v.ServiceCharge
|
|
|
+// pricing = v
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// var maxRate int = 0
|
|
|
+// for _, v := range pricings {
|
|
|
+// if v.ServiceRate >= maxRate {
|
|
|
+// maxRate = v.ServiceRate
|
|
|
+// pricing = v
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// var serviceCharge = 0.0
|
|
|
+// var serviceRate = 0
|
|
|
+// var allReward = 0.0
|
|
|
+// var allPayment = 0.0
|
|
|
+// switch strategy.FeeForm {
|
|
|
+// case 1: // 产品置换,服务费固定,在项目生成时确定
|
|
|
+// serviceCharge = float64(strategy.ServiceCharge)
|
|
|
+// allPayment = serviceCharge
|
|
|
+// break
|
|
|
+// case 2: // 固定稿费,m2 = y2 * r2
|
|
|
+// allPayment = float64(strategy.Offer)
|
|
|
+// serviceRate = pricing.ServiceRate
|
|
|
+// serviceCharge = allPayment * float64(serviceRate) / 1000
|
|
|
+// allReward = allPayment - serviceCharge
|
|
|
+// break
|
|
|
+// case 3: // 自报价,m3 = x3 * r3
|
|
|
+// allReward = float64(signTaskInfo.Offer)
|
|
|
+// serviceRate = pricing.ServiceRate
|
|
|
+// var tmpRate = float64(1000-serviceRate) / 1000
|
|
|
+// allPayment = allReward / tmpRate
|
|
|
+// serviceCharge = allPayment - allReward
|
|
|
+// break
|
|
|
+// default:
|
|
|
+// break
|
|
|
+// }
|
|
|
+// taskInfo = model.YoungeeTaskInfo{
|
|
|
+// TaskId: newTaskId,
|
|
|
+// ProjectId: signTaskInfo.ProjectId,
|
|
|
+// TalentId: tid,
|
|
|
+// AccountId: accountInfo.AccountId,
|
|
|
+// TalentPlatformInfoSnap: string(accountSnap),
|
|
|
+// TalentPersonalInfoSnap: string(talentSnap),
|
|
|
+// TalentPostAddrSnap: string(addrSnap),
|
|
|
+// StrategyId: signTaskInfo.StrategyId,
|
|
|
+// TaskReward: allReward,
|
|
|
+// SettleAmount: allReward,
|
|
|
+// AllPayment: allPayment,
|
|
|
+// TaskStage: 1,
|
|
|
+// RealPayment: allPayment,
|
|
|
+// FeeForm: strategy.FeeForm,
|
|
|
+// ServiceCharge: serviceCharge,
|
|
|
+// ServiceRate: serviceRate,
|
|
|
+// CreateDate: gtime.Now(),
|
|
|
+// TaskStatus: 1,
|
|
|
+// LogisticsStatus: 1,
|
|
|
+// LinkStatus: 1,
|
|
|
+// DataStatus: 1,
|
|
|
+// ScriptStatus: 1,
|
|
|
+// SketchStatus: 1,
|
|
|
+// CompleteStatus: 1,
|
|
|
+// CurDefaultType: 0,
|
|
|
+// WithdrawStatus: 1,
|
|
|
+// SettleStatus: 1,
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// // 专项任务
|
|
|
+// taskInfo = model.YoungeeTaskInfo{
|
|
|
+// TaskId: newTaskId,
|
|
|
+// ProjectId: signTaskInfo.ProjectId,
|
|
|
+// TalentId: tid,
|
|
|
+// AccountId: accountInfo.AccountId,
|
|
|
+// //TalentPlatformInfoSnap: string(accountSnap),
|
|
|
+// TalentPersonalInfoSnap: string(talentSnap),
|
|
|
+// TalentPostAddrSnap: string(addrSnap),
|
|
|
+// TaskStage: 1,
|
|
|
+// CreateDate: gtime.Now(),
|
|
|
+// TaskStatus: 1,
|
|
|
+// LogisticsStatus: 1,
|
|
|
+// LinkStatus: 1,
|
|
|
+// DataStatus: 1,
|
|
|
+// ScriptStatus: 1,
|
|
|
+// SketchStatus: 1,
|
|
|
+// CompleteStatus: 1,
|
|
|
+// CurDefaultType: 0,
|
|
|
+// WithdrawStatus: 1,
|
|
|
+// }
|
|
|
+// }
|
|
|
+// err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
+// // 在task_info表中插入任务
|
|
|
+// _, err = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(&taskInfo).Insert()
|
|
|
+// if err != nil {
|
|
|
+// return err
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 对应项目的报名人数自增
|
|
|
+// _, err = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.ProjectId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
|
|
|
+// if err != nil {
|
|
|
+// return err
|
|
|
+// }
|
|
|
+// return nil
|
|
|
+// })
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// return &TalentHttpResult{Code: 0, Msg: "success", Data: newTaskId}
|
|
|
+//}
|
|
|
+
|
|
|
+// 判断是否已报名任务,快手平台账号选择时,已经判断过
|
|
|
func IsSignUpTask(r *ghttp.Request) *TalentHttpResult {
|
|
|
tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
if err != nil {
|
|
@@ -251,12 +252,14 @@ func GetTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
|
|
|
fmt.Print(whereStr)
|
|
|
// 获取任务列表
|
|
|
- var taskList []*model.YoungeeTaskInfo
|
|
|
+ var taskList []*youngee_talent_model.YoungeeTaskInfo
|
|
|
+ //此达人下,所有快手账号的任务都展示
|
|
|
err = g.Model(dao.YoungeeTaskInfo.Table).Where(whereStr).Scan(&taskList)
|
|
|
if err != nil {
|
|
|
return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
|
|
|
}
|
|
|
|
|
|
+ //便后续根据 PlatformId 快速查找平台信息。platformMap的key是PlatformId,value是平台具体描述
|
|
|
platformMap := make(map[string]model.InfoThirdPlatform)
|
|
|
platformInfo := []*model.InfoThirdPlatform{}
|
|
|
if len(taskList) != 0 {
|
|
@@ -271,23 +274,34 @@ func GetTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
}
|
|
|
|
|
|
// 为每个任务根据项目id查询项目名称和主图
|
|
|
+ //taskBriefList存了各个阶段的tasklist
|
|
|
taskBriefList := youngee_talent_model.TaskInfoBriefList{}
|
|
|
- for _, v := range taskList {
|
|
|
- projectInfo, err := g.Model(dao.ProjectInfo.Table).Where("project_id = ?", v.ProjectId).One()
|
|
|
+ for _, v := range taskList { //taskList含所有任务
|
|
|
+ //获取具体的招募策略,taskInfo中
|
|
|
+ var projectDetail *youngee_talent_model.ProjectDetail
|
|
|
+ err := g.Model("project_info").WithAll().Where("project_id = ?", v.ProjectId).Scan(&projectDetail)
|
|
|
+ fmt.Println("projectDetail-----", projectDetail)
|
|
|
if err != nil {
|
|
|
return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
|
|
|
}
|
|
|
- account, err := g.Model(dao.YoungeePlatformAccountInfo.Table).One("platform_id = ? and talent_id = ?", projectInfo[dao.ProjectInfo.Columns.ProjectPlatform], v.TalentId)
|
|
|
+ var account *youngee_talent_model.KuaishouUserInfo
|
|
|
+ err = g.Model("platform_kuaishou_user_info").Where("platform_id = ? and talent_id = ? and open_id = ?", 8, tid, v.OpenId).Scan(&account)
|
|
|
+ //拿快手平台验证是否过期
|
|
|
+ expired := youngee_talent_service.CheckKuaishouTokenExp(account.OpenId)
|
|
|
+ account.Expired = expired
|
|
|
+
|
|
|
if err != nil {
|
|
|
return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
|
|
|
}
|
|
|
+ //taskInfoBrief含需要展示在页面的内容,被加入各阶段List
|
|
|
taskInfoBrief := &youngee_talent_model.TaskInfoBrief{
|
|
|
- TaskId: v.TaskId,
|
|
|
- PlatformIconUrl: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformIcon,
|
|
|
- PlatformName: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
|
|
|
- PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
|
|
|
- ProjectName: projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
|
|
|
- ProductPhotoSnap: projectInfo[dao.ProjectInfo.Columns.ProductPhotoSnap].String(),
|
|
|
+ TaskId: v.TaskId,
|
|
|
+ PlatformIconUrl: platformMap[strconv.Itoa(projectDetail.PlatformInfo.PlatformId)].PlatformIcon,
|
|
|
+ //PlatformName: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
|
|
|
+ //PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
|
|
|
+
|
|
|
+ ProjectName: projectDetail.ProjectName,
|
|
|
+ ProductPhotoSnap: projectDetail.ProductPhotoSnap,
|
|
|
TaskStatus: v.TaskStatus,
|
|
|
TaskStage: v.TaskStage,
|
|
|
LinkStatus: v.LinkStatus,
|
|
@@ -298,6 +312,10 @@ func GetTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
BreakRate: v.ScriptBreakRate + v.SketchBreakRate + v.LinkBreakRate + v.DataBreakRate,
|
|
|
CurBreakAt: v.CurBreakAt,
|
|
|
FeeForm: v.FeeForm,
|
|
|
+ ProjectDetail: projectDetail,
|
|
|
+ TaskInfo: v,
|
|
|
+ AccountInfo: account, //含是否过期,粉丝数,作品数目
|
|
|
+
|
|
|
}
|
|
|
taskBriefList.AllTaskInfoList = append(taskBriefList.AllTaskInfoList, taskInfoBrief)
|
|
|
|
|
@@ -314,84 +332,84 @@ func GetTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
}
|
|
|
|
|
|
// 查询执行中所有任务
|
|
|
-func GetExeTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
- tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
- }
|
|
|
- var taskStageList = [5]int{0, 7, 9, 11, 13}
|
|
|
- taskStageKey := r.GetQueryInt("taskStage", 0)
|
|
|
- if taskStageKey == 0 {
|
|
|
- return &TalentHttpResult{Code: -2, Msg: "parse param error"}
|
|
|
- }
|
|
|
- taskStage := taskStageList[taskStageKey+1]
|
|
|
-
|
|
|
- // 获取任务列表
|
|
|
- //这是一个切片,其中的每个元素都是指向 model.YoungeeTaskInfo 结构体的指针。通常用于存储多个任务信息的列表。
|
|
|
- var taskList []*model.YoungeeTaskInfo
|
|
|
- whereCondition := g.Map{
|
|
|
- dao.YoungeeTaskInfo.Columns.TalentId: tid,
|
|
|
- dao.YoungeeTaskInfo.Columns.TaskStage: taskStage,
|
|
|
- }
|
|
|
- err = g.Model(dao.YoungeeTaskInfo.Table).Where(whereCondition).Scan(&taskList)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
|
|
|
- }
|
|
|
-
|
|
|
- platformMap := make(map[string]model.InfoThirdPlatform)
|
|
|
- var platformInfo []*model.InfoThirdPlatform
|
|
|
- if len(taskList) != 0 {
|
|
|
- err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
|
|
|
- }
|
|
|
-
|
|
|
- for i, _ := range platformInfo {
|
|
|
- platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 为每个任务根据项目id查询项目名称和主图
|
|
|
- var taskBriefList []*youngee_talent_model.TaskInfoBrief
|
|
|
- for _, v := range taskList {
|
|
|
- whereCondition = g.Map{
|
|
|
- dao.ProjectInfo.Columns.ProjectId: v.ProjectId,
|
|
|
- }
|
|
|
- projectInfo, err := g.Model(dao.ProjectInfo.Table).Where(whereCondition).One()
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
|
|
|
- }
|
|
|
- whereCondition = g.Map{
|
|
|
- dao.YoungeePlatformAccountInfo.Columns.PlatformId: projectInfo[dao.ProjectInfo.Columns.ProjectPlatform],
|
|
|
- dao.YoungeePlatformAccountInfo.Columns.TalentId: v.TalentId,
|
|
|
- }
|
|
|
- account, err := g.Model(dao.YoungeePlatformAccountInfo.Table).Where(whereCondition).One()
|
|
|
- if err != nil {
|
|
|
- return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
|
|
|
- }
|
|
|
- taskInfoBrief := &youngee_talent_model.TaskInfoBrief{
|
|
|
- TaskId: v.TaskId,
|
|
|
- PlatformIconUrl: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformIcon,
|
|
|
- PlatformName: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
|
|
|
- PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
|
|
|
- ProjectName: projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
|
|
|
- ProductPhotoSnap: projectInfo[dao.ProjectInfo.Columns.ProductPhotoSnap].String(),
|
|
|
- TaskStatus: v.TaskStatus,
|
|
|
- TaskStage: v.TaskStage,
|
|
|
- LinkStatus: v.LinkStatus,
|
|
|
- DataStatus: v.DataStatus,
|
|
|
- ScriptStatus: v.ScriptStatus,
|
|
|
- SketchStatus: v.SketchStatus,
|
|
|
- TaskReward: v.TaskReward,
|
|
|
- BreakRate: v.ScriptBreakRate + v.SketchBreakRate + v.LinkBreakRate + v.DataBreakRate,
|
|
|
- CurBreakAt: v.CurBreakAt,
|
|
|
- FeeForm: v.FeeForm,
|
|
|
- }
|
|
|
- taskBriefList = append(taskBriefList, taskInfoBrief)
|
|
|
- }
|
|
|
-
|
|
|
- return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
|
|
|
-}
|
|
|
+//func GetExeTaskBriefList(r *ghttp.Request) *TalentHttpResult {
|
|
|
+// tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
+// }
|
|
|
+// var taskStageList = [5]int{0, 7, 9, 11, 13}
|
|
|
+// taskStageKey := r.GetQueryInt("taskStage", 0)
|
|
|
+// if taskStageKey == 0 {
|
|
|
+// return &TalentHttpResult{Code: -2, Msg: "parse param error"}
|
|
|
+// }
|
|
|
+// taskStage := taskStageList[taskStageKey+1]
|
|
|
+//
|
|
|
+// // 获取任务列表
|
|
|
+// //这是一个切片,其中的每个元素都是指向 model.YoungeeTaskInfo 结构体的指针。通常用于存储多个任务信息的列表。
|
|
|
+// var taskList []*model.YoungeeTaskInfo
|
|
|
+// whereCondition := g.Map{
|
|
|
+// dao.YoungeeTaskInfo.Columns.TalentId: tid,
|
|
|
+// dao.YoungeeTaskInfo.Columns.TaskStage: taskStage,
|
|
|
+// }
|
|
|
+// err = g.Model(dao.YoungeeTaskInfo.Table).Where(whereCondition).Scan(&taskList)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get task list failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// platformMap := make(map[string]model.InfoThirdPlatform)
|
|
|
+// var platformInfo []*model.InfoThirdPlatform
|
|
|
+// if len(taskList) != 0 {
|
|
|
+// err := g.Model(dao.InfoThirdPlatform.Table).Scan(&platformInfo)
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get platform failed"}
|
|
|
+// }
|
|
|
+//
|
|
|
+// for i, _ := range platformInfo {
|
|
|
+// platformMap[strconv.Itoa(platformInfo[i].PlatformId)] = *platformInfo[i]
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 为每个任务根据项目id查询项目名称和主图
|
|
|
+// var taskBriefList []*youngee_talent_model.TaskInfoBrief
|
|
|
+// for _, v := range taskList {
|
|
|
+// whereCondition = g.Map{
|
|
|
+// dao.ProjectInfo.Columns.ProjectId: v.ProjectId,
|
|
|
+// }
|
|
|
+// projectInfo, err := g.Model(dao.ProjectInfo.Table).Where(whereCondition).One()
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get fullproject info failed"}
|
|
|
+// }
|
|
|
+// whereCondition = g.Map{
|
|
|
+// dao.YoungeePlatformAccountInfo.Columns.PlatformId: projectInfo[dao.ProjectInfo.Columns.ProjectPlatform],
|
|
|
+// dao.YoungeePlatformAccountInfo.Columns.TalentId: v.TalentId,
|
|
|
+// }
|
|
|
+// account, err := g.Model(dao.YoungeePlatformAccountInfo.Table).Where(whereCondition).One()
|
|
|
+// if err != nil {
|
|
|
+// return &TalentHttpResult{Code: -1, Msg: "Get account info failed"}
|
|
|
+// }
|
|
|
+// taskInfoBrief := &youngee_talent_model.TaskInfoBrief{
|
|
|
+// TaskId: v.TaskId,
|
|
|
+// PlatformIconUrl: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformIcon,
|
|
|
+// PlatformName: platformMap[projectInfo[dao.ProjectInfo.Columns.ProjectPlatform].String()].PlatformName,
|
|
|
+// PlatformNickName: account[dao.YoungeePlatformAccountInfo.Columns.PlatformNickname].String(),
|
|
|
+// ProjectName: projectInfo[dao.ProjectInfo.Columns.ProjectName].String(),
|
|
|
+// ProductPhotoSnap: projectInfo[dao.ProjectInfo.Columns.ProductPhotoSnap].String(),
|
|
|
+// TaskStatus: v.TaskStatus,
|
|
|
+// TaskStage: v.TaskStage,
|
|
|
+// LinkStatus: v.LinkStatus,
|
|
|
+// DataStatus: v.DataStatus,
|
|
|
+// ScriptStatus: v.ScriptStatus,
|
|
|
+// SketchStatus: v.SketchStatus,
|
|
|
+// TaskReward: v.TaskReward,
|
|
|
+// BreakRate: v.ScriptBreakRate + v.SketchBreakRate + v.LinkBreakRate + v.DataBreakRate,
|
|
|
+// CurBreakAt: v.CurBreakAt,
|
|
|
+// FeeForm: v.FeeForm,
|
|
|
+// }
|
|
|
+// taskBriefList = append(taskBriefList, taskInfoBrief)
|
|
|
+// }
|
|
|
+//
|
|
|
+// return &TalentHttpResult{Code: 0, Msg: "success", Data: taskBriefList}
|
|
|
+//}
|
|
|
|
|
|
// 查询执行中所有任务
|
|
|
func GetExeTaskNum(r *ghttp.Request) *TalentHttpResult {
|
|
@@ -505,3 +523,162 @@ func GetTaskDetail(r *ghttp.Request) *TalentHttpResult {
|
|
|
|
|
|
return &TalentHttpResult{Code: 0, Msg: "success", Data: taskDetail}
|
|
|
}
|
|
|
+
|
|
|
+// 匹配种草策略,含是否可选属性
|
|
|
+func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
|
|
|
+ fanNum := r.GetQueryInt("fan_num", -1)
|
|
|
+ projectId := r.GetQueryString("project_id", -1)
|
|
|
+ var recruitStrategies []*youngee_talent_model.RecruitStrategy
|
|
|
+ err := g.DB().Model("recruit_strategy").Where("project_id = ?", projectId).Scan(&recruitStrategies)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err.Error())
|
|
|
+ }
|
|
|
+ for _, strategy := range recruitStrategies {
|
|
|
+ // 判断粉丝数是否满足当前策略的要求
|
|
|
+ if fanNum >= strategy.FollowersLow {
|
|
|
+ // 如果粉丝数满足策略的范围,设置 is_fit 为 1
|
|
|
+ strategy.IsFit = 1
|
|
|
+ } else {
|
|
|
+ // 否则设置 is_fit 为 0
|
|
|
+ strategy.IsFit = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //根据projectId获取招募策略表多条策略,
|
|
|
+ return &TalentHttpResult{Code: 0, Msg: "success", Data: recruitStrategies}
|
|
|
+}
|
|
|
+
|
|
|
+// 报名种草任务
|
|
|
+func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
|
|
|
+ tid, err := utils.SessionTalentInfo.GetTalentIdFromSession(r)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -1, Msg: "Get talent info failed"}
|
|
|
+ }
|
|
|
+
|
|
|
+ //POST请求体信息
|
|
|
+ var signTaskInfo *youngee_talent_model.SignTaskInfo
|
|
|
+ err = r.ParseForm(&signTaskInfo)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -2, Msg: "data query failed"}
|
|
|
+ }
|
|
|
+
|
|
|
+ //种草详情信息
|
|
|
+ var projectDetail *youngee_talent_model.ProjectDetail
|
|
|
+ err = g.DB().Model(youngee_talent_model.ProjectDetail{}).WithAll().Where("project_id", signTaskInfo.ProjectId).Scan(&projectDetail)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -3, Msg: err.Error()}
|
|
|
+ }
|
|
|
+
|
|
|
+ //达人用户信息
|
|
|
+ var talentInfo *youngee_talent_model.TalentInfo
|
|
|
+ err = g.DB().Model("youngee_talent_info").WithAll().Where("id", tid).Scan(&talentInfo)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -4, Msg: "Get talent info failed"}
|
|
|
+ }
|
|
|
+
|
|
|
+ //达人快手信息
|
|
|
+ var accountInfo *youngee_talent_model.KuaishouUserInfo
|
|
|
+ err = g.DB().Model("platform_kuaishou_user_info").WithAll().Where("talent_id = ? AND open_id = ? AND platform_id = ? ", tid, signTaskInfo.OpenID, 8).Scan(&accountInfo)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -5, Msg: err.Error()}
|
|
|
+ }
|
|
|
+
|
|
|
+ //var accountInfo *youngee_talent_model.PlatformAccountInfo
|
|
|
+ //err = g.DB().Model("youngee_platform_account_info").WithAll().Where("talent_id = ? and platform_id = ?", tid, projectDetail.ProjectPlatform).Scan(&accountInfo)
|
|
|
+ //if err != nil {
|
|
|
+ // return &TalentHttpResult{Code: -5, Msg: err.Error()}
|
|
|
+ //}
|
|
|
+
|
|
|
+ //project_form=1寄拍需要填写地址
|
|
|
+ var address *model.YoungeeTalentDeliveryAddress
|
|
|
+ if projectDetail.ProjectForm == 1 {
|
|
|
+ err := g.DB().Model(dao.YoungeeTalentDeliveryAddress.Table).Where("talent_id = ? and address_id = ?", tid, signTaskInfo.AddressId).Scan(&address)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -6, Msg: err.Error()}
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ address = new(model.YoungeeTalentDeliveryAddress) //赋空值
|
|
|
+ }
|
|
|
+ var newTaskId string
|
|
|
+ // 首先生成任务id
|
|
|
+ newTaskId = utils.GetUuid.GetTaskId(projectDetail.ProjectId, projectDetail.EnterpriseId, tid)
|
|
|
+ //// 生成达人平台账号信息快照
|
|
|
+ accountSnap, err := gjson.Encode(accountInfo)
|
|
|
+ //if err != nil {
|
|
|
+ // return &TalentHttpResult{Code: -7, Msg: "encode platform snap failed"}
|
|
|
+ //}
|
|
|
+
|
|
|
+ // 生成达人信息快照
|
|
|
+ talentSnap, err := gjson.Encode(talentInfo)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -8, Msg: "encode talent info snap failed"}
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成收货地址快照
|
|
|
+ addrSnap, err := gjson.Encode(address)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
|
+ }
|
|
|
+ taskInfo := youngee_talent_model.YoungeeTaskInfo{}
|
|
|
+ if projectDetail.ProjectType == 1 {
|
|
|
+ // 全流程任务/公开任务
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.ProjectId).Scan(&strategy)
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
+ }
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
+ TaskId: newTaskId,
|
|
|
+ ProjectId: signTaskInfo.ProjectId,
|
|
|
+ TalentId: tid,
|
|
|
+ OpenId: accountInfo.OpenId,
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
+ TalentPostAddrSnap: string(addrSnap),
|
|
|
+ StrategyId: signTaskInfo.StrategyId,
|
|
|
+ TaskStage: 1,
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
+ //ServiceCharge: serviceCharge,
|
|
|
+ //ServiceRate: serviceRate,
|
|
|
+ CreateDate: gtime.Now(),
|
|
|
+ TaskStatus: 1,
|
|
|
+ LogisticsStatus: 1,
|
|
|
+ LinkStatus: 1,
|
|
|
+ DataStatus: 1,
|
|
|
+ ScriptStatus: 1,
|
|
|
+ SketchStatus: 1,
|
|
|
+ CompleteStatus: 1,
|
|
|
+ CurDefaultType: 0,
|
|
|
+ WithdrawStatus: 1,
|
|
|
+ SettleStatus: 1,
|
|
|
+ DraftFee: signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的,
|
|
|
+ SettleAmount: signTaskInfo.Offer,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
+ // 在task_info表中插入任务
|
|
|
+ _, err = tx.Ctx(ctx).Model(dao.YoungeeTaskInfo.Table).Data(&taskInfo).Insert()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ // 对应项目的报名人数自增
|
|
|
+ _, err = tx.Ctx(ctx).Model(dao.ProjectInfo.Table).Where(dao.ProjectInfo.Columns.ProjectId, projectDetail.ProjectId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ //如果经过服务商,服务younggee_s_project_info中报名人数加一
|
|
|
+ if projectDetail.ProjectInfoSupplier != nil {
|
|
|
+ _, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("project_id = ? ", projectDetail.ProjectId).Increment("apply_num", 1)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
|
|
|
+ }
|
|
|
+
|
|
|
+ return &TalentHttpResult{Code: 0, Msg: "success", Data: newTaskId}
|
|
|
+}
|