Browse Source

route_group

Xingyu Xian 1 week ago
parent
commit
293bdc42b7

+ 23 - 2
db/job.go

@@ -2,6 +2,7 @@ package db
 
 
 import (
 import (
 	"context"
 	"context"
+	"fmt"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/gorm_model"
 )
 )
 
 
@@ -38,15 +39,35 @@ func DeleteJob(ctx context.Context, job gorm_model.YounggeeJob) error {
 }
 }
 
 
 // FindJobBySupplierId 按服务商ID查找岗位信息
 // FindJobBySupplierId 按服务商ID查找岗位信息
-func FindJobBySupplierId(ctx context.Context, supplierId int) ([]*gorm_model.YounggeeJob, int64, error) {
+func FindJobBySupplierId(ctx context.Context, supplierId int, pageNum int32, pageSize int32) ([]*gorm_model.YounggeeJob, int64, error) {
 	db := GetReadDB(ctx)
 	db := GetReadDB(ctx)
 	var Jobs []*gorm_model.YounggeeJob
 	var Jobs []*gorm_model.YounggeeJob
 	whereCondition := gorm_model.YounggeeJob{SupplierId: supplierId}
 	whereCondition := gorm_model.YounggeeJob{SupplierId: supplierId}
 	var total int64
 	var total int64
-	err := db.Model(gorm_model.YounggeeJob{}).Where(whereCondition).Find(&Jobs).Count(&total).Error
+	fmt.Println(pageSize, pageNum)
+
+	// 先计算总数
+	err := db.Model(gorm_model.YounggeeJob{}).Where(whereCondition).Count(&total).Error
+	if err != nil {
+		return nil, 0, err
+	}
+
+	// 如果 pageNum <= 0 或 pageSize <= 0,则返回全部数据
+	if pageNum <= 0 || pageSize <= 0 {
+		err = db.Where(whereCondition).Find(&Jobs).Error
+		if err != nil {
+			return nil, 0, err
+		}
+		return Jobs, total, nil
+	}
+
+	// 否则返回分页数据
+	offset := (pageNum - 1) * pageSize
+	err = db.Where(whereCondition).Offset(int(offset)).Limit(int(pageSize)).Find(&Jobs).Error
 	if err != nil {
 	if err != nil {
 		return nil, 0, err
 		return nil, 0, err
 	}
 	}
+
 	return Jobs, total, nil
 	return Jobs, total, nil
 }
 }
 
 

+ 45 - 6
db/sub_account.go

@@ -73,20 +73,59 @@ func FindSubAccountById(ctx context.Context, subAccountId int) (*gorm_model.Youn
 	return subAccount, nil
 	return subAccount, nil
 }
 }
 
 
+/*
 // FindSubAccountBySupplierId 根据服务商ID查找包含的所有子账号信息
 // FindSubAccountBySupplierId 根据服务商ID查找包含的所有子账号信息
-func FindSubAccountBySupplierId(ctx context.Context, supplierId int, jobId int, accountStatus int) ([]*gorm_model.YounggeeSubAccount, int64, error) {
+
+	func FindSubAccountBySupplierId(ctx context.Context, pageNum int32, pageSize int32, supplierId int, jobId int, accountStatus int, condition string) ([]*gorm_model.YounggeeSubAccount, int64, error) {
+		db := GetReadDB(ctx)
+		var total int64
+		var subAccount []*gorm_model.YounggeeSubAccount
+		whereCondition := gorm_model.YounggeeSubAccount{SupplierId: supplierId, SubAccountType: 3, JobId: jobId, AccountStatus: accountStatus}
+		err := db.Model(gorm_model.YounggeeSubAccount{}).Where(whereCondition).Find(&subAccount).Count(&total).Error
+		if err != nil {
+			return nil, 0, err
+		}
+		if total == 0 {
+			return nil, 0, err
+		}
+		return subAccount, total, nil
+	}
+*/
+
+// FindSubAccountBySupplierId 根据服务商ID查找包含的所有子账号信息
+func FindSubAccountBySupplierId(ctx context.Context, pageNum int32, pageSize int32, supplierId int, jobId int, accountStatus int, condition string) ([]*gorm_model.YounggeeSubAccount, int64, error) {
 	db := GetReadDB(ctx)
 	db := GetReadDB(ctx)
+
+	query := db.Model(&gorm_model.YounggeeSubAccount{}).
+		Where("supplier_id = ? and sub_account_type = ? and account_status = 1", supplierId, 3)
+
+	if jobId != 0 {
+		query = query.Where("job_id = ?", jobId)
+	}
+	if accountStatus != 0 {
+		query = query.Where("account_status = ?", accountStatus)
+	}
+	if condition != "" {
+		query = query.Where("sub_account_name LIKE ?", "%"+condition+"%")
+	}
+
+	// Get total count
 	var total int64
 	var total int64
-	var subAccount []*gorm_model.YounggeeSubAccount
-	whereCondition := gorm_model.YounggeeSubAccount{SupplierId: supplierId, SubAccountType: 3, JobId: jobId, AccountStatus: accountStatus}
-	err := db.Model(gorm_model.YounggeeSubAccount{}).Where(whereCondition).Find(&subAccount).Count(&total).Error
-	if err != nil {
+	if err := query.Count(&total).Error; err != nil {
 		return nil, 0, err
 		return nil, 0, err
 	}
 	}
+
 	if total == 0 {
 	if total == 0 {
+		return nil, 0, nil
+	}
+
+	var subAccounts []*gorm_model.YounggeeSubAccount
+	offset := (pageNum - 1) * pageSize
+	if err := query.Offset(int(offset)).Limit(int(pageSize)).Find(&subAccounts).Error; err != nil {
 		return nil, 0, err
 		return nil, 0, err
 	}
 	}
-	return subAccount, total, nil
+
+	return subAccounts, total, nil
 }
 }
 
 
 // CountSubAccountUserByPhone 按照手机号码统计子账号数量
 // CountSubAccountUserByPhone 按照手机号码统计子账号数量

