Xingyu Xian пре 3 месеци
родитељ
комит
ee687cea51

+ 11 - 0
db/product_photo.go

@@ -32,3 +32,14 @@ func DeleteProductPhotoByProductID(ctx context.Context, productID int64) error {
 	}
 	return nil
 }
+
+// GetStorePhotoByStoreID 根据门店ID查找门店图片信息
+func GetStorePhotoByStoreID(ctx context.Context, storeId int) ([]gorm_model.YounggeeProductPhoto, error) {
+	db := GetReadDB(ctx)
+	productPhotos := []gorm_model.YounggeeProductPhoto{}
+	err := db.Where("store_id = ?", storeId).Find(&productPhotos).Error
+	if err != nil {
+		return nil, err
+	}
+	return productPhotos, nil
+}

+ 53 - 0
db/s_local_life.go

@@ -0,0 +1,53 @@
+package db
+
+import (
+	"context"
+	"fmt"
+	"github.com/sirupsen/logrus"
+	"reflect"
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/util"
+)
+
+// GetFullLocalLifeList 查看所有本地生活列表
+func GetFullLocalLifeList(ctx context.Context, pageSize, pageNum int32, condition *common_model.SLocalLifeCondition) ([]*gorm_model.YounggeeLocalLifeInfo, int64, error) {
+	db := GetReadDB(ctx)
+
+	// 根据带货任务状态过滤
+	db = db.Debug().Model(gorm_model.YounggeeLocalLifeInfo{}).Where("task_status = 4")
+
+	// 根据Project条件过滤
+	conditionType := reflect.TypeOf(condition).Elem()
+	conditionValue := reflect.ValueOf(condition).Elem()
+	for i := 0; i < conditionType.NumField(); i++ {
+		field := conditionType.Field(i)
+		tag := field.Tag.Get("condition")
+		value := conditionValue.FieldByName(field.Name)
+		if (tag == "local_id" || tag == "local_name") && !util.IsBlank(value) {
+			db = db.Where(fmt.Sprintf("local_id like '%%%v%%' or local_name like '%%%v%%'", value.Interface(), value.Interface()))
+		} else if tag == "updated_at" && value.Interface() != "0" {
+			db = db.Where(fmt.Sprintf("updated_at like '%s%%'", value.Interface()))
+		} else if !util.IsBlank(value) && tag != "updated_at" {
+			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		}
+	}
+
+	// 查询总数
+	var total int64
+	var fullLocals []*gorm_model.YounggeeLocalLifeInfo
+	if err := db.Count(&total).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetFullProjectList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	err := db.Order("updated_at desc").Limit(int(limit)).Offset(int(offset)).Find(&fullLocals).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetFullProjectList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	return fullLocals, total, nil
+}

+ 5 - 5
db/s_project.go

@@ -72,12 +72,12 @@ func GetSProjectDetail(ctx context.Context, sProjectId int) (*gorm_model.SProjec
 	return sProjectInfo, nil
 }
 
