Xingyu Xian 2 hónapja
szülő
commit
2f95bec227

+ 70 - 0
db/local_life_task.go

@@ -0,0 +1,70 @@
+package db
+
+import (
+	"context"
+	"fmt"
+	"github.com/sirupsen/logrus"
+	"reflect"
+	"strings"
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/util"
+)
+
+// GetLocalTaskList 本地生活子任务列表
+func GetLocalTaskList(ctx context.Context, pageSize, pageNum int32, conditions *common_model.LocalTaskConditions) ([]*gorm_model.YoungeeLocalTaskInfo, int64, error) {
+
+	db := GetReadDB(ctx)
+	// 查询task表信息
+	db = db.Debug().Model(gorm_model.YoungeeLocalTaskInfo{})
+	// 根据Local条件过滤
+	conditionType := reflect.TypeOf(conditions).Elem()
+	conditionValue := reflect.ValueOf(conditions).Elem()
+	var platform_nickname string = ""
+
+	for i := 0; i < conditionType.NumField(); i++ {
+		field := conditionType.Field(i)
+		tag := field.Tag.Get("condition")
+		value := conditionValue.FieldByName(field.Name)
+		if !util.IsBlank(value) && tag != "platform_nickname" {
+			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		} else if tag == "platform_nickname" {
+			platform_nickname = fmt.Sprintf("%v", value.Interface())
+			continue
+		}
+	}
+
+	var taskInfos []*gorm_model.YoungeeLocalTaskInfo
+	db = db.Model(gorm_model.YoungeeLocalTaskInfo{})
+	// 查询总数
+	var totalTask int64
+	if err := db.Count(&totalTask).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+	db.Order("task_id").Find(&taskInfos)
+
+	// 查询该页数据
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
+	err := db.Order("task_id").Limit(int(limit)).Offset(int(offset)).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetProjectTaskList] error query mysql total, err:%+v", err)
+		return nil, 0, err
+	}
+
+	var taskDatas []*gorm_model.YoungeeLocalTaskInfo
+	var newTaskDatas []*gorm_model.YoungeeLocalTaskInfo
+	taskDatas = taskInfos
+
+	for _, v := range taskDatas {
+		if platform_nickname == "" {
+			newTaskDatas = append(newTaskDatas, v)
+		} else if strings.Contains(v.TaskID, platform_nickname) {
+			newTaskDatas = append(newTaskDatas, v)
+		} else {
+			totalTask--
+		}
+	}
+	return newTaskDatas, totalTask, nil
+}

+ 27 - 0
db/platform_kuaishou_user.go

