Xingyu Xian пре 2 месеци
родитељ
комит
677c670082

+ 11 - 0
db/product_photo.go

@@ -43,3 +43,14 @@ func GetStorePhotoByStoreID(ctx context.Context, storeId int) ([]gorm_model.Youn
 	}
 	return productPhotos, nil
 }
+
+// GetTeamPhotoByStoreID 根据团购ID查找团购图片信息
+func GetTeamPhotoByStoreID(ctx context.Context, teamId int) ([]gorm_model.YounggeeProductPhoto, error) {
+	db := GetReadDB(ctx)
+	productPhotos := []gorm_model.YounggeeProductPhoto{}
+	err := db.Where("team_buying_id = ?", teamId).Find(&productPhotos).Error
+	if err != nil {
+		return nil, err
+	}
+	return productPhotos, nil
+}

+ 22 - 0
db/recruit_strategy.go

@@ -67,3 +67,25 @@ func GetRecruitStrategyByProjectId(ctx context.Context, projectId string) ([]gor
 	}
 	return RecruitStrategys, nil
 }
+
+func GetRecruitStrategyBySProjectId(ctx context.Context, sProjectId int) ([]gorm_model.RecruitStrategy, error) {
+	db := GetReadDB(ctx)
+	RecruitStrategys := []gorm_model.RecruitStrategy{}
+	err := db.Model(gorm_model.RecruitStrategy{}).Where("s_project_id = ? AND strategy_type = ?", sProjectId, 2).Scan(&RecruitStrategys).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[logistics db] call GetRecruitStrategyByProjectId error,err:%+v", err)
+		return nil, err
+	}
+	return RecruitStrategys, nil
+}
+
+func GetRecruitStrategyBySLocalId(ctx context.Context, sLocalId int) ([]gorm_model.RecruitStrategy, error) {
+	db := GetReadDB(ctx)
+	RecruitStrategys := []gorm_model.RecruitStrategy{}
+	err := db.Model(gorm_model.RecruitStrategy{}).Where("s_local_id = ? AND strategy_type = ?", sLocalId, 2).Scan(&RecruitStrategys).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[logistics db] call GetRecruitStrategyByProjectId error,err:%+v", err)
+		return nil, err
+	}
+	return RecruitStrategys, nil
+}

+ 36 - 0
db/s_local_life.go

@@ -63,3 +63,39 @@ func GetLocalLifeDetail(ctx context.Context, localLifeId string) (*gorm_model.Yo
 	}
 	return localLifeInfo, nil
 }
+
+// CreateSLocalLife 创建服务商加入商单后的本地生活详情
+func CreateSLocalLife(ctx context.Context, newSLocal *gorm_model.YounggeeSLocalLifeInfo) error {
+	db := GetWriteDB(ctx)
+	err := db.Create(&newSLocal).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// FindBriefByLocalId 根据localId查找Brief
+func FindBriefByLocalId(ctx context.Context, localId string) ([]gorm_model.LocalLifeBrief, error) {
+	db := GetReadDB(ctx)
+	var sProjectInfo []gorm_model.LocalLifeBrief
+	// 1. 根据服务商种草任务id过滤
+	err := db.Model(gorm_model.LocalLifeBrief{}).Where("local_id = ?", localId).Find(&sProjectInfo).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetSProjectDetail] error query mysql, err:%+v", err)
+		return nil, err
+	}
+	return sProjectInfo, nil
+}
+
+// FindMaterialByLocalId 根据localId查找Material
+func FindMaterialByLocalId(ctx context.Context, localId string) ([]gorm_model.LocalLifeMaterial, error) {
+	db := GetReadDB(ctx)
+	var sProjectInfo []gorm_model.LocalLifeMaterial
+	// 1. 根据服务商种草任务id过滤
+	err := db.Model(gorm_model.LocalLifeMaterial{}).Where("local_id = ?", localId).Find(&sProjectInfo).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetSProjectDetail] error query mysql, err:%+v", err)
+		return nil, err
+	}
+	return sProjectInfo, nil
+}

+ 12 - 0
db/task.go

@@ -399,6 +399,18 @@ func CountTaskNumByStrategyId(ctx context.Context, projectId string, strategyId
 	return taskNum, nil
 }
 
