Browse Source

feat:xiugai

wangchuanjin 6 months ago
parent
commit
d457509dd8
1 changed files with 2 additions and 4 deletions
  1. 2 4
      service/exportChargeService.go

+ 2 - 4
service/exportChargeService.go

@@ -38,8 +38,7 @@ func ChargeAccount(data *resourcesCenter.ChargeAccountReq) (resp *resourcesCente
 	if exportPower == 1 && (entNums > 0 || personNums == 0) {
 		// 企业流量包扣除
 		var personLimit []*entity.PersonLimit
-		err = jyOrm.Table("entniche_export_limit").Select("*").
-			Where("ent_id = ? and user_id = ?", data.EntId, data.EntUserId).Find(&personLimit)
+		err := jyOrm.SQL(`select a.* from jianyu.entniche_export_limit a inner join jianyu.entniche_user b on (a.user_id=? and a.user_id=b.id and b.export_power=1)`, data.EntUserId).Find(&personLimit)
 		if err != nil || personLimit == nil || len(personLimit) == 0 {
 			return &resourcesCenter.ChargeResp{Code: entity.ErrorCode, Message: "企业个人账号限额查询失败"}
 		}
@@ -86,8 +85,7 @@ func entCharge(data *resourcesCenter.ChargeReq) (resp *resourcesCenter.ChargeRes
 	souceOrm := entity.Engine.NewSession()
 	jyOrm := entity.JyEngine.NewSession()
 	var personLimit []*entity.PersonLimit
-	err := jyOrm.Table("entniche_export_limit").Select("*").
-		Where("ent_id = ? and user_id = ?", data.EntId, data.EntUserId).Find(&personLimit)
+	err := jyOrm.SQL(`select a.* from jianyu.entniche_export_limit a inner join jianyu.entniche_user b on (a.user_id=? and a.user_id=b.id and b.export_power=1)`, data.EntUserId).Find(&personLimit)
 	if err != nil || personLimit == nil || len(personLimit) == 0 {
 		return &resourcesCenter.ChargeResp{Code: entity.ErrorCode, Message: "企业个人账号限额查询失败"}
 	}