|
@@ -530,10 +530,16 @@ func GetTaskDetail(r *ghttp.Request) *TalentHttpResult {
|
|
func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
|
|
func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
|
|
fanNum := r.GetQueryInt("fan_num", -1)
|
|
fanNum := r.GetQueryInt("fan_num", -1)
|
|
projectId := r.GetQueryString("project_id", -1)
|
|
projectId := r.GetQueryString("project_id", -1)
|
|
|
|
+ SProjectId := r.GetQueryInt("project_id", 0)
|
|
var recruitStrategies []*youngee_talent_model.RecruitStrategy
|
|
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())
|
|
|
|
|
|
+ //不经过服务商
|
|
|
|
+ if SProjectId == 0 {
|
|
|
|
+ err := g.DB().Model("recruit_strategy").Where("project_id = ? and strategy_type=?", projectId, 1).Scan(&recruitStrategies)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err.Error())
|
|
|
|
+ }
|
|
|
|
+ } else { //经过服务商
|
|
|
|
+ _ = g.DB().Model("recruit_strategy").Where("s_project_id = ?", SProjectId).Scan(&recruitStrategies)
|
|
}
|
|
}
|
|
for _, strategy := range recruitStrategies {
|
|
for _, strategy := range recruitStrategies {
|
|
// 判断粉丝数是否满足当前策略的要求
|
|
// 判断粉丝数是否满足当前策略的要求
|
|
@@ -545,6 +551,7 @@ func GetProjRecruitList(r *ghttp.Request) *TalentHttpResult {
|
|
strategy.IsFit = 0
|
|
strategy.IsFit = 0
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
//根据projectId获取招募策略表多条策略,
|
|
//根据projectId获取招募策略表多条策略,
|
|
return &TalentHttpResult{Code: 0, Msg: "success", Data: recruitStrategies}
|
|
return &TalentHttpResult{Code: 0, Msg: "success", Data: recruitStrategies}
|
|
}
|
|
}
|
|
@@ -621,13 +628,133 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
|
|
return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
}
|
|
}
|
|
taskInfo := youngee_talent_model.YoungeeTaskInfo{}
|
|
taskInfo := youngee_talent_model.YoungeeTaskInfo{}
|
|
|
|
+ // 公开任务
|
|
if projectDetail.ProjectType == 1 {
|
|
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()}
|
|
|
|
|
|
+ //经过服务商
|
|
|
|
+ if signTaskInfo.SProjectId != 0 {
|
|
|
|
+ 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)
|
|
|
|
+ var ServiceChargePrice = 0.0 //服务费
|
|
|
|
+ var SupporPricer = 0.0 //提报价
|
|
|
|
+ if signTaskInfo.StrategyId == 3 { //自报价
|
|
|
|
+ ServiceChargePrice = signTaskInfo.Offer * strategy.ServiceRate * 0.01
|
|
|
|
+ SupporPricer = signTaskInfo.Offer * (1 + strategy.ServiceRate*0.01)
|
|
|
|
+
|
|
|
|
+ } else if signTaskInfo.StrategyId == 2 { //一口价
|
|
|
|
+ ServiceChargePrice = strategy.ServiceCharge
|
|
|
|
+ SupporPricer = signTaskInfo.Offer
|
|
|
|
+ } else { //无费置换
|
|
|
|
+ ServiceChargePrice = 0.0
|
|
|
|
+ SupporPricer = 0.0
|
|
|
|
+ }
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
|
+ }
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.ProjectId,
|
|
|
|
+ SProjectId: signTaskInfo.SProjectId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ TalentPostAddrSnap: string(addrSnap),
|
|
|
|
+ StrategyId: signTaskInfo.StrategyId,
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
|
+ ServiceCharge: ServiceChargePrice, //服务费(自报价要计算,一口价直接从strategy中取得,无非置换为0)
|
|
|
|
+ ServiceRate: projectDetail.ServiceChargeRate, //公开服务费率,projectinfo和recruit 表中是一样的
|
|
|
|
+ SupportFee: SupporPricer,
|
|
|
|
+ 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,自报价是达人添加的也是t_offer,
|
|
|
|
+ SettleAmount: signTaskInfo.Offer,
|
|
|
|
+ SupplierStatus: 1,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //不经过服务商
|
|
|
|
+ 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: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ TalentPostAddrSnap: string(addrSnap),
|
|
|
|
+ StrategyId: signTaskInfo.StrategyId,
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
|
+ ServiceCharge: 0, //不经过服务商则为0
|
|
|
|
+ ServiceRate: projectDetail.ServiceChargeRate, //公开服务费率
|
|
|
|
+ SupportFee: signTaskInfo.Offer,
|
|
|
|
+ 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,自报价是达人添加的也是t_offer,
|
|
|
|
+ SettleAmount: signTaskInfo.Offer,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } else if projectDetail.ProjectType == 2 { //定向任务
|
|
|
|
+ //经过服务商
|
|
|
|
+ if signTaskInfo.SProjectId != 0 {
|
|
|
|
+ //查找服务商定义的策略
|
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SProjectId).Scan(&strategy)
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.ProjectId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ 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,
|
|
|
|
+ ServiceCharge: 0, //不经过服务商,无服务费
|
|
|
|
+ ServiceRate: 0, //服务费率
|
|
|
|
+ SupportFee: signTaskInfo.Offer, //不经过服务商, 提报价格=一口价*(1+服务费率)
|
|
|
|
+ DraftFee: signTaskInfo.Offer, //稿费价格,一口价
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //不经过服务商
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //定向任务,服务费在哪设置
|
|
taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
TaskId: newTaskId,
|
|
TaskId: newTaskId,
|
|
ProjectId: signTaskInfo.ProjectId,
|
|
ProjectId: signTaskInfo.ProjectId,
|
|
@@ -636,11 +763,7 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
|
|
TalentPlatformInfoSnap: string(accountSnap),
|
|
TalentPlatformInfoSnap: string(accountSnap),
|
|
TalentPersonalInfoSnap: string(talentSnap),
|
|
TalentPersonalInfoSnap: string(talentSnap),
|
|
TalentPostAddrSnap: string(addrSnap),
|
|
TalentPostAddrSnap: string(addrSnap),
|
|
- StrategyId: signTaskInfo.StrategyId,
|
|
|
|
TaskStage: 1,
|
|
TaskStage: 1,
|
|
- FeeForm: strategy.FeeForm,
|
|
|
|
- ServiceCharge: strategy.ServiceCharge, // 服务费
|
|
|
|
- ServiceRate: projectDetail.ServiceChargeRate, //公开服务费率
|
|
|
|
CreateDate: gtime.Now(),
|
|
CreateDate: gtime.Now(),
|
|
TaskStatus: 1,
|
|
TaskStatus: 1,
|
|
LogisticsStatus: 1,
|
|
LogisticsStatus: 1,
|
|
@@ -651,10 +774,10 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
|
|
CompleteStatus: 1,
|
|
CompleteStatus: 1,
|
|
CurDefaultType: 0,
|
|
CurDefaultType: 0,
|
|
WithdrawStatus: 1,
|
|
WithdrawStatus: 1,
|
|
- SettleStatus: 1,
|
|
|
|
- DraftFee: signTaskInfo.Offer, //商家或者服务商可以看到的稿费价格,无非置换为空,一口价为策略表中的t_offer,自报价是达人添加的,
|
|
|
|
- SettleAmount: signTaskInfo.Offer,
|
|
|
|
|
|
+ SupportFee: signTaskInfo.Offer, //不经过服务商, 提报价格=一口价*(1+服务费率)
|
|
|
|
+ DraftFee: signTaskInfo.Offer, //稿费价格,一口价
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
err = g.DB().Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
// 在task_info表中插入任务
|
|
// 在task_info表中插入任务
|
|
@@ -669,8 +792,263 @@ func SignUpTaskWithKsAccount(r *ghttp.Request) *TalentHttpResult {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
//如果经过服务商,服务younggee_s_project_info中报名人数加一
|
|
//如果经过服务商,服务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 signTaskInfo.SProjectId != 0 {
|
|
|
|
+ _, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("s_project_id = ? ", signTaskInfo.SProjectId).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}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 本地生活报名
|
|
|
|
+func SignUpLocalWithKsAccount(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.SignLocalTaskInfo
|
|
|
|
+ err = r.ParseForm(&signTaskInfo)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -2, Msg: "data query failed"}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var projectDetail *youngee_talent_model.LocalInfoDetail
|
|
|
|
+ err = g.DB().Model(youngee_talent_model.LocalInfoDetail{}).WithAll().Where("local_id", signTaskInfo.LocalId).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, projectDetail.LocalPlatform).Scan(&accountInfo)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -5, Msg: err.Error()}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var newTaskId string
|
|
|
|
+ // 首先生成任务id
|
|
|
|
+ newTaskId = utils.GetUuid.GetTaskId(projectDetail.LocalId, 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"}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -9, Msg: "encode delivery address snap failed"}
|
|
|
|
+ }
|
|
|
|
+ taskInfo := youngee_talent_model.YoungeeTaskInfo{}
|
|
|
|
+ // 公开任务
|
|
|
|
+ if projectDetail.LocalType == 1 {
|
|
|
|
+ //经过服务商
|
|
|
|
+ if signTaskInfo.SLocalId != 0 {
|
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.LocalId).Scan(&strategy)
|
|
|
|
+ var ServiceChargePrice = 0.0 //服务费
|
|
|
|
+ var SupporPricer = 0.0 //提报价
|
|
|
|
+ if signTaskInfo.StrategyId == 3 { //自报价
|
|
|
|
+ ServiceChargePrice = signTaskInfo.Offer * strategy.ServiceRate * 0.01
|
|
|
|
+ SupporPricer = signTaskInfo.Offer * (1 + strategy.ServiceRate*0.01)
|
|
|
|
+
|
|
|
|
+ } else if signTaskInfo.StrategyId == 2 { //一口价
|
|
|
|
+ ServiceChargePrice = strategy.ServiceCharge
|
|
|
|
+ SupporPricer = signTaskInfo.Offer
|
|
|
|
+ } else { //无费置换
|
|
|
|
+ ServiceChargePrice = 0.0
|
|
|
|
+ SupporPricer = 0.0
|
|
|
|
+ }
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
|
+ }
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.LocalId,
|
|
|
|
+ SProjectId: signTaskInfo.SLocalId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ StrategyId: signTaskInfo.StrategyId,
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
|
+ ServiceCharge: ServiceChargePrice, //服务费(自报价要计算,一口价直接从strategy中取得,无非置换为0)
|
|
|
|
+ ServiceRate: projectDetail.ServiceChargeRate, //公开服务费率,projectinfo和recruit 表中是一样的
|
|
|
|
+ SupportFee: SupporPricer,
|
|
|
|
+ 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,自报价是达人添加的也是t_offer,
|
|
|
|
+ SettleAmount: signTaskInfo.Offer,
|
|
|
|
+ SupplierStatus: 1,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //不经过服务商
|
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and project_id= ?", signTaskInfo.StrategyId, signTaskInfo.LocalId).Scan(&strategy)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return &TalentHttpResult{Code: -10, Msg: err.Error()}
|
|
|
|
+ }
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.LocalId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ StrategyId: signTaskInfo.StrategyId,
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
|
+ ServiceCharge: 0, //不经过服务商则为0
|
|
|
|
+ ServiceRate: projectDetail.ServiceChargeRate, //公开服务费率
|
|
|
|
+ SupportFee: signTaskInfo.Offer,
|
|
|
|
+ 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,自报价是达人添加的也是t_offer,
|
|
|
|
+ SettleAmount: signTaskInfo.Offer,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } else if projectDetail.LocalType == 2 { //定向任务
|
|
|
|
+ //经过服务商
|
|
|
|
+ if signTaskInfo.SLocalId != 0 {
|
|
|
|
+ //查找服务商定义的策略
|
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.LocalId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ CreateDate: gtime.Now(),
|
|
|
|
+ TaskStatus: 1,
|
|
|
|
+ LogisticsStatus: 1,
|
|
|
|
+ LinkStatus: 1,
|
|
|
|
+ DataStatus: 1,
|
|
|
|
+ ScriptStatus: 1,
|
|
|
|
+ SketchStatus: 1,
|
|
|
|
+ CompleteStatus: 1,
|
|
|
|
+ CurDefaultType: 0,
|
|
|
|
+ WithdrawStatus: 1,
|
|
|
|
+ ServiceCharge: 0, //不经过服务商,无服务费
|
|
|
|
+ ServiceRate: 0, //服务费率
|
|
|
|
+ SupportFee: signTaskInfo.Offer, //不经过服务商, 提报价格=一口价*(1+服务费率)
|
|
|
|
+ DraftFee: signTaskInfo.Offer, //稿费价格,一口价
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //不经过服务商
|
|
|
|
+ //查找服务商定义的策略
|
|
|
|
+ var strategy *youngee_talent_model.RecruitStrategy
|
|
|
|
+ err = g.DB().Model("recruit_strategy").WithAll().Where("strategy_id = ? and s_project_id= ?", signTaskInfo.StrategyId, signTaskInfo.SLocalId).Scan(&strategy)
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.LocalId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ CreateDate: gtime.Now(),
|
|
|
|
+ TaskStatus: 1,
|
|
|
|
+ LogisticsStatus: 1,
|
|
|
|
+ LinkStatus: 1,
|
|
|
|
+ DataStatus: 1,
|
|
|
|
+ ScriptStatus: 1,
|
|
|
|
+ SketchStatus: 1,
|
|
|
|
+ CompleteStatus: 1,
|
|
|
|
+ CurDefaultType: 0,
|
|
|
|
+ WithdrawStatus: 1,
|
|
|
|
+ ServiceCharge: 0, //不经过服务商,无服务费
|
|
|
|
+ ServiceRate: 0, //服务费率
|
|
|
|
+ SupportFee: signTaskInfo.Offer, //不经过服务商, 提报价格=一口价*(1+服务费率)
|
|
|
|
+ DraftFee: signTaskInfo.Offer, //稿费价格,一口价
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //定向任务,服务费在哪设置
|
|
|
|
+ taskInfo = youngee_talent_model.YoungeeTaskInfo{
|
|
|
|
+ TaskId: newTaskId,
|
|
|
|
+ ProjectId: signTaskInfo.LocalId,
|
|
|
|
+ TalentId: tid,
|
|
|
|
+ OpenId: signTaskInfo.OpenID,
|
|
|
|
+ TalentPlatformInfoSnap: string(accountSnap),
|
|
|
|
+ TalentPersonalInfoSnap: string(talentSnap),
|
|
|
|
+ TaskStage: 1,
|
|
|
|
+ CreateDate: gtime.Now(),
|
|
|
|
+ TaskStatus: 1,
|
|
|
|
+ LogisticsStatus: 1,
|
|
|
|
+ LinkStatus: 1,
|
|
|
|
+ DataStatus: 1,
|
|
|
|
+ ScriptStatus: 1,
|
|
|
|
+ SketchStatus: 1,
|
|
|
|
+ CompleteStatus: 1,
|
|
|
|
+ CurDefaultType: 0,
|
|
|
|
+ WithdrawStatus: 1,
|
|
|
|
+ SupportFee: signTaskInfo.Offer, //不经过服务商, 提报价格=一口价*(1+服务费率)
|
|
|
|
+ DraftFee: 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.LocalId).Increment(dao.ProjectInfo.Columns.ApplyNum, 1)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ //如果经过服务商,服务younggee_s_project_info中报名人数加一
|
|
|
|
+ if signTaskInfo.SLocalId != 0 {
|
|
|
|
+ _, err = tx.Ctx(ctx).Model("younggee_s_project_info").Where("s_project_id = ? ", signTaskInfo.SLocalId).Increment("apply_num", 1)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|