@@ -0,0 +1,27 @@
+package db
+
+import (
+	"context"
+	"youngee_b_api/model/gorm_model"
+)
+
+func FindUserInfoByTalentId(ctx context.Context, talentId string) (*gorm_model.PlatformKuaishouUserInfo, error) {
+	db := GetReadDB(ctx)
+	var userInfo gorm_model.PlatformKuaishouUserInfo
+	err := db.Model(gorm_model.PlatformKuaishouUserInfo{}).Where("talent_id = ? and platform_id = ?", talentId, 4).Find(&userInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return &userInfo, nil
+}
+
+// FindUserInfoByOpenId 根据openID去查找快手授权信息
+func FindUserInfoByOpenId(ctx context.Context, openId string) (*gorm_model.PlatformKuaishouUserInfo, error) {
+	db := GetReadDB(ctx)
+	var userInfo gorm_model.PlatformKuaishouUserInfo
+	err := db.Model(gorm_model.PlatformKuaishouUserInfo{}).Where("open_id = ? and platform_id = ?", openId, 4).Find(&userInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return &userInfo, nil
+}

+ 4 - 5
db/supplier_income.go

@@ -4,15 +4,14 @@ import (
 	"context"
 	"github.com/sirupsen/logrus"
 	"youngee_b_api/model/gorm_model"
-	"youngee_b_api/model/http_model"
 )
 
 // GetSupplierIncomeList 查询服务商收入列表
-func GetSupplierIncomeList(ctx context.Context, reqData *http_model.FullSProjectIncomeListRequest) ([]*gorm_model.YounggeeSupplierIncome, int64, error) {
+func GetSupplierIncomeList(ctx context.Context, pageSize int32, pageNum int32, supplierId int, incomeStatus int) ([]*gorm_model.YounggeeSupplierIncome, int64, error) {
 	db := GetReadDB(ctx)
 
 	// 1. 根据基本信息过滤
-	db = db.Debug().Model(gorm_model.YounggeeSupplierIncome{}).Where("supplier_id = ? and income_status = ?", reqData.SupplierId, reqData.IncomeStatus)
+	db = db.Debug().Model(gorm_model.YounggeeSupplierIncome{}).Where("supplier_id = ? and income_status = ?", supplierId, incomeStatus)
 
 	// 2. 确定查询总数和返回当前页数据
 	var total int64
@@ -21,8 +20,8 @@ func GetSupplierIncomeList(ctx context.Context, reqData *http_model.FullSProject
 		logrus.WithContext(ctx).Errorf("[GetSupplierIncomeList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
-	limit := reqData.PageSize
-	offset := reqData.PageSize * reqData.PageNum // assert pageNum start with 0
+	limit := pageSize
+	offset := pageSize * pageNum // assert pageNum start with 0
 	err := db.Order("s_project_id desc").Limit(int(limit)).Offset(int(offset)).Find(&SupplierIncomeList).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetSupplierIncomeList] error query mysql total, err:%+v", err)

+ 48 - 0
handler/full_s_project_task_bill_list.go

@@ -0,0 +1,48 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapFullSProjectTaskBillListHandler(ctx *gin.Context) {
+	handler := newFullSProjectTaskBillListHandler(ctx)
+	baseRun(handler)
+}
+
+func newFullSProjectTaskBillListHandler(ctx *gin.Context) *FullSProjectBillTaskListHandler {
+	return &FullSProjectBillTaskListHandler{
+		req:  http_model.NewFullSProjectTaskBillRequest(),
+		resp: http_model.NewFullSProjectTaskBillResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FullSProjectBillTaskListHandler struct {
+	req  *http_model.FullSProjectTaskBillListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FullSProjectBillTaskListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FullSProjectBillTaskListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FullSProjectBillTaskListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FullSProjectBillTaskListHandler) run() {
+	data, err := service.SProject.FullSProjectTaskBillList(h.ctx, h.req)
+	if err != nil {
+		h.resp.Message = err.Error()
+	}
+	h.resp.Data = data
+	h.resp.Message = "成功查询"
+}
+
+func (h *FullSProjectBillTaskListHandler) checkParam() error {
+	return nil
+}

+ 3 - 4
handler/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"
@@ -45,9 +44,9 @@ func (h *LocalLifeDetailHandler) getResponse() interface{} {
 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)
+	// 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)

+ 53 - 0
handler/local_task_list.go

@@ -0,0 +1,53 @@
+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 WrapLocalTaskListHandler(ctx *gin.Context) {
+	handler := newLocalTaskListHandler(ctx)
+	baseRun(handler)
+}
+
+func newLocalTaskListHandler(ctx *gin.Context) *LocalTaskListHandler {
+	return &LocalTaskListHandler{
+		req:  http_model.NewLocalTaskListRequest(),
+		resp: http_model.NewLocalTaskListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type LocalTaskListHandler struct {
+	req  *http_model.LocalTaskListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *LocalTaskListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *LocalTaskListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *LocalTaskListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *LocalTaskListHandler) run() {
+	conditions := pack.HttpLocalTaskRequestToCondition(h.req)
+	data, err := service.SLocalLife.GetLocalTaskList(h.ctx, h.req.PageSize, h.req.PageNum, conditions)
+	if err != nil {
+		logrus.WithContext(h.ctx).Errorf("[LocalTaskListHandler] error LocalTaskList, err:%+v", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	// h.resp.Data = data
+}
+func (h *LocalTaskListHandler) checkParam() error {
+	return nil
+}

+ 10 - 0
model/common_model/local_task_list.go

@@ -0,0 +1,10 @@
+package common_model
+
+type LocalTaskConditions struct {
+	LocalId          string `condition:"local_id"`          // 本地生活ID
+	SLocalId         int    `condition:"s_local_id"`        // 服务商加入商单的本地生活ID
+	TaskStatus       string `condition:"task_status"`       // 任务状态
+	SupplierStatus   int    `condition:"supplier_status"`   // 服务商任务状态 0表示达人来源非服务商 1待选 2已选 3落选
+	TaskStage        int    `condition:"task_stage"`        // 任务阶段,1:已报名, 2:申请成功, 3:申请失败, 4:待预约探店, 5:预约确认中 6:预约成功 7:待传脚本, 8:脚本待审, 9:待传初稿, 10:初稿待审, 11:待传链接, 12:链接待审, 13:待传数据, 14:数据待审, 15:已结案, 16:解约, 17:终止合作(过渡态)
+	PlatformNickname string `condition:"platform_nickname"` // 账号昵称
+}

+ 3 - 3
model/gorm_model/local_life_task_info.go

@@ -18,7 +18,7 @@ type YoungeeLocalTaskInfo struct {
 	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"`                                 // 服务费
+	ServiceCharge          float64   `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"`              // 未上传类型违约扣款比例,百分之
@@ -50,7 +50,7 @@ type YoungeeLocalTaskInfo struct {
 	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"`                         // 达人稿费,达人所见的稿费金额
+	DraftFee               float64   `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"`                                       // 平均点赞数
@@ -61,7 +61,7 @@ type YoungeeLocalTaskInfo struct {
 	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"`                                    // 提报价格(达人自报价经过计算后,)
+	SupportFee             float64   `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"`                              // 未发作品违约时间

+ 32 - 0
model/gorm_model/platform_kuaishou_user_info.go

@@ -0,0 +1,32 @@
+package gorm_model
+
+import (
+	"time"
+)
+
+type PlatformKuaishouUserInfo struct {
+	Id           int       `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:主键,自增长" json:"id"`
+	OpenId       string    `gorm:"column:open_id;type:varchar(255);comment:快手用户唯一表示" json:"open_id"`
+	PlatformId   int       `gorm:"column:platform_id;type:int(11);comment:平台id,与third_platform_info中的id相同" json:"platform_id"`
+	TalentId     string    `gorm:"column:talent_id;type:varchar(255);comment:达人id" json:"talent_id"`
+	Code         string    `gorm:"column:code;type:varchar(255);comment:扫码后获得的临时票据" json:"code"`
+	AccessToken  string    `gorm:"column:access_token;type:varchar(1000);comment:调用API需要的参数" json:"access_token"`
+	RefreshToken string    `gorm:"column:refresh_token;type:varchar(1000);comment:用于刷新access_token" json:"refresh_token"`
+	NickName     string    `gorm:"column:nick_name;type:varchar(255);comment:快手昵称" json:"nick_name"`
+	HeadUri      string    `gorm:"column:head_uri;type:varchar(255);comment:用户头像" json:"head_uri"`
+	Fan          string    `gorm:"column:fan;type:varchar(255);comment:用户粉丝数" json:"fan"`
+	Expired      int       `gorm:"column:expired;type:tinyint(4);comment:access_token是否可用" json:"expired"`
+	SaleNum30Day int       `gorm:"column:sale_num_30day;type:int(11);comment:30日销量" json:"sale_num_30day"`
+	SaleNumTotal int       `gorm:"column:sale_num_total;type:int(11);comment:总销量" json:"sale_num_total"`
+	CreateTime   time.Time `gorm:"column:create_time;type:datetime;comment:创建时间" json:"create_time"`
+	UpdateTime   time.Time `gorm:"column:update_time;type:datetime;comment:更新时间" json:"update_time"`
+	IsDelete     int       `gorm:"column:is_delete;type:int(11);default:0;comment:是否被删除" json:"is_delete"`
+	LikeNum      int       `gorm:"column:like_num;type:int(11);default:0;comment:点赞数" json:"like_num"`
+	VideoNum     int       `gorm:"column:video_num;type:int(11);default:0;comment:作品数" json:"video_num"`
+	Gender       string    `gorm:"column:gender;type:varchar(255);comment:快手性别" json:"gender"`
+	City         string    `gorm:"column:city;type:varchar(255);comment:快手用户城市所在地" json:"city"`
+}
+
+func (m *PlatformKuaishouUserInfo) TableName() string {
+	return "platform_kuaishou_user_info"
+}

+ 1 - 0
model/gorm_model/s_project.go

@@ -29,6 +29,7 @@ type SProjectInfo struct {
 	CreateStrategyId    int        `gorm:"column:create_strategy_id"`                      // 服务商修改服务费操作人ID
 	CreateStrategyType  int        `gorm:"column:create_strategy_type"`                    // 服务商修改服务费操作人类型:1服务商主账号,2子账号
 	CreateTime          *time.Time `gorm:"column:create_time"`                             // 创建时间
+	FinishTime          *time.Time `gorm:"column:finish_time"`                             // 结案时间
 }
 
 func (m *SProjectInfo) TableName() string {

+ 11 - 3
model/http_model/create_supplier_withdraw.go

@@ -1,16 +1,24 @@
 package http_model
 
 type CreateSupplierWithdrawRequest struct {
-	SupplierId                 int                `json:"supplier_id"`                   // 服务商ID
-	CreateSupplierWithdrawList []SupplierWithdraw `json:"create_supplier_withdraw_list"` // 回票List
+	SupplierId                    int                       `json:"supplier_id"`                      // 服务商ID
+	CreateCompanySupplierWithdraw []CompanySupplierWithdraw `json:"create_company_supplier_withdraw"` // 机构服务商提现列表
+	CreatePersonSupplierWithdraw  []PersonSupplierWithdraw  `json:"create_person_supplier_withdraw"`  // 个人服务商提现列表
 }
 
-type SupplierWithdraw struct {
+type CompanySupplierWithdraw struct {
 	InvoiceId  int    `json:"invoice_id"`  // 回票ID
 	BankName   string `json:"bank_name"`   // 开户银行
 	BankNumber string `json:"bank_number"` // 银行卡号
 }
 
+type PersonSupplierWithdraw struct {
+	IncomeId   int    `json:"income_id"`   // 收入ID
+	BankName   string `json:"bank_name"`   // 开户银行
+	BankNumber string `json:"bank_number"` // 银行卡号
+	Phone      string `json:"phone"`       // 银行预留手机号
+}
+
 type CreateSupplierWithdrawData struct {
 }
 

+ 24 - 4
model/http_model/full_s_project_income_list.go

@@ -1,7 +1,5 @@
 package http_model
 
-import "youngee_b_api/model/gorm_model"
-
 type FullSProjectIncomeListRequest struct {
 	SupplierId   int   `json:"supplier_id"`     // 服务商ID
 	IncomeStatus int   `json:"income_status"`   // 收入状态
@@ -12,8 +10,30 @@ type FullSProjectIncomeListRequest struct {
 }
 
 type FullSProjectIncomeData struct {
-	SProjectIncomeList []*gorm_model.YounggeeSupplierIncome `json:"s_project_income"` // 服务商加入商单的种草任务信息
-	Total              int64                                `json:"total"`            // 数量
+	SupplierIncome []*FullSProjectIncomeListResponse `json:"supplier_income"` // 任务信息
+	Total          int64                             `json:"total"`           // 数量
+}
+
+type FullSProjectIncomeListResponse struct {
+	IncomeId             int     `json:"income_id"`               // 收入ID
+	IncomeType           int     `json:"income_type"`             // 服务商收入类型,1种草,2带货,3本地生活
+	SProjectId           int     `json:"s_project_id"`            // 服务商加入商单后的种草任务ID
+	ProjectName          string  `json:"project_name"`            // 种草任务名称
+	ProjectPlatform      int64   `json:"project_platform"`        // 种草任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	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"`            // 商品名称
+	ProductPrice         float64 `json:"product_price"`           // 商品售价
+	SupplierChargeActual float64 `json:"supplier_charge_actual"`  // 服务费已结算
+	FinishTime           string  `json:"finish_time"`             // 结束时间
+	SLocalId             int     `json:"s_local_id"`              // 本地生活ID
+	LocalName            string  `json:"local_name"`              // 本地生活名称
+	LocalPlatform        int     `json:"local_platform"`          // 本地生活平台
+	StoreMainPhotoUrl    string  `json:"store_main_photo_url"`    // 商品主图URL
+	StoreMainPhotoSymbol int64   `json:"store_main_photo_symbol"` // 标志位
+	StoreMainPhotoUid    string  `json:"store_main_photo_uid"`    // uid
+	StoreName            string  `json:"store_name"`              // 门店名称
 }
 
 func NewFullSProjectIncomeRequest() *FullSProjectIncomeListRequest {

+ 37 - 0
model/http_model/full_s_project_task_bill_list.go

@@ -0,0 +1,37 @@
+package http_model
+
+type FullSProjectTaskBillListRequest struct {
+	SProjectId int `json:"s_project_id"` // 种草任务ID
+	//TalentId   string `json:"talent_id"`    // 达人ID
+	PageNum  int32 `json:"page_num"`
+	PageSize int32 `json:"page_size"`
+}
+
+type FullSProjectTaskBillData struct {
+	SProjectTaskList []*FullSProjectTaskBillListData `json:"s_project_task_info"` // 服务商加入商单的种草任务信息
+	Total            int64                           `json:"total"`               // 数量
+}
+
+type FullSProjectTaskBillListData struct {
+	TaskId            string  `json:"task_id"`             // 子任务ID
+	ViewNum           int     `json:"view_num"`            // 浏览量
+	VoteNum           int     `json:"vote_num"`            // 点赞数
+	CommitNum         int     `json:"commit_num"`          // 评论数
+	CollectNum        int     `json:"collect_num"`         // 收藏数
+	ServiceCharge     float64 `json:"service_charge"`      // 服务费
+	DraftFee          float64 `json:"draft_fee"`           // 达人稿费
+	DelayRate         int     `json:"delay_rate"`          // 违约扣款比例
+	RealServiceCharge float64 `json:"real_service_charge"` // 实际服务费
+	SettleAmount      float64 `json:"settle_amount"`       // 达人实际所得
+	SettleTime        string  `json:"settle_time"`         // 结算时间
+}
+
+func NewFullSProjectTaskBillRequest() *FullSProjectTaskBillListRequest {
+	return new(FullSProjectTaskBillListRequest)
+}
+
+func NewFullSProjectTaskBillResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(FullSProjectTaskBillData)
+	return resp
+}

+ 59 - 0
model/http_model/local_task_list.go

@@ -0,0 +1,59 @@
+package http_model
+
+type LocalTaskListRequest struct {
+	PageSize         int32  `json:"page_size"`
+	PageNum          int32  `json:"page_num"`
+	LocalId          string `json:"local_id"`          // 本地生活ID
+	SLocalId         int    `json:"s_local_id"`        // 服务商加入商单的本地生活ID
+	TaskStatus       string `json:"task_status"`       // 任务状态
+	SupplierStatus   int    `json:"supplier_status"`   // 服务商任务状态 0表示达人来源非服务商 1待选 2已选 3落选
+	TaskStage        int    `json:"task_stage"`        // 任务阶段,1:已报名, 2:申请成功, 3:申请失败, 4:待预约探店, 5:预约确认中 6:预约成功 7:待传脚本, 8:脚本待审, 9:待传初稿, 10:初稿待审, 11:待传链接, 12:链接待审, 13:待传数据, 14:数据待审, 15:已结案, 16:解约, 17:终止合作(过渡态)
+	PlatformNickname string `json:"platform_nickname"` // 账号昵称
+}
+
+type LocalTaskPreview struct {
+	TaskId           string  `json:"task_id"`           // 任务ID
+	PlatformNickname string  `json:"platform_nickname"` // 账号昵称
+	FansCount        string  `json:"fans_count"`        // 粉丝数
+	AvatarUrl        string  `json:"avatar_url"`        // 达人头像url
+	Location         string  `json:"location"`          // 达人所在地区
+	Gender           string  `json:"gender"`            // 达人性别
+	ServiceCharge    float64 `json:"service_charge"`    // 服务费
+	DraftFee         float64 `json:"draft_fee"`         // 达人稿费
+	SupportFee       float64 `json:"support_fee"`       // 提报价格
+	StrategyId       int     `json:"strategy_id"`       // 报名选择的招募策略id
+	TaskStatus       int     `json:"task_status"`       // 任务状态
+	CreateDate       string  `json:"create_date"`       // 创建时间
+	SelectDate       string  `json:"select_date"`       // 商家同意时间
+	DeliveryDate     string  `json:"delivery_date"`     // 发货时间
+	SignedTime       string  `json:"signed_time"`       // 收货时间
+	CurBreakAt       string  `json:"cur_break_at"`      // 当前阶段结束时间
+	FansNum          int     `json:"fans_num"`          // 粉丝数
+	VoteAvg          int     `json:"vote_avg"`          // 平均点赞数
+	CommitAvg        int     `json:"commit_avg"`        // 平均评论数
+	BOperator        string  `json:"b_operator"`        // 商家确定达人操作人ID
+	BOperatorType    int     `json:"b_operator_type"`   // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	SOperator        int     `json:"s_operator"`        // 服务商确定达人操作人ID
+	SOperatorType    int     `json:"s_operator_type"`   // 服务商操作人类型,1服务商用户,2服务商子账号,3管理后台
+	TaskStage        int     `json:"task_stage"`        // 任务状态
+}
+
+type LocalTaskListData struct {
+	LocalTaskPreview    []*LocalTaskPreview `json:"local_task_pre_view"`   // Task
+	RecruitNum          int                 `json:"recruit_num"`           // 执行人数
+	QuitNum             int                 `json:"quit_num"`              // 解约人数
+	SettleNum           int                 `json:"settle_num"`            // 结算人数
+	ServiceChargeActual float64             `json:"service_charge_actual"` // 服务费总额
+	ServiceChargeSettle float64             `json:"service_charge_settle"` // 服务费已结算
+	Total               int64               `json:"total"`
+}
+
+func NewLocalTaskListRequest() *LocalTaskListRequest {
+	return new(LocalTaskListRequest)
+}
+
+func NewLocalTaskListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(LocalTaskListData)
+	return resp
+}

+ 23 - 22
model/http_model/s_local_life_list.go

@@ -14,28 +14,29 @@ type FullSLocalListRequest struct {
 }
 
 type FullSLocalPreview 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"`    // 本地生活内容形式
-	ServiceCharge       float64 `json:"service_charge"`        // 预估赚
-	ServiceChargeActual float64 `json:"service_charge_actual"` // 实际已赚
-	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"`            // 门店名称
-	StoreId             int     `json:"store_id"`              // 门店ID
-	ApplyNum            int     `json:"apply_num"`             // 报名人数
-	RecruitNum          int     `json:"recruit_num"`           // 已招募人数
-	SettleNum           int     `json:"settle_num"`            // 已结算人数
-	SupplierId          int     `json:"supplier_id"`           // 服务商ID
-	SubAccountId        int     `json:"sub_account_id"`        // 子账号ID
-	OperatorType        int     `json:"operator_type"`         // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
-	CreateTime          string  `json:"create_time"`           // 加入商单时间
+	LocalId              string  `json:"local_id"`                // 本地生活ID
+	SLocalId             int     `json:"s_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"`      // 本地生活内容形式
+	ServiceCharge        float64 `json:"service_charge"`          // 预估赚
+	ServiceChargeActual  float64 `json:"service_charge_actual"`   // 实际已赚
+	RecruitDdl           string  `json:"recruit_ddl"`             // 招募截至时间
+	StoreMainPhotoUrl    string  `json:"store_main_photo_url"`    // 商品主图URL
+	StoreMainPhotoSymbol int64   `json:"store_main_photo_symbol"` // 标志位
+	StoreMainPhotoUid    string  `json:"store_main_photo_uid"`    // uid
+	StoreName            string  `json:"store_name"`              // 门店名称
+	StoreId              int     `json:"store_id"`                // 门店ID
+	ApplyNum             int     `json:"apply_num"`               // 报名人数
+	RecruitNum           int     `json:"recruit_num"`             // 已招募人数
+	SettleNum            int     `json:"settle_num"`              // 已结算人数
+	SupplierId           int     `json:"supplier_id"`             // 服务商ID
+	SubAccountId         int     `json:"sub_account_id"`          // 子账号ID
+	OperatorType         int     `json:"operator_type"`           // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
+	CreateTime           string  `json:"create_time"`             // 加入商单时间
 }
 
 type FullSLocalListData struct {

+ 2 - 0
model/http_model/supplier_to_withdraw_list.go

@@ -16,6 +16,8 @@ type SupplierToWithdrawListData struct {
 }
 
 type SupplierToWithdrawInfo struct {
+	InvoiceId int          `json:"invoice_id"`  // 回票ID,企业服务商需要
+	IncomeId  int          `json:"income_id"`   // 收入ID,个人服务商不需要回票,所以需要这个
 	STaskInfo []*STaskInfo `json:"s_task_info"` // 任务信息
 	Amount    float64      `json:"amount"`      // 回票金额
 	AgreeTime *time.Time   `json:"agree_time"`  // 同意时间

+ 17 - 0
pack/local_task_list.go

@@ -0,0 +1,17 @@
+package pack
+
+import (
+	"youngee_b_api/model/common_model"
+	"youngee_b_api/model/http_model"
+)
+
+func HttpLocalTaskRequestToCondition(req *http_model.LocalTaskListRequest) *common_model.LocalTaskConditions {
+	return &common_model.LocalTaskConditions{
+		LocalId:          req.LocalId,
+		SLocalId:         req.SLocalId,
+		TaskStatus:       req.TaskStatus,
+		SupplierStatus:   req.SupplierStatus,
+		TaskStage:        req.TaskStage,
+		PlatformNickname: req.PlatformNickname,
+	}
+}

+ 5 - 4
route/init.go

@@ -191,7 +191,7 @@ func InitRoute(r *gin.Engine) {
 		l.POST("/sLocalLife/addToList", handler.WrapLocalLifeAddToListHandler)             // 公开本地生活任务服务商加入商单
 		l.POST("/sLocalLife/fullSLocalList", handler.WrapFullSLocalListHandler)            // 商单管理-公开本地生活任务列表
 		l.POST("/sLocalLife/showSLocal", handler.WrapShowSLocalHandler)                    // 服务商本地生活任务详情
-		l.POST("/sLocalLife/taskList", handler.WrapProjectTaskListHandler)                 // 任务列表
+		l.POST("/sLocalLife/taskList", handler.WrapLocalTaskListHandler)                   // 子任务列表
 		l.POST("/sLocalLife/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
 
 		l.POST("/localLife/specialLocalList", handler.WrapFullListHandler)            // 商单广场-公开本地生活任务列表
@@ -204,9 +204,10 @@ func InitRoute(r *gin.Engine) {
 		f.Use(middleware.LoginAuthMiddleware)
 
 		// 财务管理
-		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)     // 种草账单列表
-		f.POST("/supplierWithdraw/toList", handler.WrapSupplierToWithdrawListHandler) // 服务商可提现账单列表
-		f.POST("/supplierWithdraw/create", handler.WrapCreateSupplierWithdrawHandler) // 服务商提现
+		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草账单列表
+		f.POST("/fullSProject/taskBillList", handler.WrapFullSProjectTaskBillListHandler) // 种草子任务账单列表
+		f.POST("/supplierWithdraw/toList", handler.WrapSupplierToWithdrawListHandler)     // 服务商可提现账单列表
+		f.POST("/supplierWithdraw/create", handler.WrapCreateSupplierWithdrawHandler)     // 服务商提现
 
 		// 回票
 		f.POST("/supplierInvoice/incomeList", handler.WrapFullSProjectIncomeListHandler) // 可回发票列表

+ 61 - 4
service/s_local_life.go

@@ -11,7 +11,7 @@ import (
 	"youngee_b_api/model/http_model"
 )
 
-var SLcoalLife *sLocalLife
+var SLocalLife *sLocalLife
 
 type sLocalLife struct {
 }
@@ -226,9 +226,9 @@ func (*sLocalLife) GetFullSLocalLifeList(ctx context.Context, pageSize, pageNum
 			for _, photo := range productPhotoInfo {
 				fmt.Println(photo)
 				if photo.Symbol == 1 {
-					local.ProductPhotoSymbol = 1
-					local.ProductPhotoUrl = photo.PhotoUrl
-					local.ProductPhotoUid = photo.PhotoUid
+					local.StoreMainPhotoSymbol = 1
+					local.StoreMainPhotoUrl = photo.PhotoUrl
+					local.StoreMainPhotoUid = photo.PhotoUid
 				}
 			}
 		}
@@ -236,3 +236,60 @@ func (*sLocalLife) GetFullSLocalLifeList(ctx context.Context, pageSize, pageNum
 	}
 	return fullLocalData, nil
 }
+
+// GetLocalTaskList 查询本地生活子任务
+func (*sLocalLife) GetLocalTaskList(ctx context.Context, pageSize, pageNum int32, condition *common_model.LocalTaskConditions) (*http_model.LocalTaskListData, error) {
+
+	var localTaskListData *http_model.LocalTaskListData
+	localTaskListData = &http_model.LocalTaskListData{}
+
+	// 1. 根据condition查询子任务信息
+	localTaskList, total, localTaskErr := db.GetLocalTaskList(ctx, pageSize, pageNum, condition)
+	if localTaskErr != nil {
+		return nil, localTaskErr
+	}
+	if localTaskList != nil {
+		localTaskListData.Total = total
+		for _, localTask := range localTaskList {
+			var localTaskInfo *http_model.LocalTaskPreview
+			localTaskInfo = &http_model.LocalTaskPreview{}
+
+			// 2. 补充查询达人身份信息
+			talentInfo, talentErr := db.FindUserInfoByTalentId(ctx, localTask.TalentID)
+			if talentErr != nil {
+				return nil, talentErr
+			}
+			if talentInfo != nil {
+				localTaskInfo.TaskId = localTask.TaskID
+				localTaskInfo.TaskStage = localTask.TaskStage
+				localTaskInfo.ServiceCharge = localTask.ServiceCharge
+				localTaskInfo.DraftFee = localTask.DraftFee
+				localTaskInfo.SupportFee = localTask.SupportFee
+				localTaskInfo.StrategyId = localTask.StrategyID
+				localTaskInfo.TaskStatus = localTask.TaskStatus
+				localTaskInfo.CreateDate = conv.MustString(localTask.CreateDate)
+				localTaskInfo.SelectDate = conv.MustString(localTask.SelectDate)
+				localTaskInfo.DeliveryDate = conv.MustString(localTask.DeliveryDate)
+				localTaskInfo.SignedTime = conv.MustString(localTask.SignedTime)
+				localTaskInfo.CurBreakAt = conv.MustString(localTask.CurBreakAt)
+				localTaskInfo.FansNum = localTask.FansNum
+				localTaskInfo.VoteAvg = localTask.VoteAvg
+				localTaskInfo.CommitAvg = localTask.CommitAvg
+				localTaskInfo.BOperator = localTask.BOperator
+				localTaskInfo.BOperatorType = localTask.BOperatorType
+				localTaskInfo.SOperator = localTask.SOperator
+				localTaskInfo.SOperatorType = localTask.SOperatorType
+				localTaskInfo.PlatformNickname = talentInfo.NickName
+				localTaskInfo.FansCount = talentInfo.Fan
+				localTaskInfo.AvatarUrl = talentInfo.HeadUri
+				localTaskInfo.Location = talentInfo.City
+				localTaskInfo.Gender = talentInfo.Gender
+				localTaskListData.LocalTaskPreview = append(localTaskListData.LocalTaskPreview, localTaskInfo)
+			}
+		}
+
+		// 3. 本地生活任务信息补充
+
+	}
+	return localTaskListData, nil
+}

+ 7 - 0
service/s_project.go

@@ -548,3 +548,10 @@ func (*sProject) FullSProjectBillList(ctx context.Context, request *http_model.F
 
 	return currSProjectBillData, nil
 }
+
+// FullSProjectTaskBillList 种草子任务账单列表
+func (*sProject) FullSProjectTaskBillList(ctx context.Context, request *http_model.FullSProjectTaskBillListRequest) (*http_model.FullSProjectTaskBillData, error) {
+	var currSProjectTaskBillData *http_model.FullSProjectTaskBillData
+	currSProjectTaskBillData = &http_model.FullSProjectTaskBillData{}
+	return currSProjectTaskBillData, nil
+}

+ 56 - 47
service/supplier.go

@@ -56,17 +56,21 @@ func (*supplier) CreateSupplier(ctx context.Context, phone string) (*http_model.
 
 // GetSupplierIncomeList 查询服务商收入列表
 func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.FullSProjectIncomeListRequest) (*http_model.FullSProjectIncomeData, error) {
+	var sProjectIncomeData *http_model.FullSProjectIncomeData
+	sProjectIncomeData = &http_model.FullSProjectIncomeData{}
+
 	// 1. 查询
-	supplierIncome, total, err := db.GetSupplierIncomeList(ctx, req)
+	supplierIncome, total, err := db.GetSupplierIncomeList(ctx, req.PageSize, req.PageNum, req.SupplierId, req.IncomeStatus)
 	if err != nil {
 		return nil, nil
 	}
+	// 2. 补充种草/本地生活任务信息
+	if supplierIncome != nil {
+		sProjectIncomeData.Total = total
+	} else {
+		sProjectIncomeData.Total = 0
+	}
 
-	// 2. 整理数据格式
-	var sProjectIncomeData *http_model.FullSProjectIncomeData
-	sProjectIncomeData = &http_model.FullSProjectIncomeData{}
-	sProjectIncomeData.SProjectIncomeList = supplierIncome
-	sProjectIncomeData.Total = total
 	return sProjectIncomeData, nil
 }
 
@@ -223,54 +227,59 @@ func (*supplier) GetSupplierInvoiceList(ctx context.Context, req *http_model.Sup
 // GetSupplierToWithdrawList 服务商待提现列表
 func (*supplier) GetSupplierToWithdrawList(ctx context.Context, req *http_model.SupplierToWithdrawListRequest) (*http_model.SupplierToWithdrawListData, error) {
 	// 1. 查询服务商发票信息
+	var supplierInvoiceData *http_model.SupplierToWithdrawListData
+	supplierInvoiceData = &http_model.SupplierToWithdrawListData{}
+
 	supplierInvoiceList, total, err := db.GetInvoiceListBySupplierId(ctx, req.SupplierId, 3, 1, req.PageSize, req.PageNum)
 	if err != nil {
 		return nil, err
 	}
-
-	// 2. 根据发票中的incomeIds去查找任务及其服务费收入
-	var supplierInvoiceData *http_model.SupplierToWithdrawListData
-	supplierInvoiceData = &http_model.SupplierToWithdrawListData{}
-
-	for _, supplierInvoice := range supplierInvoiceList {
-		var supplierInvoiceInfo *http_model.SupplierToWithdrawInfo
-		supplierInvoiceInfo = &http_model.SupplierToWithdrawInfo{}
-
-		// 2.1. 基础信息填入
-		supplierInvoiceInfo.AgreeTime = supplierInvoice.AgreeTime
-		supplierInvoiceInfo.Company = supplierInvoice.Company
-
-		// 2.2. 任务及其收入信息填入
-		incomeIds := supplierInvoice.IncomeIds
-		strSlice := strings.Split(incomeIds, ",")
-		intSlice := make([]int, len(strSlice))
-		for i, s := range strSlice {
-			num, err := strconv.Atoi(s)
-			if err != nil {
-				fmt.Println("转换错误:", err)
-				return nil, err
-			}
-			intSlice[i] = num
-		}
-		for _, incomeId := range intSlice {
-			var sTaskInfo *http_model.STaskInfo
-			sTaskInfo = &http_model.STaskInfo{}
-			currIncome, incomeErr := db.GetIncomeInfoByIncomeId(ctx, incomeId)
-			if incomeErr != nil {
-				return nil, incomeErr
+	if supplierInvoiceList != nil {
+		// 企业服务商
+		// 2. 根据发票中的incomeIds去查找任务及其服务费收入
+		for _, supplierInvoice := range supplierInvoiceList {
+			var supplierInvoiceInfo *http_model.SupplierToWithdrawInfo
+			supplierInvoiceInfo = &http_model.SupplierToWithdrawInfo{}
+
+			// 2.1. 基础信息填入
+			supplierInvoiceInfo.AgreeTime = supplierInvoice.AgreeTime
+			supplierInvoiceInfo.Company = supplierInvoice.Company
+
+			// 2.2. 任务及其收入信息填入
+			incomeIds := supplierInvoice.IncomeIds
+			strSlice := strings.Split(incomeIds, ",")
+			intSlice := make([]int, len(strSlice))
+			for i, s := range strSlice {
+				num, err := strconv.Atoi(s)
+				if err != nil {
+					fmt.Println("转换错误:", err)
+					return nil, err
+				}
+				intSlice[i] = num
 			}
-			sTaskInfo.ServiceCharge = currIncome.SupplierChargeActual
-			supplierInvoiceInfo.Amount += currIncome.SupplierChargeActual
-			if currIncome.IncomeType == 1 {
-				sTaskInfo.Id = currIncome.SProjectID
-			} else if currIncome.IncomeType == 3 {
-				sTaskInfo.Id = currIncome.SLocalLifeID
+			for _, incomeId := range intSlice {
+				var sTaskInfo *http_model.STaskInfo
+				sTaskInfo = &http_model.STaskInfo{}
+				currIncome, incomeErr := db.GetIncomeInfoByIncomeId(ctx, incomeId)
+				if incomeErr != nil {
+					return nil, incomeErr
+				}
+				sTaskInfo.ServiceCharge = currIncome.SupplierChargeActual
+				supplierInvoiceInfo.Amount += currIncome.SupplierChargeActual
+				if currIncome.IncomeType == 1 {
+					sTaskInfo.Id = currIncome.SProjectID
+				} else if currIncome.IncomeType == 3 {
+					sTaskInfo.Id = currIncome.SLocalLifeID
+				}
+				supplierInvoiceInfo.STaskInfo = append(supplierInvoiceInfo.STaskInfo, sTaskInfo)
 			}
-			supplierInvoiceInfo.STaskInfo = append(supplierInvoiceInfo.STaskInfo, sTaskInfo)
+			supplierInvoiceData.ToWithdrawList = append(supplierInvoiceData.ToWithdrawList, supplierInvoiceInfo)
 		}
-		supplierInvoiceData.ToWithdrawList = append(supplierInvoiceData.ToWithdrawList, supplierInvoiceInfo)
+		supplierInvoiceData.Total = total
+	} else {
+		// 个人服务商
 	}
-	supplierInvoiceData.Total = total
+
 	return supplierInvoiceData, nil
 }
 
@@ -280,7 +289,7 @@ func (*supplier) CreateSupplierWithdraw(ctx context.Context, req *http_model.Cre
 
 	// 1. 数据整理
 	var supplierWithdrawInfoList []*gorm_model.YounggeeSupplierWithdraw
-	for _, withdrawInfo := range req.CreateSupplierWithdrawList {
+	for _, withdrawInfo := range req.CreateCompanySupplierWithdraw {
 		var supplierWithdrawInfo *gorm_model.YounggeeSupplierWithdraw
 		supplierWithdrawInfo = &gorm_model.YounggeeSupplierWithdraw{}