瀏覽代碼

[20250515]财务结算补充

lin-jim-leon 1 天之前
父節點
當前提交
4084a6f2f9
共有 6 個文件被更改,包括 113 次插入0 次删除
  1. 17 0
      db/finance.go
  2. 14 0
      db/subaccount.go
  3. 58 0
      handler/gettalentwithdrawinfo.go
  4. 1 0
      model/http_model/SubAccountDetail.go
  5. 22 0
      model/http_model/gettalentwithdrawinfo.go
  6. 1 0
      route/init.go

+ 17 - 0
db/finance.go

@@ -357,6 +357,23 @@ func RefuseRecharge(ctx context.Context, req http_model.RefuseRechargeRequest) (
 
 }
 
+func GetTalentWithdrawInfo(ctx context.Context, req http_model.GetTalentWithdrawInfoRequest) (*http_model.TalentWithdrawResponse, error) {
+	db := GetReadDB(ctx)
+	var withdrawinfo gorm_model.YounggeeWithdrawRecord
+	err := db.Model(gorm_model.YounggeeWithdrawRecord{}).Where("withdraw_id = ?", req.WithdrawId).First(&withdrawinfo).Error
+	if err != nil {
+		return &http_model.TalentWithdrawResponse{}, err
+	}
+	res := &http_model.TalentWithdrawResponse{
+		Name:         withdrawinfo.Name,
+		IdcardNumber: withdrawinfo.IdcardNum,
+		PhoneNumber:  withdrawinfo.PhoneNum,
+		BankNumber:   withdrawinfo.BankNum,
+	}
+
+	return res, nil
+
+}
 func GetRechargeInfo(ctx context.Context, req http_model.GetRechargeInfoRequest) (*http_model.RechargeInfoResponse, error) {
 	db := GetReadDB(ctx)
 	var rechargeinfo gorm_model.YounggeeRechargeRecord

+ 14 - 0
db/subaccount.go

@@ -139,6 +139,11 @@ func GetSubAccountDetail(ctx context.Context, req *http_model.SubAccountDetailRe
 		userIDs = append(userIDs, acc.SuperAdminId)
 	}
 
+	//收集所有JobID
+	var JobIDs []int
+	for _, acc := range subaccountInfo {
+		JobIDs = append(JobIDs, acc.JobId)
+	}
 	// 查询所有相关用户
 	var users []gorm_model.YounggeeUser
 	db.Where("id IN (?)", userIDs).Find(&users)
@@ -149,12 +154,21 @@ func GetSubAccountDetail(ctx context.Context, req *http_model.SubAccountDetailRe
 		userMap[user.ID] = user.Username
 	}
 
+	var Jobs []gorm_model.YounggeeJob
+	db.Where("job_id IN (?)", JobIDs).Find(&Jobs)
+
+	//创建岗位id到jobname的映射
+	JobMap := make(map[int]string)
+	for _, job := range Jobs {
+		JobMap[job.JobId] = job.JobName
+	}
 	// 构造返回结果
 	var subaccountInfoPointers []*http_model.SubAccountDetailResponse
 	for _, acc := range subaccountInfo {
 		response := &http_model.SubAccountDetailResponse{
 			SubAccountInfo: acc,
 			Creater:        userMap[acc.SuperAdminId], // 从映射中获取用户名
+			JobName:        JobMap[acc.JobId],
 		}
 		subaccountInfoPointers = append(subaccountInfoPointers, response)
 	}

+ 58 - 0
handler/gettalentwithdrawinfo.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_m_api/consts"
+	"youngee_m_api/db"
+	"youngee_m_api/model/http_model"
+	"youngee_m_api/util"
+)
+
+func WrapGetTalentWithdrawInfoHandler(ctx *gin.Context) {
+	handler := newGetTalentWithdrawInfoHandler(ctx)
+	BaseRun(handler)
+}
+
+type GetTalentWithdrawInfoHandler struct {
+	ctx  *gin.Context
+	req  *http_model.GetTalentWithdrawInfoRequest
+	resp *http_model.CommonResponse
+}
+
+func (g GetTalentWithdrawInfoHandler) getContext() *gin.Context {
+	return g.ctx
+}
+
+func (g GetTalentWithdrawInfoHandler) getResponse() interface{} {
+	return g.resp
+}
+
+func (g GetTalentWithdrawInfoHandler) getRequest() interface{} {
+	return g.req
+}
+
+func (g GetTalentWithdrawInfoHandler) run() {
+	req := g.req
+	data, err := db.GetTalentWithdrawInfo(g.ctx, *req)
+	if err != nil {
+		logrus.WithContext(g.ctx).Errorf("[GetTalentWithdrawInfoHandler] error GetTalentWithdrawInfo, err:%+v", err)
+		util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
+		return
+	}
+	g.resp.Data = data
+	g.resp.Status = consts.ErrorSuccess
+	g.resp.Message = "ok"
+}
+
+func (g GetTalentWithdrawInfoHandler) checkParam() error {
+	return nil
+}
+
+func newGetTalentWithdrawInfoHandler(ctx *gin.Context) *GetTalentWithdrawInfoHandler {
+	return &GetTalentWithdrawInfoHandler{
+		ctx:  ctx,
+		req:  http_model.NewGetTalentWithdrawInfoRequest(),
+		resp: http_model.NewGetTalentWithdrawInfoResponse(),
+	}
+}

+ 1 - 0
model/http_model/SubAccountDetail.go

@@ -12,6 +12,7 @@ type SubAccountDetailRequest struct {
 
 type SubAccountDetailResponse struct {
 	SubAccountInfo gorm_model.YounggeeSubAccount //子账号详情
+	JobName        string                        `json:"job_name"`
 	Creater        string                        `json:"creater"`
 }
 

+ 22 - 0
model/http_model/gettalentwithdrawinfo.go

@@ -0,0 +1,22 @@
+package http_model
+
+type GetTalentWithdrawInfoRequest struct {
+	WithdrawId string `json:"withdraw_id"`
+}
+
+type TalentWithdrawResponse struct {
+	Name         string `json:"name"`
+	IdcardNumber string `json:"idcard_number"`
+	BankNumber   string `json:"bank_number"`
+	PhoneNumber  string `json:"phone_number"`
+}
+
+func NewGetTalentWithdrawInfoRequest() *GetTalentWithdrawInfoRequest {
+	return new(GetTalentWithdrawInfoRequest)
+}
+
+func NewGetTalentWithdrawInfoResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(TalentWithdrawResponse)
+	return resp
+}

+ 1 - 0
route/init.go

@@ -227,6 +227,7 @@ func InitRoute(r *gin.Engine) {
 		f.GET("/gettalentwithdrawValue", handler.WarpGetTalentWithdrawPrevalueHandler) //达人提现待确认
 		f.GET("/withdrawvalue", handler.WarpGetWithdrawValueHandler)                   //累计提现金额
 		f.POST("/getTalentWithdrawlist", handler.WrapGetTalentWithdrawListHandler)     //达人待/已提现、已驳回列表
+		f.POST("/getTalentWithdrawinfo", handler.WrapGetTalentWithdrawInfoHandler)     //达人提现信息
 		f.POST("/getwithdrawinfo", handler.WrapGetWithDrawInfoHandler)                 //确认信息
 		f.GET("/getwithdrawcount", handler.WrapGetWithdrawCountHandler)                //列表角标