Browse Source

feat:xiugai

wangchuanjin 5 months ago
parent
commit
3e1e973032

+ 2 - 0
api/integral.api

@@ -12,6 +12,8 @@ type purchResourcesReq {
 	EndTime      string `form:"endTime,optional"`      //新增时数据包截止时间
 	VipTime      string `form:"vipTime,optional"`      //超级订阅时间
 	Remarks      string `form:"remarks,optional"`      //备注
+	EntId        int64  `form:"entId,optional"`        //企业id
+	EntUserId    int64  `form:"entUserId,optional"`    //企业员工id
 }
 
 type vipReq {

+ 4 - 1
api/internal/logic/purchaseuserbalancelogic.go

@@ -1,9 +1,10 @@
 package logic
 
 import (
-	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
 	"context"
 
+	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenterclient"
+
 	"app.yhyue.com/moapp/jyResourcesCenter/api/internal/svc"
 	"app.yhyue.com/moapp/jyResourcesCenter/api/internal/types"
 
@@ -42,6 +43,8 @@ func (l *PurchaseUserBalanceLogic) PurchaseUserBalance(req types.PurchResourcesR
 		Spec:         req.Spec,
 		Remarks:      req.Remarks,
 		VipTime:      req.VipTime,
+		EntId:        req.EntId,
+		EntUserId:    req.EntUserId,
 	})
 	if err != nil {
 		return nil, err

+ 2 - 0
api/internal/types/types.go

@@ -13,6 +13,8 @@ type PurchResourcesReq struct {
 	EndTime      string `form:"endTime,optional"`      //新增时数据包截止时间
 	VipTime      string `form:"vipTime,optional"`      //超级订阅时间
 	Remarks      string `form:"remarks,optional"`      //备注
+	EntId        int64  `form:"entId,optional"`        //企业id
+	EntUserId    int64  `form:"entUserId,optional"`    //企业员工id
 }
 
 type VipReq struct {

+ 3 - 2
rpc/internal/logic/purchaseuserbalancelogic.go

@@ -1,9 +1,10 @@
 package logic
 
 import (
+	"context"
+
 	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/config"
 	"app.yhyue.com/moapp/jyResourcesCenter/service"
-	"context"
 
 	"app.yhyue.com/moapp/jyResourcesCenter/rpc/internal/svc"
 	"app.yhyue.com/moapp/jyResourcesCenter/rpc/resourcesCenter"
@@ -53,7 +54,7 @@ func (l *PurchaseUserBalanceLogic) PurchaseUserBalance(in *resourcesCenter.Resou
 		UserType:     in.Model,
 		Remarks:      in.Remarks,
 	}
-	code, msg := balanceService.PurchaseUserBalance(balance, detailed, config.ConfigJson.ProductMap)
+	code, msg := balanceService.PurchaseUserBalance(balance, detailed, config.ConfigJson.ProductMap, in.EntId, in.EntUserId)
 	return &resourcesCenter.Response{
 		Code:    code,
 		Message: msg,

+ 7 - 1
service/balanceService.go

@@ -24,8 +24,9 @@ const (
 )
 
 // 根据账户标识新增资源
-func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.Balance, detailedData *resourcesCenter.Detailed, producMap map[string]interface{}) (int64, string) {
+func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.Balance, detailedData *resourcesCenter.Detailed, producMap map[string]interface{}, entId, entUserId int64) (int64, string) {
 	orm := entity.Engine.NewSession()
+	jyOrm := entity.JyEngine.NewSession()
 	err := orm.Begin()
 	balance := entity.Balance{}
 	userType := int64(1)
@@ -92,6 +93,11 @@ func (service *BalanceService) PurchaseUserBalance(balanceData *resourcesCenter.
 		Remarks:      remarks,
 		UserType:     userType,
 		UserId:       detailedData.AccountId,
+		EntId:        entId,
+		EntUserId:    entUserId,
+	}
+	if detailed.EntUserId > 0 {
+		jyOrm.Table("entniche_user").Select("CONCAT(NAME,'(',phone,')')").Where("id=?", detailed.EntUserId).Get(&detailed.Operator)
 	}
 	if userType == 3 && balanceData.ResourceType == "附件下载包" {
 		dataNumber := int64(0)