Răsfoiți Sursa

feat:新增api

wangchuanjin 3 ani în urmă
părinte
comite
98e8c9229f

+ 1 - 1
api/internal/types/types.go

@@ -3,7 +3,7 @@ package types
 
 type SurplusReq struct {
 	Appid         string `json:"appid"`
-	Function_code string `json:"function_code"`
+	Function_code string `json:"functionCode"`
 	Muser_id      string `json:"userId,optional"`
 	User_id       int64  `json:"newUserId,optional"`
 	Ent_id        int64  `json:"entId,optional"`

+ 1 - 1
api/resource.api

@@ -9,7 +9,7 @@ info(
 type (
 	surplusReq {
 		Appid         string `json:"appid"`
-		Function_code string `json:"function_code"`
+		Function_code string `json:"functionCode"`
 		Muser_id      string `json:"userId,optional"`
 		User_id       int64  `json:"newUserId,optional"`
 		Ent_id        int64  `json:"entId,optional"`

+ 5 - 0
public/entity/base_ent_empower.go

@@ -21,3 +21,8 @@ func (b *base_ent_empower) FindMyEntId(appid, function_code string, ent_id int64
 	list := Mysql_BaseService.SelectBySql(`select * from base_ent_empower where appid=? and function_code=? and ent_id=?`, appid, function_code, ent_id)
 	return JsonUnmarshal(list, &[]*base_ent_empower{}).(*[]*base_ent_empower)
 }
+
+//授权记录数量
+func (b *base_ent_empower) Count(appid, function_code string, ent_id int64) int64 {
+	return Mysql_BaseService.CountBySql(`select count(1) as count from base_ent_empower where appid=? and function_code=? and ent_id=?`, appid, function_code, ent_id)
+}

+ 1 - 1
public/entity/base_power.go

@@ -75,7 +75,7 @@ func (b *base_power) OpenPower(appid, goods_code string, user_id, ent_id int64,
 			}
 			power_values = append(power_values, v.Limit_strategy, v.Strategy_count, 1, NowFormat(Date_Full_Layout))
 			//
-			if v.Power_type == 2 && v.Power_count == -1 {
+			if v.Power_type == 2 && v.Power_count == -1 && Base_ent_empower.Count(appid, v.Function_code, ent_id) == 0 {
 				empower_values = append(empower_values, appid, ent_id, 0, v.Function_code, NowFormat(Date_Full_Layout))
 			}
 		}


BIN
rpc/rpc.exe