瀏覽代碼

0318BugFix

Xingyu Xian 2 月之前
父節點
當前提交
0b016bfcbf

+ 19 - 0
db/manage_invoice.go

@@ -0,0 +1,19 @@
+package db
+
+import (
+	"context"
+	"youngee_b_api/model/gorm_model"
+)
+
+func GetManageInvoice(ctx context.Context) (*gorm_model.YounggeeManageInvoiceInfo, error) {
+	db := GetReadDB(ctx)
+	var latestInvoice gorm_model.YounggeeManageInvoiceInfo
+	err := db.Model(&gorm_model.YounggeeManageInvoiceInfo{}).
+		Order("invoice_info_id DESC"). // 按 ID 降序排序
+		First(&latestInvoice).         // 获取第一条记录
+		Error
+	if err != nil {
+		return nil, err
+	}
+	return &latestInvoice, nil
+}

+ 17 - 0
db/supplier_income.go

@@ -52,3 +52,20 @@ func GetIncomeInfoByIncomeId(ctx context.Context, incomeId int) (*gorm_model.You
 	}
 	return incomeInfo, nil
 }
+
+// GetFullSupplierIncomeList 查找服务商全部收入信息
+func GetFullSupplierIncomeList(ctx context.Context, supplierId int, incomeStatus int) ([]*gorm_model.YounggeeSupplierIncome, error) {
+	db := GetReadDB(ctx)
+
+	// 1. 根据基本信息过滤
+	db = db.Debug().Model(gorm_model.YounggeeSupplierIncome{}).Where("supplier_id = ? and income_status = ?", supplierId, incomeStatus)
+
+	// 2. 查询全部数据
+	var SupplierIncomeList []*gorm_model.YounggeeSupplierIncome
+	err := db.Order("s_project_id desc").Find(&SupplierIncomeList).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[GetSupplierIncomeList] error query mysql, err:%+v", err)
+		return nil, err
+	}
+	return SupplierIncomeList, nil
+}

+ 50 - 0
handler/get_manage_invoice_info.go

