package service import ( "errors" "strconv" "time" "youngee_b_api/app/dao" "youngee_b_api/app/entity" "youngee_b_api/app/vo" ) type DefaultService struct{} // 违约管理——违约公开任务列表 func (s DefaultService) GetPublicDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) { if param.Page <= 0 { param.Page = 1 } if param.PageSize <= 0 { param.PageSize = 10 } var result vo.ResultVO // 种草 if param.TaskType == 1 { reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param) if err != nil { return result, err } for i := range reTaskDefaultPublics { // 获取商品详情字段 var creatorName string var productName string var productPrice float64 var mainImage string if reTaskDefaultPublics[i].SubAccountId == 0 { enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId) if err == nil && enterprise != nil { creatorName = enterprise.BusinessName } } else { subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId) if err == nil && subAccount != nil { creatorName = subAccount.SubAccountName } } product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultPublics[i].ProductId) if err == nil && product != nil { productName = product.ProductName productPrice = product.ProductPrice } mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultPublics[i].ProductId) reTaskDefaultPublics[i].CreatorName = creatorName reTaskDefaultPublics[i].ProductName = productName reTaskDefaultPublics[i].ProductPrice = productPrice reTaskDefaultPublics[i].MainImage = mainImage // 获取未传数量字段 0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约 projectId := reTaskDefaultPublics[i].TaskId noSketchNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 4) noLinkNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 6) noDataNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 8) // 终止合作还是解约字段待确认 endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 16) reTaskDefaultPublics[i].NoSketchNum = noSketchNum reTaskDefaultPublics[i].NoLinkNum = noLinkNum reTaskDefaultPublics[i].NoDataNum = noDataNum reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum } result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: reTaskDefaultPublics, } return result, nil // 本地生活 } else if param.TaskType == 2 { reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param) if err != nil { return result, err } for i := range reTaskDefaultPublics { // 获取商品详情字段 var creatorName string var storeName string var storeLocation string //var productPrice float64 var mainImage string if reTaskDefaultPublics[i].SubAccountId == 0 { enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId) if err == nil && enterprise != nil { creatorName = enterprise.BusinessName } } else { subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId) if err == nil && subAccount != nil { creatorName = subAccount.SubAccountName } } store, err := dao.StoreDao{}.GetStoreByID(reTaskDefaultPublics[i].StoreId) if err == nil && store != nil { storeName = store.StoreName storeLocation = store.StoreLocation } mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(reTaskDefaultPublics[i].StoreId) reTaskDefaultPublics[i].CreatorName = creatorName reTaskDefaultPublics[i].StoreName = storeName reTaskDefaultPublics[i].StoreLocation = storeLocation reTaskDefaultPublics[i].MainImage = mainImage // 获取未传数量字段 0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约 localId := reTaskDefaultPublics[i].TaskId noSketchNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 4) noLinkNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 6) noDataNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 8) // 终止合作还是解约字段待确认 endCooperationNum := dao.LocalLifeTaskInfoDao{}.CountByTaskStage(localId, 16) reTaskDefaultPublics[i].NoSketchNum = noSketchNum reTaskDefaultPublics[i].NoLinkNum = noLinkNum reTaskDefaultPublics[i].NoDataNum = noDataNum reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum } result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: reTaskDefaultPublics, } return result, nil } else { return result, nil } } // 违约管理——违约定向任务列表 func (s DefaultService) GetTargetDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) { if param.Page <= 0 { param.Page = 1 } if param.PageSize <= 0 { param.PageSize = 10 } var result vo.ResultVO // 以下代码只考虑了种草 reTaskDefaultTargets, total, err := (&dao.ProjectDAO{}).GetProjectTargetList(param) if err != nil { return result, err } for i := range reTaskDefaultTargets { // 获取商品详情字段 var creatorName string var productName string var productPrice float64 var mainImage string if reTaskDefaultTargets[i].SubAccountId == 0 { enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultTargets[i].EnterpriseId) if err == nil && enterprise != nil { creatorName = enterprise.BusinessName } } else { subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultTargets[i].SubAccountId) if err == nil && subAccount != nil { creatorName = subAccount.SubAccountName } } product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultTargets[i].ProductId) if err == nil && product != nil { productName = product.ProductName productPrice = product.ProductPrice } mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultTargets[i].ProductId) reTaskDefaultTargets[i].CreatorName = creatorName reTaskDefaultTargets[i].ProductName = productName reTaskDefaultTargets[i].ProductPrice = productPrice reTaskDefaultTargets[i].MainImage = mainImage // 终止合作还是解约字段待确认 endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(reTaskDefaultTargets[i].TaskId, 17) reTaskDefaultTargets[i].EndCooperationNum = endCooperationNum } result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: reTaskDefaultTargets, } return result, nil } // 违约管理——公开任务-违约达人列表 func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) { if param.Page <= 0 { param.Page = 1 } if param.PageSize <= 0 { param.PageSize = 10 } var result vo.ResultVO var reTalentDefaults []*vo.ReTalentDefault // 种草 if param.TaskType == 1 { var projectTaskInfos []entity.ProjectTaskInfo var total int64 var err error var cutRate int64 // 违约扣款比例 defaultType := param.DefaultType if defaultType == 1 { // 未传初稿 projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListBySketchDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.SketchOtherNotUpload } else if defaultType == 2 { // 未发作品 projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByLinkDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.LinkReplaceNotUpload } else if defaultType == 3 { // 未传数据 projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByDataDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.DataReplaceNotUpload } else if defaultType == 4 { // 终止合作 projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTerminateDefault(param) } else if defaultType == 5 { // 已解约 projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByCancelDefault(param) } if err != nil { return result, err } for _, projectTaskInfo := range projectTaskInfos { talentId := projectTaskInfo.TalentID talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId) platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(projectTaskInfo.OpenID) reTalentDefault := &vo.ReTalentDefault{ TalentId: talentId, TalentPhone: talentInfo.TalentPhoneNumber, TaskId: projectTaskInfo.TaskID, DraftFee: projectTaskInfo.DraftFee, OpenId: platformKuaishouUserInfo.OpenID, PlatformId: platformKuaishouUserInfo.PlatformID, NickName: platformKuaishouUserInfo.NickName, HeadUri: platformKuaishouUserInfo.HeadUri, City: platformKuaishouUserInfo.City, Gender: platformKuaishouUserInfo.Gender, } if defaultType == 1 { reTalentDefault.DefaultTime = projectTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount } else if defaultType == 2 { reTalentDefault.DefaultTime = projectTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount } else if defaultType == 3 { reTalentDefault.DefaultTime = projectTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount } else if defaultType == 4 { reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05") reTalentDefault.Reason = projectTaskInfo.TerminateReason terminateOperatorType := projectTaskInfo.TerminateOperatorType if terminateOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if terminateOperatorType == 2 { operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if terminateOperatorType == 3 { operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } else if defaultType == 5 { reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount reTalentDefault.Reason = projectTaskInfo.CancelReason cancelOperatorType := projectTaskInfo.CancelOperatorType if cancelOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if cancelOperatorType == 2 { operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if cancelOperatorType == 3 { operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } reTalentDefaults = append(reTalentDefaults, reTalentDefault) } resultMap := make(map[string]interface{}) resultMap["cutRate"] = cutRate resultMap["reTalentDefaults"] = reTalentDefaults result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: resultMap, } return result, nil } else if param.TaskType == 2 { // 本地生活 var localLifeTaskInfos []entity.LocalLifeTaskInfo var total int64 var err error var cutRate int64 // 违约扣款比例 defaultType := param.DefaultType if defaultType == 1 { // 未传初稿 localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListBySketchDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.SketchOtherNotUpload } else if defaultType == 2 { // 未发作品 localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByLinkDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.LinkReplaceNotUpload } else if defaultType == 3 { // 未传数据 localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByDataDefault(param) autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId) infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId) cutRate = infoAutoDefault.DataReplaceNotUpload } else if defaultType == 4 { // 终止合作 localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTerminateDefault(param) } else if defaultType == 5 { // 已解约 localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByCancelDefault(param) } if err != nil { return result, err } for _, localLifeTaskInfo := range localLifeTaskInfos { talentId := localLifeTaskInfo.TalentID talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId) platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(localLifeTaskInfo.OpenID) reTalentDefault := &vo.ReTalentDefault{ TalentId: talentId, TalentPhone: talentInfo.TalentPhoneNumber, TaskId: localLifeTaskInfo.TaskID, DraftFee: localLifeTaskInfo.DraftFee, OpenId: platformKuaishouUserInfo.OpenID, PlatformId: platformKuaishouUserInfo.PlatformID, NickName: platformKuaishouUserInfo.NickName, HeadUri: platformKuaishouUserInfo.HeadUri, City: platformKuaishouUserInfo.City, Gender: platformKuaishouUserInfo.Gender, } if defaultType == 1 { reTalentDefault.DefaultTime = localLifeTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount } else if defaultType == 2 { reTalentDefault.DefaultTime = localLifeTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount } else if defaultType == 3 { reTalentDefault.DefaultTime = localLifeTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount } else if defaultType == 4 { reTalentDefault.DefaultTime = localLifeTaskInfo.TerminateTime.Format("2006-01-02 15:04:05") reTalentDefault.Reason = localLifeTaskInfo.TerminateReason terminateOperatorType := localLifeTaskInfo.TerminateOperatorType if terminateOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(localLifeTaskInfo.TerminateOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if terminateOperatorType == 2 { operatorId, _ := strconv.ParseInt(localLifeTaskInfo.TerminateOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if terminateOperatorType == 3 { operatorId, _ := strconv.ParseInt(localLifeTaskInfo.TerminateOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } else if defaultType == 5 { reTalentDefault.DefaultTime = localLifeTaskInfo.CancelTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount reTalentDefault.Reason = localLifeTaskInfo.CancelReason cancelOperatorType := localLifeTaskInfo.CancelOperatorType if cancelOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(localLifeTaskInfo.CancelOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if cancelOperatorType == 2 { operatorId, _ := strconv.ParseInt(localLifeTaskInfo.CancelOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if cancelOperatorType == 3 { operatorId, _ := strconv.ParseInt(localLifeTaskInfo.CancelOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } reTalentDefaults = append(reTalentDefaults, reTalentDefault) } resultMap := make(map[string]interface{}) resultMap["cutRate"] = cutRate resultMap["reTalentDefaults"] = reTalentDefaults result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: resultMap, } return result, nil } else { return result, nil } } // 违约管理——公开任务-违约达人列表角标 func (s DefaultService) GetPublicDefaultTalentCount(param *vo.DefaultSearchParam) (map[string]int64, error) { res := make(map[string]int64) var noSketchNum int64 var noLinkNum int64 var noDataNum int64 var endCooperationNum int64 if param.TaskType == 1 { noSketchNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 4) noLinkNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 6) noDataNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 8) // 终止合作还是解约字段待确认 endCooperationNum = dao.ProjectTaskInfoDao{}.CountByTaskStage(param.TaskId, 16) } else { noSketchNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 4) noLinkNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 6) noDataNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 8) // 终止合作还是解约字段待确认 endCooperationNum = dao.LocalLifeTaskInfoDao{}.CountByTaskStage(param.TaskId, 16) } res["noSketchNum"] = noSketchNum res["noLinkNum"] = noLinkNum res["noDataNum"] = noDataNum res["endCooperationNum"] = endCooperationNum return res, nil } // 违约管理——定向任务-违约达人列表 func (s DefaultService) GetTargetDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) { if param.Page <= 0 { param.Page = 1 } if param.PageSize <= 0 { param.PageSize = 10 } var result vo.ResultVO var reTalentDefaults []*vo.ReTalentDefault // 以下代码只考虑了种草 var projectTaskInfos []entity.ProjectTaskInfo var total int64 var err error defaultType := param.DefaultType if defaultType == 4 { // 终止合作 projectTaskInfos, total, err = (&dao.ProjectTaskInfoDao{}).GetListByTerminateDefault(param) } else if defaultType == 5 { // 已解约 projectTaskInfos, total, err = (&dao.ProjectTaskInfoDao{}).GetListByCancelDefault(param) } if err != nil { return result, err } for _, projectTaskInfo := range projectTaskInfos { talentId := projectTaskInfo.TalentID talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId) platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(projectTaskInfo.OpenID) reTalentDefault := &vo.ReTalentDefault{ TalentId: talentId, TalentPhone: talentInfo.TalentPhoneNumber, TaskId: projectTaskInfo.TaskID, DraftFee: projectTaskInfo.DraftFee, OpenId: platformKuaishouUserInfo.OpenID, PlatformId: platformKuaishouUserInfo.PlatformID, NickName: platformKuaishouUserInfo.NickName, HeadUri: platformKuaishouUserInfo.HeadUri, City: platformKuaishouUserInfo.City, Gender: platformKuaishouUserInfo.Gender, } if defaultType == 4 { reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05") reTalentDefault.Reason = projectTaskInfo.TerminateReason terminateOperatorType := projectTaskInfo.TerminateOperatorType if terminateOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if terminateOperatorType == 2 { operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if terminateOperatorType == 3 { operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } else if defaultType == 5 { reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05") reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount cancelOperatorType := projectTaskInfo.CancelOperatorType if cancelOperatorType == 1 { enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator) reTalentDefault.OperatorName = enterprise.BusinessName } else if cancelOperatorType == 2 { operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64) subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId) reTalentDefault.OperatorName = subAccount.SubAccountName } else if cancelOperatorType == 3 { operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64) userName, _ := dao.UserDao{}.GetNameByUserId(operatorId) reTalentDefault.OperatorName = userName } } reTalentDefaults = append(reTalentDefaults, reTalentDefault) } result = vo.ResultVO{ Page: param.Page, PageSize: param.PageSize, Total: total, Data: reTalentDefaults, } return result, nil } // 违约管理——达人解约 func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error { if param.TaskId == "" { return errors.New("taskId is empty") } updateData := map[string]interface{}{ "task_stage": 16, "settle_amount": param.RealPayment, "real_payment": param.RealPayment, "cancel_reason": param.CancelReason, "cancel_time": time.Now(), } if param.SubAccountId == 0 { updateData["cancel_operator_type"] = 1 updateData["cancel_operator"] = param.EnterpriseId } else { updateData["cancel_operator_type"] = 2 updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10) } err := dao.ProjectTaskInfoDao{}.UpdateField(param.TaskId, updateData) if err != nil { return err } return nil } // 违约管理——达人批量解约 func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error { if param.TaskIds == nil { return errors.New("taskIds is empty") } updateData := map[string]interface{}{ "task_stage": 16, "settle_amount": param.RealPayment, "real_payment": param.RealPayment, "cancel_reason": param.CancelReason, "cancel_time": time.Now(), } if param.SubAccountId == 0 { updateData["cancel_operator_type"] = 1 updateData["cancel_operator"] = param.EnterpriseId } else { updateData["cancel_operator_type"] = 2 updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10) } err := dao.ProjectTaskInfoDao{}.UpdateFieldBatch(param.TaskIds, updateData) if err != nil { return err } return nil }