-// GetSSpecialProjectList 根据服务商ID和其他附加条件查询定向种草任务列表
-func GetSSpecialProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) ([]*gorm_model.SProjectInfo, int64, error) {
+// GetSpecialProjectList 根据服务商ID和其他附加条件查询定向种草任务列表
+func GetSpecialProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) ([]*gorm_model.SProjectInfo, int64, error) {
 	db := GetReadDB(ctx)
 
 	// 1. 根据服务商id过滤
-	db = db.Debug().Model(gorm_model.SProjectInfo{}).Where("supplier_id = ? and project_status <> 1", supplierId)
+	db = db.Debug().Model(gorm_model.SProjectInfo{}).Where("supplier_id = ? and project_status = 4 and project_type = 2", supplierId)
 
 	// 2. 根据SProjectCondition条件过滤
 	conditionType := reflect.TypeOf(condition).Elem()
@@ -176,8 +176,8 @@ func GetFullSProjectBillList(ctx context.Context, supplierId int, ProjectPlatfor
 	return SProjects, total, nil
 }
 
-// UpdateSProjectByProjectIdAndSupplierId 根据种草任务ID和服务商ID查找种草任务是否加入商单
-func UpdateSProjectByProjectIdAndSupplierId(ctx context.Context, projectId string, supplierId int) (int64, error) {
+// FindSProjectByProjectIdAndSupplierId 根据种草任务ID和服务商ID查找种草任务是否加入商单
+func FindSProjectByProjectIdAndSupplierId(ctx context.Context, projectId string, supplierId int) (int64, error) {
 	db := GetWriteDB(ctx)
 	whereCondition := gorm_model.SProjectInfo{
 		ProjectId:  projectId,

+ 18 - 0
db/store.go

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

+ 54 - 0
handler/full_local_life_list.go

@@ -0,0 +1,54 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/pack"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapFullListHandler(ctx *gin.Context) {
+	handler := newFullListHandler(ctx)
+	baseRun(handler)
+}
+
+func newFullListHandler(ctx *gin.Context) *FullListHandler {
+	return &FullListHandler{
+		req:  http_model.NewFullListRequest(),
+		resp: http_model.NewFullListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FullListHandler struct {
+	req  *http_model.FullListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FullListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FullListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FullListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FullListHandler) run() {
+	// enterpriseID := middleware.GetSessionAuth(h.ctx).EnterpriseID
+	condition := pack.HttpFullLocalLifeListRequestToCondition(h.req)
+	data, err := service.LocalLife.GetFullLocalLifeList(h.ctx, h.req.PageSize, h.req.PageNum, h.req.SupplierId, condition)
+	if err != nil {
+		logrus.WithContext(h.ctx).Errorf("[FullListHandler] error GetFullProjectList, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	h.resp.Data = data
+}
+func (h *FullListHandler) checkParam() error {
+	return nil
+}

+ 42 - 0
handler/local_life_add_to_list.go

@@ -0,0 +1,42 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+)
+
+func WrapLocalLifeAddToListHandler(ctx *gin.Context) {
+	handler := newLocalLifeAddToListHandler(ctx)
+	baseRun(handler)
+}
+
+func newLocalLifeAddToListHandler(ctx *gin.Context) *LocalLifeAddToListHandler {
+	return &LocalLifeAddToListHandler{
+		req:  http_model.NewLocalLifeAddToListRequest(),
+		resp: http_model.NewLocalLifeAddToListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type LocalLifeAddToListHandler struct {
+	req  *http_model.LocalLifeAddToListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *LocalLifeAddToListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *LocalLifeAddToListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *LocalLifeAddToListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *LocalLifeAddToListHandler) run() {
+
+}
+
+func (h *LocalLifeAddToListHandler) checkParam() error {
+	return nil
+}

+ 64 - 0
handler/local_life_detail.go

@@ -0,0 +1,64 @@
+package handler
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapLocalLifeDetailHandler(ctx *gin.Context) {
+	handler := newLocalLifeDetailHandler(ctx)
+	baseRun(handler)
+}
+
+func newLocalLifeDetailHandler(ctx *gin.Context) *LocalLifeDetailHandler {
+	return &LocalLifeDetailHandler{
+		req:  http_model.NewShowProjectRequest(),
+		resp: http_model.NewShowProjectResponse(),
+		ctx:  ctx,
+	}
+}
+
+type LocalLifeDetailHandler struct {
+	req  *http_model.ShowProjectRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *LocalLifeDetailHandler) getRequest() interface{} {
+	return h.req
+}
+
+func (h *LocalLifeDetailHandler) getContext() *gin.Context {
+	return h.ctx
+}
+
+func (h *LocalLifeDetailHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *LocalLifeDetailHandler) 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)
+	if err != nil {
+		logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("ShowProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功查询项目"
+	h.resp.Data = res
+}
+
+func (h *LocalLifeDetailHandler) checkParam() error {
+	return nil
+}

+ 0 - 12
handler/project_show.go

@@ -12,18 +12,6 @@ import (
 	log "github.com/sirupsen/logrus"
 )
 
-// WrapShowProjectHandler
-// @BasePath /youngee/m/
-// SendCode godoc
-// @Summary CreateProduct 创建商品
-// @Schemes
-// @Description 企业查看执行中项目
-// @Accept json
-// @Produce json
-// @Param Authorization header string true "登录TOKEN信息"
-// @Param req body http_model.ShowProjectRequest true "查看项目请求结构体"
-// @Success 200 {object} http_model.CommonResponse{data=http_model.ShowProjectData} "查看项目相应结构体"
-// @Router /project/show [post]
 func WrapShowProjectHandler(ctx *gin.Context) {
 	handler := newShowProjectHandler(ctx)
 	baseRun(handler)

+ 3 - 5
handler/special_project_list.go

@@ -43,16 +43,14 @@ func (h *SpecialProjectListHandler) getResponse() interface{} {
 
 func (h *SpecialProjectListHandler) run() {
 	condition := pack.HttpSpecialProjectRequestToCondition(h.req)
-	data, total, err := service.SProject.GetSSpecialProjectList(h.ctx, h.req.SupplierId, h.req.PageSize, h.req.PageNum, condition)
+	data, err := service.SProject.GetSpecialProjectList(h.ctx, h.req.SupplierId, h.req.PageSize, h.req.PageNum, condition)
 	if err != nil {
 		logrus.WithContext(h.ctx).Errorf("[FullProjectListHandler] error GetFullProjectList, err:%+v", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
 		return
 	}
-	var curr http_model.SpecialProjectListData
-	curr.FullProjectPreview = data
-	curr.Total = total
-	h.resp.Data = curr
+	h.resp.Status = 20000
+	h.resp.Data = data
 }
 
 func (h *SpecialProjectListHandler) checkParam() error {

+ 13 - 0
model/common_model/full_local_life_condition.go

@@ -0,0 +1,13 @@
+package common_model
+
+type SLocalLifeCondition struct {
+	LocalPlatform   int    `condition:"local_platform"`     // 本地生活平台
+	TaskForm        int    `condition:"task_form"`          // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType     int    `condition:"content_type"`       // 内容形式
+	AddToListStatus int    `condition:"add_to_list_status"` // 加入商单状态,1已加入,2未加入
+	LocalId         string `condition:"local_id"`           // 本地生活ID
+	LocalName       string `condition:"local_name"`         // 本地生活标题
+}
+
+type SSpecialLocalLifeCondition struct {
+}

+ 59 - 0
model/gorm_model/local_life.go

@@ -0,0 +1,59 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type YounggeeLocalLifeInfo struct {
+	Id                  int64     `gorm:"column:id;primary_key;AUTO_INCREMENT"`             // 本地生活表主键ID
+	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"` // 公开服务费率
+	StoreId             int       `gorm:"column:store_id"`                                  // 关联门店id
+	StoreRelatedAt      time.Time `gorm:"column:store_related_at"`                          // 关联门店时间
+	TeamBuyingId        int       `gorm:"column:team_buying_id"`                            // 关联团购id
+	TeamBuyingRelatedAt time.Time `gorm:"column:team_buying_related_at"`                    // 关联团购时间
+	PromoteBody         int       `gorm:"column:promote_body"`                              // 推广主体(1门店 2团购)
+	Donate              int       `gorm:"column:donate"`                                    // 赠送达人套餐(1有赠送 2无赠送)
+	LocalName           string    `gorm:"column:local_name"`                                // 任务标题
+	TalentType          string    `gorm:"column:talent_type"`                               // 达人类型(,分隔)
+	RecruitDdl          time.Time `gorm:"column:recruit_ddl"`                               // 招募截止时间
+	TaskForm            int       `gorm:"column:task_form"`                                 // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType         int       `gorm:"column:content_type"`                              // 内容形式,1代表图文,2代表视频
+	TaskDetail          string    `gorm:"column:task_detail"`                               // 任务详情
+	TaskStatus          int       `gorm:"column:task_status"`                               // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	EnterpriseId        string    `gorm:"column:enterprise_id"`                             // 所属企业id
+	SubAccountId        int       `gorm:"column:sub_account_id;default:0;NOT NULL"`         // 子账号id
+	OperatorType        int       `gorm:"column:operator_type"`                             // 创建者类型,1商家主账号,2商家子账号
+	ApplyNum            int       `gorm:"column:apply_num;default:0;NOT NULL"`              // 报名人数
+	RecruitNum          int       `gorm:"column:recruit_num;default:0;NOT NULL"`            // 已招募人数
+	SettleNum           int       `gorm:"column:settle_num;default:0"`                      // 结案人数
+	CreatedAt           time.Time `gorm:"column:created_at"`                                // 创建时间
+	UpdatedAt           time.Time `gorm:"column:updated_at"`                                // 修改时间
+	AutoFailAt          time.Time `gorm:"column:auto_fail_at"`                              // 失效自动处理时间
+	AutoTaskId          int       `gorm:"column:auto_task_id;default:0;NOT NULL"`           // 定时任务id
+	AutoDefaultId       int       `gorm:"column:auto_default_id;default:0;NOT NULL"`        // 违约状态id
+	FailReason          int       `gorm:"column:fail_reason"`                               // 失效原因,1、2分别表示逾期未支付、项目存在风险
+	PaymentAmount       string    `gorm:"column:payment_amount"`                            // 支付金额
+	PayAt               time.Time `gorm:"column:pay_at"`                                    // 支付时间
+	SubmitAt            time.Time `gorm:"column:submit_at"`                                 // 提交审核时间
+	PassAt              time.Time `gorm:"column:pass_at"`                                   // 审核通过时间
+	FinishAt            time.Time `gorm:"column:finish_at"`                                 // 结案时间
+	EstimatedCost       string    `gorm:"column:estimated_cost"`                            // 预估成本
+	SettlementAmount    string    `gorm:"column:settlement_amount"`                         // 结算金额
+	TotalRecruitNum     int       `gorm:"column:total_recruit_num"`                         // 此任务各策略招募人数总和
+	Tools               string    `gorm:"column:tools;NOT NULL"`                            // 工具选择,1邀约招募 2探店邀约 3审稿工具 4作品审查 5数据巡检 6结算账单(,分隔)
+	NeedReview          int       `gorm:"column:need_review;default:0;NOT NULL"`            // 待审稿
+	NeedQuality         int       `gorm:"column:need_quality;default:0;NOT NULL"`           // 待质检
+	NeedCalculate       int       `gorm:"column:need_calculate;default:0;NOT NULL"`         // 待结算
+	NeedReserve         int       `gorm:"column:need_reserve;default:0;NOT NULL"`           // 待预约
+	NeedConfirm         int       `gorm:"column:need_confirm;default:0;NOT NULL"`           // 待确认
+	NeedExplore         int       `gorm:"column:need_explore;default:0;NOT NULL"`           // 待探店
+	ExploredNum         int       `gorm:"column:explored_num;default:0;NOT NULL"`           // 已探店
+	InvoiceStatus       int       `gorm:"column:invoice_status;default:0;NOT NULL"`         // 开票状态(1开票中 2已开票)
+}
+
+func (m *YounggeeLocalLifeInfo) TableName() string {
+	return "younggee_local_life_info"
+}

+ 9 - 7
model/gorm_model/product_photo.go

@@ -1,4 +1,3 @@
-// Code generated by sql2gorm. DO NOT EDIT.
 package gorm_model
 
 import (
@@ -6,12 +5,15 @@ import (
 )
 
 type YounggeeProductPhoto struct {
-	ProductPhotoID int64     `gorm:"column:product_photo_id;primary_key;AUTO_INCREMENT"` // 商品图片id
-	PhotoUrl       string    `gorm:"column:photo_url"`                                   // 图片或视频url
-	PhotoUid       string    `gorm:"column:photo_uid"`
-	Symbol         int64     `gorm:"column:symbol"`     // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
-	ProductID      int64     `gorm:"column:product_id"` // 所属商品id
-	CreatedAt      time.Time `gorm:"column:created_at"` // 创建时间
+	ProductPhotoID   int64     `gorm:"column:product_photo_id;primary_key;AUTO_INCREMENT"` // 商品图片id
+	PhotoUrl         string    `gorm:"column:photo_url"`                                   // 图片或视频url
+	PhotoUid         string    `gorm:"column:photo_uid"`                                   // uid
+	Symbol           int64     `gorm:"column:symbol"`                                      // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
+	ProductID        int64     `gorm:"column:product_id"`                                  // 所属商品id
+	CreatedAt        time.Time `gorm:"column:created_at"`                                  // 创建时间
+	StoreID          int       `gorm:"column:store_id"`                                    // 所属门店ID
+	TeamBuyingID     int       `gorm:"column:team_buying_id"`                              // 所属团购ID
+	ProductPhotoType int       `gorm:"column:product_photo_type;default:1"`                // 图片类型:1商品,2门店,3团购
 }
 
 func (m *YounggeeProductPhoto) TableName() string {

+ 1 - 0
model/gorm_model/project.go

@@ -41,6 +41,7 @@ type ProjectInfo struct {
 	ServiceChargeRate float64    `gorm:"column:service_charge_rate"`            // 服务费率%
 	OperatorType      int        `gorm:"column:operator_type"`                  // 创建者类型,1商家主账号,2商家子账号
 	SubAccountId      int        `gorm:"column:sub_account_id"`                 // 子账号ID
+	Tools             string     `gorm:"column:tools"`                          // 工具
 }
 
 func (m *ProjectInfo) TableName() string {

+ 31 - 0
model/gorm_model/s_local_life.go

@@ -0,0 +1,31 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type YounggeeSLocalLifeInfo struct {
+	SLocalLifeId        int       `gorm:"column:s_local_life_id;primary_key"` // 主键ID
+	LocalLifeId         string    `gorm:"column:local_life_id"`               // 被加入商单的原本地生活ID
+	EnterpriseId        string    `gorm:"column:enterprise_id"`               // 商家ID
+	SupplierId          int       `gorm:"column:supplier_id"`                 // 服务商ID
+	ApplyNum            int       `gorm:"column:apply_num"`                   // 报名人数
+	RecruitNum          int       `gorm:"column:recruit_num"`                 // 已招募人数
+	SettleNum           int       `gorm:"column:settle_num;default:0"`        // 已结算人数
+	SubAccountId        int       `gorm:"column:sub_account_id"`              // 服务商子账号ID
+	ServiceCharge       string    `gorm:"column:service_charge"`              // 服务商预估可赚服务费
+	ServiceChargeActual string    `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"`                  // 商家发起入库邀约人
+	BOperatorType       int       `gorm:"column:b_operator_type"`             // 商家发起入库邀约人类型:1主账号 2子账号
+	CreateTime          time.Time `gorm:"column:create_time"`                 // 创建时间
+	CreateStrategyId    int       `gorm:"column:create_strategy_id"`          // 服务商修改服务费操作人ID
+	CreateStrategyType  string    `gorm:"column:create_strategy_type"`        // 服务商修改服务费操作人类型:1服务商主账号,2子账号
+
+}
+
+func (m *YounggeeSLocalLifeInfo) TableName() string {
+	return "younggee_s_local_life_info"
+}

+ 27 - 0
model/gorm_model/store.go

@@ -0,0 +1,27 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type Store struct {
+	StoreId            int       `gorm:"column:store_id;primary_key;AUTO_INCREMENT"` // 门店id
+	StoreName          string    `gorm:"column:store_name;NOT NULL"`                 // 门店名称
+	StoreCategory      string    `gorm:"column:store_category;NOT NULL"`             // 门店类目(/分隔)
+	StoreType          int       `gorm:"column:store_type;NOT NULL"`                 // 门店类型,1单门店,2连锁门店
+	StoreLocation      string    `gorm:"column:store_location"`                      // 门店地址
+	StoreDetail        string    `gorm:"column:store_detail"`                        // 门店特点
+	StoreLink          string    `gorm:"column:store_link"`                          // 分销链接
+	TeamNum            int       `gorm:"column:team_num;default:0;NOT NULL"`         // 包含团购套餐数
+	BelongEnterpriseId string    `gorm:"column:belong_enterprise_id"`                // 门店所属商家ID
+	IsDeleted          int       `gorm:"column:is_deleted;default:0;NOT NULL"`       // 已删除(0否 1是)
+	OperateType        int       `gorm:"column:operate_type;NOT NULL"`               // 操作人类型(1商家 2后台)
+	EnterpriseId       string    `gorm:"column:enterprise_id;NOT NULL"`              // 商家id
+	SubAccountId       int       `gorm:"column:sub_account_id;default:0;NOT NULL"`   // 商家子账号id
+	CreatedAt          time.Time `gorm:"column:created_at;NOT NULL"`                 // 创建时间
+	UpdatedAt          time.Time `gorm:"column:updated_at"`                          // 更新时间
+}
+
+func (m *Store) TableName() string {
+	return "younggee_store"
+}

+ 26 - 0
model/gorm_model/team_buying.go

@@ -0,0 +1,26 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type YounggeeTeamBuying struct {
+	TeamBuyingId       int       `gorm:"column:team_buying_id;primary_key;AUTO_INCREMENT"` // 团购id
+	StoreId            int       `gorm:"column:store_id;NOT NULL"`                         // 所属门店ID
+	TeamBuyingCategory string    `gorm:"column:team_buying_category;NOT NULL"`             // 团购类目(/分隔)
+	TeamBuyingName     string    `gorm:"column:team_buying_name;NOT NULL"`                 // 团购标题
+	TeamBuyingPrice    string    `gorm:"column:team_buying_price;NOT NULL"`                // 团购售价
+	PublicCommission   int       `gorm:"column:public_commission"`                         // 公开佣金%
+	TeamBuyingDetail   string    `gorm:"column:team_buying_detail;NOT NULL"`               // 团购详情
+	TeamBuyingLink     string    `gorm:"column:team_buying_link"`                          // 分销链接
+	IsDeleted          int       `gorm:"column:is_deleted;default:0;NOT NULL"`             // 删除(0否 1是)
+	OperateType        int       `gorm:"column:operate_type;NOT NULL"`                     // 操作人类型(1商家 2后台)
+	EnterpriseId       string    `gorm:"column:enterprise_id;NOT NULL"`                    // 商家id
+	SubAccountId       int       `gorm:"column:sub_account_id;default:0;NOT NULL"`         // 商家子账号id
+	CreatedAt          time.Time `gorm:"column:created_at;NOT NULL"`                       // 创建时间
+	UpdatedAt          time.Time `gorm:"column:updated_at"`                                // 更新时间
+}
+
+func (m *YounggeeTeamBuying) TableName() string {
+	return "younggee_team_buying"
+}

+ 50 - 0
model/http_model/full_local_life_list.go

@@ -0,0 +1,50 @@
+package http_model
+
+type FullListRequest struct {
+	PageSize        int32  `json:"page_size"`
+	PageNum         int32  `json:"page_num"`
+	SupplierId      int    `json:"supplier_id"`        // 服务商ID
+	LocalPlatform   int    `json:"local_platform"`     // 本地生活平台
+	TaskForm        int    `json:"task_form"`          // 任务形式,1-2分别
+	ContentType     int    `json:"content_type"`       // 内容形式
+	AddToListStatus int    `json:"add_to_list_status"` // 加入商单状态,1已加
+	LocalId         string `json:"local_id"`           // 本地生活ID
+	LocalName       string `json:"local_name"`         // 本地生活标题
+}
+
+type FullPreview struct {
+	LocalId            string                 `json:"local_id"`             // 本地生活ID
+	LocalName          string                 `json:"local_name"`           // 本地生活名称
+	TaskStatus         int                    `json:"task_status"`          // 本地生活状态
+	LocalPlatform      int                    `json:"local_platform"`       // 本地生活平台
+	TaskForm           int                    `json:"task_form"`            // 本地生活形式
+	LocalType          int                    `json:"local_type"`           // 本地生活类型
+	LocalContentType   int                    `json:"local_content_type"`   // 本地生活内容形式
+	RecruitStrategy    []*EasyRecruitStrategy `json:"recruit_strategy"`     // 招募策略
+	ProjectUpdated     string                 `json:"project_updated"`      // 最后操作时间
+	EstimatedCost      float64                `json:"estimated_cost"`       // 任务总预算
+	ServiceChargeRate  float64                `json:"service_charge_rate"`  // 服务费率
+	ServiceCharge      float64                `json:"service_charge"`       // 任务总服务费
+	RecruitDdl         string                 `json:"recruit_ddl"`          // 招募截至时间
+	ProductPhotoUrl    string                 `json:"product_photo_url"`    // 商品主图URL
+	ProductPhotoSymbol int64                  `json:"product_photo_symbol"` // 标志位
+	ProductPhotoUid    string                 `json:"product_photo_uid"`    // uid
+	StoreName          string                 `json:"store_name"`           // 门店名称
+	ProductPrice       float64                `json:"product_price"`        // 商品售价
+	StoreId            int                    `json:"store_id"`             // 门店ID
+	AddToListStatus    int                    `json:"add_to_list_status"`   // 加入商单状态,1已加入,2未加入
+}
+
+type FullListData struct {
+	FullPreview []*FullPreview `json:"full_local_pre_view"`
+	Total       int64          `json:"total"`
+}
+
+func NewFullListRequest() *FullListRequest {
+	return new(FullListRequest)
+}
+func NewFullListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FullListData)
+	return resp
+}

+ 17 - 0
model/http_model/local_life_add_to_list.go

@@ -0,0 +1,17 @@
+package http_model
+
+type LocalLifeAddToListRequest struct {
+	LocalLifeId  string `json:"local_life_id"`  // 待加入商单的本地生活ID
+	EnterpriseId string `json:"enterprise_id"`  // 商家ID
+	SupplierId   int    `json:"supplier_id"`    // 服务商ID
+	SubAccountId int    `json:"sub_account_id"` // 子账号ID
+	OperatorType int    `json:"operator_type"`  // 账号类型,1为主账号,2为子账号
+}
+
+func NewLocalLifeAddToListRequest() *LocalLifeAddToListRequest {
+	return new(LocalLifeAddToListRequest)
+}
+func NewLocalLifeAddToListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	return resp
+}

+ 20 - 3
model/http_model/special_project_list.go

@@ -1,6 +1,6 @@
 package http_model
 
-import "youngee_b_api/model/gorm_model"
+import "time"
 
 type SpecialProjectListRequest struct {
 	PageSize           int32  `json:"page_size"`
@@ -16,8 +16,25 @@ type SpecialProjectListRequest struct {
 }
 
 type SpecialProjectListData struct {
-	FullProjectPreview []*gorm_model.SProjectInfo `json:"s_special_project_list"`
-	Total              int64                      `json:"total"`
+	SpecialProjectInfo []*SpecialProjectResponse `json:"special_project_info"`
+	Total              int64                     `json:"total"`
+}
+
+type SpecialProjectResponse struct {
+	SProjectId         int                   `json:"s_project_id"`         // 服务商加入商单后的种草任务ID
+	ProjectPlatform    int64                 `json:"project_platform"`     // 种草任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectForm        int64                 `json:"project_form"`         // 任务形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
+	ContentType        int64                 `json:"content_type"`         // 内容形式,1代表图文,2代表视频
+	SProjectStatus     int                   `json:"s_project_status"`     // 服务商种草任务状态,1待确认,2已确认,3已拒绝
+	CreateTime         *time.Time            `json:"create_time"`          // 创建时间
+	RecruitStrategy    []EasyRecruitStrategy `json:"recruit_strategy"`     // 招募策略
+	ProductPhotoUrl    string                `json:"product_photo_url"`    // 商品主图URL
+	ProductPhotoSymbol int64                 `json:"product_photo_symbol"` // 标志位
+	ProductPhotoUid    string                `json:"product_photo_uid"`    // uid
+	ProductName        string                `json:"product_name"`         // 商品名称
+	ProductId          int64                 `json:"product_id"`           // 商品ID
+	ProductPrice       float64               `json:"product_price"`        // 商品售价
+	Tools              string                `json:"tools"`                // 工具选择,1邀约招募 2样品物流 3审稿工具 4作品审查 5数据巡检 6结算账单(,分隔)
 }
 
 func NewSpecialProjectListRequest() *SpecialProjectListRequest {

+ 17 - 0
pack/full_local_life_list.go

@@ -0,0 +1,17 @@
+package pack
+
+import (
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/http_model"
+)
+
+func HttpFullLocalLifeListRequestToCondition(req *http_model.FullListRequest) *common_model.SLocalLifeCondition {
+	return &common_model.SLocalLifeCondition{
+		LocalPlatform:   req.LocalPlatform,   // 本地生活平台
+		TaskForm:        req.TaskForm,        // 任务形式,1-2分别代表线下探店,素材分发
+		ContentType:     req.ContentType,     // 内容形式
+		AddToListStatus: req.AddToListStatus, // 加入商单状态,1已加入,2未加入
+		LocalId:         req.LocalId,         // 本地生活ID
+		LocalName:       req.LocalName,       // 本地生活标题
+	}
+}

+ 6 - 3
route/init.go

@@ -54,7 +54,8 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/sProject/fullProjectList", handler.WrapFullProjectListHandler)          // 商单广场-公开种草任务列表
 		m.POST("/sProject/sProjectList", handler.WrapSProjectListHandler)                // 商单管理-服务商商单列表
 		m.POST("/sProject/addToList", handler.WrapAddToListHandler)                      // 公开种草任务服务商加入商单
-		m.POST("/sProject/showSProject", handler.WrapShowSProjectHandler)                // 展示选中的服务商种草任务内容
+		m.POST("/sProject/showProject", handler.WrapShowProjectHandler)                  // 种草任务内容
+		m.POST("/sProject/showSProject", handler.WrapShowSProjectHandler)                // 服务商种草任务内容
 		m.POST("/sProject/product/find", handler.WrapFindProductHandler)                 // 查找单个产品
 		m.POST("/sProject/projectStrategy", handler.WrapProjectStrategyHandler)          // 招募策略查询
 		m.POST("/sProject/taskList", handler.WrapProjectTaskListHandler)                 // 任务列表
@@ -65,7 +66,7 @@ func InitRoute(r *gin.Engine) {
 		// 服务商版定向种草接口
 		m.POST("/sProject/specialList", handler.WrapSpecialProjectListHandler)            // 商单广场 - 定向种草任务列表
 		m.POST("/sProject/specialAddToList", handler.WrapSpecialSProjectAddToListHandler) // 定向种草任务加入商单 (同意/拒绝定向邀约)
-		m.POST("/sProject/specialAddStrategy", handler.WrapSpecialAddStrategyHandler)     // 种草任务添加招募策略
+		m.POST("/sProject/specialAddStrategy", handler.WrapSpecialAddStrategyHandler)     // 定向种草任务添加招募策略
 
 		// 下面接口都是商家端遗留
 		m.POST("/project/create", handler.WrapCreateProjectHandler)                          // 创建项目
@@ -184,7 +185,9 @@ func InitRoute(r *gin.Engine) {
 	l := r.Group("/youngee/l")
 	{
 		l.Use(middleware.LoginAuthMiddleware)
-		//l.POST("/locallife/fullList", handler.WrapFullListHandler)
+		l.POST("/localLife/fullList", handler.WrapFullListHandler)             // 商单广场-公开本地生活任务列表
+		l.POST("/localLife/detail", handler.WrapLocalLifeDetailHandler)        // 本地生活任务详情
+		m.POST("/sLocalLife/addToList", handler.WrapLocalLifeAddToListHandler) // 公开本地生活任务服务商加入商单
 	}
 
 	// 财务结算板块

+ 99 - 0
service/local_life.go

@@ -0,0 +1,99 @@
+package service
+
+import (
+	"context"
+	"fmt"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/db"
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/http_model"
+)
+
+var LocalLife *localLife
+
+type localLife struct {
+}
+
+func (*localLife) GetFullLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SLocalLifeCondition) (*http_model.FullListData, error) {
+
+	// 1. 查询本地生活任务基本信息
+	fullLocals, total, err := db.GetFullLocalLifeList(ctx, pageSize, pageNum, condition)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
+		return nil, err
+	}
+	var fullLocalData *http_model.FullListData
+	fullLocalData = &http_model.FullListData{}
+	fullLocalData.Total = total
+	for _, fullLocal := range fullLocals {
+		var fullLocalPreview *http_model.FullPreview
+		fullLocalPreview = &http_model.FullPreview{}
+		fullLocalPreview.LocalId = fullLocal.LocalId
+		fullLocalPreview.LocalName = fullLocal.LocalName
+		fullLocalPreview.TaskStatus = fullLocal.TaskStatus
+		fullLocalPreview.LocalPlatform = fullLocal.LocalPlatform
+		fullLocalPreview.TaskForm = fullLocal.TaskForm
+		fullLocalPreview.LocalType = fullLocal.LocalType
+		fullLocalPreview.LocalContentType = fullLocal.ContentType
+		fullLocalData.FullPreview = append(fullLocalData.FullPreview, fullLocalPreview)
+	}
+
+	// 2. 查询本地生活补充信息:门店信息,招募策略
+	for _, project := range fullLocalData.FullPreview {
+
+		// 2.1. 门店信息
+		storeInfo, productErr := db.FindStoreById(ctx, project.StoreId)
+		if productErr != nil {
+			return nil, productErr
+		}
+		if storeInfo != nil {
+			project.StoreId = storeInfo.StoreId
+			// project.ProductPrice = storeInfo.S
+			project.StoreName = storeInfo.StoreName
+		}
+
+		// 2.2. 门店图片信息
+		productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, project.StoreId)
+		if productPhotoErr != nil {
+			return nil, productPhotoErr
+		}
+		if productPhotoInfo != nil {
+			for _, photo := range productPhotoInfo {
+				fmt.Println(photo)
+				if photo.Symbol == 1 {
+					project.ProductPhotoSymbol = 1
+					project.ProductPhotoUrl = photo.PhotoUrl
+					project.ProductPhotoUid = photo.PhotoUid
+				}
+			}
+		}
+
+		// 2.3. 招募策略信息
+		recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, project.LocalId)
+		if recruitErr != nil {
+			return nil, recruitErr
+		}
+		if recruitStrategyInfo != nil {
+			for _, strategy := range recruitStrategyInfo {
+				var recruitStrategy *http_model.EasyRecruitStrategy
+				recruitStrategy = &http_model.EasyRecruitStrategy{}
+				recruitStrategy.StrategyId = strategy.StrategyID
+				recruitStrategy.FeeForm = strategy.FeeForm
+				recruitStrategy.RecruitNumber = strategy.RecruitNumber
+				project.RecruitStrategy = append(project.RecruitStrategy, recruitStrategy)
+			}
+		}
+
+		// 2.4. 判断是否加入商单
+		//sProjectCount, sProjectErr := db.UpdateSProjectByProjectIdAndSupplierId(ctx, project.LocalId, supplierId)
+		//if sProjectErr != nil {
+		//	return nil, sProjectErr
+		//}
+		//if sProjectCount > 0 {
+		//	project.AddToListStatus = 1
+		//} else {
+		//	project.AddToListStatus = 2
+		//}
+	}
+	return fullLocalData, nil
+}

+ 1 - 1
service/project.go

@@ -422,7 +422,7 @@ func (*project) GetFullProjectList(ctx context.Context, pageSize, pageNum int32,
 		}
 
 		// 2.4. 判断是否加入商单
-		sProjectCount, sProjectErr := db.UpdateSProjectByProjectIdAndSupplierId(ctx, project.ProjectId, supplierId)
+		sProjectCount, sProjectErr := db.FindSProjectByProjectIdAndSupplierId(ctx, project.ProjectId, supplierId)
 		if sProjectErr != nil {
 			return nil, sProjectErr
 		}

+ 20 - 0
service/s_local_life.go

@@ -0,0 +1,20 @@
+package service
+
+import (
+	"context"
+	"youngee_b_api/model/http_model"
+)
+
+var SLcoalLife *sLocalLife
+
+type sLocalLife struct {
+}
+
+// CreateSLocalLife 新建服务商加入商单后的公开本地生活
+func (*sLocalLife) CreateSLocalLife(ctx context.Context, request http_model.LocalLifeAddToListRequest) error {
+
+	// 1. 建立SLocalLife信息
+	// 1.1. 根据传入的LocalLifeId去LocalLife表查找信息补全SLocalLife
+
+	return nil
+}

+ 83 - 3
service/s_project.go

@@ -294,9 +294,89 @@ func (*sProject) GetSPorjectDetail(ctx context.Context, sProjectId int) (*http_m
 	return sProjectData, nil
 }
 
-// GetSSpecialProjectList 查找服务商加入商单的定向种草任务列表
-func (*sProject) GetSSpecialProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) ([]*gorm_model.SProjectInfo, int64, error) {
-	sProjects, total, err := db.GetSSpecialProjectList(ctx, supplierId, pageSize, pageNum, condition)
+// GetSpecialProjectList 查找服务商加入商单前的定向种草任务列表
+func (*sProject) GetSpecialProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) (*http_model.SpecialProjectListData, error) {
+	var specialProjectListData *http_model.SpecialProjectListData
+	specialProjectListData = &http_model.SpecialProjectListData{}
+
+	// 1. 定向种草任务基本信息填入
+	specialProjects, total, err := db.GetSpecialProjectList(ctx, supplierId, pageSize, pageNum, condition)
+	if err != nil {
+		return nil, err
+	}
+	if specialProjects != nil {
+		specialProjectListData.Total = total
+		for _, specialProject := range specialProjects {
+			var currSpecialProject *http_model.SpecialProjectResponse
+			currSpecialProject = &http_model.SpecialProjectResponse{}
+			currSpecialProject.SProjectId = specialProject.SProjectId
+			currSpecialProject.ProjectPlatform = specialProject.ProjectPlatform
+			currSpecialProject.ProjectForm = specialProject.ProjectForm
+			currSpecialProject.ContentType = specialProject.ContentType
+			currSpecialProject.SProjectStatus = specialProject.SProjectStatus
+
+			// 2. 定向种草任务商品信息填入
+			// 2.1. 商品信息
+			productInfo, productErr := db.GetProductByID(ctx, specialProject.ProductId)
+			if productErr != nil {
+				return nil, productErr
+			}
+			if productInfo != nil {
+				currSpecialProject.ProductId = productInfo.ProductID
+				currSpecialProject.ProductName = productInfo.ProductName
+				currSpecialProject.ProductPrice = productInfo.ProductPrice
+			}
+
+			// 2.2. 商品图片信息
+			productPhotoInfo, productPhotoErr := db.GetProductPhotoByProductID(ctx, specialProject.ProductId)
+			if productPhotoErr != nil {
+				return nil, productPhotoErr
+			}
+			if productPhotoInfo != nil {
+				for _, p := range productPhotoInfo {
+					if p.Symbol == 1 {
+						currSpecialProject.ProductPhotoUrl = p.PhotoUrl
+						currSpecialProject.ProductPhotoUid = p.PhotoUid
+						currSpecialProject.ProductPhotoSymbol = 1
+					}
+				}
+			}
+
+			// 3. 招募策略信息
+			recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, specialProject.ProjectId)
+			if recruitErr != nil {
+				return nil, recruitErr
+			}
+			if recruitStrategy != nil {
+				for _, strategy := range recruitStrategy {
+					showStrategy := http_model.EasyRecruitStrategy{
+						FeeForm:       strategy.FeeForm,
+						RecruitNumber: strategy.RecruitNumber,
+						StrategyId:    strategy.StrategyID,
+					}
+					currSpecialProject.RecruitStrategy = append(currSpecialProject.RecruitStrategy, showStrategy)
+				}
+			}
+
+			// 4. 原种草任务信息
+			projectInfo, projectErr := db.GetProjectDetail(ctx, specialProject.ProjectId)
+			if projectErr != nil {
+				return nil, projectErr
+			}
+			if projectInfo != nil {
+				currSpecialProject.Tools = projectInfo.Tools
+			}
+			specialProjectListData.SpecialProjectInfo = append(specialProjectListData.SpecialProjectInfo, currSpecialProject)
+		}
+	} else {
+		specialProjectListData.Total = 0
+	}
+	return specialProjectListData, nil
+}
+
+// GetSpecialSProjectList 查找服务商加入商单后的定向种草任务列表
+func (*sProject) GetSpecialSProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) ([]*gorm_model.SProjectInfo, int64, error) {
+	sProjects, total, err := db.GetSpecialProjectList(ctx, supplierId, pageSize, pageNum, condition)
 	if err != nil {
 		return nil, 0, err
 	}