@@ -0,0 +1,50 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapManageInvoiceInfoHandler(ctx *gin.Context) {
+	handler := newManageInvoiceInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newManageInvoiceInfoHandler(ctx *gin.Context) *ManageInvoiceInfoHandler {
+	return &ManageInvoiceInfoHandler{
+		req:  http_model.NewManageInvoiceInfoRequest(),
+		resp: http_model.NewManageInvoiceInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type ManageInvoiceInfoHandler struct {
+	req  *http_model.ManageInvoiceInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *ManageInvoiceInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *ManageInvoiceInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *ManageInvoiceInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *ManageInvoiceInfoHandler) run() {
+	supplierInvoice, err := service.Supplier.GetManageInvoiceInfo(h.ctx, h.req)
+	if err != nil {
+		h.resp.Data = err
+		h.resp.Message = "查询失败"
+	}
+	h.resp.Data = supplierInvoice
+	h.resp.Message = "查询成功"
+
+}
+
+func (h *ManageInvoiceInfoHandler) checkParam() error {
+	return nil
+}

+ 64 - 0
handler/get_user_info.go

@@ -0,0 +1,64 @@
+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 WrapGetUserInfoHandler(ctx *gin.Context) {
+	handler := newGetUserInfoHandler(ctx)
+	userToken := ctx.Request.Header.Get("Authorization")
+	handler.req.Token = userToken
+	baseRun(handler)
+}
+
+func newGetUserInfoHandler(ctx *gin.Context) *GetUserInfoHandler {
+	return &GetUserInfoHandler{
+		req:  http_model.NewGetUserInfoRequest(),
+		resp: http_model.NewGetUserInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type GetUserInfoHandler struct {
+	req  *http_model.GetUserInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *GetUserInfoHandler) getRequest() interface{} {
+	return h.req
+}
+
+func (h *GetUserInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+
+func (h *GetUserInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *GetUserInfoHandler) run() {
+	userData, err := service.SUserInfo.FindBUserInfoByToken(h.ctx, h.req.Token)
+	if err != nil {
+		logrus.Errorf("[CodeLoginHandler] call AuthCode err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("login fail,req:%+v", h.req)
+		return
+	}
+	var data *http_model.GetUserInfoData
+	data = userData
+	h.resp.Message = "成功查询用户信息"
+	h.resp.Data = data
+	h.resp.Status = 20000
+	return
+}
+
+func (h *GetUserInfoHandler) checkParam() error {
+	return nil
+}

+ 49 - 0
handler/supplier_bill_amount.go

@@ -0,0 +1,49 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapSupplierBillAmountHandler(ctx *gin.Context) {
+	handler := newSupplierBillAmountHandler(ctx)
+	baseRun(handler)
+}
+
+func newSupplierBillAmountHandler(ctx *gin.Context) *SupplierBillAmountHandler {
+	return &SupplierBillAmountHandler{
+		req:  http_model.SupplierBillAmountRequest(),
+		resp: http_model.SupplierBillAmountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type SupplierBillAmountHandler struct {
+	req  *http_model.SupplierAmountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *SupplierBillAmountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *SupplierBillAmountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *SupplierBillAmountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *SupplierBillAmountHandler) run() {
+	data, err := service.Supplier.GetSupplierBillAmount(h.ctx, h.req)
+	if err != nil {
+		h.resp.Message = err.Error()
+	}
+	h.resp.Data = data
+	// fmt.Println(data)
+	h.resp.Message = "成功查询"
+}
+
+func (h *SupplierBillAmountHandler) checkParam() error {
+	return nil
+}

+ 50 - 0
handler/supplier_invoice_amount.go

@@ -0,0 +1,50 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapInvoiceAmountHandler(ctx *gin.Context) {
+	handler := newInvoiceAmountHandler(ctx)
+	baseRun(handler)
+}
+
+func newInvoiceAmountHandler(ctx *gin.Context) *InvoiceAmountHandler {
+	return &InvoiceAmountHandler{
+		req:  http_model.NewInvoiceAmountRequest(),
+		resp: http_model.NewInvoiceAmountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type InvoiceAmountHandler struct {
+	req  *http_model.InvoiceAmountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *InvoiceAmountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *InvoiceAmountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *InvoiceAmountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *InvoiceAmountHandler) run() {
+	amount, err := service.Supplier.GetSupplierInvoiceAmount(h.ctx, h.req)
+	if err != nil {
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
+	}
+	h.resp.Data = amount
+	h.resp.Message = "成功添加"
+}
+
+func (h *InvoiceAmountHandler) checkParam() error {
+	return nil
+}

+ 50 - 0
handler/supplier_withdraw_amount.go

@@ -0,0 +1,50 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapWithdrawAmountHandler(ctx *gin.Context) {
+	handler := newWithdrawAmountHandler(ctx)
+	baseRun(handler)
+}
+
+func newWithdrawAmountHandler(ctx *gin.Context) *WithdrawAmountHandler {
+	return &WithdrawAmountHandler{
+		req:  http_model.NewWithdrawAmountRequest(),
+		resp: http_model.NewWithdrawAmountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type WithdrawAmountHandler struct {
+	req  *http_model.WithdrawAmountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *WithdrawAmountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *WithdrawAmountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *WithdrawAmountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *WithdrawAmountHandler) run() {
+	amount, err := service.Supplier.GetWithdrawAmount(h.ctx, h.req)
+	if err != nil {
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
+	}
+	h.resp.Data = amount
+	h.resp.Message = "成功添加"
+}
+
+func (h *WithdrawAmountHandler) checkParam() error {
+	return nil
+}

+ 50 - 0
handler/withdraw_payment_info.go

@@ -0,0 +1,50 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapWithdrawPaymentInfoHandler(ctx *gin.Context) {
+	handler := newWithdrawPaymentInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newWithdrawPaymentInfoHandler(ctx *gin.Context) *WithdrawPaymentInfoHandler {
+	return &WithdrawPaymentInfoHandler{
+		req:  http_model.NewWithdrawPaymentInfoRequest(),
+		resp: http_model.NewWithdrawPaymentInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type WithdrawPaymentInfoHandler struct {
+	req  *http_model.WithdrawPaymentInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *WithdrawPaymentInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *WithdrawPaymentInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *WithdrawPaymentInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *WithdrawPaymentInfoHandler) run() {
+	amount, err := service.Supplier.GetWithdrawPaymentInfo(h.ctx, h.req)
+	if err != nil {
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
+	}
+	h.resp.Data = amount
+	h.resp.Message = "成功添加"
+}
+
+func (h *WithdrawPaymentInfoHandler) checkParam() error {
+	return nil
+}

+ 49 - 0
handler/withdraw_update_payment_info.go

@@ -0,0 +1,49 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapUpdateWithdrawPaymentInfoHandler(ctx *gin.Context) {
+	handler := newUpdateWithdrawPaymentInfoHandler(ctx)
+	baseRun(handler)
+}
+
+func newUpdateWithdrawPaymentInfoHandler(ctx *gin.Context) *UpdateWithdrawPaymentInfoHandler {
+	return &UpdateWithdrawPaymentInfoHandler{
+		req:  http_model.NewUpdateWithdrawPaymentInfoRequest(),
+		resp: http_model.NewUpdateWithdrawPaymentInfoResponse(),
+		ctx:  ctx,
+	}
+}
+
+type UpdateWithdrawPaymentInfoHandler struct {
+	req  *http_model.UpdateWithdrawPaymentInfoRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *UpdateWithdrawPaymentInfoHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *UpdateWithdrawPaymentInfoHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *UpdateWithdrawPaymentInfoHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *UpdateWithdrawPaymentInfoHandler) run() {
+	err := service.Supplier.UpdateWithdrawPaymentInfo(h.ctx, h.req)
+	if err != nil {
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
+	}
+	h.resp.Message = "ok"
+}
+
+func (h *UpdateWithdrawPaymentInfoHandler) checkParam() error {
+	return nil
+}

+ 15 - 0
model/gorm_model/manage_invoice_info.go

@@ -0,0 +1,15 @@
+package gorm_model
+
+type YounggeeManageInvoiceInfo struct {
+	InvoiceInfoID       int    `gorm:"column:invoice_info_id;primary_key;AUTO_INCREMENT"` // 后台设置回票信息ID
+	EnterpriseName      string `gorm:"column:enterprise_name;NOT NULL"`                   // 企业名称
+	Address             string `gorm:"column:address;NOT NULL"`                           // 注册地址
+	Phone               string `gorm:"column:phone;NOT NULL"`                             // 注册电话
+	BankName            string `gorm:"column:bank_name;NOT NULL"`                         // 开户银行
+	BankNumber          string `gorm:"column:bank_number;NOT NULL"`                       // 开户银行账号
+	ProjectNameToChoose string `gorm:"column:project_name_to_choose;NOT NULL"`            // 项目名称可选
+}
+
+func (m *YounggeeManageInvoiceInfo) TableName() string {
+	return "younggee_manage_invoice_info"
+}

+ 29 - 29
model/gorm_model/s_local_life.go

@@ -5,35 +5,35 @@ import (
 )
 
 type YounggeeSLocalLifeInfo struct {
-	SLocalId            int       `gorm:"column:s_local_id;primary_key"` // 主键ID
-	LocalId             string    `gorm:"column:local_id"`               // 被加入商单的原本地生活ID
-	EnterpriseId        string    `gorm:"column:enterprise_id"`          // 商家ID
-	SupplierId          int       `gorm:"column:supplier_id"`            // 服务商ID
-	StoreId             int       `gorm:"column:store_id"`               // 门店ID
-	LocalName           string    `gorm:"column:local_name"`             // 本地生活名称
-	TeamBuyingId        int       `gorm:"column:team_buying_id"`         // 团购ID
-	LocalType           int       `gorm:"column:local_type"`             // 任务类型,1为公开,2为定向
-	TaskStatus          int       `gorm:"column:task_status"`            // 任务状态
-	LocalPlatform       int       `gorm:"column:local_platform"`         // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
-	TaskForm            int       `gorm:"column:task_form"`              // 任务形式,1-2分别代表线下探店,素材分发
-	ContentType         int       `gorm:"column:content_type"`           // 内容形式,1代表图文,2代表视频
-	ShareCode           string    `gorm:"column:share_code"`             // 分享码URL
-	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       float64   `gorm:"column:service_charge"`         // 服务商预估可赚服务费
-	ServiceChargeActual float64   `gorm:"column:service_charge_actual"`  // 服务商实际可赚服务费
-	ServiceChargeSettle float64   `gorm:"column:service_charge_settle"`  // 服务商已结算服务费
-	OperatorType        int       `gorm:"column:operator_type"`          // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
-	SLocalStatus        int       `gorm:"column:s_local_status"`         // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
-	StrategyStatus      int       `gorm:"column:strategy_status"`        // 定向本地生活任务是否替换招募策略
-	BOperator           int       `gorm:"column:b_operator"`             // 商家发起入库邀约人
-	BOperatorType       int       `gorm:"column:b_operator_type"`        // 商家发起入库邀约人类型:1主账号 2子账号
-	CreateTime          time.Time `gorm:"column:create_time"`            // 创建时间
-	FinishTime          time.Time `gorm:"column:finish_time"`            // 结束时间
-	CreateStrategyId    int       `gorm:"column:create_strategy_id"`     // 服务商修改服务费操作人ID
-	CreateStrategyType  int       `gorm:"column:create_strategy_type"`   // 服务商修改服务费操作人类型:1服务商主账号,2子账号
+	SLocalId            int        `gorm:"column:s_local_id;primary_key"` // 主键ID
+	LocalId             string     `gorm:"column:local_id"`               // 被加入商单的原本地生活ID
+	EnterpriseId        string     `gorm:"column:enterprise_id"`          // 商家ID
+	SupplierId          int        `gorm:"column:supplier_id"`            // 服务商ID
+	StoreId             int        `gorm:"column:store_id"`               // 门店ID
+	LocalName           string     `gorm:"column:local_name"`             // 本地生活名称
+	TeamBuyingId        int        `gorm:"column:team_buying_id"`         // 团购ID
+	LocalType           int        `gorm:"column:local_type"`             // 任务类型,1为公开,2为定向
+	TaskStatus          int        `gorm:"column:task_status"`            // 任务状态
+	LocalPlatform       int        `gorm:"column:local_platform"`         // 任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	TaskForm            int        `gorm:"column:task_form"`              // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType         int        `gorm:"column:content_type"`           // 内容形式,1代表图文,2代表视频
+	ShareCode           string     `gorm:"column:share_code"`             // 分享码URL
+	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       float64    `gorm:"column:service_charge"`         // 服务商预估可赚服务费
+	ServiceChargeActual float64    `gorm:"column:service_charge_actual"`  // 服务商实际可赚服务费
+	ServiceChargeSettle float64    `gorm:"column:service_charge_settle"`  // 服务商已结算服务费
+	OperatorType        int        `gorm:"column:operator_type"`          // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
+	SLocalStatus        int        `gorm:"column:s_local_status"`         // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
+	StrategyStatus      int        `gorm:"column:strategy_status"`        // 定向本地生活任务是否替换招募策略
+	BOperator           int        `gorm:"column:b_operator"`             // 商家发起入库邀约人
+	BOperatorType       int        `gorm:"column:b_operator_type"`        // 商家发起入库邀约人类型:1主账号 2子账号
+	CreateTime          *time.Time `gorm:"column:create_time"`            // 创建时间
+	FinishTime          *time.Time `gorm:"column:finish_time"`            // 结束时间
+	CreateStrategyId    int        `gorm:"column:create_strategy_id"`     // 服务商修改服务费操作人ID
+	CreateStrategyType  int        `gorm:"column:create_strategy_type"`   // 服务商修改服务费操作人类型:1服务商主账号,2子账号
 }
 
 func (m *YounggeeSLocalLifeInfo) TableName() string {

+ 16 - 0
model/gorm_model/supplier_withdraw_payment_info.go

@@ -0,0 +1,16 @@
+package gorm_model
+
+type SupplierPaymentInfo struct {
+	PaymentInfoID int    `gorm:"column:payment_info_id;primary_key;AUTO_INCREMENT"` // 主键ID
+	BankName      string `gorm:"column:bank_name"`                                  // 开户银行
+	BankNumber    string `gorm:"column:bank_number"`                                // 银行账户
+	SupplierID    int    `gorm:"column:supplier_id"`                                // 服务商ID
+	Name          string `gorm:"column:name"`                                       // 个人服务商姓名
+	IDNumber      string `gorm:"column:id_number"`                                  // 个人服务商身份证号码
+	Phone         string `gorm:"column:phone"`                                      // 个人服务商银行预留手机号码
+	SupplierType  int    `gorm:"column:supplier_type"`                              // 服务商类型,1个人,2机构
+}
+
+func (m *SupplierPaymentInfo) TableName() string {
+	return "supplier_payment_info"
+}

+ 2 - 0
model/http_model/full_s_project_income_list.go

@@ -27,6 +27,8 @@ type FullSProjectIncomeListResponse struct {
 	ProductPrice         float64 `json:"product_price"`           // 商品售价
 	ServiceCharge        float64 `json:"service_charge"`          // 服务费总计
 	ServiceChargeSettle  float64 `json:"service_charge_settle"`   // 服务费已结算
+	RecruitNum           int     `json:"recruit_num"`             // 已招募人数
+	SettleNum            int     `json:"settle_num"`              // 已结算人数
 	FinishTime           string  `json:"finish_time"`             // 结束时间
 	SLocalId             int     `json:"s_local_id"`              // 本地生活ID
 	LocalName            string  `json:"local_name"`              // 本地生活名称

+ 28 - 0
model/http_model/get_user_info.go

@@ -0,0 +1,28 @@
+package http_model
+
+type GetUserInfoRequest struct {
+	Token string `json:"token"` // Token
+}
+
+type GetUserInfoData struct {
+	Role                 string `json:"role"`                  // 角色 1,超级管理员; 2,管理员;3,企业用户; 4. 企业子账号;5. 管理后台子账号;6.服务商账号;7.服务商子账号
+	UserId               int64  `json:"user_id"`               // YG用户ID
+	SupplierId           int    `json:"supplier_id"`           // 服务商ID
+	SubAccountId         int    `json:"sub_account_id"`        // 子账号ID
+	AuthStatus           int    `json:"auth_status"`           // 认证状态,1未认证,2已认证
+	SupplierType         int    `json:"supplier_type"`         // 服务商用户类型,1为个人PR,2为机构
+	JobName              string `json:"job_name"`              // 岗位名称
+	CommercialCenter     string `json:"commercial_center"`     // 商单广场权限
+	CommercialManagement string `json:"commercial_management"` // 商单管理权限
+	CooperatePermission  string `json:"cooperate_permission"`  // 推广合作权限
+	FinancialPermission  string `json:"financial_permission"`  // 财务结算权限
+}
+
+func NewGetUserInfoRequest() *GetUserInfoRequest {
+	return new(GetUserInfoRequest)
+}
+func NewGetUserInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetUserInfoData)
+	return resp
+}

+ 25 - 0
model/http_model/manage_invoice_info.go

@@ -0,0 +1,25 @@
+package http_model
+
+type ManageInvoiceInfoRequest struct {
+	SupplierId int `json:"supplier_id"` // 服务商ID
+}
+
+type ManageInvoiceInfoData struct {
+	InvoiceInfoID       int    `json:"invoice_info_id"`        // 后台设置回票信息ID
+	EnterpriseName      string `json:"enterprise_name"`        // 企业名称
+	Address             string `json:"address"`                // 注册地址
+	Phone               string `json:"phone"`                  // 注册电话
+	BankName            string `json:"bank_name"`              // 开户银行
+	BankNumber          string `json:"bank_number"`            // 开户银行账号
+	ProjectNameToChoose string `json:"project_name_to_choose"` // 项目名称可选
+}
+
+func NewManageInvoiceInfoRequest() *ManageInvoiceInfoRequest {
+	return new(ManageInvoiceInfoRequest)
+}
+
+func NewManageInvoiceInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ManageInvoiceInfoData)
+	return resp
+}

+ 5 - 3
model/http_model/supplier_amount_bill_list.go

@@ -42,12 +42,14 @@ type SupplierAmountBillListData struct {
 	// 共有
 	EnterpriseId        string  `json:"enterprise_id"`         // 所属企业ID
 	SupplierId          int     `json:"supplier_id"`           // 所属服务商ID
+	SupplierName        string  `json:"supplier_name"`         // 服务商名称
 	SubAccountId        int     `json:"sub_account_id"`        // 所属子账号ID
-	OperatorType        int     `json:"column:operator_type"`  // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
+	SubAccountName      string  `json:"sub_account_name"`      // 服务商子账号名称
+	OperatorType        int     `json:"operator_type"`         // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
 	ServiceChargeActual float64 `json:"service_charge_actual"` // 服务商实际可赚服务费
 	ServiceChargeSettle float64 `json:"service_charge_settle"` // 已结算服务费
-	RecruitNum          int     `json:"column:recruit_num"`    // 合作人数
-	SettleNum           int     `json:"column:settle_num"`     // 已结算人数
+	RecruitNum          int     `json:"recruit_num"`           // 合作人数
+	NotSettleNum        int     `json:"not_settle_num"`        // 未结算人数
 	CreateTime          string  `json:"create_time"`           // 加入商单时间
 }
 

+ 21 - 0
model/http_model/supplier_bill_amount.go

@@ -0,0 +1,21 @@
+package http_model
+
+type SupplierAmountRequest struct {
+	SupplierId   int `json:"supplier_id"`   // 服务商ID
+	SupplierType int `json:"supplier_type"` // 服务商用户类型,1为个人PR,2为机构
+}
+
+type SupplierBillAmountData struct {
+	FullAmount float64 `json:"full_amount"` // 总余额
+	Settle     float64 `json:"settle"`      // 可提现
+}
+
+func SupplierBillAmountRequest() *SupplierAmountRequest {
+	return new(SupplierAmountRequest)
+}
+
+func SupplierBillAmountResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(SupplierBillAmountData)
+	return resp
+}

+ 22 - 0
model/http_model/supplier_invoice_amount.go

@@ -0,0 +1,22 @@
+package http_model
+
+type InvoiceAmountRequest struct {
+	SupplierId int `json:"supplier_id"` // 服务商ID
+}
+
+type InvoiceAmountData struct {
+	CanUpload          float64 `json:"can_upload"`          // 可回发票
+	PendingUpload      float64 `json:"pending_upload"`      // 待传发票
+	PlatformConfirming float64 `json:"platform_confirming"` // 平台确认中
+	InvoiceReturned    float64 `json:"invoice_returned"`    // 已回发票
+}
+
+func NewInvoiceAmountRequest() *InvoiceAmountRequest {
+	return new(InvoiceAmountRequest)
+}
+
+func NewInvoiceAmountResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(InvoiceAmountData)
+	return resp
+}

+ 21 - 0
model/http_model/supplier_withdraw_amount.go

@@ -0,0 +1,21 @@
+package http_model
+
+type WithdrawAmountRequest struct {
+	SupplierId int `json:"supplier_id"` // 服务商ID
+}
+
+type WithdrawAmountData struct {
+	WithdrawAble    float64 `json:"withdraw_able"`    // 可提现
+	PendingWithdraw float64 `json:"pending_withdraw"` // 提现中
+	Withdrawn       float64 `json:"withdrawn"`        // 已提现
+}
+
+func NewWithdrawAmountRequest() *WithdrawAmountRequest {
+	return new(WithdrawAmountRequest)
+}
+
+func NewWithdrawAmountResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(WithdrawAmountData)
+	return resp
+}

+ 25 - 0
model/http_model/update_withdraw_payment_info.go

@@ -0,0 +1,25 @@
+package http_model
+
+type UpdateWithdrawPaymentInfoRequest struct {
+	BankName     string `json:"bank_name"`     // 开户银行
+	BankNumber   string `json:"bank_number"`   // 银行账户
+	Company      string `json:"company"`       // 服务商企业名称
+	SupplierID   int    `json:"supplier_id"`   // 服务商ID
+	Name         string `json:"name"`          // 个人服务商姓名
+	IDNumber     string `json:"id_number"`     // 个人服务商身份证号码
+	Phone        string `json:"phone"`         // 个人服务商银行预留手机号码
+	SupplierType int    `json:"supplier_type"` // 服务商类型,1个人,2机构
+}
+
+type UpdateWithdrawPaymentInfoData struct {
+}
+
+func NewUpdateWithdrawPaymentInfoRequest() *UpdateWithdrawPaymentInfoRequest {
+	return new(UpdateWithdrawPaymentInfoRequest)
+}
+
+func NewUpdateWithdrawPaymentInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(UpdateWithdrawPaymentInfoData)
+	return resp
+}

+ 29 - 0
model/http_model/withdraw_payment_info.go

@@ -0,0 +1,29 @@
+package http_model
+
+type WithdrawPaymentInfoRequest struct {
+	SupplierId   int `json:"supplier_id"`   // 服务商ID
+	SupplierType int `json:"supplier_type"` // 服务商类型,1个人,2企业
+}
+
+type WithdrawPaymentInfoData struct {
+	Tag           int    `json:"tag"`             // 标志位:1没有收款信息,2存在收款信息
+	PaymentInfoID int    `json:"payment_info_id"` // 主键ID
+	BankName      string `json:"bank_name"`       // 开户银行
+	BankNumber    string `json:"bank_number"`     // 银行账户
+	Company       string `json:"company"`         // 服务商企业名称
+	SupplierID    int    `json:"supplier_id"`     // 服务商ID
+	Name          string `json:"name"`            // 个人服务商姓名
+	IDNumber      string `json:"id_number"`       // 个人服务商身份证号码
+	Phone         string `json:"phone"`           // 个人服务商银行预留手机号码
+	SupplierType  int    `json:"supplier_type"`   // 服务商类型,1个人,2机构
+}
+
+func NewWithdrawPaymentInfoRequest() *WithdrawPaymentInfoRequest {
+	return new(WithdrawPaymentInfoRequest)
+}
+
+func NewWithdrawPaymentInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(WithdrawAmountData)
+	return resp
+}

+ 10 - 3
route/init.go

@@ -24,6 +24,7 @@ func InitRoute(r *gin.Engine) {
 		a.POST("/deleteJob", handler.WrapdeleteJobHandler)                 // 服务商删除岗位
 		a.POST("/sendCode", handler.WrapSendCodeHandler)                   // 发送登录验证码
 		a.POST("/login", handler.WrapCodeLoginHandler)                     // 服务商登录
+		a.POST("/getUserInfo", handler.WrapGetUserInfoHandler)             // 商家用户信息
 		a.GET("/test/ping", func(c *gin.Context) {
 			resp := http_model.CommonResponse{
 				Status:  0,
@@ -213,6 +214,7 @@ func InitRoute(r *gin.Engine) {
 
 		// 余额管理
 		f.POST("/supplierAmount/billList", handler.WrapSupplierAmountBillListHandler) // 账单列表
+		f.POST("/supplierAmount/billAmount", handler.WrapSupplierBillAmountHandler)   // 总余额、可提现金额
 
 		// 账单查询
 		f.POST("/fullSProject/billList", handler.WrapFullSProjectBillListHandler)         // 种草任务账单列表
@@ -225,10 +227,15 @@ func InitRoute(r *gin.Engine) {
 		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/toList", handler.WrapSupplierToWithdrawListHandler) // 服务商可提现账单列表
-		f.POST("/supplierWithdraw/create", handler.WrapCreateSupplierWithdrawHandler) // 服务商提现
-		f.POST("/supplierWithdraw/List", handler.WrapSupplierWithdrawListHandler)     // 提现管理列表
+		f.POST("/supplierWithdraw/amount", handler.WrapWithdrawAmountHandler)                       // 可提现、提现中、已提现金额
+		f.POST("/supplierWithdraw/paymentInfo", handler.WrapWithdrawPaymentInfoHandler)             // 提现收款信息
+		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/login_auth.go

@@ -167,7 +167,7 @@ func (l *loginAuth) AuthCode(ctx context.Context, phone string, code string) (st
 			UserId:               userData.ID,
 			Token:                token,
 			Role:                 userData.Role,
-			SubAccountId:         -1,
+			SubAccountId:         0,
 			SupplierId:           supplierUser.SupplierId,
 			JobName:              "-1",
 			EnterpriseId:         "-1",

+ 2 - 1
service/s_local_life.go

@@ -47,7 +47,8 @@ func (*sLocalLife) CreateSLocalLife(ctx context.Context, request *http_model.Loc
 		sLocalLifeInfo.SubAccountId = request.SubAccountId
 		sLocalLifeInfo.SupplierId = request.SupplierId
 		sLocalLifeInfo.OperatorType = request.OperatorType
-		sLocalLifeInfo.CreateTime = time.Now()
+		currTime := time.Now()
+		sLocalLifeInfo.CreateTime = &currTime
 
 		// 2. 入库
 		sLocalId, createErr := db.CreateSLocalLife(ctx, sLocalLifeInfo)

+ 63 - 0
service/s_user_info.go

@@ -0,0 +1,63 @@
+package service
+
+import (
+	"context"
+	"fmt"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/db"
+	"youngee_b_api/model/http_model"
+)
+
+var SUserInfo *sUserInfo
+
+type sUserInfo struct {
+}
+
+// FindBUserInfoByToken 根据Token查询商家端用户信息
+func (*sUserInfo) FindBUserInfoByToken(ctx context.Context, token string) (*http_model.GetUserInfoData, error) {
+	if token != "" {
+		if auth, err := LoginAuth.AuthToken(ctx, token); err == nil {
+			var userInfo *http_model.GetUserInfoData
+			userInfo = &http_model.GetUserInfoData{
+				SupplierId: auth.SupplierId,
+				UserId:     auth.ID,
+				Role:       auth.Role,
+			}
+			if auth.Role == "6" {
+				fmt.Println("SupplierUser")
+				userInfo.JobName = "主账号无岗位名称"
+				userInfo.CommercialCenter = "1"
+				userInfo.CommercialManagement = "1"
+				userInfo.CooperatePermission = "1"
+				userInfo.FinancialPermission = "1"
+			} else if auth.Role == "7" {
+				subaccountInfo, subaccountErr := db.FindSubAccountByPhone(ctx, auth.Phone)
+				if subaccountErr != nil {
+					return nil, subaccountErr
+				}
+				userInfo.SubAccountId = subaccountInfo.SubAccountId
+				jobInfo, jonErr := db.FindJobByJobId(ctx, subaccountInfo.JobId)
+				if jonErr != nil {
+					return nil, jonErr
+				}
+				userInfo.JobName = jobInfo.JobName
+				userInfo.CommercialCenter = jobInfo.CommercialCenter
+				userInfo.CommercialManagement = jobInfo.CommercialManagement
+				userInfo.CooperatePermission = jobInfo.CooperatePermission
+				userInfo.FinancialPermission = jobInfo.FinancialPermission
+			}
+			supplierUserInfo, supplierUserErr := db.GetUserByPhone(ctx, auth.Phone)
+			if supplierUserErr != nil {
+				return nil, supplierUserErr
+			}
+			if supplierUserInfo != nil {
+				userInfo.AuthStatus = supplierUserInfo.AuthStatus
+			}
+			return userInfo, nil
+		} else {
+			log.Infof("[LoginAuthMiddleware] auth fail,err:%+v", err)
+			return nil, err
+		}
+	}
+	return nil, nil
+}

+ 159 - 0
service/supplier.go

@@ -309,6 +309,7 @@ func (*supplier) GetSupplierInvoiceList(ctx context.Context, req *http_model.Sup
 				return nil, incomeErr
 			}
 			sTaskInfo.ServiceCharge = currIncome.ServiceChargeSettle
+			supplierInvoiceInfo.Amount += currIncome.ServiceChargeSettle
 			if currIncome.IncomeType == 1 {
 				sTaskInfo.Id = currIncome.SProjectID
 			} else if currIncome.IncomeType == 3 {
@@ -346,6 +347,7 @@ func (*supplier) GetSupplierToWithdrawList(ctx context.Context, req *http_model.
 					// 2. 根据发票中的incomeIds去查找任务及其服务费收入
 					var supplierInvoiceInfo *http_model.SupplierToWithdrawInfo
 					supplierInvoiceInfo = &http_model.SupplierToWithdrawInfo{}
+					// supplierInvoiceInfo.Amount = 0.0
 
 					// 2.1. 基础信息填入
 					supplierInvoiceInfo.AgreeTime = supplierInvoice.AgreeTime
@@ -649,3 +651,160 @@ func (*supplier) GetSupplierWithdrawList(ctx context.Context, req *http_model.Su
 func (*supplier) GetSupplierAmountBillList(ctx context.Context, req *http_model.SupplierAmountBillListRequest) (*http_model.SupplierAmountBillData, error) {
 	return nil, nil
 }
+
+// GetManageInvoiceInfo 查找后台回票信息
+func (*supplier) GetManageInvoiceInfo(ctx context.Context, req *http_model.ManageInvoiceInfoRequest) (*http_model.ManageInvoiceInfoData, error) {
+
+	var invoiceInfo *http_model.ManageInvoiceInfoData
+	invoiceInfo = &http_model.ManageInvoiceInfoData{}
+	manageInvoiceInfo, mamageInvoiceErr := db.GetManageInvoice(ctx)
+	if mamageInvoiceErr != nil {
+		return nil, mamageInvoiceErr
+	}
+	if manageInvoiceInfo != nil {
+		invoiceInfo.InvoiceInfoID = manageInvoiceInfo.InvoiceInfoID
+		invoiceInfo.Address = manageInvoiceInfo.Address
+		invoiceInfo.Phone = manageInvoiceInfo.Phone
+		invoiceInfo.BankNumber = manageInvoiceInfo.BankNumber
+		invoiceInfo.EnterpriseName = manageInvoiceInfo.EnterpriseName
+		invoiceInfo.ProjectNameToChoose = manageInvoiceInfo.ProjectNameToChoose
+		invoiceInfo.BankName = manageInvoiceInfo.BankName
+	}
+	return invoiceInfo, nil
+}
+
+// GetWithdrawAmount 查找可提现、提现中、已提现金额
+func (*supplier) GetWithdrawAmount(ctx context.Context, req *http_model.WithdrawAmountRequest) (*http_model.WithdrawAmountData, error) {
+
+	var amountInfo *http_model.WithdrawAmountData
+	amountInfo = &http_model.WithdrawAmountData{}
+
+	amountInfo.WithdrawAble = 0.0
+	amountInfo.PendingWithdraw = 0.0
+	amountInfo.Withdrawn = 0.0
+
+	return amountInfo, nil
+}
+
+// GetSupplierBillAmount 服务商账单 总余额、可提现金额
+func (*supplier) GetSupplierBillAmount(ctx context.Context, req *http_model.SupplierAmountRequest) (*http_model.SupplierBillAmountData, error) {
+	var incomeData *http_model.SupplierBillAmountData
+	incomeData = &http_model.SupplierBillAmountData{}
+	incomeData.FullAmount = 0.0
+	incomeData.Settle = 0.0
+
+	// 1. 个人服务商
+	if req.SupplierType == 1 {
+		supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
+		if supplierIncomeErr != nil {
+			return nil, supplierIncomeErr
+		}
+		if supplierIncome != nil {
+			for _, income := range supplierIncome {
+				incomeData.FullAmount += income.ServiceChargeSettle
+			}
+			incomeData.Settle = incomeData.FullAmount
+		}
+	} else if req.SupplierType == 2 {
+		// 2. 企业服务商
+		// 可提现
+		supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
+		if supplierIncomeErr != nil {
+			return nil, supplierIncomeErr
+		}
+		if supplierIncome != nil {
+			for _, income := range supplierIncome {
+				incomeData.Settle += income.ServiceChargeSettle
+			}
+			incomeData.FullAmount = incomeData.Settle
+		}
+
+		// 可回票
+		supplierToInvoice, supplierToInvoiceErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 1)
+		if supplierToInvoiceErr != nil {
+			return nil, supplierToInvoiceErr
+		}
+		if supplierToInvoice != nil {
+			for _, invoice := range supplierToInvoice {
+				incomeData.FullAmount += invoice.ServiceChargeSettle
+			}
+		}
+	}
+	// fmt.Println(incomeData)
+	return incomeData, nil
+}
+
+// GetWithdrawPaymentInfo 提现收款信息
+func (*supplier) GetWithdrawPaymentInfo(ctx context.Context, req *http_model.WithdrawPaymentInfoRequest) (*http_model.WithdrawPaymentInfoData, error) {
+
+	var paymentInfo *http_model.WithdrawPaymentInfoData
+	paymentInfo = &http_model.WithdrawPaymentInfoData{}
+
+	// 1. 个人服务商
+	if req.SupplierType == 1 {
+
+	}
+
+	return paymentInfo, nil
+}
+
+// UpdateWithdrawPaymentInfo 提现收款信息
+func (*supplier) UpdateWithdrawPaymentInfo(ctx context.Context, req *http_model.UpdateWithdrawPaymentInfoRequest) error {
+
+	return nil
+}
+
+// GetSupplierInvoiceAmount 可回发票、待传发票、平台确认中、已回发票金额
+func (*supplier) GetSupplierInvoiceAmount(ctx context.Context, req *http_model.InvoiceAmountRequest) (*http_model.InvoiceAmountData, error) {
+	var invoiceAmount *http_model.InvoiceAmountData
+	invoiceAmount = &http_model.InvoiceAmountData{}
+	invoiceAmount.InvoiceReturned = 0.0
+	invoiceAmount.PendingUpload = 0.0
+	invoiceAmount.CanUpload = 0.0
+	invoiceAmount.PlatformConfirming = 0.0
+
+	// 可回发票
+	supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 1)
+	if supplierIncomeErr != nil {
+		return nil, supplierIncomeErr
+	}
+	if supplierIncome != nil {
+		for _, income := range supplierIncome {
+			invoiceAmount.CanUpload += income.ServiceChargeSettle
+		}
+	}
+
+	// 待传发票
+	pendingUploadIncome, pendingUploadErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 2)
+	if pendingUploadErr != nil {
+		return nil, pendingUploadErr
+	}
+	if pendingUploadIncome != nil {
+		for _, income := range pendingUploadIncome {
+			invoiceAmount.PendingUpload += income.ServiceChargeSettle
+		}
+	}
+
+	// 平台确认中
+	platformConfirmingIncome, platformConfirmingErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 3)
+	if platformConfirmingErr != nil {
+		return nil, platformConfirmingErr
+	}
+	if platformConfirmingIncome != nil {
+		for _, income := range platformConfirmingIncome {
+			invoiceAmount.PlatformConfirming += income.ServiceChargeSettle
+		}
+	}
+
+	// 已回票
+	InvoiceReturnedIncome, InvoiceReturnedErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
+	if InvoiceReturnedErr != nil {
+		return nil, InvoiceReturnedErr
+	}
+	if InvoiceReturnedIncome != nil {
+		for _, income := range InvoiceReturnedIncome {
+			invoiceAmount.InvoiceReturned += income.ServiceChargeSettle
+		}
+	}
+	return invoiceAmount, nil
+}