+// CountTaskNumByStrategyIdAndSProjectId 根据招募策略查找对应的种草子任务数量
+func CountTaskNumByStrategyIdAndSProjectId(ctx context.Context, sProjectId int, strategyId int64) (int64, error) {
+	db := GetReadDB(ctx)
+	var taskNum int64
+	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("s_project_id = ? and strategy_id = ?", sProjectId, strategyId).Count(&taskNum).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[CreateMessageByTask] error read mysql, err:%+v", err)
+		return 0, err
+	}
+	return taskNum, nil
+}
+
 // GetTaskByTaskId 根据task_id查询子任务详细信息
 func GetTaskByTaskId(ctx context.Context, taskId string) (*gorm_model.YoungeeTaskInfo, error) {
 	db := GetReadDB(ctx)

+ 18 - 0
db/team_buying.go

@@ -0,0 +1,18 @@
+package db
+
+import (
+	"context"
+	"youngee_b_api/model/gorm_model"
+)
+
+// FindTeamById 根据团购ID查找门店信息
+func FindTeamById(ctx context.Context, teamId int) (*gorm_model.YounggeeTeamBuying, error) {
+	db := GetReadDB(ctx)
+	var teamInfo *gorm_model.YounggeeTeamBuying
+	whereCondition := gorm_model.YounggeeTeamBuying{TeamBuyingId: teamId}
+	err := db.Model(gorm_model.YounggeeTeamBuying{}).Where(whereCondition).Find(&teamInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return teamInfo, nil
+}

+ 2 - 3
handler/add_to_list.go

@@ -1,7 +1,6 @@
 package handler
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/service"
@@ -45,13 +44,13 @@ func (h *AddToListHandler) run() {
 		h.resp.Status = 50000
 		h.resp.Message = "加入商单失败"
 		h.resp.Data = createSProjectErr
-		fmt.Println(createSProjectErr)
+		// fmt.Println(createSProjectErr)
 	}
 
 	// 2. 创建合作关系
 	createCooperateErr := service.Cooperate.CreateCooperate(h.ctx, h.req.EnterpriseId, h.req.SupplierId, h.req.SubAccountId)
 	if createCooperateErr != nil {
-		fmt.Println(createCooperateErr)
+		// fmt.Println(createCooperateErr)
 		h.resp.Status = 50000
 		h.resp.Message = "创建合作关系失败"
 		h.resp.Data = createCooperateErr

+ 17 - 0
handler/local_life_add_to_list.go

@@ -3,6 +3,7 @@ package handler
 import (
 	"github.com/gin-gonic/gin"
 	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
 )
 
 func WrapLocalLifeAddToListHandler(ctx *gin.Context) {
@@ -34,7 +35,23 @@ func (h *LocalLifeAddToListHandler) getResponse() interface{} {
 	return h.resp
 }
 func (h *LocalLifeAddToListHandler) run() {
+	// 1. 加入商单
+	createErr := service.SLcoalLife.CreateSLocalLife(h.ctx, h.req)
+	if createErr != nil {
+		h.resp.Status = 50000
+		h.resp.Message = "加入商单失败"
+		return
+	}
 
+	// 2. 创建合作关系
+	createCooperateErr := service.Cooperate.CreateCooperate(h.ctx, h.req.EnterpriseId, h.req.SupplierId, h.req.SubAccountId)
+	if createCooperateErr != nil {
+		h.resp.Status = 50000
+		h.resp.Message = "创建合作关系失败"
+		return
+	}
+	h.resp.Status = 20000
+	h.resp.Message = "加入商单成功"
 }
 
 func (h *LocalLifeAddToListHandler) checkParam() error {

+ 4 - 10
handler/s_local_life_detail.go

@@ -1,7 +1,6 @@
 package handler
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
@@ -18,14 +17,14 @@ func WrapShowSLocalHandler(ctx *gin.Context) {
 
 func newShowSLocalHandler(ctx *gin.Context) *ShowSLocalHandler {
 	return &ShowSLocalHandler{
-		req:  http_model.NewShowProjectRequest(),
-		resp: http_model.NewShowProjectResponse(),
+		req:  http_model.NewShowSLocalRequest(),
+		resp: http_model.NewShowSLocalResponse(),
 		ctx:  ctx,
 	}
 }
 
 type ShowSLocalHandler struct {
-	req  *http_model.ShowProjectRequest
+	req  *http_model.ShowSLocalRequest
 	resp *http_model.CommonResponse
 	ctx  *gin.Context
 }
@@ -43,12 +42,7 @@ func (h *ShowSLocalHandler) getResponse() interface{} {
 }
 
 func (h *ShowSLocalHandler) run() {
-	data := http_model.ShowProjectRequest{}
-	data = *h.req
-	//auth := middleware.GetSessionAuth(h.ctx)
-	//enterpriseID := auth.EnterpriseID
-	fmt.Printf("projectID %+v", data.ProjectID)
-	res, err := service.Project.GetPorjectDetail(h.ctx, data.ProjectID)
+	res, err := service.SLcoalLife.ShowSLocalLife(h.ctx, h.req)
 	if err != nil {
 		logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")

+ 1 - 1
model/gorm_model/local_life.go

@@ -9,7 +9,7 @@ type YounggeeLocalLifeInfo struct {
 	LocalId             string    `gorm:"column:local_id;NOT NULL"`                         // 项目id
 	LocalType           int       `gorm:"column:local_type"`                                // 项目类型,1代表公开项目,2代表定向项目
 	LocalPlatform       int       `gorm:"column:local_platform"`                            // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
-	ServiceChargeRate   string    `gorm:"column:service_charge_rate;default:0.00;NOT NULL"` // 公开服务费率
+	ServiceChargeRate   float64   `gorm:"column:service_charge_rate;default:0.00;NOT NULL"` // 公开服务费率
 	StoreId             int       `gorm:"column:store_id"`                                  // 关联门店id
 	StoreRelatedAt      time.Time `gorm:"column:store_related_at"`                          // 关联门店时间
 	TeamBuyingId        int       `gorm:"column:team_buying_id"`                            // 关联团购id

+ 89 - 0
model/gorm_model/local_life_task_info.go

@@ -0,0 +1,89 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type YoungeeLocalTaskInfo struct {
+	TaskID                 string    `gorm:"column:task_id;primary_key"`                            // 任务id
+	LocalID                string    `gorm:"column:local_id;NOT NULL"`                              // 项目id
+	TalentID               string    `gorm:"column:talent_id;NOT NULL"`                             // 达人id
+	AccountID              int       `gorm:"column:account_id;NOT NULL"`                            // 账号id
+	StrategyID             int       `gorm:"column:strategy_id"`                                    // 报名选择的招募策略id
+	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;NOT NULL"`             // 达人平台信息快照
+	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;NOT NULL"`             // 达人个人信息快照
+	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;NOT NULL"`                 // 收货地址快照
+	TaskReward             string    `gorm:"column:task_reward;NOT NULL"`                           // 达人报酬(3.0未用)
+	SettleAmount           string    `gorm:"column:settle_amount;NOT NULL"`                         // 达人实际所得(自动填充)(扣除违约扣款)
+	AllPayment             string    `gorm:"column:all_payment;NOT NULL"`                           // 企业支付(3.0未用)
+	RealPayment            string    `gorm:"column:real_payment;NOT NULL"`                          // 企业实际支付(加上服务商的服务费)(扣除违约扣款)
+	ServiceRate            int       `gorm:"column:service_rate"`                                   // 服务费率,千分之
+	ServiceCharge          string    `gorm:"column:service_charge"`                                 // 服务费
+	RealServiceCharge      string    `gorm:"column:real_service_charge"`                            // 服务商实际所得服务费(扣除违约)
+	FeeForm                int       `gorm:"column:fee_form"`                                       // 稿费形式,1,2,3分别代表产品置换、一口价、自报价
+	ErrBreakRate           int       `gorm:"column:err_break_rate;default:0;NOT NULL"`              // 未上传类型违约扣款比例,百分之
+	ScriptBreakRate        int       `gorm:"column:script_break_rate;default:0;NOT NULL"`           // 脚本上传超时违约扣款比例,百分之
+	SketchBreakRate        int       `gorm:"column:sketch_break_rate;default:0;NOT NULL"`           // 初稿上传超时违约扣款比例,百分之
+	LinkBreakRate          int       `gorm:"column:link_break_rate;default:0;NOT NULL"`             // 链接上传超时违约扣款比例,百分之
+	DataBreakRate          int       `gorm:"column:data_break_rate;default:0;NOT NULL"`             // 数据上传超时违约扣款比例,百分之
+	TaskStage              int       `gorm:"column:task_stage;NOT NULL"`                            // 任务阶段,1:已报名, 2:申请成功, 3:申请失败, 4:待预约探店, 5:预约确认中 6:预约成功  , 7:待传脚本, 8:脚本待审, 9:待传初稿, 10:初稿待审, 11:待传链接, 12:链接待审, 13:待传数据, 14:数据待审, 15:已结案, 16:解约, 17:终止合作(过渡态)
+	TaskStatus             int       `gorm:"column:task_status;default:1;NOT NULL"`                 // 商家任务状态 1待选 2已选 3落选
+	LogisticsStatus        int       `gorm:"column:logistics_status;default:1"`                     // 发货状态 1 待发货 2已发货 3 已签收
+	BookStatus             uint      `gorm:"column:book_status;default:1"`                          // 预约探店状态 1-6分别代表待预约、已预约、待修改、已修改、已通过(待探店)、已探店
+	SketchStatus           uint      `gorm:"column:sketch_status;default:1"`                        // 初稿上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	LinkStatus             uint      `gorm:"column:link_status;default:1"`                          // 链接上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	DataStatus             uint      `gorm:"column:data_status;default:1"`                          // 数据上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	CompleteStatus         int       `gorm:"column:complete_status;default:1"`                      // 结束方式 1未结束 2正常结束 3反选失败 4被解约
+	UpdateAt               time.Time `gorm:"column:update_at"`                                      // 更新时间
+	CreateDate             time.Time `gorm:"column:create_date;default:CURRENT_TIMESTAMP;NOT NULL"` // 创建时间,即报名时间
+	SelectDate             time.Time `gorm:"column:select_date"`                                    // 反选时间,即任务开始执行时间
+	DeliveryDate           time.Time `gorm:"column:delivery_date"`                                  // 发货时间
+	CompleteDate           time.Time `gorm:"column:complete_date"`                                  // 结束时间
+	WithdrawDate           time.Time `gorm:"column:withdraw_date"`                                  // 提现时间
+	CurDefaultType         int       `gorm:"column:cur_default_type"`                               // 当前违约类型 0未违约 1脚本超时违约 2脚本未上传违约 3初稿超时违约 4初稿未上传违约 5链接超时违约 6链接未上传违约 7数据超时违约 8数据未上传违约 9解约待处理 10解约
+	WithdrawStatus         int       `gorm:"column:withdraw_status;default:1"`                      // 提现状态,1-4分别代表不可提现、可提现、提现中、已提现
+	LeadTeamID             string    `gorm:"column:lead_team_id"`                                   // 作为团长的young之团id,对应younggee_talent_team中的team_id字段
+	TeamID                 string    `gorm:"column:team_id"`                                        // 作为团员的young之团id,对应younggee_talent_team中的team_id字段
+	SettleStatus           int       `gorm:"column:settle_status;default:1"`                        // 结算状态,1、2分别表示待结算、已结算
+	TeamIncome             string    `gorm:"column:team_income"`                                    // young之团团长现金收益
+	TeamPoint              int       `gorm:"column:team_point"`                                     // young之团团长积分收益
+	CurBreakAt             time.Time `gorm:"column:cur_break_at"`                                   // 当前阶段截止时间
+	SupplierID             int       `gorm:"column:supplier_id;default:0"`                          // 服务商ID
+	SupplierStatus         int       `gorm:"column:supplier_status;default:0"`                      // 服务商任务状态 0表示达人来源非服务商 1待选 2已选 3落选
+	DraftFee               string    `gorm:"column:draft_fee;default:0.00"`                         // 达人稿费,达人所见的稿费金额
+	SignedTime             time.Time `gorm:"column:signed_time"`                                    // 签收时间
+	FansNum                int       `gorm:"column:fans_num"`                                       // 粉丝数
+	VoteAvg                int       `gorm:"column:vote_avg"`                                       // 平均点赞数
+	CommitAvg              int       `gorm:"column:commit_avg"`                                     // 平均评论数
+	BOperator              string    `gorm:"column:b_operator"`                                     // 商家确定达人操作人ID
+	BOperatorType          int       `gorm:"column:b_operator_type;default:0"`                      // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	SOperator              int       `gorm:"column:s_operator;default:0"`                           // 服务商提报达人操作人ID
+	SOperatorType          int       `gorm:"column:s_operator_type;default:0"`                      // 服务商操作人类型,1服务商主账号,2服务商子账号,3管理后台
+	OpenID                 string    `gorm:"column:open_id"`                                        // 达人报名的快手唯一标识
+	SLocalLifeID           int       `gorm:"column:s_local_life_id"`                                // 服务商本地生活任务ID
+	SupportFee             string    `gorm:"column:support_fee"`                                    // 提报价格(达人自报价经过计算后,)
+	SketchMissingTime      time.Time `gorm:"column:sketch_missing_time"`                            // 未传初稿违约时间
+	SketchMissingStatus    int       `gorm:"column:sketch_missing_status;default:0"`                // 未传初稿违约状态,0无违约,1有违约
+	LinkMissingTime        time.Time `gorm:"column:link_missing_time"`                              // 未发作品违约时间
+	LinkMissingStatus      int       `gorm:"column:link_missing_status;default:0"`                  // 未发作品违约状态,0无违约,1有违约
+	DataMissingTime        time.Time `gorm:"column:data_missing_time"`                              // 未传数据违约时间
+	DataMissingStatus      int       `gorm:"column:data_missing_status;default:0"`                  // 未传数据违约状态,0无违约,1有违约
+	TerminateOperatorType  int       `gorm:"column:terminate_operator_type"`                        // 终止合作操作人类型,1商家用户,2商家子账号,3管理后台
+	TerminateOperator      string    `gorm:"column:terminate_operator"`                             // 终止合作操作人ID
+	TerminateReason        string    `gorm:"column:terminate_reason"`                               // 终止理由
+	TerminateTime          time.Time `gorm:"column:terminate_time"`                                 // 终止合作时间
+	CancelOperatorType     int       `gorm:"column:cancel_operator_type"`                           // 解约操作人类型,1商家用户,2商家子账号,3管理后台
+	CancelOperator         string    `gorm:"column:cancel_operator"`                                // 解约操作人ID
+	CancelReason           string    `gorm:"column:cancel_reason"`                                  // 解约原因
+	CancelTime             time.Time `gorm:"column:cancel_time"`                                    // 解约时间
+	PlatformID             int       `gorm:"column:platform_id;NOT NULL"`                           // 平台id
+	City                   string    `gorm:"column:city;NOT NULL"`                                  // 所在城市
+	ReserveTime            time.Time `gorm:"column:reserve_time"`                                   // 预约探店时间
+	ExploreTime            time.Time `gorm:"column:explore_time"`                                   // 探店时间
+	FinishExploreTime      time.Time `gorm:"column:finish_explore_time"`                            // 完成探店时间
+	WxNum                  string    `gorm:"column:wx_num"`                                         // 报名时填写的微信号
+}
+
+func (m *YoungeeLocalTaskInfo) TableName() string {
+	return "youngee_local_task_info"
+}

+ 1 - 0
model/gorm_model/recruit_strategy.go

@@ -26,6 +26,7 @@ type RecruitStrategy struct {
 	FinishNumber           int64   `gorm:"column:finish_number;default:0"`                        // 结案数量
 	TotalOffer             float64 `gorm:"column:total_offer;default:0"`                          // 支付合计
 	SProjectId             int     `gorm:"column:s_project_id;default:0"`                         // 服务商种草任务ID
+	SLocalId               int     `gorm:"column:s_local_id;default:0"`                           // 服务商本地生活ID
 	StrategyType           int     `gorm:"column:strategy_type;default:0"`                        // 策略类型,1为商家设置,2为服务商设置
 	QuoteRecruitStrategyId int     `gorm:"column:quote_recruit_strategy_id;default:0"`            // 服务商修改的招募策略所引用的原策略ID
 }

+ 5 - 4
model/gorm_model/s_local_life.go

@@ -9,8 +9,9 @@ type YounggeeSLocalLifeInfo struct {
 	LocalId             string    `gorm:"column:local_id"`               // 被加入商单的原本地生活ID
 	EnterpriseId        string    `gorm:"column:enterprise_id"`          // 商家ID
 	SupplierId          int       `gorm:"column:supplier_id"`            // 服务商ID
+	StoreId             int       `gorm:"column:store_id"`               // 门店ID
+	TeamBuyingId        int       `gorm:"column:team_buying_id"`         // 团购ID
 	LocalType           int       `gorm:"column:local_type"`             // 任务类型,1为公开,2为定向
-	LocalName           string    `gorm:"column:local_name"`             // 任务名称
 	TaskStatus          int       `gorm:"column:task_status"`            // 任务状态
 	LocalPlatform       int       `gorm:"column:local_platform"`         // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	TaskForm            int       `gorm:"column:task_form"`              // 任务形式,1-2分别代表线下探店,素材分发
@@ -23,9 +24,9 @@ type YounggeeSLocalLifeInfo struct {
 	ServiceCharge       float64   `gorm:"column:service_charge"`         // 服务商预估可赚服务费
 	ServiceChargeActual float64   `gorm:"column:service_charge_actual"`  // 服务商实际可赚服务费
 	OperatorType        int       `gorm:"column:operator_type"`          // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
-	SProjectStatus      string    `gorm:"column:s_project_status"`       // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
-	StrategyStatus      string    `gorm:"column:strategy_status"`        // 定向本地生活任务是否替换招募策略
-	BOperator           string    `gorm:"column:b_operator"`             // 商家发起入库邀约人
+	SLocalStatus        int       `gorm:"column:s_local_status"`         // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
+	StrategyStatus      int       `gorm:"column:strategy_status"`        // 定向本地生活任务是否替换招募策略
+	BOperator           int       `gorm:"column:b_operator"`             // 商家发起入库邀约人
 	BOperatorType       int       `gorm:"column:b_operator_type"`        // 商家发起入库邀约人类型:1主账号 2子账号
 	CreateTime          time.Time `gorm:"column:create_time"`            // 创建时间
 	CreateStrategyId    int       `gorm:"column:create_strategy_id"`     // 服务商修改服务费操作人ID

+ 44 - 32
model/http_model/show_s_local_life.go

@@ -1,46 +1,58 @@
 package http_model
 
-import "time"
+import "youngee_b_api/model/gorm_model"
 
 type ShowSLocalPhoto struct {
 	PhotoUrl string `json:"photo_url"` // 图片url
-	PhotoUid string `json:"photo_uid"`
-	FileName string `json:"name"` //文件名
+	PhotoUid string `json:"photo_uid"` // uid
+	FileName string `json:"name"`      // 文件名
 }
 
 type ShowSLocalData struct {
-	ProjectName      string                `json:"project_name"`       // 项目名称
-	ProjectStatus    string                `json:"project_status"`     // 项目状态,1-7分别代表创建中、待审核、招募中、待支付、失效、执行中、已结案
-	ProjectType      string                `json:"project_type"`       // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectPlatform  string                `json:"project_platform"`   // 项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
-	ProjectForm      string                `json:"project_form"`       // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
-	TalentType       string                `json:"talent_type"`        // 达人类型
-	RecruitDdl       time.Time             `json:"recruit_ddl"`        // 招募截止时间
-	ContentType      string                `json:"content_type"`       // 内容形式,1代表图文,2代表视频
-	ProjectDetail    string                `json:"project_detail"`     // 项目详情
-	RecruitStrategys []ShowRecruitStrategy `json:"recruit_strategys"`  // 定价策略
-	ProjectPhotos    []ShowProjectPhoto    `json:"project_photos"`     // 项目图片
-	ProductID        string                `json:"product_id"`         // 关联商品id
-	ProductInfo      string                `json:"product_info"`       // 商品信息
-	ProductPhotoInfo string                `json:"product_photo_info"` // 商品图片
-	EstimatedCost    string                `json:"estimated_cost"`     // 预估成本
-	EnterpriseID     string                `json:"enterprise_id"`      // 企业id
-	Balance          string                `json:"balance"`            // 企业余额
-	AvailableBalance string                `json:"available_balance"`  //可用余额
-	ProjectID        string                `json:"project_id"`         // 项目id
-	FailReason       string                `json:"fail_reason"`        // 失效原因
-	Phone            string                `json:"phone"`              // 联系方式
-	CreateAt         time.Time             `json:"create_at"`          // 创建时间
-	UpdateAt         time.Time             `json:"update_at"`          // 更新时间
-	SubmitAt         time.Time             `json:"submit_at"`          // 更新时间
-	PassAt           time.Time             `json:"pass_at"`            // 审核通过时间
-	FinishAt         time.Time             `json:"finish_at"`          // 结案时间
-	PayAt            time.Time             `json:"pay_at"`             // 支付时间
-	AutoFailAt       time.Time             `json:"auto_fail_at"`       // 自动失效时间
+	// 系统信息
+	SLocalId          int     `json:"s_local_id"`          // 主键ID
+	LocalId           string  `json:"local_id"`            // 被加入商单的原本地生活ID
+	LocalPlatform     int     `json:"local_platform"`      // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	TaskStatus        int     `json:"task_status"`         // 任务状态
+	CreateAt          string  `json:"create_at"`           // 创建时间
+	EnterpriseId      string  `json:"enterprise_id"`       // 商家ID
+	EnterprisePhone   string  `json:"enterprise_phone"`    // 商家用户手机号码
+	EstimatedCost     string  `json:"estimated_cost"`      // 预估成本
+	ServiceChargeRate float64 `json:"service_charge_rate"` // 公开服务费率
+
+	// 关联主体
+	StoreId              int     `json:"store_id"`                // 关联门店id
+	StoreName            string  `json:"store_name"`              // 门店名称
+	StoreCategory        string  `json:"store_category"`          // 门店类目(/分隔)
+	StoreMainPhotoUrl    string  `json:"store_main_photo_url"`    // 门店主图URL
+	StoreMainPhotoUid    string  `json:"store_main_photo_uid"`    // 门店主图uid
+	StoreMainPhotoSymbol int     `json:"store_main_photo_symbol"` // 门店主图类型
+	StoreRelatedAt       string  `json:"store_related_at"`        // 关联门店时间
+	TeamBuyingId         int     `json:"team_buying_id"`          // 关联团购id
+	TeamBuyingCategory   string  `json:"team_buying_category"`    // 团购类目(/分隔)
+	TeamBuyingName       string  `json:"team_buying_name"`        // 团购标题
+	TeamMainPhotoUrl     string  `json:"team_main_photo_url"`     // 团购主图URL
+	TeamMainPhotoUid     string  `json:"team_main_photo_uid"`     // 团购主图uid
+	TeamMainPhotoSymbol  int     `json:"team_main_photo_symbol"`  // 团购主图类型
+	TeamBuyingPrice      float64 `json:"team_buying_price"`       // 团购售价
+	TeamBuyingRelatedAt  string  `json:"team_buying_related_at"`  // 关联团购时间
+
+	// 招募要求
+	TalentType       string                 `json:"talent_type"`       // 达人类型
+	RecruitDdl       string                 `json:"recruit_ddl"`       // 招募截至时间
+	RecruitStrategys []ShowSRecruitStrategy `json:"recruit_strategys"` // 定价策略
+
+	// 执行要求
+	TaskForm      int                            `json:"task_form"`      // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType   int                            `json:"content_type"`   // 内容形式,1代表图文,2代表视频
+	TaskDetail    string                         `json:"task_detail"`    // 任务详情
+	LocalBrief    []gorm_model.LocalLifeBrief    `json:"local_brief"`    // Brief
+	LocalMaterial []gorm_model.LocalLifeMaterial `json:"local_material"` // 素材
 }
 
 type ShowSLocalRequest struct {
-	ProjectID string `json:"Project_id"` // 项目id
+	LocalId  string `json:"local_id"`   // 本地生活ID
+	SLocalId int    `json:"s_local_id"` // 服务商本地生活id
 }
 
 func NewShowSLocalRequest() *ShowSLocalRequest {

+ 7 - 4
route/init.go

@@ -188,11 +188,14 @@ func InitRoute(r *gin.Engine) {
 		l.Use(middleware.LoginAuthMiddleware)
 		l.POST("/localLife/fullLocalList", handler.WrapFullListHandler)                    // 商单广场-公开本地生活任务列表
 		l.POST("/localLife/detail", handler.WrapLocalLifeDetailHandler)                    // 本地生活任务详情
-		m.POST("/sLocalLife/addToList", handler.WrapLocalLifeAddToListHandler)             // 公开本地生活任务服务商加入商单
+		l.POST("/sLocalLife/addToList", handler.WrapLocalLifeAddToListHandler)             // 公开本地生活任务服务商加入商单
 		l.POST("/sLocalLife/fullSLocalList", handler.WrapFullSLocalListHandler)            // 商单管理-公开本地生活任务列表
-		m.POST("/sLocalLife/showSLocal", handler.WrapShowSLocalHandler)                    // 服务商本地生活任务详情
-		m.POST("/sLocalLife/taskList", handler.WrapProjectTaskListHandler)                 // 任务列表
-		m.POST("/sLocalLife/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
+		l.POST("/sLocalLife/showSLocal", handler.WrapShowSLocalHandler)                    // 服务商本地生活任务详情
+		l.POST("/sLocalLife/taskList", handler.WrapProjectTaskListHandler)                 // 任务列表
+		l.POST("/sLocalLife/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
+
+		l.POST("/localLife/specialLocalList", handler.WrapFullListHandler)            // 商单广场-公开本地生活任务列表
+		l.POST("/sLocalLife/specialAddToList", handler.WrapLocalLifeAddToListHandler) // 定向本地生活任务服务商加入商单
 	}
 
 	// 财务结算板块

+ 2 - 2
service/cooperate.go

@@ -46,11 +46,11 @@ func (*cooperate) CreateCooperate(ctx context.Context, enterpriseId string, supp
 		cooperateInfo.SOperator = supplierId
 		cooperateInfo.SOperatorType = 1
 	}
-	totol, findErr := db.FindCooperateInfoBySupplierAndEnterprise(ctx, supplierId, enterpriseId)
+	total, findErr := db.FindCooperateInfoBySupplierAndEnterprise(ctx, supplierId, enterpriseId)
 	if findErr != nil {
 		return findErr
 	}
-	if totol == 0 {
+	if total == 0 {
 		err := db.CreateCooperateInfo(ctx, cooperateInfo)
 		if err != nil {
 			return err

+ 140 - 3
service/s_local_life.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"context"
+	"github.com/issue9/conv"
 	"youngee_b_api/db"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
@@ -13,7 +14,7 @@ type sLocalLife struct {
 }
 
 // CreateSLocalLife 新建服务商加入商单后的公开本地生活
-func (*sLocalLife) CreateSLocalLife(ctx context.Context, request http_model.LocalLifeAddToListRequest) error {
+func (*sLocalLife) CreateSLocalLife(ctx context.Context, request *http_model.LocalLifeAddToListRequest) error {
 	var sLocalLifeInfo *gorm_model.YounggeeSLocalLifeInfo
 	sLocalLifeInfo = &gorm_model.YounggeeSLocalLifeInfo{}
 
@@ -24,11 +25,147 @@ func (*sLocalLife) CreateSLocalLife(ctx context.Context, request http_model.Loca
 		return localErr
 	}
 	if localLifeInfo != nil {
-		sLocalLifeInfo.LocalLifeId = localLifeInfo.LocalId
+		sLocalLifeInfo.LocalId = localLifeInfo.LocalId
 		sLocalLifeInfo.SettleNum = 0
 		sLocalLifeInfo.RecruitNum = 0
 		sLocalLifeInfo.ApplyNum = 0
-	}
+		sLocalLifeInfo.LocalType = localLifeInfo.LocalType
+		sLocalLifeInfo.LocalPlatform = localLifeInfo.LocalPlatform
+		sLocalLifeInfo.TaskStatus = localLifeInfo.TaskStatus
+		sLocalLifeInfo.StoreId = localLifeInfo.StoreId
+		sLocalLifeInfo.TeamBuyingId = localLifeInfo.TeamBuyingId
+		sLocalLifeInfo.TaskForm = localLifeInfo.TaskForm
+		sLocalLifeInfo.ContentType = localLifeInfo.ContentType
+		sLocalLifeInfo.SLocalStatus = 2
+
+		// 1.2. 填入加入商单操作人信息
+		sLocalLifeInfo.SubAccountId = request.SubAccountId
+		sLocalLifeInfo.SupplierId = request.SupplierId
+		sLocalLifeInfo.OperatorType = request.OperatorType
 
+		// 2. 入库
+		createErr := db.CreateSLocalLife(ctx, sLocalLifeInfo)
+		if createErr != nil {
+			return createErr
+		}
+	}
 	return nil
 }
+
+func (*sLocalLife) ShowSLocalLife(ctx context.Context, req *http_model.ShowSLocalRequest) (*http_model.ShowSLocalData, error) {
+	var sLocalInfo *http_model.ShowSLocalData
+	sLocalInfo = &http_model.ShowSLocalData{}
+
+	// 1. 查询系统信息
+	localInfo, localErr := db.GetLocalLifeDetail(ctx, req.LocalId)
+	if localErr != nil {
+		return nil, localErr
+	}
+	if localInfo != nil {
+		sLocalInfo.LocalId = localInfo.LocalId
+		sLocalInfo.SLocalId = req.SLocalId
+		sLocalInfo.LocalPlatform = localInfo.LocalPlatform
+		sLocalInfo.TaskStatus = localInfo.TaskStatus
+		sLocalInfo.EnterpriseId = localInfo.EnterpriseId
+		sLocalInfo.ServiceChargeRate = localInfo.ServiceChargeRate
+		sLocalInfo.EstimatedCost = localInfo.EstimatedCost
+		sLocalInfo.CreateAt = conv.MustString(localInfo.CreatedAt)
+
+		// 2. 关联主体
+		// 2.1. 门店信息
+		storeInfo, storeErr := db.FindStoreById(ctx, localInfo.StoreId)
+		if storeErr != nil {
+			return nil, storeErr
+		}
+		if storeInfo != nil {
+			sLocalInfo.StoreId = storeInfo.StoreId
+			sLocalInfo.StoreName = storeInfo.StoreName
+			sLocalInfo.StoreCategory = storeInfo.StoreCategory
+			sLocalInfo.StoreRelatedAt = conv.MustString(localInfo.StoreRelatedAt)
+
+			// 2.2. 门店图片信息
+			storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, localInfo.StoreId)
+			if storePhotoErr != nil {
+				return nil, storePhotoErr
+			}
+			if storePhotoInfo != nil {
+				for _, photo := range storePhotoInfo {
+					if photo.Symbol == 1 {
+						sLocalInfo.StoreMainPhotoSymbol = 1
+						sLocalInfo.StoreMainPhotoUrl = photo.PhotoUrl
+						sLocalInfo.StoreMainPhotoUid = photo.PhotoUid
+					}
+				}
+			}
+		}
+
+		// 2.3. 团购信息
+		teamInfo, teamErr := db.FindTeamById(ctx, localInfo.StoreId)
+		if teamErr != nil {
+			return nil, teamErr
+		}
+		if teamInfo != nil {
+			sLocalInfo.TeamBuyingId = teamInfo.StoreId
+			sLocalInfo.TeamBuyingName = teamInfo.TeamBuyingName
+			sLocalInfo.TeamBuyingCategory = teamInfo.TeamBuyingCategory
+			sLocalInfo.TeamBuyingRelatedAt = conv.MustString(localInfo.TeamBuyingRelatedAt)
+
+			// 2.4. 团购图片信息
+			teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByStoreID(ctx, localInfo.StoreId)
+			if teamPhotoErr != nil {
+				return nil, teamPhotoErr
+			}
+			if teamPhotoInfo != nil {
+				for _, photo := range teamPhotoInfo {
+					if photo.Symbol == 1 {
+						sLocalInfo.TeamMainPhotoSymbol = 1
+						sLocalInfo.TeamMainPhotoUrl = photo.PhotoUrl
+						sLocalInfo.TeamMainPhotoUid = photo.PhotoUid
+					}
+				}
+			}
+		}
+
+		// 3. 招募要求
+		sLocalInfo.TalentType = localInfo.TalentType
+		sLocalInfo.RecruitDdl = conv.MustString(localInfo.RecruitDdl)
+		recruitStrategy, recruitErr := db.GetRecruitStrategyBySLocalId(ctx, req.SLocalId)
+		if recruitErr != nil {
+			return nil, recruitErr
+		}
+		if recruitStrategy != nil {
+			for _, strategy := range recruitStrategy {
+				showStrategy := http_model.ShowSRecruitStrategy{
+					StrategyID:    strategy.StrategyID,
+					FeeForm:       strategy.FeeForm,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					Offer:         strategy.Offer,
+				}
+				sLocalInfo.RecruitStrategys = append(sLocalInfo.RecruitStrategys, showStrategy)
+			}
+		}
+
+		// 4. 执行要求
+		sLocalInfo.TaskForm = localInfo.TaskForm
+		sLocalInfo.ContentType = localInfo.ContentType
+		briefInfo, briefErr := db.FindBriefByLocalId(ctx, req.LocalId)
+		if briefErr != nil {
+			return nil, briefErr
+		}
+		if briefInfo != nil {
+			sLocalInfo.LocalBrief = briefInfo
+		}
+		materialInfo, materialErr := db.FindMaterialByLocalId(ctx, req.LocalId)
+		if materialErr != nil {
+			return nil, materialErr
+		}
+		if materialInfo != nil {
+			sLocalInfo.LocalMaterial = materialInfo
+		}
+
+	}
+
+	return sLocalInfo, nil
+}

+ 2 - 2
service/s_project.go

@@ -187,14 +187,14 @@ func (*sProject) GetSPorjectDetail(ctx context.Context, sProjectId int) (*http_m
 			sProjectData.PassAt = conv.MustString(projectInfo.PassAt)[0:19]
 
 			// 3. 取出招募策略并聚合达人数量信息
-			recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, sProjectData.ProjectID)
+			recruitStrategy, recruitErr := db.GetRecruitStrategyBySProjectId(ctx, sProjectData.SProjectId)
 			if recruitErr != nil {
 				return nil, recruitErr
 			}
 			if recruitStrategy != nil {
 				for _, strategy := range recruitStrategy {
 					// fmt.Println("recruitStrategy: ", strategy)
-					selectedNumber, countTaskErr := db.CountTaskNumByStrategyId(ctx, sProjectData.ProjectID, strategy.StrategyID)
+					selectedNumber, countTaskErr := db.CountTaskNumByStrategyIdAndSProjectId(ctx, sProjectData.SProjectId, strategy.StrategyID)
 					if countTaskErr != nil {
 						return nil, countTaskErr
 					}