Bladeren bron

增加账号id

wangchuanjin 2 jaren geleden
bovenliggende
commit
11654553bf

+ 1 - 1
api/internal/logic/haspowerslogic.go

@@ -26,7 +26,7 @@ func NewHaspowersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Haspowe
 
 func (l *HaspowersLogic) Haspowers(req *types.Req) (resp *types.Reply, err error) {
 	resp = &types.Reply{}
-	powers, err := HasPowers(req.AppId, req.User_id, req.Ent_id, req.Ent_user_id)
+	powers, err := HasPowers(req.AppId, req.Account_id, req.Ent_id, req.Ent_user_id)
 	if err != nil {
 		resp.Error_msg = err.Error()
 		l.Error(fmt.Sprintf("%+v", req), err)

+ 1 - 1
api/internal/logic/surplusdetaillogic.go

@@ -29,7 +29,7 @@ func NewSurplusDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sur
 //资源剩余详情
 func (l *SurplusDetailLogic) SurplusDetail(req *types.Req) (resp *types.Reply, err error) {
 	resp = &types.Reply{}
-	status, total, surplus, err := Surplus(req.AppId, req.Function_code, req.User_id, req.Ent_id, req.Ent_user_id)
+	status, total, surplus, err := Surplus(req.AppId, req.Function_code, req.Account_id, req.Ent_id, req.Ent_user_id)
 	if err != nil {
 		resp.Error_msg = err.Error()
 		l.Error(fmt.Sprintf("%+v", req), err)

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

@@ -4,7 +4,7 @@ package types
 type Req struct {
 	AppId         string `header:"appId,default=10000"`
 	Function_code string `header:"functionCode,optional"`
-	User_id       int64  `header:"newUserId,optional"`
+	Account_id    int64  `header:"accountId,optional"`
 	Ent_id        int64  `header:"entId,optional"`
 	Ent_user_id   int64  `header:"entUserId,optional"`
 }

+ 1 - 1
api/resource.api

@@ -10,7 +10,7 @@ type (
 	Req {
 		AppId         string `header:"appId,default=10000"`
 		Function_code string `header:"functionCode,optional"`
-		User_id       int64  `header:"newUserId,optional"`
+		Account_id    int64  `header:"accountId,optional"`
 		Ent_id        int64  `header:"entId,optional"`
 		Ent_user_id   int64  `header:"entUserId,optional"`
 	}

BIN
api/resourceCenter_api


+ 24 - 53
public/entity/base_power.go

@@ -19,7 +19,7 @@ type base_power struct {
 	Appid          string
 	Function_code  string //功能代码
 	Power_type     int64  //权益所属类型;1:个人 2:企业
-	Power_ofid     int64  //权益所属id;个人id/企业id/部门id/员工id
+	Account_id     int64  //账户id
 	Start_time     string //开始时间
 	End_time       string //结束时间
 	Use_count      int64  //使用数量
@@ -29,22 +29,22 @@ type base_power struct {
 }
 
 //获取所有权益
-func (b *base_power) FindMyPowers(appid string, user_id, ent_id int64) *[]*base_power {
+func (b *base_power) FindMyPowers(appid string, account_id int64) *[]*base_power {
 	now := NowFormat(Date_Full_Layout)
-	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and ((power_type=1 and power_ofid=?) or (power_type=2 and power_ofid=?)) and end_time>? and status=1 order by power_type`, appid, user_id, ent_id, now)
+	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and account_id=? and end_time>? and status=1 order by power_type`, appid, account_id, now)
 	return JsonUnmarshal(list, &[]*base_power{}).(*[]*base_power)
 }
 
 //查找我的权益
-func (b *base_power) FindMyPowersByFc(appid, function_code string, user_id, ent_id int64) *[]*base_power {
+func (b *base_power) FindMyPowersByFc(appid, function_code string, account_id int64) *[]*base_power {
 	now := NowFormat(Date_Full_Layout)
-	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and function_code=? and ((power_type=1 and power_ofid=?) or (power_type=2 and power_ofid=?)) and end_time>? and status=1 order by power_type`, appid, function_code, user_id, ent_id, now)
+	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and function_code=? and account_id=? and end_time>? and status=1 order by power_type`, appid, function_code, account_id, now)
 	return JsonUnmarshal(list, &[]*base_power{}).(*[]*base_power)
 }
 
 //查找我最新一条的权益,没有过期限制
-func (b *base_power) FindMyLastPowerByFc(appid, function_code string, user_id, ent_id int64) *base_power {
-	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and function_code=? and ((power_type=1 and power_ofid=?) or (power_type=2 and power_ofid=?)) order by update_time desc limit 1`, appid, function_code, user_id, ent_id)
+func (b *base_power) FindMyLastPowerByFc(appid, function_code string, account_id int64) *base_power {
+	list := Mysql_BaseService.SelectBySql(`select * from base_power where appid=? and function_code=? and account_id=? order by update_time desc limit 1`, appid, function_code, account_id)
 	if len(*list) == 0 {
 		return nil
 	}
@@ -61,23 +61,13 @@ func (b *base_power) FindMyPowerForUpdate(id int64) *base_power {
 }
 
 //开通权益
-func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, user_id, ent_id int64, buy_num int64, start_time, end_time string, bgss *[]*base_goods_spec) bool {
+func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, account_id, ent_id int64, buy_num int64, start_time, end_time string, bgss *[]*base_goods_spec) bool {
 	return Mysql_BaseService.ExecTx("开通权益", func(tx *sql.Tx) bool {
-		ok1, ok2 := true, true
 		//企业互斥的功能失效掉
-		if ent_id > 0 {
-			ok1 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_spec_power b 
-				on (a.appid=? and a.power_type=2 and a.power_ofid=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and a.function_code=b.function_code) 
+		ok1 := Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_spec_power b 
+				on (a.appid=? and a.account_id=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and a.function_code=b.function_code) 
 				inner join base_function c on (c.appid=? and c.status=1 and c.power_type=1 and c.code=a.function_code) 
-				set a.status=0,update_time=?`, appid, ent_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
-		}
-		//用户互斥的功能失效掉
-		if user_id > 0 {
-			ok2 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_spec_power b 
-				on (a.appid=? and a.power_type=1 and a.power_ofid=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and a.function_code=b.function_code) 
-				inner join base_function c on (c.appid=? and c.status=1 and c.power_type=1 and c.code=a.function_code) 
-				set a.status=0,update_time=?`, appid, user_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
-		}
+				set a.status=0,update_time=?`, appid, account_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
 		power_values, empower_values, wait_empower_values := []interface{}{}, []interface{}{}, []interface{}{}
 		if start_time == "" {
 			start_time = NowFormat(Date_Full_Layout)
@@ -92,15 +82,7 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, us
 				} else if v.Base_function.Haspower == 0 {
 					continue
 				}
-				power_values = append(power_values, appid, v.Id, v.Function_code, v.Power_type)
-				if v.Power_type == 1 {
-					power_values = append(power_values, user_id)
-				} else if v.Power_type == 2 {
-					power_values = append(power_values, ent_id)
-				} else {
-					logx.Error(appid, goods_code, goods_spec_id, v.Function_code, "无效的power_type", v.Power_type)
-					continue
-				}
+				power_values = append(power_values, appid, v.Id, v.Function_code, v.Power_type, account_id)
 				if end_time == "" {
 					now := time.Now()
 					end := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, time.Local)
@@ -126,7 +108,7 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, us
 				}
 				surplus_count := use_count
 				if v.Base_function.Function_type == 2 {
-					lastPower := b.FindMyLastPowerByFc(appid, v.Function_code, user_id, ent_id)
+					lastPower := b.FindMyLastPowerByFc(appid, v.Function_code, account_id)
 					if lastPower != nil {
 						surplus_count = lastPower.Surplus_count
 					}
@@ -141,38 +123,27 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, us
 			}
 		}
 		if len(power_values) == 0 {
-			logx.Error(appid, goods_code, goods_spec_id, user_id, ent_id, "没有找到需要开通的权益")
+			logx.Error(appid, goods_code, goods_spec_id, account_id, ent_id, "没有找到需要开通的权益")
 			return false
 		}
-		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_power", []string{"appid", "goods_spec_power_id", "function_code", "power_type", "power_ofid", "start_time", "end_time", "use_count", "surplus_count", "limit_strategy", "strategy_count", "status", "create_time", "update_time"}, power_values)
-		ok3 := true
+		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_power", []string{"appid", "goods_spec_power_id", "function_code", "power_type", "account_id", "start_time", "end_time", "use_count", "surplus_count", "limit_strategy", "strategy_count", "status", "create_time", "update_time"}, power_values)
+		ok2 := true
 		if len(empower_values) > 0 {
 			v3, v4 := Mysql_BaseService.InsertBatchByTx(tx, "base_ent_empower", []string{"appid", "ent_id", "ent_user_id", "function_code", "create_time"}, empower_values)
-			ok3 = v3 > 0 && v4 > 0
+			ok2 = v3 > 0 && v4 > 0
 		}
-		ok4 := true
+		ok3 := true
 		if len(wait_empower_values) > 0 {
 			v5, v6 := Mysql_BaseService.InsertBatchByTx(tx, "base_ent_wait_empower", []string{"appid", "goods_spec_power_id", "ent_id", "start_time", "end_time", "use_count", "empower_count", "limit_strategy", "create_time"}, wait_empower_values)
-			ok4 = v5 > 0 && v6 > 0
+			ok3 = v5 > 0 && v6 > 0
 		}
-		return ok1 && ok2 && v1 > 0 && v2 > 0 && ok3 && ok4
+		return ok1 && ok2 && v1 > 0 && v2 > 0 && ok3
 	})
 }
 
 //取消权益
-func (b *base_power) CancelPower(appid, goods_code string, spec_id, user_id, ent_id int64) bool {
-	return Mysql_BaseService.ExecTx("取消权益", func(tx *sql.Tx) bool {
-		ok1, ok2 := false, false
-		if user_id > 0 {
-			ok1 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_spec_power b 
-				on (a.appid=? and a.power_type=1 and a.power_ofid=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and b.power_type=1 and a.function_code=b.function_code) 
-				set a.status=-1,update_time=?`, appid, user_id, appid, goods_code, spec_id, NowFormat(Date_Full_Layout)) > 0
-		}
-		if ent_id > 0 {
-			ok2 = Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power a inner join base_goods_spec_power b 
-				on (a.appid=? and a.power_type=2 and a.power_ofid=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and b.power_type=2 and a.function_code=b.function_code) 
-				set a.status=-1,update_time=?`, appid, ent_id, appid, goods_code, spec_id, NowFormat(Date_Full_Layout)) > 0
-		}
-		return ok1 || ok2
-	})
+func (b *base_power) CancelPower(appid, goods_code string, spec_id, account_id int64) bool {
+	return Mysql_BaseService.UpdateOrDeleteBySql(`update base_power a inner join base_goods_spec_power b 
+				on (a.appid=? and a.account_id=? and a.status=1 and b.appid=? and b.goods_code=? and b.spec_id=? and b.power_type=2 and a.function_code=b.function_code) 
+				set a.status=-1,update_time=?`, appid, account_id, appid, goods_code, spec_id, NowFormat(Date_Full_Layout)) > 0
 }

+ 7 - 20
public/entity/base_resource_use.go

@@ -16,8 +16,7 @@ var Base_resource_use = base_resource_use{}
 type base_resource_use struct {
 	Id            int64
 	Appid         string
-	Ent_id        int64  //企业id
-	User_id       int64  //用户id
+	Account_id    int64  //账户id
 	Function_code string //功能代码
 	Add_count     int64  //新增数量
 	Surplus_count int64  //剩余数量
@@ -26,20 +25,8 @@ type base_resource_use struct {
 }
 
 //查找最新一条的权益使用记录
-func (b *base_resource_use) FindLastOne(appid, function_code string, user_id, ent_id, power_type int64) (*base_resource_use, error) {
-	query := `select * from base_resource_use where appid=? and function_code=?`
-	args := []interface{}{appid, function_code}
-	if power_type == 1 {
-		query += ` and user_id=?`
-		args = append(args, user_id)
-	} else if power_type == 2 {
-		query += ` and ent_id=?`
-		args = append(args, ent_id)
-	} else {
-		return nil, errors.New("power_type error")
-	}
-	query += ` order by create_time desc limit 1`
-	list := Mysql_BaseService.SelectBySql(query, args...)
+func (b *base_resource_use) FindLastOne(appid, function_code string, account_id int64) (*base_resource_use, error) {
+	list := Mysql_BaseService.SelectBySql(`select * from base_resource_use where appid=? and function_code=? and account_id=? order by create_time desc limit 1`, appid, function_code, account_id)
 	if list == nil {
 		return nil, errors.New("find error")
 	}
@@ -56,7 +43,7 @@ func (b *base_resource_use) FindLastOne(appid, function_code string, user_id, en
 //新增扣减记录
 func (b *base_resource_use) Deduction(use_values []interface{}, detail_values [][]interface{}, update [][]interface{}) bool {
 	return Mysql_BaseService.ExecTx("新增扣减记录", func(tx *sql.Tx) bool {
-		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_resource_use", []string{"appid", "ent_id", "user_id", "function_code", "add_count", "surplus_count", "deduct_count", "business_id", "create_time"}, use_values)
+		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_resource_use", []string{"appid", "account_id", "function_code", "add_count", "surplus_count", "deduct_count", "business_id", "create_time"}, use_values)
 		array := []interface{}{}
 		for _, v := range detail_values {
 			array = append(array, v...)
@@ -72,7 +59,7 @@ func (b *base_resource_use) Deduction(use_values []interface{}, detail_values []
 }
 
 //新增充值记录
-func (b *base_resource_use) Recharge(appid, function_code string, power_id, user_id, ent_id int64, count int64, ids []string) int {
+func (b *base_resource_use) Recharge(appid, function_code string, power_id, account_id int64, count int64, ids []string) int {
 	status := 0
 	Mysql_BaseService.ExecTx("新增充值记录", func(tx *sql.Tx) bool {
 		power := Base_power.FindMyPowerForUpdate(power_id)
@@ -84,8 +71,8 @@ func (b *base_resource_use) Recharge(appid, function_code string, power_id, user
 			return true
 		}
 		nowFormat := NowFormat(Date_Full_Layout)
-		use_values := []interface{}{appid, ent_id, user_id, function_code, count, power.Surplus_count + count, 0, strings.Join(ids, ","), nowFormat}
-		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_resource_use", []string{"appid", "ent_id", "user_id", "function_code", "add_count", "surplus_count", "deduct_count", "business_id", "create_time"}, use_values)
+		use_values := []interface{}{appid, account_id, function_code, count, power.Surplus_count + count, 0, strings.Join(ids, ","), nowFormat}
+		v1, v2 := Mysql_BaseService.InsertBatchByTx(tx, "base_resource_use", []string{"appid", "account_id", "function_code", "add_count", "surplus_count", "deduct_count", "business_id", "create_time"}, use_values)
 		use_detail_values := []interface{}{appid, v2, power_id, 0, 0, nowFormat}
 		v4, v5 := Mysql_BaseService.InsertBatchByTx(tx, "base_resource_use_detail", []string{"appid", "use_id", "power_id", "surplus_count", "deduct_count", "create_time"}, use_detail_values)
 		v3 := Mysql_BaseService.UpdateOrDeleteBySqlByTx(tx, `update base_power set surplus_count=surplus_count+?,update_time=? where id=?`, count, nowFormat, power_id)

+ 6 - 21
public/service/deduction.go

@@ -19,21 +19,21 @@ import (
  * @param ids 业务id
  * @return 状态 0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
  */
-func Deduction(appid, function_code string, user_id, ent_id int64, count int64, ids []string) (int64, error) {
+func Deduction(appid, function_code string, account_id int64, count int64, ids []string) (int64, error) {
 	if appid == "" {
 		return 0, errors.New("无效的参数appid")
 	} else if function_code == "" {
 		return 0, errors.New("无效的参数function_code")
 	} else if count <= 0 {
 		return 0, errors.New("无效的参数count")
-	} else if user_id == 0 && ent_id == 0 {
-		return 0, errors.New("无效的参数user_id、ent_id")
+	} else if account_id == 0 {
+		return 0, errors.New("无效的参数account_id")
 	}
 	function := Base_function.FindByCode(appid, function_code)
 	if function == nil {
 		return 0, errors.New("功能原始表中没有找到该功能")
 	}
-	myPowers := Base_power.FindMyPowersByFc(appid, function_code, user_id, ent_id)
+	myPowers := Base_power.FindMyPowersByFc(appid, function_code, account_id)
 	if myPowers == nil || len(*myPowers) == 0 {
 		return -1, errors.New("功能权益表中没有找到权益记录")
 	}
@@ -41,7 +41,6 @@ func Deduction(appid, function_code string, user_id, ent_id int64, count int64,
 	update := [][]interface{}{}
 	surplus_count := int64(-1)
 	deduct_count := count
-	userId, entId := int64(0), int64(0)
 	if function.Power_rule == 2 { //周期+数量
 		my_surplus_count := int64(0)
 		for _, v := range *myPowers {
@@ -49,13 +48,6 @@ func Deduction(appid, function_code string, user_id, ent_id int64, count int64,
 				continue
 			}
 			if deduct_count > 0 {
-				if v.Power_type == 1 {
-					userId = v.Power_ofid
-				} else if v.Power_type == 2 {
-					entId = v.Power_ofid
-				} else {
-					continue
-				}
 				this_deduct_count := deduct_count
 				if v.Surplus_count >= deduct_count { //本次记录的数据足够扣减
 					v.Surplus_count -= deduct_count
@@ -76,7 +68,7 @@ func Deduction(appid, function_code string, user_id, ent_id int64, count int64,
 		}
 	} else if function.Power_rule == 3 { //周期+频率+数量
 		for _, v := range *myPowers {
-			use, err := Base_resource_use.FindLastOne(appid, function_code, user_id, ent_id, v.Power_type)
+			use, err := Base_resource_use.FindLastOne(appid, function_code, account_id)
 			if err != nil {
 				return 0, errors.New("查询资源使用记录失败," + err.Error())
 			}
@@ -104,13 +96,6 @@ func Deduction(appid, function_code string, user_id, ent_id int64, count int64,
 			} else {
 				surplus_count = v.Strategy_count - count
 			}
-			if v.Power_type == 1 {
-				userId = v.Power_ofid
-			} else if v.Power_type == 2 {
-				entId = v.Power_ofid
-			} else {
-				continue
-			}
 			if surplus_count >= 0 {
 				detail_values = append(detail_values, []interface{}{appid, v.Id, surplus_count, count, NowFormat(Date_Full_Layout)})
 				break
@@ -120,7 +105,7 @@ func Deduction(appid, function_code string, user_id, ent_id int64, count int64,
 	if surplus_count < 0 {
 		return -2, nil
 	} else {
-		use_values = append(use_values, appid, entId, userId, function_code, 0, surplus_count, count, strings.Join(ids, ","), NowFormat(Date_Full_Layout))
+		use_values = append(use_values, appid, account_id, function_code, 0, surplus_count, count, strings.Join(ids, ","), NowFormat(Date_Full_Layout))
 	}
 	if len(use_values) > 0 && len(detail_values) > 0 && Base_resource_use.Deduction(use_values, detail_values, update) {
 		return 1, nil

+ 12 - 12
public/service/power.go

@@ -19,13 +19,13 @@ import (
  * @param buy_num 购买数量
  * @return error
  */
-func OpenPower(appid, goods_code string, goods_spec_id, user_id, ent_id int64, buy_num int64, start_time, end_time string) error {
+func OpenPower(appid, goods_code string, goods_spec_id, account_id, ent_id int64, buy_num int64, start_time, end_time string) error {
 	if appid == "" {
 		return errors.New("无效的参数appid")
 	} else if goods_code == "" {
 		return errors.New("无效的参数goods_code")
-	} else if user_id == 0 && ent_id == 0 {
-		return errors.New("无效的参数user_id、ent_id")
+	} else if account_id == 0 && ent_id == 0 {
+		return errors.New("无效的参数account_id、ent_id")
 	}
 	if start_time != "" {
 		if _, err := time.ParseInLocation(Date_Full_Layout, start_time, time.Local); err != nil {
@@ -40,7 +40,7 @@ func OpenPower(appid, goods_code string, goods_spec_id, user_id, ent_id int64, b
 	list := Base_goods_spec.FindById(goods_spec_id, appid, goods_code)
 	if list == nil {
 		return errors.New("没有找到该商品规格")
-	} else if Base_power.OpenPower(goods_spec_id, appid, goods_code, user_id, ent_id, buy_num, start_time, end_time, list) {
+	} else if Base_power.OpenPower(goods_spec_id, appid, goods_code, account_id, ent_id, buy_num, start_time, end_time, list) {
 		return nil
 	} else {
 		return errors.New("开通失败")
@@ -56,15 +56,15 @@ func OpenPower(appid, goods_code string, goods_spec_id, user_id, ent_id int64, b
  * @param ent_id 企业id
  * @return 是否成功
  */
-func CancelPower(appid, goods_code string, goods_spec_id, user_id, ent_id int64) (bool, error) {
+func CancelPower(appid, goods_code string, goods_spec_id, account_id int64) (bool, error) {
 	if appid == "" {
 		return false, errors.New("无效的参数appid")
 	} else if goods_code == "" {
 		return false, errors.New("无效的参数goods_code")
-	} else if user_id == 0 && ent_id == 0 {
-		return false, errors.New("无效的参数user_id、ent_id")
+	} else if account_id == 0 {
+		return false, errors.New("无效的参数account_id")
 	}
-	return Base_power.CancelPower(appid, goods_code, goods_spec_id, user_id, ent_id), nil
+	return Base_power.CancelPower(appid, goods_code, goods_spec_id, account_id), nil
 }
 
 /*
@@ -105,15 +105,15 @@ func WaitEmpowerDetail(appid, function_code string, ent_id int64) (*WaitEmpowerD
  * @param ent_user_id 企业用户id
  * @return 所有已开通的权益
  */
-func HasPowers(appid string, user_id, ent_id, ent_user_id int64) ([]string, error) {
+func HasPowers(appid string, account_id, ent_id, ent_user_id int64) ([]string, error) {
 	result := []string{}
 	if appid == "" {
 		return result, errors.New("无效的参数appid")
-	} else if user_id == 0 && ent_id == 0 && ent_user_id == 0 {
-		return result, errors.New("无效的参数user_id、ent_id、ent_user_id")
+	} else if account_id == 0 && ent_id == 0 && ent_user_id == 0 {
+		return result, errors.New("无效的参数account_id、ent_id、ent_user_id")
 	}
 	m := map[string]bool{}
-	bps := Base_power.FindMyPowers(appid, user_id, ent_id)
+	bps := Base_power.FindMyPowers(appid, account_id)
 	if bps != nil {
 		for _, v := range *bps {
 			if v.Power_type == 1 || (v.Power_type == 2 && Base_ent_empower.HasEmpower(appid, v.Function_code, ent_id, ent_user_id)) {

+ 5 - 5
public/service/recharge.go

@@ -16,25 +16,25 @@ import (
  * @param ids 业务id
  * @return 状态 0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
  */
-func Recharge(appid, function_code string, user_id, ent_id int64, count int64, ids []string) (int64, error) {
+func Recharge(appid, function_code string, account_id int64, count int64, ids []string) (int64, error) {
 	if appid == "" {
 		return 0, errors.New("无效的参数appid")
 	} else if function_code == "" {
 		return 0, errors.New("无效的参数function_code")
 	} else if count <= 0 {
 		return 0, errors.New("无效的参数count")
-	} else if user_id == 0 && ent_id == 0 {
-		return 0, errors.New("无效的参数user_id、ent_id")
+	} else if account_id == 0 {
+		return 0, errors.New("无效的参数account_id")
 	}
 	function := Base_function.FindByCode(appid, function_code)
 	if function == nil {
 		return 0, errors.New("功能原始表中没有找到该功能")
 	}
-	myPowers := Base_power.FindMyPowersByFc(appid, function_code, user_id, ent_id)
+	myPowers := Base_power.FindMyPowersByFc(appid, function_code, account_id)
 	if myPowers == nil || len(*myPowers) == 0 {
 		return -1, errors.New("功能权益表中没有找到权益记录")
 	}
-	status := Base_resource_use.Recharge(appid, function_code, (*myPowers)[0].Id, user_id, ent_id, count, ids)
+	status := Base_resource_use.Recharge(appid, function_code, (*myPowers)[0].Id, account_id, count, ids)
 	if status == 1 {
 		return 1, nil
 	} else if status == -1 {

+ 5 - 5
public/service/surplus.go

@@ -19,19 +19,19 @@ import (
  * @return 剩余数
  * @return 错误信息
  */
-func Surplus(appid, function_code string, user_id, ent_id, ent_user_id int64) (int64, int64, int64, error) {
+func Surplus(appid, function_code string, account_id, ent_id, ent_user_id int64) (int64, int64, int64, error) {
 	if appid == "" {
 		return 0, 0, 0, errors.New("无效的参数appid")
 	} else if function_code == "" {
 		return 0, 0, 0, errors.New("无效的参数function_code")
-	} else if user_id == 0 && ent_id == 0 && ent_user_id == 0 {
-		return 0, 0, 0, errors.New("无效的参数user_id、ent_id、ent_user_id")
+	} else if account_id == 0 && ent_id == 0 && ent_user_id == 0 {
+		return 0, 0, 0, errors.New("无效的参数account_id、ent_id、ent_user_id")
 	}
 	function := Base_function.FindByCode(appid, function_code)
 	if function == nil {
 		return 0, 0, 0, errors.New("功能原始表中没有找到该功能")
 	}
-	myPowers := Base_power.FindMyPowersByFc(appid, function_code, user_id, ent_id)
+	myPowers := Base_power.FindMyPowersByFc(appid, function_code, account_id)
 	if myPowers == nil || len(*myPowers) == 0 {
 		return -1, 0, 0, errors.New("不在有效期内")
 	}
@@ -61,7 +61,7 @@ func Surplus(appid, function_code string, user_id, ent_id, ent_user_id int64) (i
 			if v.Power_type == 2 && !Base_ent_empower.HasEmpower(appid, function_code, ent_id, ent_user_id) {
 				return -3, 0, 0, errors.New("没有对该用户进行授权")
 			}
-			use, err := Base_resource_use.FindLastOne(appid, function_code, user_id, ent_id, v.Power_type)
+			use, err := Base_resource_use.FindLastOne(appid, function_code, account_id)
 			if err != nil {
 				return 0, 0, 0, errors.New("查询资源使用记录失败")
 			} else if use == nil {

+ 3 - 3
rpc/internal/logic/checkpowerlogic.go

@@ -35,8 +35,8 @@ func (l *CheckPowerLogic) CheckPower(in *pb.CheckPowerReq) (*pb.Resp, error) {
 	} else if in.FunctionCode == "" {
 		l.Error(fmt.Sprintf("%+v", in), "无效的参数function_code")
 		return resp, nil
-	} else if in.UserId == 0 && in.EntId == 0 && in.EntUserId == 0 {
-		l.Error(fmt.Sprintf("%+v", in), "无效的参数user_id、ent_id、ent_user_id")
+	} else if in.AccountId == 0 && in.EntId == 0 && in.EntUserId == 0 {
+		l.Error(fmt.Sprintf("%+v", in), "无效的参数account_id、ent_id、ent_user_id")
 		return resp, nil
 	}
 	function := Base_function.FindByCode(in.Appid, in.FunctionCode)
@@ -44,7 +44,7 @@ func (l *CheckPowerLogic) CheckPower(in *pb.CheckPowerReq) (*pb.Resp, error) {
 		l.Error(fmt.Sprintf("%+v", in), "功能原始表中没有找到该功能")
 		return resp, nil
 	}
-	status, use_count, surplus_count, err := Surplus(in.Appid, in.FunctionCode, in.UserId, in.EntId, in.EntUserId)
+	status, use_count, surplus_count, err := Surplus(in.Appid, in.FunctionCode, in.AccountId, in.EntId, in.EntUserId)
 	resp.Status = status
 	resp.UseCount = use_count
 	resp.SurplusCount = surplus_count

+ 1 - 1
rpc/internal/logic/deductionlogic.go

@@ -27,7 +27,7 @@ func NewDeductionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Deducti
 // 资源扣减
 func (l *DeductionLogic) Deduction(in *pb.DeductionReq) (*pb.Resp, error) {
 	resp := &pb.Resp{}
-	status, err := Deduction(in.Appid, in.FunctionCode, in.UserId, in.EntId, in.Count, in.Ids)
+	status, err := Deduction(in.Appid, in.FunctionCode, in.AccountId, in.Count, in.Ids)
 	if err != nil {
 		l.Error(fmt.Sprintf("%+v", in), err)
 	}

+ 1 - 1
rpc/internal/logic/haspowerslogic.go

@@ -27,7 +27,7 @@ func NewHaspowersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Haspowe
 // 所有的权益
 func (l *HaspowersLogic) Haspowers(in *pb.HaspowersReq) (*pb.HaspowersResp, error) {
 	resp := &pb.HaspowersResp{}
-	powers, err := HasPowers(in.Appid, in.UserId, in.EntId, in.EntUserId)
+	powers, err := HasPowers(in.Appid, in.AccountId, in.EntId, in.EntUserId)
 	if err != nil {
 		l.Error(fmt.Sprintf("%+v", in), err)
 	}

+ 2 - 2
rpc/internal/logic/powerhandlelogic.go

@@ -30,12 +30,12 @@ func (l *PowerHandleLogic) PowerHandle(in *pb.PowerReq) (*pb.Resp, error) {
 	resp := &pb.Resp{}
 	var err error
 	if in.Type == 1 { //开通
-		if err = OpenPower(in.Appid, in.GoodsCode, in.GoodsSpecId, in.UserId, in.EntId, in.BuyNum, in.StartTime, in.EndTime); err == nil {
+		if err = OpenPower(in.Appid, in.GoodsCode, in.GoodsSpecId, in.AccountId, in.EntId, in.BuyNum, in.StartTime, in.EndTime); err == nil {
 			resp = &pb.Resp{Status: 1}
 		}
 	} else if in.Type == -1 { //取消
 		var ok bool
-		ok, err = CancelPower(in.Appid, in.GoodsCode, in.GoodsSpecId, in.UserId, in.EntId)
+		ok, err = CancelPower(in.Appid, in.GoodsCode, in.GoodsSpecId, in.AccountId)
 		if ok {
 			resp = &pb.Resp{Status: 1}
 		}

+ 1 - 1
rpc/internal/logic/rechargelogic.go

@@ -27,7 +27,7 @@ func NewRechargeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Recharge
 // 资源充值
 func (l *RechargeLogic) Recharge(in *pb.RechargeReq) (*pb.Resp, error) {
 	resp := &pb.Resp{}
-	status, err := Recharge(in.Appid, in.FunctionCode, in.UserId, in.EntId, in.Count, in.Ids)
+	status, err := Recharge(in.Appid, in.FunctionCode, in.AccountId, in.Count, in.Ids)
 	if err != nil {
 		l.Error(fmt.Sprintf("%+v", in), err)
 	}

+ 115 - 113
rpc/pb/resource.pb.go

@@ -76,7 +76,7 @@ type PowerReq struct {
 	GoodsCode   string `protobuf:"bytes,2,opt,name=goods_code,json=goodsCode,proto3" json:"goods_code,omitempty"`          //商品代码
 	GoodsSpecId int64  `protobuf:"varint,3,opt,name=goods_spec_id,json=goodsSpecId,proto3" json:"goods_spec_id,omitempty"` //商品规格id
 	EntId       int64  `protobuf:"varint,4,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
-	UserId      int64  `protobuf:"varint,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`                  //用户id
+	AccountId   int64  `protobuf:"varint,5,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`         //账户id
 	BuyNum      int64  `protobuf:"varint,6,opt,name=buy_num,json=buyNum,proto3" json:"buy_num,omitempty"`                  //购买的数量或者购买的份数
 	Type        int64  `protobuf:"varint,7,opt,name=type,proto3" json:"type,omitempty"`                                    //操作类型 1:开通权益 -1:取消权益
 	StartTime   string `protobuf:"bytes,8,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`          //权益开始时间 格式:2006-01-02 15:04:05
@@ -143,9 +143,9 @@ func (x *PowerReq) GetEntId() int64 {
 	return 0
 }
 
-func (x *PowerReq) GetUserId() int64 {
+func (x *PowerReq) GetAccountId() int64 {
 	if x != nil {
-		return x.UserId
+		return x.AccountId
 	}
 	return 0
 }
@@ -185,7 +185,7 @@ type CheckPowerReq struct {
 
 	Appid        string `protobuf:"bytes,1,opt,name=appid,proto3" json:"appid,omitempty"`
 	FunctionCode string `protobuf:"bytes,2,opt,name=function_code,json=functionCode,proto3" json:"function_code,omitempty"` //功能代码
-	UserId       int64  `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`                  //用户id
+	AccountId    int64  `protobuf:"varint,3,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`         //账户id
 	EntId        int64  `protobuf:"varint,4,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
 	EntUserId    int64  `protobuf:"varint,5,opt,name=ent_user_id,json=entUserId,proto3" json:"ent_user_id,omitempty"`       //企业用户id
 }
@@ -236,9 +236,9 @@ func (x *CheckPowerReq) GetFunctionCode() string {
 	return ""
 }
 
-func (x *CheckPowerReq) GetUserId() int64 {
+func (x *CheckPowerReq) GetAccountId() int64 {
 	if x != nil {
-		return x.UserId
+		return x.AccountId
 	}
 	return 0
 }
@@ -265,7 +265,7 @@ type DeductionReq struct {
 	Appid        string   `protobuf:"bytes,1,opt,name=appid,proto3" json:"appid,omitempty"`
 	FunctionCode string   `protobuf:"bytes,2,opt,name=function_code,json=functionCode,proto3" json:"function_code,omitempty"` //功能代码
 	EntId        int64    `protobuf:"varint,3,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
-	UserId       int64    `protobuf:"varint,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`                  //用户id
+	AccountId    int64    `protobuf:"varint,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`         //账户id
 	Count        int64    `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`                                  //扣除数量
 	Ids          []string `protobuf:"bytes,6,rep,name=ids,proto3" json:"ids,omitempty"`                                       //id列表
 }
@@ -323,9 +323,9 @@ func (x *DeductionReq) GetEntId() int64 {
 	return 0
 }
 
-func (x *DeductionReq) GetUserId() int64 {
+func (x *DeductionReq) GetAccountId() int64 {
 	if x != nil {
-		return x.UserId
+		return x.AccountId
 	}
 	return 0
 }
@@ -352,7 +352,7 @@ type RechargeReq struct {
 	Appid        string   `protobuf:"bytes,1,opt,name=appid,proto3" json:"appid,omitempty"`
 	FunctionCode string   `protobuf:"bytes,2,opt,name=function_code,json=functionCode,proto3" json:"function_code,omitempty"` //功能代码
 	EntId        int64    `protobuf:"varint,3,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
-	UserId       int64    `protobuf:"varint,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`                  //用户id
+	AccountId    int64    `protobuf:"varint,4,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`         //账户id
 	Count        int64    `protobuf:"varint,5,opt,name=count,proto3" json:"count,omitempty"`                                  //扣除数量
 	Ids          []string `protobuf:"bytes,6,rep,name=ids,proto3" json:"ids,omitempty"`                                       //id列表
 }
@@ -410,9 +410,9 @@ func (x *RechargeReq) GetEntId() int64 {
 	return 0
 }
 
-func (x *RechargeReq) GetUserId() int64 {
+func (x *RechargeReq) GetAccountId() int64 {
 	if x != nil {
-		return x.UserId
+		return x.AccountId
 	}
 	return 0
 }
@@ -705,7 +705,7 @@ type HaspowersReq struct {
 	unknownFields protoimpl.UnknownFields
 
 	Appid     string `protobuf:"bytes,1,opt,name=appid,proto3" json:"appid,omitempty"`
-	UserId    int64  `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`            //用户id
+	AccountId int64  `protobuf:"varint,2,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"`   //账户id
 	EntId     int64  `protobuf:"varint,3,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`               //企业id
 	EntUserId int64  `protobuf:"varint,4,opt,name=ent_user_id,json=entUserId,proto3" json:"ent_user_id,omitempty"` //企业用户id
 }
@@ -749,9 +749,9 @@ func (x *HaspowersReq) GetAppid() string {
 	return ""
 }
 
-func (x *HaspowersReq) GetUserId() int64 {
+func (x *HaspowersReq) GetAccountId() int64 {
 	if x != nil {
-		return x.UserId
+		return x.AccountId
 	}
 	return 0
 }
@@ -823,7 +823,7 @@ var file_resource_proto_rawDesc = []byte{
 	0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
 	0x22, 0x29, 0x0a, 0x07, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0b, 0x65,
 	0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
-	0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xfa, 0x01, 0x0a, 0x08,
+	0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x80, 0x02, 0x0a, 0x08,
 	0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69,
 	0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x1d,
 	0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
@@ -831,104 +831,106 @@ var file_resource_proto_rawDesc = []byte{
 	0x0d, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x03,
 	0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x53, 0x70, 0x65, 0x63, 0x49,
 	0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
-	0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x17, 0x0a, 0x07, 0x62, 0x75, 0x79, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
-	0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d,
-	0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a,
-	0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x0d, 0x43, 0x68, 0x65,
-	0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70,
-	0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64,
-	0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
-	0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
-	0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x15,
-	0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
-	0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65,
-	0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55,
-	0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xa1, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74,
-	0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d,
-	0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64,
-	0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
-	0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
-	0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x06,
-	0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x0b, 0x52, 0x65,
-	0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70,
-	0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12,
-	0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
-	0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75,
-	0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73,
-	0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64,
-	0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x7e, 0x0a, 0x0a,
-	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70,
-	0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64,
-	0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
-	0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18,
-	0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b,
-	0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28,
-	0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x9a, 0x01, 0x0a,
-	0x0e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12,
-	0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
-	0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
-	0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75,
-	0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e,
-	0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49,
-	0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1b, 0x0a, 0x09,
-	0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x45, 0x0a, 0x0f, 0x45, 0x6d, 0x70,
-	0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05,
-	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
-	0x32, 0x08, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74,
-	0x22, 0x60, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
-	0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
-	0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x08, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a,
-	0x0d, 0x73, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03,
-	0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x43, 0x6f, 0x75,
-	0x6e, 0x74, 0x22, 0x74, 0x0a, 0x0c, 0x48, 0x61, 0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52,
+	0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f,
+	0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x63,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x62, 0x75, 0x79, 0x5f, 0x6e,
+	0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d,
+	0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
+	0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69,
+	0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54,
+	0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
+	0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xa0,
+	0x01, 0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71,
+	0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
+	0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66,
+	0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61,
+	0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e,
+	0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49,
+	0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
+	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49,
+	0x64, 0x22, 0xa7, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52,
 	0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
-	0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f,
-	0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65,
-	0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x61, 0x73, 0x70,
-	0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x77,
-	0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x77, 0x65, 0x72,
-	0x73, 0x32, 0xb8, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f,
-	0x0a, 0x0b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x09, 0x2e,
-	0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x23, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0e, 0x2e,
-	0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x09, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f,
-	0x6e, 0x12, 0x0d, 0x2e, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
-	0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x68, 0x61,
-	0x72, 0x67, 0x65, 0x12, 0x0c, 0x2e, 0x52, 0x65, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x52, 0x65,
-	0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x09, 0x52, 0x65, 0x45, 0x6d,
-	0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52,
-	0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x43, 0x61, 0x6e,
-	0x63, 0x65, 0x6c, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70,
-	0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30,
-	0x0a, 0x0b, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e,
-	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10,
-	0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x2a, 0x0a, 0x09, 0x48, 0x61, 0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x12, 0x0d, 0x2e,
-	0x48, 0x61, 0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x48,
-	0x61, 0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04,
-	0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63,
+	0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a,
+	0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65,
+	0x6e, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f,
+	0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
+	0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73,
+	0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0xa6, 0x01, 0x0a, 0x0b,
+	0x52, 0x65, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61,
+	0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69,
+	0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f,
+	0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
+	0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a,
+	0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75,
+	0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
+	0x03, 0x69, 0x64, 0x73, 0x22, 0x7e, 0x0a, 0x0a, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52,
+	0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x75, 0x6e, 0x63,
+	0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a,
+	0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65,
+	0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72,
+	0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73,
+	0x65, 0x72, 0x49, 0x64, 0x22, 0x9a, 0x01, 0x0a, 0x0e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72,
+	0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64, 0x12, 0x23, 0x0a,
+	0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f,
+	0x64, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x67,
+	0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67,
+	0x65, 0x4e, 0x75, 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a,
+	0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a,
+	0x65, 0x22, 0x45, 0x0a, 0x0f, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74,
+	0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x04, 0x6c, 0x69,
+	0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77,
+	0x65, 0x72, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x60, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x5f,
+	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x75, 0x73, 0x65,
+	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73,
+	0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x75,
+	0x72, 0x70, 0x6c, 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7a, 0x0a, 0x0c, 0x48, 0x61,
+	0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70,
+	0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x69, 0x64,
+	0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12,
+	0x15, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
+	0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73,
+	0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x74,
+	0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x61, 0x73, 0x70, 0x6f, 0x77,
+	0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x77, 0x65, 0x72,
+	0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x32,
+	0xb8, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b,
+	0x50, 0x6f, 0x77, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x09, 0x2e, 0x50, 0x6f,
+	0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a,
+	0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0e, 0x2e, 0x43, 0x68,
+	0x65, 0x63, 0x6b, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x21, 0x0a, 0x09, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+	0x0d, 0x2e, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x05,
+	0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x68, 0x61, 0x72, 0x67,
+	0x65, 0x12, 0x0c, 0x2e, 0x52, 0x65, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a,
+	0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x09, 0x52, 0x65, 0x45, 0x6d, 0x70, 0x6f,
+	0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71,
+	0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65,
+	0x6c, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x0b, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77,
+	0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0b,
+	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x45, 0x6d,
+	0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x45,
+	0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a,
+	0x0a, 0x09, 0x48, 0x61, 0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x12, 0x0d, 0x2e, 0x48, 0x61,
+	0x73, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x48, 0x61, 0x73,
+	0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
+	0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 6 - 6
rpc/resource.proto

@@ -11,17 +11,17 @@ message PowerReq {
   string goods_code = 2; 	//商品代码
   int64 goods_spec_id = 3;  //商品规格id
   int64 ent_id = 4;         //企业id
-  int64 user_id = 5;     	//用户id
+  int64 account_id = 5;     //账户id
   int64 buy_num = 6;     	//购买的数量或者购买的份数
   int64 type = 7;        	//操作类型 1:开通权益 -1:取消权益
-  string start_time = 8;      //权益开始时间 格式:2006-01-02 15:04:05
+  string start_time = 8;    //权益开始时间 格式:2006-01-02 15:04:05
   string end_time = 9;      //权益到期时间 格式:2006-01-02 15:04:05
 }
 
 message CheckPowerReq {
   string appid = 1;
   string function_code = 2; //功能代码
-  int64 user_id = 3;        //用户id
+  int64 account_id = 3;     //账户id
   int64 ent_id = 4;         //企业id
   int64 ent_user_id = 5;    //企业用户id 
 }
@@ -30,7 +30,7 @@ message DeductionReq {
   string appid = 1;
   string function_code = 2; //功能代码
   int64 ent_id = 3;         //企业id
-  int64 user_id = 4;        //用户id
+  int64 account_id = 4;     //账户id
   int64 count = 5;          //扣除数量
   repeated string ids = 6;  //id列表
 }
@@ -39,7 +39,7 @@ message RechargeReq {
   string appid = 1;
   string function_code = 2; //功能代码
   int64 ent_id = 3;         //企业id
-  int64 user_id = 4;        //用户id
+  int64 account_id = 4;     //账户id
   int64 count = 5;          //扣除数量
   repeated string ids = 6;  //id列表
 }
@@ -72,7 +72,7 @@ message Resp {
 
 message HaspowersReq {
   string appid = 1;
-  int64 user_id = 2;        //用户id
+  int64 account_id = 2;     //账户id
   int64 ent_id = 3;         //企业id
   int64 ent_user_id = 4;    //企业用户id 
 }

BIN
test/openPower


+ 41 - 2
test/openPower.go

@@ -38,7 +38,7 @@ var (
 func main() {
 	phone := flag.String("p", "", "手机号")
 	m := flag.Int("m", 0, "1:查询权益 2:开通权益 3:取消权益")
-	t := flag.String("t", "", "yxy:医械云 bi_yllyh:医疗领域化BI bi_ldx:立达信BI分析工具")
+	t := flag.String("t", "", "yxy:医械云 bi_yllyh:医疗领域化BI bi_ldx:立达信BI分析工具 bi_hnyd_fx:河南移动_数据分析 bi_hnyd_gl:河南移动_数据管理")
 	isProduct := flag.Int("d", 0, "是否是线上环境;0:否 1:是")
 	dayCount := flag.Int("c", 0, "自定义设置需要开通权益的天数,包含今天")
 	flag.Parse()
@@ -51,8 +51,11 @@ func main() {
 	} else if *t == "bi_yllyh" {
 		entity = &Bi_yllyh{}
 	} else if *t == "bi_ldx" {
-		goodsCode = "special_nosale_goods"
 		entity = &Bi_ldx{}
+	} else if *t == "bi_hnyd_fx" {
+		entity = &Bi_hnyd_fx{}
+	} else if *t == "bi_hnyd_gl" {
+		entity = &Bi_hnyd_gl{}
 	} else {
 		log.Fatalln("-t 参数无效")
 	}
@@ -274,6 +277,42 @@ func (b *Bi_ldx) beforeOpen(phone *string, u *map[string]interface{}) bool {
 func (b *Bi_ldx) afterOpen(phone *string, u *map[string]interface{}) {
 }
 
+/******************************bi_河南移动_数据分析******************************************/
+type Bi_hnyd_fx struct {
+}
+
+//
+func (b *Bi_hnyd_fx) init() (string, string, int64, map[string]string) {
+	return "bi_河南移动_数据分析", "special_nosale_goods", 16, map[string]string{"bi_河南移动_数据分析": "bi_hnyd_fx"}
+}
+
+//
+func (b *Bi_hnyd_fx) beforeOpen(phone *string, u *map[string]interface{}) bool {
+	return true
+}
+
+//
+func (b *Bi_hnyd_fx) afterOpen(phone *string, u *map[string]interface{}) {
+}
+
+/******************************bi_河南移动_数据管理******************************************/
+type Bi_hnyd_gl struct {
+}
+
+//
+func (b *Bi_hnyd_gl) init() (string, string, int64, map[string]string) {
+	return "bi_河南移动_数据管理", "special_nosale_goods", 17, map[string]string{"bi_河南移动_数据管理": "bi_hnyd_gl"}
+}
+
+//
+func (b *Bi_hnyd_gl) beforeOpen(phone *string, u *map[string]interface{}) bool {
+	return true
+}
+
+//
+func (b *Bi_hnyd_gl) afterOpen(phone *string, u *map[string]interface{}) {
+}
+
 /******************************医械云******************************************/
 type Yxy struct {
 }