+ 58 - 0
handler/shut_down_sub_account.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"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 WrapShutDownSubAccountHandler(ctx *gin.Context) {
+	handler := newShutDownSubAccountHandler(ctx)
+	baseRun(handler)
+}
+
+func newShutDownSubAccountHandler(ctx *gin.Context) *ShutDownSubAccountHandler {
+	return &ShutDownSubAccountHandler{
+		req:  http_model.NewShutDownSubAccountRequest(),
+		resp: http_model.NewShutDownSubAccountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type ShutDownSubAccountHandler struct {
+	req  *http_model.ShutDownSubAccountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *ShutDownSubAccountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *ShutDownSubAccountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *ShutDownSubAccountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *ShutDownSubAccountHandler) run() {
+	err := service.SubAccount.ShutDownSubAccount(h.ctx, *h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountBySupplierId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountBySupplierId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = nil
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *ShutDownSubAccountHandler) checkParam() error {
+	return nil
+}

+ 58 - 0
handler/update_sub_account.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"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 WrapUpdateSubAccountHandler(ctx *gin.Context) {
+	handler := newUpdateSubAccountHandler(ctx)
+	baseRun(handler)
+}
+
+func newUpdateSubAccountHandler(ctx *gin.Context) *UpdateSubAccountHandler {
+	return &UpdateSubAccountHandler{
+		req:  http_model.NewUpdateSubAccountRequest(),
+		resp: http_model.NewUpdateSubAccountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type UpdateSubAccountHandler struct {
+	req  *http_model.UpdateSubAccountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *UpdateSubAccountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *UpdateSubAccountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *UpdateSubAccountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *UpdateSubAccountHandler) run() {
+	data, err := service.SubAccount.UpdateSubAccount(h.ctx, *h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountBySupplierId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountBySupplierId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *UpdateSubAccountHandler) checkParam() error {
+	return nil
+}

+ 3 - 1
model/http_model/find_all_job.go

@@ -3,7 +3,9 @@ package http_model
 import "youngee_b_api/model/gorm_model"
 import "youngee_b_api/model/gorm_model"
 
 
 type FindAllJobRequest struct {
 type FindAllJobRequest struct {
-	SupplierId int `json:"supplier_id"` // 子账号属于的服务商id
+	PageNum    int32 `json:"page"`
+	PageSize   int32 `json:"page_size"`
+	SupplierId int   `json:"supplier_id"` // 子账号属于的服务商id
 }
 }
 
 
 type FindAllJobInfo struct {
 type FindAllJobInfo struct {

+ 6 - 3
model/http_model/find_all_sub_account.go

@@ -1,9 +1,12 @@
 package http_model
 package http_model
 
 
 type FindAllSubAccountRequest struct {
 type FindAllSubAccountRequest struct {
-	SupplierId    int `json:"supplier_id"`    // 子账号属于的服务商id
-	JobId         int `json:"job_id"`         // 岗位ID
-	AccountStatus int `json:"account_status"` // 账号状态,1为正常,2为停用
+	PageNum       int32  `json:"page"`
+	PageSize      int32  `json:"page_size"`
+	SupplierId    int    `json:"supplier_id"`    // 子账号属于的服务商id
+	JobId         int    `json:"job_id"`         // 岗位ID
+	AccountStatus int    `json:"account_status"` // 账号状态,1为正常,2为停用
+	Condition     string `json:"condition"`      // 搜索框内容
 }
 }
 
 
 type FindAllSubAccountInfo struct {
 type FindAllSubAccountInfo struct {

+ 18 - 0
model/http_model/shut_down_sub_account.go

@@ -0,0 +1,18 @@
+package http_model
+
+type ShutDownSubAccountRequest struct {
+	SubAccountId int `json:"sub_account_id"`
+}
+
+type ShutDownSubAccountInfo struct {
+}
+
+func NewShutDownSubAccountRequest() *ShutDownSubAccountRequest {
+	return new(ShutDownSubAccountRequest)
+}
+
+func NewShutDownSubAccountResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ShutDownSubAccountInfo)
+	return resp
+}

+ 26 - 0
model/http_model/update_sub_account.go

@@ -0,0 +1,26 @@
+package http_model
+
+type UpdateSubAccountRequest struct {
+	SubAccountId   int    `json:"sub_account_id"`   // 子账号ID
+	SubAccountName string `json:"sub_account_name"` // 子账号名称
+	Phone          string `json:"phone"`            // 绑定手机
+	Code           string `json:"code"`             // 验证码
+	JobId          int    `json:"job_id"`           // 岗位ID
+}
+
+type UpdateSubAccountInfo struct {
+	SubAccountId   int    `json:"sub_account_id"`   // 子账号ID
+	SubAccountName string `json:"sub_account_name"` // 子账号名称
+	Phone          string `json:"phone"`            // 绑定手机
+	JobId          int    `json:"job_id"`           // 岗位ID
+}
+
+func NewUpdateSubAccountRequest() *UpdateSubAccountRequest {
+	return new(UpdateSubAccountRequest)
+}
+
+func NewUpdateSubAccountResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(UpdateSubAccountInfo)
+	return resp
+}

+ 147 - 120
route/init.go

@@ -14,28 +14,10 @@ func InitRoute(r *gin.Engine) {
 	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // nothing
 	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // nothing
 	a := r.Group("/youngee")
 	a := r.Group("/youngee")
 	{
 	{
-		a.POST("/register", handler.WrapRegisterHandler)                    // 服务商主账号注册
-		a.POST("/addNewSubAccount", handler.WrapAddNewSubAccountHandler)    // 服务商子账号注册
-		a.POST("/findAllSubAccount", handler.WrapFindAllSubAccountHandler)  // 查找全部所属子账号
-		a.POST("/deleteSubAccount", handler.WrapDeleteSubAccountHandler)    // 删除子账号
-		a.POST("/findAllJob", handler.WrapFindAllJobHandler)                // 查找服务商全部所属岗位
-		a.POST("/addNewJob", handler.WrapaddNewJobHandler)                  // 服务商新增岗位
-		a.POST("/updateJob", handler.WrapupdateJobHandler)                  // 服务商修改岗位
-		a.POST("/deleteJob", handler.WrapdeleteJobHandler)                  // 服务商删除岗位
-		a.POST("/sendCode", handler.WrapSendCodeHandler)                    // 发送登录验证码
-		a.POST("/login", handler.WrapCodeLoginHandler)                      // 服务商登录
-		a.POST("/getUserInfo", handler.WrapGetUserInfoHandler)              // 服务商用户信息
-		a.POST("/accountInfo/get", handler.WrapGetAccountInfoHandler)       // 账号管理-账号信息查询
-		a.POST("/accountInfo/update", handler.WrapUpdateAccountInfoHandler) // 账号管理-账号信息更新
-		a.POST("/reviewInfo/get", handler.WrapGetReviewInfoHandler)         // 账号管理-认证信息查询
-		a.POST("/company/review", handler.WrapCompanyReviewHandler)         // 账号管理-营业执照认证
-		a.POST("/idCard/review", handler.WrapIdCardReviewHandler)           // 账号管理-身份证认证
-		a.POST("/reviewInfo/create", handler.WrapSaveReviewHandler)         // 账号管理-认证信息创建
-		a.POST("/contactInfo/get", handler.WrapGetContactInfoHandler)       // 联系方式-查询
-		a.POST("/contactInfo/update", handler.WrapUpdateContactInfoHandler) // 联系方式-更新
-		a.POST("/sendCodeT", handler.WrapSendCodeTHandler)                  // 发送验证码测试接口
-		// a.POST("/contactInfo/create", handler.WrapCreateContactInfoHandler) // 联系方式-创建
-
+		a.POST("/sendCode", handler.WrapSendCodeHandler)   // 发送登录验证码
+		a.POST("/login", handler.WrapCodeLoginHandler)     // 服务商登录
+		a.POST("/register", handler.WrapRegisterHandler)   // 服务商主账号注册
+		a.POST("/sendCodeT", handler.WrapSendCodeTHandler) // 发送验证码测试接口
 		a.GET("/test/ping", func(c *gin.Context) {
 		a.GET("/test/ping", func(c *gin.Context) {
 			resp := http_model.CommonResponse{
 			resp := http_model.CommonResponse{
 				Status:  0,
 				Status:  0,
@@ -46,15 +28,149 @@ func InitRoute(r *gin.Engine) {
 		})
 		})
 	}
 	}
 
 
-	//r.Any("/testDemo", func(c *gin.Context) {
-	//	resp := http_model.CommonResponse{
-	//		Status:  0,
-	//		Message: "",
-	//		Data:    "pong",
-	//	}
-	//	c.JSON(200, resp)
-	//	// 注意这里只是debug用的 接口要写成handler形式
-	//})
+	// 账号管理
+	accountInfo := r.Group("/youngee")
+	{
+		accountInfo.Use(middleware.LoginAuthMiddleware)
+		accountInfo.POST("/getUserInfo", handler.WrapGetUserInfoHandler)              // 服务商用户信息
+		accountInfo.POST("/accountInfo/get", handler.WrapGetAccountInfoHandler)       // 账号管理-账号信息查询
+		accountInfo.POST("/accountInfo/update", handler.WrapUpdateAccountInfoHandler) // 账号管理-账号信息更新
+		accountInfo.POST("/reviewInfo/get", handler.WrapGetReviewInfoHandler)         // 账号管理-认证信息查询
+		accountInfo.POST("/company/review", handler.WrapCompanyReviewHandler)         // 账号管理-营业执照认证
+		accountInfo.POST("/idCard/review", handler.WrapIdCardReviewHandler)           // 账号管理-身份证认证
+		accountInfo.POST("/reviewInfo/create", handler.WrapSaveReviewHandler)         // 账号管理-认证信息创建
+		accountInfo.POST("/contactInfo/get", handler.WrapGetContactInfoHandler)       // 联系方式-查询
+		accountInfo.POST("/contactInfo/update", handler.WrapUpdateContactInfoHandler) // 联系方式-更新
+		// a.POST("/contactInfo/create", handler.WrapCreateContactInfoHandler) // 联系方式-创建
+	}
+
+	// 子账号
+	subAccount := r.Group("/youngee/subAccount")
+	{
+		subAccount.Use(middleware.LoginAuthMiddleware)
+		subAccount.POST("/create", handler.WrapAddNewSubAccountHandler)     // 子账号-注册
+		subAccount.POST("/get", handler.WrapFindAllSubAccountHandler)       // 子账号-查询
+		subAccount.POST("/shutDown", handler.WrapShutDownSubAccountHandler) // 子账号-停用
+		subAccount.POST("/update", handler.WrapUpdateSubAccountHandler)     // 子账号-更新
+		subAccount.POST("/delete", handler.WrapDeleteSubAccountHandler)     // 子账号-删除
+	}
+
+	// 岗位
+	job := r.Group("/youngee/job")
+	{
+		job.Use(middleware.LoginAuthMiddleware)
+		job.POST("/get", handler.WrapFindAllJobHandler)   // 查找服务商全部所属岗位
+		job.POST("/create", handler.WrapaddNewJobHandler) // 服务商新增岗位
+		job.POST("/update", handler.WrapupdateJobHandler) // 服务商修改岗位
+		job.POST("/delete", handler.WrapdeleteJobHandler) // 服务商删除岗位
+	}
+
+	// 种草
+	sProject := r.Group("/youngee/m/sProject")
+	{
+		sProject.Use(middleware.LoginAuthMiddleware)
+		// 服务商版公开种草接口
+		sProject.POST("/fullProjectList", handler.WrapFullProjectListHandler)          // 商单广场-公开种草任务列表
+		sProject.POST("/sProjectList", handler.WrapSProjectListHandler)                // 商单管理-服务商商单列表
+		sProject.POST("/addToList", handler.WrapAddToListHandler)                      // 公开种草任务服务商加入商单
+		sProject.POST("/showProject", handler.WrapShowProjectHandler)                  // 种草任务内容
+		sProject.POST("/showSProject", handler.WrapShowSProjectHandler)                // 服务商种草任务内容
+		sProject.POST("/product/find", handler.WrapFindProductHandler)                 // 查找单个产品
+		sProject.POST("/projectStrategy", handler.WrapProjectStrategyHandler)          // 招募策略查询
+		sProject.POST("/taskList", handler.WrapProjectTaskListHandler)                 // 子任务列表
+		sProject.POST("/taskCount", handler.WrapProjectTaskCountHandler)               // 子任务数量统计
+		sProject.POST("/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
+		sProject.POST("/showTaskProgress", handler.WrapShowTaskProgressHandler)        // 展示子任务进度
+		sProject.POST("/qrcode/getWxQrcode", handler.WrapGetWxQRCodeHandler)           // 获取微信二维码
+
+		// 服务商版定向种草接口
+		sProject.POST("/specialProjectList", handler.WrapSpecialProjectListHandler)     // 商单广场 - 定向种草任务列表
+		sProject.POST("/specialSProjectList", handler.WrapSpecialSProjectListHandler)   // 商单管理 - 定向种草任务列表
+		sProject.POST("/specialAddToList", handler.WrapSpecialSProjectAddToListHandler) // 定向种草任务加入商单 (同意/拒绝定向邀约)
+		sProject.POST("/specialAddStrategy", handler.WrapSpecialAddStrategyHandler)     // 定向种草任务添加招募策略
+	}
+
+	// 推广合作
+	c := r.Group("/youngee/c/cooperate")
+	{
+		c.Use(middleware.LoginAuthMiddleware)
+		c.POST("/enterpriseList", handler.WrapEnterpriseListHandler)   // 商家列表
+		c.POST("/agreeCooperate", handler.WrapAgreeCooperateHandler)   // 同意入库邀请
+		c.POST("/rejectCooperate", handler.WrapRejectCooperateHandler) // 拒绝入库邀请
+
+		c.POST("/talentList", handler.WrapTalentListHandler)                   // 达人库达人列表
+		c.POST("/talentData", handler.WrapTalentDataHandler)                   // 达人库核心数据、达人信息查询
+		c.POST("/talentCooperateData", handler.WrapTalentCooperateDataHandler) // 达人库合作数据-活跃数据查询
+		c.POST("/projectList", handler.WrapTalentProjectListHandler)           // 达人种草表现
+		c.POST("/localList", handler.WrapTalentLocalListHandler)               // 达人本地生活表现
+	}
+
+	// 本地生活
+	localLife := r.Group("/youngee/l/localLife")
+	{
+		localLife.Use(middleware.LoginAuthMiddleware)
+		localLife.POST("/localLife/fullLocalList", handler.WrapFullListHandler)            // 商单广场-公开本地生活任务列表
+		localLife.POST("/localLife/detail", handler.WrapLocalLifeDetailHandler)            // 本地生活任务详情
+		localLife.POST("/localLife/specialLocalList", handler.WrapSpecialLocalListHandler) // 商单广场-定向本地生活任务列表
+	}
+
+	// 服务商本地生活
+	sLocalLife := r.Group("/youngee/l/sLocalLife")
+	{
+		sLocalLife.Use(middleware.LoginAuthMiddleware)
+		sLocalLife.POST("/addToList", handler.WrapLocalLifeAddToListHandler)               // 公开本地生活任务服务商加入商单
+		sLocalLife.POST("/fullSLocalList", handler.WrapFullSLocalListHandler)              // 商单管理-公开本地生活任务列表
+		sLocalLife.POST("/showSLocal", handler.WrapShowSLocalHandler)                      // 服务商本地生活任务详情
+		sLocalLife.POST("/taskList", handler.WrapLocalTaskListHandler)                     // 子任务列表
+		sLocalLife.POST("/taskCount", handler.WrapLocalTaskCountHandler)                   // 子任务数量统计
+		sLocalLife.POST("/changeTaskStatus", handler.WrapLocalChangeTaskStatusHandler)     // 改变子任务的状态 报名通过,拒绝报名
+		sLocalLife.POST("/teamBuying/find", handler.WrapFindTeamBuyingHandler)             // 查找团购
+		sLocalLife.POST("/store/find", handler.WrapFindStoreHandler)                       // 查找门店
+		sLocalLife.POST("/specialAddToList", handler.WrapSpecialLocalAddToListHandler)     // 定向本地生活任务同意/拒绝加入商单
+		sLocalLife.POST("/localStrategy", handler.WrapLocalStrategyHandler)                // 招募策略查询
+		sLocalLife.POST("/specialAddStrategy", handler.WrapLocalSpecialAddStrategyHandler) // 定向本地生活任务添加招募策略
+	}
+
+	// 余额、账单
+	f := r.Group("/youngee/f")
+	{
+		f.Use(middleware.LoginAuthMiddleware)
+
+		// 余额管理
+		f.POST("/supplierAmount/billList", handler.WrapSupplierAmountBillListHandler) // 账单列表
+		f.POST("/supplierAmount/billAmount", handler.WrapSupplierBillAmountHandler)   // 总余额、可提现金额
+
+		// 账单查询
+		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草任务账单列表
+		f.POST("/fullSProject/taskBillList", handler.WrapFullSProjectTaskBillListHandler) // 种草子任务账单列表
+		f.POST("/fullSLocal/billList", handler.WrapFullSLocalBillListHandler)             // 本地生活任务账单列表
+		f.POST("/fullSLocal/taskBillList", handler.WrapFullSLocalTaskBillListHandler)     // 本地生活子任务账单列表
+	}
+
+	// 回票
+	supplierInvoice := r.Group("/youngee/l/supplierInvoice")
+	{
+		supplierInvoice.Use(middleware.LoginAuthMiddleware)
+		f.POST("/incomeList", handler.WrapFullSProjectIncomeListHandler) // 可回发票列表
+		f.POST("/create", handler.WrapCreateSupplierInvoiceHandler)      // 合并账单回票
+		f.POST("/update", handler.WrapUpdateSupplierInvoiceHandler)      // 上传发票
+		f.POST("/invoiceList", handler.WrapSupplierInvoiceListHandler)   // 发票列表
+		f.POST("/ygInvoiceInfo", handler.WrapManageInvoiceInfoHandler)   // 平台回票信息
+		f.POST("/amount", handler.WrapInvoiceAmountHandler)              // 可回发票、待传发票、平台确认中、已回发票金额
+	}
+
+	// 提现
+	supplierWithdraw := r.Group("/youngee/l/supplierWithdraw")
+	{
+		supplierWithdraw.Use(middleware.LoginAuthMiddleware)
+		f.POST("/amount", handler.WrapWithdrawAmountHandler)                       // 可提现、提现中、已提现金额
+		f.POST("/paymentInfo", handler.WrapWithdrawPaymentInfoHandler)             // 查询提现收款信息
+		f.POST("/createPaymentInfo", handler.WrapCreateWithdrawPaymentInfoHandler) // 新增收款信息
+		f.POST("/updatePaymentInfo", handler.WrapUpdateWithdrawPaymentInfoHandler) // 更新收款信息
+		f.POST("/toList", handler.WrapSupplierToWithdrawListHandler)               // 服务商可提现账单列表
+		f.POST("/create", handler.WrapCreateSupplierWithdrawHandler)               // 服务商提现
+		f.POST("/List", handler.WrapSupplierWithdrawListHandler)                   // 提现管理列表
+	}
 
 
 	m := r.Group("/youngee/m")
 	m := r.Group("/youngee/m")
 	{
 	{
@@ -66,26 +182,6 @@ func InitRoute(r *gin.Engine) {
 			logrus.Infof("auth:%+v", auth)
 			logrus.Infof("auth:%+v", auth)
 		})
 		})
 
 
-		// 服务商版公开种草接口
-		m.POST("/sProject/fullProjectList", handler.WrapFullProjectListHandler)          // 商单广场-公开种草任务列表
-		m.POST("/sProject/sProjectList", handler.WrapSProjectListHandler)                // 商单管理-服务商商单列表
-		m.POST("/sProject/addToList", handler.WrapAddToListHandler)                      // 公开种草任务服务商加入商单
-		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)                 // 子任务列表
-		m.POST("/sProject/taskCount", handler.WrapProjectTaskCountHandler)               // 子任务数量统计
-		m.POST("/sProject/changeTaskStatus", handler.WrapProjectChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
-		m.POST("/sProject/showTaskProgress", handler.WrapShowTaskProgressHandler)        // 展示子任务进度
-		m.POST("/qrcode/getWxQrcode", handler.WrapGetWxQRCodeHandler)                    // 获取微信二维码
-
-		// 服务商版定向种草接口
-		m.POST("/sProject/specialProjectList", handler.WrapSpecialProjectListHandler)     // 商单广场 - 定向种草任务列表
-		m.POST("/sProject/specialSProjectList", handler.WrapSpecialSProjectListHandler)   // 商单管理 - 定向种草任务列表
-		m.POST("/sProject/specialAddToList", handler.WrapSpecialSProjectAddToListHandler) // 定向种草任务加入商单 (同意/拒绝定向邀约)
-		m.POST("/sProject/specialAddStrategy", handler.WrapSpecialAddStrategyHandler)     // 定向种草任务添加招募策略
-
 		// 下面接口都是商家端遗留
 		// 下面接口都是商家端遗留
 		m.POST("/project/create", handler.WrapCreateProjectHandler)                          // 创建项目
 		m.POST("/project/create", handler.WrapCreateProjectHandler)                          // 创建项目
 		m.POST("/project/update", handler.WrapUpdateProjectHandler)                          // 更新项目
 		m.POST("/project/update", handler.WrapUpdateProjectHandler)                          // 更新项目
@@ -189,73 +285,4 @@ func InitRoute(r *gin.Engine) {
 		s.POST("/selection/task/settle", handler.WrapSettleSecTaskHandler)                    // 结算
 		s.POST("/selection/task/settle", handler.WrapSettleSecTaskHandler)                    // 结算
 		s.POST("/selection/getAllSelection", handler.WrapGetAllSelectionHandler)              // 查询选品广场选品列表
 		s.POST("/selection/getAllSelection", handler.WrapGetAllSelectionHandler)              // 查询选品广场选品列表
 	}
 	}
-
-	// 推广合作板块
-	c := r.Group("/youngee/c")
-	{
-		c.Use(middleware.LoginAuthMiddleware)
-		c.POST("/cooperate/enterpriseList", handler.WrapEnterpriseListHandler)   // 商家列表
-		c.POST("/cooperate/agreeCooperate", handler.WrapAgreeCooperateHandler)   // 同意入库邀请
-		c.POST("/cooperate/rejectCooperate", handler.WrapRejectCooperateHandler) // 拒绝入库邀请
-
-		c.POST("/cooperate/talentList", handler.WrapTalentListHandler)                   // 达人库达人列表
-		c.POST("/cooperate/talentData", handler.WrapTalentDataHandler)                   // 达人库核心数据、达人信息查询
-		c.POST("/cooperate/talentCooperateData", handler.WrapTalentCooperateDataHandler) // 达人库合作数据-活跃数据查询
-		c.POST("/cooperate/projectList", handler.WrapTalentProjectListHandler)           // 达人种草表现
-		c.POST("/cooperate/localList", handler.WrapTalentLocalListHandler)               // 达人本地生活表现
-	}
-
-	// 本地生活板块
-	l := r.Group("/youngee/l")
-	{
-		l.Use(middleware.LoginAuthMiddleware)
-		l.POST("/localLife/fullLocalList", handler.WrapFullListHandler)                  // 商单广场-公开本地生活任务列表
-		l.POST("/localLife/detail", handler.WrapLocalLifeDetailHandler)                  // 本地生活任务详情
-		l.POST("/sLocalLife/addToList", handler.WrapLocalLifeAddToListHandler)           // 公开本地生活任务服务商加入商单
-		l.POST("/sLocalLife/fullSLocalList", handler.WrapFullSLocalListHandler)          // 商单管理-公开本地生活任务列表
-		l.POST("/sLocalLife/showSLocal", handler.WrapShowSLocalHandler)                  // 服务商本地生活任务详情
-		l.POST("/sLocalLife/taskList", handler.WrapLocalTaskListHandler)                 // 子任务列表
-		l.POST("/sLocalLife/taskCount", handler.WrapLocalTaskCountHandler)               // 子任务数量统计
-		l.POST("/sLocalLife/changeTaskStatus", handler.WrapLocalChangeTaskStatusHandler) // 改变子任务的状态 报名通过,拒绝报名
-		l.POST("/sLocalLife/teamBuying/find", handler.WrapFindTeamBuyingHandler)         // 查找团购
-		l.POST("/sLocalLife/store/find", handler.WrapFindStoreHandler)                   // 查找门店
-
-		l.POST("/localLife/specialLocalList", handler.WrapSpecialLocalListHandler)           // 商单广场-定向本地生活任务列表
-		l.POST("/sLocalLife/specialAddToList", handler.WrapSpecialLocalAddToListHandler)     // 定向本地生活任务同意/拒绝加入商单
-		l.POST("/sLocalLife/localStrategy", handler.WrapLocalStrategyHandler)                // 招募策略查询
-		l.POST("/sLocalLife/specialAddStrategy", handler.WrapLocalSpecialAddStrategyHandler) // 定向本地生活任务添加招募策略
-	}
-
-	// 财务结算板块
-	f := r.Group("/youngee/f")
-	{
-		f.Use(middleware.LoginAuthMiddleware)
-
-		// 余额管理
-		f.POST("/supplierAmount/billList", handler.WrapSupplierAmountBillListHandler) // 账单列表
-		f.POST("/supplierAmount/billAmount", handler.WrapSupplierBillAmountHandler)   // 总余额、可提现金额
-
-		// 账单查询
-		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草任务账单列表
-		f.POST("/fullSProject/taskBillList", handler.WrapFullSProjectTaskBillListHandler) // 种草子任务账单列表
-		f.POST("/fullSLocal/billList", handler.WrapFullSLocalBillListHandler)             // 本地生活任务账单列表
-		f.POST("/fullSLocal/taskBillList", handler.WrapFullSLocalTaskBillListHandler)     // 本地生活子任务账单列表
-
-		// 回票
-		f.POST("/supplierInvoice/incomeList", handler.WrapFullSProjectIncomeListHandler) // 可回发票列表
-		f.POST("/supplierInvoice/create", handler.WrapCreateSupplierInvoiceHandler)      // 合并账单回票
-		f.POST("/supplierInvoice/update", handler.WrapUpdateSupplierInvoiceHandler)      // 上传发票
-		f.POST("/supplierInvoice/invoiceList", handler.WrapSupplierInvoiceListHandler)   // 发票列表
-		f.POST("/supplierInvoice/ygInvoiceInfo", handler.WrapManageInvoiceInfoHandler)   // 平台回票信息
-		f.POST("/supplierInvoice/amount", handler.WrapInvoiceAmountHandler)              // 可回发票、待传发票、平台确认中、已回发票金额
-
-		// 提现
-		f.POST("/supplierWithdraw/amount", handler.WrapWithdrawAmountHandler)                       // 可提现、提现中、已提现金额
-		f.POST("/supplierWithdraw/paymentInfo", handler.WrapWithdrawPaymentInfoHandler)             // 查询提现收款信息
-		f.POST("/supplierWithdraw/createPaymentInfo", handler.WrapCreateWithdrawPaymentInfoHandler) // 新增收款信息
-		f.POST("/supplierWithdraw/updatePaymentInfo", handler.WrapUpdateWithdrawPaymentInfoHandler) // 更新收款信息
-		f.POST("/supplierWithdraw/toList", handler.WrapSupplierToWithdrawListHandler)               // 服务商可提现账单列表
-		f.POST("/supplierWithdraw/create", handler.WrapCreateSupplierWithdrawHandler)               // 服务商提现
-		f.POST("/supplierWithdraw/List", handler.WrapSupplierWithdrawListHandler)                   // 提现管理列表
-	}
 }
 }

+ 1 - 1
service/job.go

@@ -64,7 +64,7 @@ func (*job) DeleteJob(ctx context.Context, request http_model.DeleteJobRequest)
 func (*job) FindJobBySupplierId(ctx context.Context, request http_model.FindAllJobRequest) (*http_model.FindAllJobData, error) {
 func (*job) FindJobBySupplierId(ctx context.Context, request http_model.FindAllJobRequest) (*http_model.FindAllJobData, error) {
 	var jobNameData *http_model.FindAllJobData
 	var jobNameData *http_model.FindAllJobData
 	jobNameData = &http_model.FindAllJobData{}
 	jobNameData = &http_model.FindAllJobData{}
-	jobInfo, total, jobErr := db.FindJobBySupplierId(ctx, request.SupplierId)
+	jobInfo, total, jobErr := db.FindJobBySupplierId(ctx, request.SupplierId, request.PageNum, request.PageSize)
 	if jobErr != nil {
 	if jobErr != nil {
 		return nil, jobErr
 		return nil, jobErr
 	}
 	}

+ 23 - 11
service/sub_account.go

@@ -52,14 +52,13 @@ func (*subaccount) CreateSubAccount(ctx context.Context, request http_model.AddN
 }
 }
 
 
 // UpdateSubAccount 修改子账号
 // UpdateSubAccount 修改子账号
-func (*subaccount) UpdateSubAccount(ctx context.Context, request http_model.UpdateJobRequest) error {
-	var newSubAccount *gorm_model.YounggeeSubAccount
-	newSubAccount = &gorm_model.YounggeeSubAccount{}
-	err := db.UpdateSubAccount(ctx, newSubAccount)
-	if err != nil {
-		return err
-	}
-	return nil
+func (*subaccount) UpdateSubAccount(ctx context.Context, request http_model.UpdateSubAccountRequest) (*http_model.UpdateSubAccountInfo, error) {
+	//var newSubAccount *gorm_model.YounggeeSubAccount
+	//newSubAccount = &gorm_model.YounggeeSubAccount{}
+	//// 1. 若修改绑定手机号
+	//if request.Phone != "" {
+	//}
+	return nil, nil
 }
 }
 
 
 // DeleteSubAccount 删除子账号
 // DeleteSubAccount 删除子账号
@@ -80,9 +79,9 @@ func (*subaccount) FindSubAccountBySupplierId(ctx context.Context, request http_
 	subAccountResp = &http_model.FindAllSubAccountData{}
 	subAccountResp = &http_model.FindAllSubAccountData{}
 
 
 	// 1. 取出子账号基本信息
 	// 1. 取出子账号基本信息
-	newSubAccount, total, subaccountErr := db.FindSubAccountBySupplierId(ctx, request.SupplierId, request.JobId, request.AccountStatus)
-	if subaccountErr != nil {
-		return nil, subaccountErr
+	newSubAccount, total, subAccountErr := db.FindSubAccountBySupplierId(ctx, request.PageNum, request.PageSize, request.SupplierId, request.JobId, request.AccountStatus, request.Condition)
+	if subAccountErr != nil {
+		return nil, subAccountErr
 	}
 	}
 	if newSubAccount != nil {
 	if newSubAccount != nil {
 		for _, s := range newSubAccount {
 		for _, s := range newSubAccount {
@@ -121,3 +120,16 @@ func (*subaccount) FindSubAccountBySupplierId(ctx context.Context, request http_
 	subAccountResp.Total = total
 	subAccountResp.Total = total
 	return subAccountResp, nil
 	return subAccountResp, nil
 }
 }
+
+// ShutDownSubAccount 停用子账号
+func (*subaccount) ShutDownSubAccount(ctx context.Context, request http_model.ShutDownSubAccountRequest) error {
+	var newSubAccount *gorm_model.YounggeeSubAccount
+	newSubAccount = &gorm_model.YounggeeSubAccount{}
+	newSubAccount.SubAccountId = request.SubAccountId
+	newSubAccount.AccountStatus = 2
+	err := db.UpdateSubAccount(ctx, newSubAccount)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 2 - 1
service/supplier.go

@@ -193,6 +193,8 @@ func (l *loginAuth) UpdateSupplierAccountInfo(ctx context.Context, req *http_mod
 		// 服务商子账号
 		// 服务商子账号
 		var subAccountInfo *gorm_model.YounggeeSubAccount
 		var subAccountInfo *gorm_model.YounggeeSubAccount
 		subAccountInfo = &gorm_model.YounggeeSubAccount{}
 		subAccountInfo = &gorm_model.YounggeeSubAccount{}
+		subAccountInfo.SubAccountId = req.SubAccountId
+		subAccountInfo.SubAccountType = 3
 		subAccountInfo.SupplierId = req.SupplierId
 		subAccountInfo.SupplierId = req.SupplierId
 		subAccountInfo.SubAccountName = req.SubAccountName
 		subAccountInfo.SubAccountName = req.SubAccountName
 		subAccountInfo.Avatar = req.Avatar
 		subAccountInfo.Avatar = req.Avatar
@@ -384,7 +386,6 @@ func (l *loginAuth) UpdateSupplierContactInfo(ctx context.Context, req *http_mod
 			contactInfo.WechatNumber = req.WechatNumber
 			contactInfo.WechatNumber = req.WechatNumber
 		}
 		}
 	}
 	}
-
 	return contactInfo, true, nil
 	return contactInfo, true, nil
 }
 }