فهرست منبع

feat: 种草&本地生活详情页携带服务商

yankun 4 روز پیش
والد
کامیت
4889927fcc

+ 7 - 7
app/api/youngee_talent_api/talent_auth_get_api.go

@@ -787,13 +787,13 @@ func (*talentAuthGetApi) GetProjectBrowseHistory(r *ghttp.Request) {
 	}
 }
 
-func (*talentAuthGetApi) GetProjectDetailFromBrowse(r *ghttp.Request) {
-	res := youngee_task_service.GetProjectDetailFromBrowse(r)
-	err := r.Response.WriteJson(res)
-	if err != nil {
-		panic("write response error")
-	}
-}
+//func (*talentAuthGetApi) GetProjectDetailFromBrowse(r *ghttp.Request) {
+//	res := youngee_task_service.GetProjectDetailFromBrowse(r)
+//	err := r.Response.WriteJson(res)
+//	if err != nil {
+//		panic("write response error")
+//	}
+//}
 
 // 获取带货浏览历史列表 get selectionid,productid
 func (*talentAuthGetApi) GetSelectionBrowseHistory(r *ghttp.Request) {

+ 3 - 3
app/model/youngee_talent_model/auth_model.go

@@ -49,9 +49,9 @@ type KuaishouUserInfo struct {
 	Status       int         `json:"status"` //绑定状态,绑定一个还是两个
 	//UseCode      int         `json:"use_code" ` //满足条件的账号可被选择
 	//BindCode     int         `json:"bind_code"` //账号绑定情况
-	IsSign int `json:"is_sign"` //是否报名该任务
-	IsOk   int `json:"is_ok"`   //是否满足领样条件
-
+	IsSign       int           `json:"is_sign"` //是否报名该任务
+	IsOk         int           `json:"is_ok"`   //是否满足领样条件
+	PlatformInfo *PlatformInfo `orm:"with:platform_id=platform_id"`
 }
 
 // 快手列表返回的结果

+ 59 - 21
app/model/youngee_talent_model/local_info.go

@@ -54,31 +54,69 @@ type YounggeeLocalLifeInfo struct {
 	MaxFollowers         int                     `json:"max_followers"`
 	IsShowOffer          int                     `json:"is_show_offer"`
 	HaveSelfOffer        int                     `json:"have_self_offer"`
-	MaxOffer             int                     `json:"max_offer"`
-	MinOffer             int                     `json:"min_offer"`
+	MaxOffer             float64                 `json:"max_offer"`
+	MinOffer             float64                 `json:"min_offer"`
 }
 
+// 服务商接手的项目信息
+//
+//	type LocalInfoSupplier struct {
+//		gmeta.Meta          `orm:"table:younggee_s_local_life_info"`
+//		SProjectID          int     `orm:"s_project_id" json:"s_project_id"`                   // 服务商种草任务ID
+//		ProjectID           string  `orm:"project_id" json:"project_id"`                       // 被服务商加入商单的原种草任务ID
+//		ProjectStatus       int8    `orm:"project_status" json:"project_status"`               // 项目状态
+//		ProjectType         int8    `orm:"project_type" json:"project_type"`                   // 种草任务类型
+//		ProjectName         string  `orm:"project_name" json:"project_name"`                   // 种草任务名称
+//		ProjectPlatform     int8    `orm:"project_platform" json:"project_platform"`           // 种草任务平台
+//		ProjectForm         int8    `orm:"project_form" json:"project_form"`                   // 任务形式
+//		ContentType         int8    `orm:"content_type" json:"content_type"`                   // 内容形式
+//		ShareCode           string  `orm:"share_code" json:"share_code"`                       // 分享码URL
+//		SupplierID          int     `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
+//		EnterpriseID        string  `orm:"enterprise_id" json:"enterprise_id"`                 // 所属企业ID
+//		ApplyNum            int     `orm:"apply_num" json:"apply_num"`                         // 报名人数
+//		RecruitNum          int     `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
+//		SettleNum           int     `orm:"settle_num" json:"settle_num"`                       // 已结算人数
+//		SubAccountID        int     `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
+//		ServiceCharge       float64 `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
+//		ServiceChargeActual float64 `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
+//		OperatorType        int     `orm:"operator_type" json:"operator_type"`
+//	}
+//
 // 服务商接手的项目信息
 type LocalInfoSupplier struct {
-	gmeta.Meta          `orm:"table:younggee_s_local_info"`
-	SProjectID          int     `orm:"s_project_id" json:"s_project_id"`                   // 服务商种草任务ID
-	ProjectID           string  `orm:"project_id" json:"project_id"`                       // 被服务商加入商单的原种草任务ID
-	ProjectStatus       int8    `orm:"project_status" json:"project_status"`               // 项目状态
-	ProjectType         int8    `orm:"project_type" json:"project_type"`                   // 种草任务类型
-	ProjectName         string  `orm:"project_name" json:"project_name"`                   // 种草任务名称
-	ProjectPlatform     int8    `orm:"project_platform" json:"project_platform"`           // 种草任务平台
-	ProjectForm         int8    `orm:"project_form" json:"project_form"`                   // 任务形式
-	ContentType         int8    `orm:"content_type" json:"content_type"`                   // 内容形式
-	ShareCode           string  `orm:"share_code" json:"share_code"`                       // 分享码URL
-	SupplierID          int     `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
-	EnterpriseID        string  `orm:"enterprise_id" json:"enterprise_id"`                 // 所属企业ID
-	ApplyNum            int     `orm:"apply_num" json:"apply_num"`                         // 报名人数
-	RecruitNum          int     `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
-	SettleNum           int     `orm:"settle_num" json:"settle_num"`                       // 已结算人数
-	SubAccountID        int     `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
-	ServiceCharge       float64 `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
-	ServiceChargeActual float64 `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
-	OperatorType        int     `orm:"operator_type" json:"operator_type"`
+	gmeta.Meta          `orm:"table:younggee_s_local_life_info"`
+	SLocalID            int         `orm:"s_local_id" json:"s_local_id"`                       // 主键ID
+	LocalID             string      `orm:"local_id" json:"local_id"`                           // 被加入商单的原本地生活ID
+	LocalType           int8        `orm:"local_type" json:"local_type"`                       // 类型,1代表公开,2代表定向
+	LocalName           string      `orm:"local_name" json:"local_name"`                       // 名称
+	LocalPlatform       int8        `orm:"local_platform" json:"local_platform"`               // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	StoreID             int         `orm:"store_id" json:"store_id"`                           // 门店ID
+	TeamBuyingID        int         `orm:"team_buying_id" json:"team_buying_id"`               // 关联团购id
+	TaskForm            int8        `orm:"task_form" json:"task_form"`                         // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType         int8        `orm:"content_type" json:"content_type"`                   // 内容形式,1代表图文,2代表视频
+	TaskStatus          int8        `orm:"task_status" json:"task_status"`                     // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	EnterpriseID        string      `orm:"enterprise_id" json:"enterprise_id"`                 // 商家ID
+	SupplierID          int         `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
+	ApplyNum            int         `orm:"apply_num" json:"apply_num"`                         // 报名人数
+	RecruitNum          int         `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
+	SettleNum           int         `orm:"settle_num" json:"settle_num"`                       // 已结算人数
+	SubAccountID        int         `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
+	ServiceCharge       float64     `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
+	ServiceChargeActual float64     `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
+	ServiceChargeSettle float64     `orm:"service_charge_settle" json:"service_charge_settle"` // 服务商已结算服务费
+	EstimateDraftFee    float64     `orm:"estimate_draft_fee" json:"estimate_draft_fee"`       // 预估达人总稿费
+	EstimateSupportFee  float64     `orm:"estimate_support_fee" json:"estimate_support_fee"`   // 预估提报价格总额
+	OperatorType        int         `orm:"operator_type" json:"operator_type"`                 // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
+	SLocalStatus        int         `orm:"s_local_status" json:"s_local_status"`               // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
+	StrategyStatus      int         `orm:"strategy_status" json:"strategy_status"`             // 定向本地生活任务是否替换招募策略,1是,2否
+	BOperator           string      `orm:"b_operator" json:"b_operator"`                       // 商家发起入库邀约人
+	BOperatorType       int         `orm:"b_operator_type" json:"b_operator_type"`             // 商家发起入库邀约人类型:1主账号 2子账号
+	CreateTime          *gtime.Time `orm:"create_time" json:"create_time"`                     // 创建时间
+	CreateStrategyID    int         `orm:"create_strategy_id" json:"create_strategy_id"`       // 服务商替换招募策略操作人ID
+	CreateStrategyType  int         `orm:"create_strategy_type" json:"create_strategy_type"`   // 服务商替换招募策略操作人类型:1服务商主账号,2子账号
+	ShareCode           string      `orm:"share_code" json:"share_code"`                       // 分享码url
+	FinishTime          *gtime.Time `orm:"finish_time" json:"finish_time"`                     // 结案时间
+	SupplierType        int         `orm:"supplier_type" json:"supplier_type"`                 // 服务商类型,1个人,2企业
 }
 
 type LocalInfoDetail struct {

+ 22 - 20
app/model/youngee_talent_model/project_detail.go

@@ -41,8 +41,8 @@ type RecruitStrategy struct {
 	FollowersLow      int     `json:"followers_low"`       // 达人粉丝数下限
 	FollowersUp       int     `json:"followers_up"`        // 达人粉丝数上限
 	RecruitNumber     int     `json:"recruit_number"`      // 招募数量 每个策略招募的人数可以不一样
-	Offer             int     `json:"offer"`               // 商家or服务商的报价
-	TOffer            int     `json:"t_offer"`             // 达人真实所见的稿费,
+	Offer             float64 `json:"offer"`               // 商家or服务商的报价
+	TOffer            float64 `json:"t_offer"`             // 达人真实所见的稿费,
 	ProjectId         string  `json:"project_id"`          // 所属项目id
 	ServiceCharge     float64 `json:"service_charge"`      // 平台服务费,稿费形式为产品置换时必填
 	ServiceRate       float64 `json:"service_rate"`        //服务费率
@@ -110,24 +110,26 @@ type YounggeeSupplier struct {
 // 服务商接手的项目信息
 type ProjectInfoSupplier struct {
 	gmeta.Meta          `orm:"table:younggee_s_project_info"`
-	SProjectID          int     `orm:"s_project_id" json:"s_project_id"`                   // 服务商种草任务ID
-	ProjectID           string  `orm:"project_id" json:"project_id"`                       // 被服务商加入商单的原种草任务ID
-	ProjectStatus       int8    `orm:"project_status" json:"project_status"`               // 项目状态
-	ProjectType         int8    `orm:"project_type" json:"project_type"`                   // 种草任务类型
-	ProjectName         string  `orm:"project_name" json:"project_name"`                   // 种草任务名称
-	ProjectPlatform     int8    `orm:"project_platform" json:"project_platform"`           // 种草任务平台
-	ProjectForm         int8    `orm:"project_form" json:"project_form"`                   // 任务形式
-	ContentType         int8    `orm:"content_type" json:"content_type"`                   // 内容形式
-	ShareCode           string  `orm:"share_code" json:"share_code"`                       // 分享码URL
-	SupplierID          int     `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
-	EnterpriseID        string  `orm:"enterprise_id" json:"enterprise_id"`                 // 所属企业ID
-	ApplyNum            int     `orm:"apply_num" json:"apply_num"`                         // 报名人数
-	RecruitNum          int     `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
-	SettleNum           int     `orm:"settle_num" json:"settle_num"`                       // 已结算人数
-	SubAccountID        int     `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
-	ServiceCharge       float64 `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
-	ServiceChargeActual float64 `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
-	OperatorType        int     `orm:"operator_type" json:"operator_type"`
+	SProjectID          int               `orm:"s_project_id" json:"s_project_id"`                   // 服务商种草任务ID
+	ProjectID           string            `orm:"project_id" json:"project_id"`                       // 被服务商加入商单的原种草任务ID
+	ProjectStatus       int8              `orm:"project_status" json:"project_status"`               // 项目状态
+	ProjectType         int8              `orm:"project_type" json:"project_type"`                   // 种草任务类型
+	ProjectName         string            `orm:"project_name" json:"project_name"`                   // 种草任务名称
+	ProjectPlatform     int8              `orm:"project_platform" json:"project_platform"`           // 种草任务平台
+	ProjectForm         int8              `orm:"project_form" json:"project_form"`                   // 任务形式
+	ContentType         int8              `orm:"content_type" json:"content_type"`                   // 内容形式
+	ShareCode           string            `orm:"share_code" json:"share_code"`                       // 分享码URL
+	SupplierID          int               `orm:"supplier_id" json:"supplier_id"`                     // 服务商ID
+	EnterpriseID        string            `orm:"enterprise_id" json:"enterprise_id"`                 // 所属企业ID
+	ApplyNum            int               `orm:"apply_num" json:"apply_num"`                         // 报名人数
+	RecruitNum          int               `orm:"recruit_num" json:"recruit_num"`                     // 已招募人数
+	SettleNum           int               `orm:"settle_num" json:"settle_num"`                       // 已结算人数
+	SubAccountID        int               `orm:"sub_account_id" json:"sub_account_id"`               // 服务商子账号ID
+	ServiceCharge       float64           `orm:"service_charge" json:"service_charge"`               // 服务商预估可赚服务费
+	ServiceChargeActual float64           `orm:"service_charge_actual" json:"service_charge_actual"` // 服务商实际可赚服务费
+	OperatorType        int               `orm:"operator_type" json:"operator_type"`
+	ProjectDetail       *ProjectDetail    `orm:"with:project_id=project_id"`   // 项目详情
+	YounggeeSupplier    *YounggeeSupplier `orm:"with:supplier_id=supplier_id"` // 服务商信息
 }
 
 type ProjectDetail struct {

+ 2 - 2
app/model/youngee_talent_model/project_info.go

@@ -34,8 +34,8 @@ type ProjectInfo struct {
 	MinFollowers         int                     `json:"min_followers"`             //最低粉丝要求
 	MaxFollowers         int                     `json:"max_followers"`             //最高粉丝要求
 	RecruitStrategys     []*RecruitStrategy      `orm:"with:project_id=project_id"`
-	MinOffer             int                     `json:"min_offer"` //如果有多个一口价的策略,展示最低的offer价格
-	MaxOffer             int                     `json:"max_offer"` //如果有多个一口价的策略,展示最高的offer价格
+	MinOffer             float64                 `json:"min_offer"` //如果有多个一口价的策略,展示最低的offer价格
+	MaxOffer             float64                 `json:"max_offer"` //如果有多个一口价的策略,展示最高的offer价格
 	HaveSelfOffer        int                     `json:"have_self_offer"`
 	IsShowOffer          int                     `json:"is_show_offer"`
 	Enterprise           *Enterprise             `orm:"with:enterprise_id=enterprise_id"`

+ 9 - 7
app/model/youngee_talent_model/task_info.go

@@ -304,11 +304,13 @@ type IsSignSecTask struct {
 
 // 物流页面展示不同的task
 type YoungeeGeneralTaskInfo struct {
-	TalentId    string            `json:"talent_id"`    // 达人ID
-	TaskName    string            `json:"task_name"`    // 任务名称
-	TaskPhoto   string            `json:"task_photo"`   // 任务图片
-	TaskPrice   float64           `json:"task_price"`   // 任务价格
-	AccountInfo *KuaishouUserInfo `json:"account_info"` //报名平台账号信息
-	SourceType  int               `json:"source_type"`  // 任务来源 1: 公开 2: 定向
-	TaskType    int               `json:"task_type"`    // 1:带货 2.种草 3,本地生活
+	TalentId     string                      `json:"talent_id"`    // 达人ID
+	TaskId       string                      `json:"task_id"`      // 任务ID
+	TaskName     string                      `json:"task_name"`    // 任务名称
+	TaskPhoto    string                      `json:"task_photo"`   // 任务图片
+	TaskPrice    float64                     `json:"task_price"`   // 任务价格
+	AccountInfo  *KuaishouUserInfo           `json:"account_info"` //报名平台账号信息
+	SourceType   int                         `json:"source_type"`  // 任务来源 1: 公开 2: 定向
+	TaskType     int                         `json:"task_type"`    // 1:带货 2.种草 3,本地生活
+	LogisticInfo *model.YoungeeTaskLogistics `json:"logisticInfo"`
 }

+ 8 - 10
app/service/youngee_task_service/local_life_info.go

@@ -150,7 +150,7 @@ func GetLocalLifeList(r *ghttp.Request) *TalentHttpResult {
 		//稿费的展示情况
 		allFeeFormNoFee := true // 假设都是无费置换
 		var hasSelfPrice bool
-		var minOffer, maxOffer int
+		var minOffer, maxOffer float64
 
 		for _, strategy := range local.RecruitStrategys {
 			if strategy.FeeForm != 1 { // 如果存在非无费置换的策略
@@ -214,21 +214,19 @@ func GetLocalLifeList(r *ghttp.Request) *TalentHttpResult {
 func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
 	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
 	local_id := r.GetQueryString("local_id", "")
-	s_local_id := r.GetQueryString("s_local_id", "")
-	localInfoSupplier := youngee_talent_model.LocalInfoSupplier{}
-	if s_local_id != "" {
+	s_local_id := r.GetQueryInt("s_local_id", 0)
+	var localInfoSupplier *youngee_talent_model.LocalInfoSupplier
+	if s_local_id != 0 {
 		// 来自服务商
-		err := g.DB().Model("younggee_s_local__info").Where("s_local_id=?", s_local_id).Scan(&localInfoSupplier)
+		err := g.DB().Model("younggee_s_local_life_info").Where("s_local_id=?", s_local_id).Scan(&localInfoSupplier)
 		if err != nil {
 			fmt.Println("projectInfoSupplier err:", err.Error())
 		}
+		local_id = localInfoSupplier.LocalID //获取local_id
 	}
 	// Redis key
 	loalViewKey := "local:view:" + local_id
 	userViewedKey := "user:viewed:" + tid + ":" + local_id
-	if local_id == "" {
-		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
-	}
 	//在redis中增加浏览量
 	// Check if the user has already viewed the product
 	//DoVar方便进行类型转化
@@ -359,7 +357,7 @@ func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
 		}
 		LocalDetail.Enterprise = enterprise
 	}
-	if s_local_id != "" {
+	if s_local_id != 0 {
 		// 来自服务商
 		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
 		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", localInfoSupplier.SupplierID).Scan(&younggeeSupplier)
@@ -367,7 +365,7 @@ func GetLocalLifeDetail(r *ghttp.Request) *TalentHttpResult {
 			return &TalentHttpResult{Code: -3, Msg: err.Error()}
 		}
 		LocalDetail.YounggeeSupplier = younggeeSupplier
-		LocalDetail.LocalInfoSupplier = &localInfoSupplier
+		LocalDetail.LocalInfoSupplier = localInfoSupplier
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: LocalDetail}

+ 259 - 54
app/service/youngee_task_service/project_info.go

@@ -163,7 +163,7 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 		//稿费的展示情况
 		allFeeFormNoFee := true // 假设都是无费置换
 		var hasSelfPrice bool
-		var minOffer, maxOffer int
+		var minOffer, maxOffer float64
 
 		for _, strategy := range project.RecruitStrategys {
 			if strategy.FeeForm != 1 { // 如果存在非无费置换的策略
@@ -231,6 +231,203 @@ func GetProjectInfoList(r *ghttp.Request) *TalentHttpResult {
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: projectInfoList}
 }
 
+func getViewNum(projectViewKey string, userViewedKey string) int {
+	// 在redis中增加浏览量
+	viewed, err := g.Redis().DoVar("GET", userViewedKey)
+	if err != nil {
+		glog.Error(err)
+		return 0
+	}
+	if viewed.IsNil() {
+		_, err = g.Redis().Do("INCR", projectViewKey)
+		if err != nil {
+			glog.Error(err)
+			return 0
+		}
+		_, err = g.Redis().Do("SET", userViewedKey, true)
+		if err != nil {
+			glog.Error(err)
+			return 0
+		}
+	}
+	viewNum, err := g.Redis().DoVar("GET", projectViewKey)
+	if err != nil {
+		fmt.Println("获取浏览量失败")
+		return 0
+	}
+	return viewNum.Int()
+}
+
+//
+//// 获取单个项目详情service
+//func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
+//	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)
+//	//列表页面进入
+//	pid := r.GetQueryString("project_id", "")
+//
+//	//扫码进入:1. 商家端的码 2. 服务商的码
+//	s_project_id := r.GetQueryInt("s_project_id", 0)
+//	var projectViewKey = ""
+//	var userViewedKey = ""
+//	//达人类型转string
+//	var talentCategory []*youngee_talent_model.YounggeeTalentCategory
+//	err := g.DB().Model("younggee_talent_category").Scan(&talentCategory)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -1, Msg: err.Error()}
+//	}
+//	// 创建一个数字到汉字的映射
+//	categoryMap := make(map[string]string)
+//	for _, category := range talentCategory {
+//		categoryMap[fmt.Sprint(category.Id)] = category.Category
+//	}
+//
+//	if s_project_id != 0 { //服务商
+//		var SProjectDetail *youngee_talent_model.ProjectInfoSupplier
+//		err := g.DB().Model("younggee_s_project_info").WithAll().Where("s_project_id", s_project_id).Scan(&SProjectDetail)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//		}
+//
+//		//浏览量统计
+//		projectViewKey = "project:view:s_" + gconv.String(s_project_id)
+//		userViewedKey = "user:viewed:" + gconv.String(tid) + ":s_" + gconv.String(s_project_id)
+//		viewNum := getViewNum(projectViewKey, userViewedKey)
+//		SProjectDetail.ProjectDetail.ViewNum = viewNum
+//		//浏览历史
+//		currentDate := gtime.Now().Format("Ymd")
+//		redisBrowseKey := fmt.Sprintf("browseProject:%s:%s", currentDate, tid)
+//		fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
+//		// 将 project_id:s_project_id  添加到 Redis 中的 SET 中,因为project_id可以对应多个s_project_id(被多个服务商接手)
+//		// 组合 pid 和 s_project_id
+//		browseItem := fmt.Sprintf("%s:%s", pid, s_project_id)
+//		_, err = g.Redis().Do("SADD", redisBrowseKey, browseItem)
+//		if err != nil {
+//			return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}
+//		}
+//		_, err = g.Redis().Do("EXPIRE", redisBrowseKey, 7*24*60*60) // 7 天的秒数
+//		if err != nil {
+//			return &TalentHttpResult{Code: 0, Msg: "Redis 设置过期时间失败"}
+//		}
+//
+//		//达人类型转化
+//		talentTypes := strings.Split(SProjectDetail.ProjectDetail.TalentType, ",")
+//		var result []string
+//		for _, t := range talentTypes {
+//			if name, ok := categoryMap[t]; ok {
+//				result = append(result, name)
+//			}
+//		}
+//		resultStr := strings.Join(result, ",")
+//		SProjectDetail.ProjectDetail.TalentType = resultStr
+//
+//		//违约
+//		if SProjectDetail.ProjectType == 1 { //公开任务
+//			one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", SProjectDetail.ProjectDetail.AutoDefaultId).One()
+//			if err != nil {
+//				return &TalentHttpResult{Code: 0, Msg: err.Error()}
+//			} else {
+//				SProjectDetail.ProjectDetail.DraftBreakPercent = one["sketch_replace_not_upload"].Int()
+//				SProjectDetail.ProjectDetail.LinkBreakPercent = one["link_replace_not_upload"].Int()
+//				SProjectDetail.ProjectDetail.DataBreakPercent = one["data_replace_not_upload"].Int()
+//			}
+//			one2, err2 := g.DB().Model("info_auto_task").Where("auto_task_id=?", SProjectDetail.ProjectDetail.AutoTaskId).One()
+//			if err2 != nil {
+//				return &TalentHttpResult{Code: 0, Msg: "one2 is nil"}
+//			} else {
+//				SProjectDetail.ProjectDetail.DraftBreakTime = one2["draft_default"].Int()
+//				SProjectDetail.ProjectDetail.LinkBreakTime = one2["link_breach"].Int()
+//				SProjectDetail.ProjectDetail.DataBreakTime = one2["case_close_default"].Int()
+//			}
+//		}
+//
+//		//填充收藏信息
+//		collectionInfo := []youngee_talent_model.ProjectCollection{}
+//		err = g.DB().Model("younggee_project_collect_info").Where("project_id=? and talent_id = ?", SProjectDetail.ProjectID, tid).Scan(&collectionInfo)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -1, Msg: err.Error()}
+//		}
+//		if len(collectionInfo) != 0 && collectionInfo[0].Deleted == 0 {
+//			SProjectDetail.ProjectDetail.IsCollected = 1
+//		} else {
+//			SProjectDetail.ProjectDetail.IsCollected = 0
+//		}
+//		return &TalentHttpResult{Code: 0, Msg: "success", Data: SProjectDetail}
+//
+//	} else { //商家
+//		var ProjectDetail *youngee_talent_model.ProjectDetail
+//		err := g.DB().Model("project_info").WithAll().Where("project_id", pid).Scan(&ProjectDetail)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//		}
+//
+//		//浏览量统计
+//		projectViewKey = "project:view:" + pid
+//		userViewedKey = "user:viewed:" + gconv.String(tid) + ":" + pid
+//		viewNum := getViewNum(projectViewKey, userViewedKey)
+//		ProjectDetail.ViewNum = viewNum
+//		//浏览历史
+//		currentDate := gtime.Now().Format("Ymd")
+//		redisBrowseKey := fmt.Sprintf("browseProject:%s:%s", currentDate, tid)
+//		fmt.Println("redis浏览记录的key为——————————", redisBrowseKey)
+//		// 将 project_id:s_project_id  添加到 Redis 中的 SET 中,因为project_id可以对应多个s_project_id(被多个服务商接手)
+//		// 组合 pid 和 s_project_id
+//		browseItem := fmt.Sprintf("%s:%s", pid, s_project_id)
+//		_, err = g.Redis().Do("SADD", redisBrowseKey, browseItem)
+//		if err != nil {
+//			return &TalentHttpResult{Code: 0, Msg: "Redis 存浏览历史数据失败"}
+//		}
+//		_, err = g.Redis().Do("EXPIRE", redisBrowseKey, 7*24*60*60) // 7 天的秒数
+//		if err != nil {
+//			return &TalentHttpResult{Code: 0, Msg: "Redis 设置过期时间失败"}
+//		}
+//
+//		//达人类型转化
+//		talentTypes := strings.Split(ProjectDetail.TalentType, ",")
+//		var result []string
+//		for _, t := range talentTypes {
+//			if name, ok := categoryMap[t]; ok {
+//				result = append(result, name)
+//			}
+//		}
+//		resultStr := strings.Join(result, ",")
+//		ProjectDetail.TalentType = resultStr
+//
+//		//违约
+//		if ProjectDetail.ProjectType == 1 { //公开任务
+//			one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", ProjectDetail.AutoDefaultId).One()
+//			if err != nil {
+//				return &TalentHttpResult{Code: 0, Msg: err.Error()}
+//			} else {
+//				ProjectDetail.DraftBreakPercent = one["sketch_replace_not_upload"].Int()
+//				ProjectDetail.LinkBreakPercent = one["link_replace_not_upload"].Int()
+//				ProjectDetail.DataBreakPercent = one["data_replace_not_upload"].Int()
+//			}
+//			one2, err2 := g.DB().Model("info_auto_task").Where("auto_task_id=?", ProjectDetail.AutoTaskId).One()
+//			if err2 != nil {
+//				return &TalentHttpResult{Code: 0, Msg: "one2 is nil"}
+//			} else {
+//				ProjectDetail.DraftBreakTime = one2["draft_default"].Int()
+//				ProjectDetail.LinkBreakTime = one2["link_breach"].Int()
+//				ProjectDetail.DataBreakTime = one2["case_close_default"].Int()
+//			}
+//		}
+//
+//		//填充收藏信息
+//		collectionInfo := []youngee_talent_model.ProjectCollection{}
+//		err = g.DB().Model("younggee_project_collect_info").Where("project_id=? and talent_id = ?", pid, tid).Scan(&collectionInfo)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -1, Msg: err.Error()}
+//		}
+//		if len(collectionInfo) != 0 && collectionInfo[0].Deleted == 0 { //有数据  且   没取消收藏
+//			ProjectDetail.IsCollected = 1
+//		} else {
+//			ProjectDetail.IsCollected = 0 //没数据  或  有数据但取消了收藏
+//		}
+//		return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
+//	}
+//
+//}
+
 // 获取单个项目详情service
 func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	g.Log().Info("This is an GetProjectDetail message")
@@ -266,6 +463,14 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	for _, category := range talentCategory {
 		categoryMap[fmt.Sprint(category.Id)] = category.Category
 	}
+	if s_project_id != 0 { //服务商
+		var SProjectDetail *youngee_talent_model.ProjectInfoSupplier
+		err = g.DB().Model("younggee_s_project_info").WithAll().Where("s_project_id", s_project_id).Scan(&SProjectDetail)
+		if err != nil {
+			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+		}
+		pid = SProjectDetail.ProjectID //获取商家端的pid
+	}
 	err = g.DB().Model("project_info").WithAll().Where("project_id", pid).Scan(&ProjectDetail)
 	if err != nil {
 		return &TalentHttpResult{Code: -3, Msg: err.Error()}
@@ -387,59 +592,59 @@ func GetProjectDetail(r *ghttp.Request) *TalentHttpResult {
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
 }
 
-func GetProjectDetailFromBrowse(r *ghttp.Request) *TalentHttpResult {
-	//从redis的 key--》browseProject:currentDate:tid中获取对应的  project_id:s_project_id
-
-	pid := r.GetQueryInt("project_id", 0)
-	enterprise_id := r.GetQueryString("enterprise_id", "") //来自商家
-	s_project_id := r.GetQueryString("s_project_id", "")
-	projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
-	if s_project_id != "" {
-		// 来自服务商
-		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
-		if err != nil {
-			fmt.Println("projectInfoSupplier err:", err.Error())
-		}
-	}
-
-	if pid == 0 {
-		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
-	}
-
-	var ProjectDetail *youngee_talent_model.ProjectDetail
-	err := g.DB().Model("project_info").WithAll().Where("project_id", pid).Scan(&ProjectDetail)
-	if err != nil {
-		return &TalentHttpResult{Code: -3, Msg: err.Error()}
-	}
-	//违约
-	one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", ProjectDetail.AutoDefaultId).One()
-	one2, err := g.DB().Model("info_auto_task").Where("auto_task_id=?", ProjectDetail.AutoTaskId).One()
-	ProjectDetail.DraftBreakPercent = one["sketch_replace_not_upload"].Int()
-	ProjectDetail.LinkBreakPercent = one["link_replace_not_upload"].Int()
-	ProjectDetail.DataBreakPercent = one["data_replace_not_upload"].Int()
-	ProjectDetail.DraftBreakTime = one2["draft_default"].Int()
-	ProjectDetail.DraftBreakTime = one2["link_breach"].Int()
-	ProjectDetail.DraftBreakTime = one2["case_close_default"].Int()
-
-	if s_project_id != "" { // 来自服务商
-		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
-		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
-		if err != nil {
-			return &TalentHttpResult{Code: -3, Msg: err.Error()}
-		}
-		ProjectDetail.YounggeeSupplier = younggeeSupplier
-		ProjectDetail.ProjectInfoSupplier = &projectInfoSupplier
-	} else { //project来自商家
-		var enterprise *youngee_talent_model.Enterprise
-		err = g.DB().Model("enterprise").WithAll().Where("enterprise_id", enterprise_id).Scan(&enterprise)
-		if err != nil {
-			return &TalentHttpResult{Code: -3, Msg: err.Error()}
-		}
-		ProjectDetail.Enterprise = enterprise
-	}
-
-	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
-}
+//func GetProjectDetailFromBrowse(r *ghttp.Request) *TalentHttpResult {
+//	//从redis的 key--》browseProject:currentDate:tid中获取对应的  project_id:s_project_id
+//
+//	pid := r.GetQueryInt("project_id", 0)
+//	enterprise_id := r.GetQueryString("enterprise_id", "") //来自商家
+//	s_project_id := r.GetQueryString("s_project_id", "")
+//	projectInfoSupplier := youngee_talent_model.ProjectInfoSupplier{}
+//	if s_project_id != "" {
+//		// 来自服务商
+//		err := g.DB().Model("younggee_s_project_info").Where("s_project_id=?", s_project_id).Scan(&projectInfoSupplier)
+//		if err != nil {
+//			fmt.Println("projectInfoSupplier err:", err.Error())
+//		}
+//	}
+//
+//	if pid == 0 {
+//		return &TalentHttpResult{Code: -2, Msg: "parse param error"}
+//	}
+//
+//	var ProjectDetail *youngee_talent_model.ProjectDetail
+//	err := g.DB().Model("project_info").WithAll().Where("project_id", pid).Scan(&ProjectDetail)
+//	if err != nil {
+//		return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//	}
+//	//违约
+//	one, err := g.DB().Model("info_auto_default_handle").Where("auto_default_id=?", ProjectDetail.AutoDefaultId).One()
+//	one2, err := g.DB().Model("info_auto_task").Where("auto_task_id=?", ProjectDetail.AutoTaskId).One()
+//	ProjectDetail.DraftBreakPercent = one["sketch_replace_not_upload"].Int()
+//	ProjectDetail.LinkBreakPercent = one["link_replace_not_upload"].Int()
+//	ProjectDetail.DataBreakPercent = one["data_replace_not_upload"].Int()
+//	ProjectDetail.DraftBreakTime = one2["draft_default"].Int()
+//	ProjectDetail.DraftBreakTime = one2["link_breach"].Int()
+//	ProjectDetail.DraftBreakTime = one2["case_close_default"].Int()
+//
+//	if s_project_id != "" { // 来自服务商
+//		var younggeeSupplier *youngee_talent_model.YounggeeSupplier
+//		err = g.DB().Model("younggee_supplier").WithAll().Where("supplier_id", projectInfoSupplier.SupplierID).Scan(&younggeeSupplier)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//		}
+//		ProjectDetail.YounggeeSupplier = younggeeSupplier
+//		ProjectDetail.ProjectInfoSupplier = &projectInfoSupplier
+//	} else { //project来自商家
+//		var enterprise *youngee_talent_model.Enterprise
+//		err = g.DB().Model("enterprise").WithAll().Where("enterprise_id", enterprise_id).Scan(&enterprise)
+//		if err != nil {
+//			return &TalentHttpResult{Code: -3, Msg: err.Error()}
+//		}
+//		ProjectDetail.Enterprise = enterprise
+//	}
+//
+//	return &TalentHttpResult{Code: 0, Msg: "success", Data: ProjectDetail}
+//}
 
 func SignUpProjKuaishouList(r *ghttp.Request) *TalentHttpResult {
 	tid, _ := utils.SessionTalentInfo.GetTalentIdFromSession(r)

+ 1 - 2
app/service/youngee_task_service/task_info.go

@@ -1009,7 +1009,6 @@ func SignUpTaskWithAccount(r *ghttp.Request) *TalentHttpResult {
 			if strategy.FeeForm == 3 {   //自报价
 				ServiceChargePrice = signTaskInfo.Offer * strategy.ServiceRate * 0.01
 				SupporPricer = signTaskInfo.Offer * (1 + strategy.ServiceRate*0.01)
-
 			} else if strategy.FeeForm == 2 { //一口价
 				ServiceChargePrice = strategy.ServiceCharge
 				SupporPricer = signTaskInfo.Offer
@@ -1196,7 +1195,7 @@ func SignUpTaskWithAccount(r *ghttp.Request) *TalentHttpResult {
 		return nil
 	})
 	if err != nil {
-		return &TalentHttpResult{Code: -18, Msg: "add Task data failed"}
+		return &TalentHttpResult{Code: -18, Msg: "报名失败,达人已报名过该任务", Data: err.Error()}
 	}
 
 	return &TalentHttpResult{Code: 0, Msg: "success", Data: newTaskId}

+ 17 - 8
app/service/youngee_task_service/task_logistics.go

@@ -142,13 +142,20 @@ func GetTaskLogisticsList(r *ghttp.Request) *TalentHttpResult {
 
 		// 遍历 task_id 查询详情
 		for _, taskId := range taskIds {
-
 			//定义name、photo、price、accountInfo
 			var TaskName string
 			var TaskPhoto string
 			var TaskPrice float64
 			var AccountInfo *youngee_talent_model.KuaishouUserInfo
 			var SourceType int
+			var logisticInfo *model.YoungeeTaskLogistics
+			//获取物流信息
+			if tabKey == 2 || tabKey == 3 {
+				err := g.Model("youngee_task_logistics").Where("task_id = ?", taskId).Scan(&logisticInfo)
+				if err != nil {
+					return &TalentHttpResult{Code: -1, Msg: "Get logistics info failed"}
+				}
+			}
 			// 根据任务类型查询对应的任务详情表
 			switch taskType {
 			case 1: // 带货任务
@@ -181,13 +188,15 @@ func GetTaskLogisticsList(r *ghttp.Request) *TalentHttpResult {
 			}
 			// 组装任务详情
 			task := &youngee_talent_model.YoungeeGeneralTaskInfo{
-				TalentId:    tid,
-				TaskName:    TaskName,    // 任务名称
-				TaskPhoto:   TaskPhoto,   // 任务图片
-				TaskPrice:   TaskPrice,   // 任务价格
-				AccountInfo: AccountInfo, // 账号信息
-				SourceType:  SourceType,  // 1公开,2种草
-				TaskType:    taskType,    //1.带货 2.种草 3.本地生活
+				TalentId:     tid,
+				TaskId:       taskId,      // 任务ID
+				TaskName:     TaskName,    // 任务名称
+				TaskPhoto:    TaskPhoto,   // 任务图片
+				TaskPrice:    TaskPrice,   // 任务价格
+				AccountInfo:  AccountInfo, // 账号信息
+				SourceType:   SourceType,  // 1公开,2种草
+				TaskType:     taskType,    //1.带货 2.种草 3.本地生活
+				LogisticInfo: logisticInfo,
 			}
 			taskList = append(taskList, task)
 		}

BIN
bin/main


BIN
bin/v4.1.9/linux_amd64/youngmini_server