wangchuanjin 1 anno fa
parent
commit
4f637f3c24

+ 7 - 1
api/internal/logic/waitempowerdetaillogic.go

@@ -33,6 +33,12 @@ func (l *WaitEmpowerDetailLogic) WaitEmpowerDetail(req *types.Req) (resp *types.
 		l.Error(fmt.Sprintf("%+v", req), err)
 	}
 	resp.Error_code = 0
-	resp.Data = data
+	resp.Data = map[string]interface{}{
+		"start_time":     data.StartTime,
+		"end_time":       data.EndTime,
+		"empower_count":  data.EmpowerCount,
+		"use_count":      data.UseCount,
+		"limit_strategy": data.LimitStrategy,
+	}
 	return
 }

+ 1 - 0
public/entity/base_ent_empower.go

@@ -79,6 +79,7 @@ func (b *base_ent_empower) ReEmpower(appid, function_code string, ent_id int64,
 
 //授权
 func (b *base_ent_empower) Empower(appid, function_code string, ent_id int64, ent_user_id []int64) bool {
+	b.CancelEmpower(appid, function_code, ent_id, ent_user_id)
 	fields := []string{"appid", "ent_id", "ent_user_id", "function_code", "create_time"}
 	nowFormat := NowFormat(Date_Full_Layout)
 	values := []interface{}{}

+ 1 - 1
public/entity/base_ent_wait_empower.go

@@ -17,7 +17,7 @@ type base_ent_wait_empower struct {
 	Ent_id              int64  //企业id
 	Start_time          string //开始时间
 	End_time            string //结束时间
-	Empower_count       int    //授权数量
+	Empower_count       int64  //授权数量
 	Limit_strategy      string //限制频率;1d:1天 1m:1个月
 }
 

+ 2 - 2
public/entity/base_power.go

@@ -65,9 +65,9 @@ func (b *base_power) OpenPower(goods_spec_id int64, appid, goods_code string, ac
 	return Mysql_BaseService.ExecTx("开通权益", func(tx *sql.Tx) bool {
 		//互斥的功能失效掉
 		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) 
+			on (a.appid=? and ((a.account_id=? and a.power_type=1) or (a.account_id=? and a.power_type=2)) 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, account_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
+			set a.status=0,update_time=?`, appid, account_id, ent_account_id, appid, goods_code, goods_spec_id, appid, NowFormat(Date_Full_Layout)) > -1
 		power_values, wait_empower_values := []interface{}{}, []interface{}{}
 		if start_time == "" {
 			start_time = NowFormat(Date_Full_Layout)

+ 0 - 8
public/entity/entity.go

@@ -6,11 +6,3 @@ type SurplusData struct {
 	Start_time string `json:"start_time"`
 	End_time   string `json:"end_time"`
 }
-
-type WaitEmpowerData struct {
-	Start_time     string `json:"start_time"`
-	End_time       string `json:"end_time"`
-	Empower_count  int    `json:"empower_count"`
-	Use_count      int    `json:"use_count"`
-	Limit_strategy string `json:"limit_strategy"`
-}

+ 8 - 8
public/service/power.go

@@ -75,8 +75,8 @@ func CancelPower(appid, goods_code string, goods_spec_id, account_id, ent_accoun
  * @param ent_id 企业id
  * @return 待授权详情
  */
-func WaitEmpowerDetail(appid, function_code string, ent_id int64) (*WaitEmpowerData, error) {
-	result := &WaitEmpowerData{}
+func WaitEmpowerDetail(appid, function_code string, ent_id int64) (*pb.WaitEmpowerDetailResp, error) {
+	result := &pb.WaitEmpowerDetailResp{}
 	if appid == "" {
 		return result, errors.New("无效的参数appid")
 	} else if function_code == "" {
@@ -87,10 +87,10 @@ func WaitEmpowerDetail(appid, function_code string, ent_id int64) (*WaitEmpowerD
 	bewes := Base_ent_wait_empower.WaitEmpowers(appid, function_code, ent_id)
 	if bewes != nil {
 		for _, v := range *bewes {
-			result.Empower_count = v.Empower_count
-			result.Limit_strategy = v.Limit_strategy
-			result.Start_time = v.Start_time
-			result.End_time = v.End_time
+			result.EmpowerCount = v.Empower_count
+			result.LimitStrategy = v.Limit_strategy
+			result.StartTime = v.Start_time
+			result.EndTime = v.End_time
 			break
 		}
 	}
@@ -151,7 +151,7 @@ func ReEmpower(appid, function_code string, ent_id int64, ent_user_id []int64) (
 	if bewes == nil {
 		return -1, nil
 	}
-	count := 0
+	var count int64
 	for _, v := range *bewes {
 		if v.Empower_count == -1 {
 			count = -1
@@ -159,7 +159,7 @@ func ReEmpower(appid, function_code string, ent_id int64, ent_user_id []int64) (
 		}
 		count += v.Empower_count
 	}
-	if count != -1 && len(ent_user_id) > count {
+	if count != -1 && int64(len(ent_user_id)) > count {
 		return -2, nil
 	}
 	if Base_ent_empower.ReEmpower(appid, function_code, ent_id, ent_user_id) {

+ 6 - 0
public/service/power_test.go

@@ -43,6 +43,12 @@ func TestReEmpower(t *testing.T) {
 	assert.Equal(t, int64(1), v)
 }
 
+func TestEmpower(t *testing.T) {
+	v, err := Empower("10000", "bi_sj_yyszs", 1, []int64{123})
+	assert.Nil(t, err)
+	assert.Equal(t, int64(1), v)
+}
+
 func TestCancelEmpower(t *testing.T) {
 	v, err := CancelEmpower("10000", "znsj_kf_use", 14184, []int64{4271, 123})
 	assert.Nil(t, err)

+ 31 - 0
rpc/internal/logic/waitempowerdetaillogic.go

@@ -0,0 +1,31 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type WaitEmpowerDetailLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewWaitEmpowerDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WaitEmpowerDetailLogic {
+	return &WaitEmpowerDetailLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 获取待授权详情
+func (l *WaitEmpowerDetailLogic) WaitEmpowerDetail(in *pb.WaitEmpowerDetailReq) (*pb.WaitEmpowerDetailResp, error) {
+	// todo: add your logic here and delete this line
+
+	return &pb.WaitEmpowerDetailResp{}, nil
+}

+ 6 - 0
rpc/internal/server/resourceserver.go

@@ -75,3 +75,9 @@ func (s *ResourceServer) Haspowers(ctx context.Context, in *pb.HaspowersReq) (*p
 	l := logic.NewHaspowersLogic(ctx, s.svcCtx)
 	return l.Haspowers(in)
 }
+
+// 获取待授权详情
+func (s *ResourceServer) WaitEmpowerDetail(ctx context.Context, in *pb.WaitEmpowerDetailReq) (*pb.WaitEmpowerDetailResp, error) {
+	l := logic.NewWaitEmpowerDetailLogic(ctx, s.svcCtx)
+	return l.WaitEmpowerDetail(in)
+}

+ 240 - 48
rpc/pb/resource.pb.go

@@ -857,6 +857,148 @@ func (x *HaspowersResp) GetPowers() []string {
 	return nil
 }
 
+type WaitEmpowerDetailReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	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,4,opt,name=ent_id,json=entId,proto3" json:"ent_id,omitempty"`                     //企业id
+}
+
+func (x *WaitEmpowerDetailReq) Reset() {
+	*x = WaitEmpowerDetailReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_resource_proto_msgTypes[11]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *WaitEmpowerDetailReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*WaitEmpowerDetailReq) ProtoMessage() {}
+
+func (x *WaitEmpowerDetailReq) ProtoReflect() protoreflect.Message {
+	mi := &file_resource_proto_msgTypes[11]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use WaitEmpowerDetailReq.ProtoReflect.Descriptor instead.
+func (*WaitEmpowerDetailReq) Descriptor() ([]byte, []int) {
+	return file_resource_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *WaitEmpowerDetailReq) GetAppid() string {
+	if x != nil {
+		return x.Appid
+	}
+	return ""
+}
+
+func (x *WaitEmpowerDetailReq) GetFunctionCode() string {
+	if x != nil {
+		return x.FunctionCode
+	}
+	return ""
+}
+
+func (x *WaitEmpowerDetailReq) GetEntId() int64 {
+	if x != nil {
+		return x.EntId
+	}
+	return 0
+}
+
+type WaitEmpowerDetailResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	StartTime     string `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`             //开始时间
+	EndTime       string `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`                   //结束时间
+	EmpowerCount  int64  `protobuf:"varint,3,opt,name=empower_count,json=empowerCount,proto3" json:"empower_count,omitempty"`   //授权数量
+	UseCount      int64  `protobuf:"varint,4,opt,name=use_count,json=useCount,proto3" json:"use_count,omitempty"`               //使用数量
+	LimitStrategy string `protobuf:"bytes,5,opt,name=limit_strategy,json=limitStrategy,proto3" json:"limit_strategy,omitempty"` //频率限制
+}
+
+func (x *WaitEmpowerDetailResp) Reset() {
+	*x = WaitEmpowerDetailResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_resource_proto_msgTypes[12]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *WaitEmpowerDetailResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*WaitEmpowerDetailResp) ProtoMessage() {}
+
+func (x *WaitEmpowerDetailResp) ProtoReflect() protoreflect.Message {
+	mi := &file_resource_proto_msgTypes[12]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use WaitEmpowerDetailResp.ProtoReflect.Descriptor instead.
+func (*WaitEmpowerDetailResp) Descriptor() ([]byte, []int) {
+	return file_resource_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *WaitEmpowerDetailResp) GetStartTime() string {
+	if x != nil {
+		return x.StartTime
+	}
+	return ""
+}
+
+func (x *WaitEmpowerDetailResp) GetEndTime() string {
+	if x != nil {
+		return x.EndTime
+	}
+	return ""
+}
+
+func (x *WaitEmpowerDetailResp) GetEmpowerCount() int64 {
+	if x != nil {
+		return x.EmpowerCount
+	}
+	return 0
+}
+
+func (x *WaitEmpowerDetailResp) GetUseCount() int64 {
+	if x != nil {
+		return x.UseCount
+	}
+	return 0
+}
+
+func (x *WaitEmpowerDetailResp) GetLimitStrategy() string {
+	if x != nil {
+		return x.LimitStrategy
+	}
+	return ""
+}
+
 var File_resource_proto protoreflect.FileDescriptor
 
 var file_resource_proto_rawDesc = []byte{
@@ -962,30 +1104,52 @@ var file_resource_proto_rawDesc = []byte{
 	0x64, 0x18, 0x05, 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, 0xd7, 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, 0x1d, 0x0a, 0x07, 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,
+	0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x22, 0x68, 0x0a, 0x14, 0x57,
+	0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c,
+	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, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
+	0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0xba, 0x01, 0x0a, 0x15, 0x57, 0x61, 0x69, 0x74, 0x45, 0x6d,
+	0x70, 0x6f, 0x77, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 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, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6d, 0x70,
+	0x6f, 0x77, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x0c, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b,
+	0x0a, 0x09, 0x75, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x08, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x6c,
+	0x69, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x05, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65,
+	0x67, 0x79, 0x32, 0x9b, 0x03, 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, 0x1d, 0x0a, 0x07, 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, 0x12, 0x42, 0x0a, 0x11,
+	0x57, 0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69,
+	0x6c, 0x12, 0x15, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x44,
+	0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x57, 0x61, 0x69, 0x74, 0x45,
+	0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70,
+	0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1000,19 +1164,21 @@ func file_resource_proto_rawDescGZIP() []byte {
 	return file_resource_proto_rawDescData
 }
 
-var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
+var file_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
 var file_resource_proto_goTypes = []interface{}{
-	(*Empower)(nil),         // 0: Empower
-	(*PowerReq)(nil),        // 1: PowerReq
-	(*CheckPowerReq)(nil),   // 2: CheckPowerReq
-	(*DeductionReq)(nil),    // 3: DeductionReq
-	(*RechargeReq)(nil),     // 4: RechargeReq
-	(*EmpowerReq)(nil),      // 5: EmpowerReq
-	(*EmpowerListReq)(nil),  // 6: EmpowerListReq
-	(*EmpowerListResp)(nil), // 7: EmpowerListResp
-	(*Resp)(nil),            // 8: Resp
-	(*HaspowersReq)(nil),    // 9: HaspowersReq
-	(*HaspowersResp)(nil),   // 10: HaspowersResp
+	(*Empower)(nil),               // 0: Empower
+	(*PowerReq)(nil),              // 1: PowerReq
+	(*CheckPowerReq)(nil),         // 2: CheckPowerReq
+	(*DeductionReq)(nil),          // 3: DeductionReq
+	(*RechargeReq)(nil),           // 4: RechargeReq
+	(*EmpowerReq)(nil),            // 5: EmpowerReq
+	(*EmpowerListReq)(nil),        // 6: EmpowerListReq
+	(*EmpowerListResp)(nil),       // 7: EmpowerListResp
+	(*Resp)(nil),                  // 8: Resp
+	(*HaspowersReq)(nil),          // 9: HaspowersReq
+	(*HaspowersResp)(nil),         // 10: HaspowersResp
+	(*WaitEmpowerDetailReq)(nil),  // 11: WaitEmpowerDetailReq
+	(*WaitEmpowerDetailResp)(nil), // 12: WaitEmpowerDetailResp
 }
 var file_resource_proto_depIdxs = []int32{
 	0,  // 0: EmpowerListResp.list:type_name -> Empower
@@ -1025,17 +1191,19 @@ var file_resource_proto_depIdxs = []int32{
 	5,  // 7: Resource.CancelEmpower:input_type -> EmpowerReq
 	6,  // 8: Resource.EmpowerList:input_type -> EmpowerListReq
 	9,  // 9: Resource.Haspowers:input_type -> HaspowersReq
-	8,  // 10: Resource.PowerHandle:output_type -> Resp
-	8,  // 11: Resource.CheckPower:output_type -> Resp
-	8,  // 12: Resource.Deduction:output_type -> Resp
-	8,  // 13: Resource.Recharge:output_type -> Resp
-	8,  // 14: Resource.ReEmpower:output_type -> Resp
-	8,  // 15: Resource.Empower:output_type -> Resp
-	8,  // 16: Resource.CancelEmpower:output_type -> Resp
-	7,  // 17: Resource.EmpowerList:output_type -> EmpowerListResp
-	10, // 18: Resource.Haspowers:output_type -> HaspowersResp
-	10, // [10:19] is the sub-list for method output_type
-	1,  // [1:10] is the sub-list for method input_type
+	11, // 10: Resource.WaitEmpowerDetail:input_type -> WaitEmpowerDetailReq
+	8,  // 11: Resource.PowerHandle:output_type -> Resp
+	8,  // 12: Resource.CheckPower:output_type -> Resp
+	8,  // 13: Resource.Deduction:output_type -> Resp
+	8,  // 14: Resource.Recharge:output_type -> Resp
+	8,  // 15: Resource.ReEmpower:output_type -> Resp
+	8,  // 16: Resource.Empower:output_type -> Resp
+	8,  // 17: Resource.CancelEmpower:output_type -> Resp
+	7,  // 18: Resource.EmpowerList:output_type -> EmpowerListResp
+	10, // 19: Resource.Haspowers:output_type -> HaspowersResp
+	12, // 20: Resource.WaitEmpowerDetail:output_type -> WaitEmpowerDetailResp
+	11, // [11:21] is the sub-list for method output_type
+	1,  // [1:11] is the sub-list for method input_type
 	1,  // [1:1] is the sub-list for extension type_name
 	1,  // [1:1] is the sub-list for extension extendee
 	0,  // [0:1] is the sub-list for field type_name
@@ -1179,6 +1347,30 @@ func file_resource_proto_init() {
 				return nil
 			}
 		}
+		file_resource_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*WaitEmpowerDetailReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_resource_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*WaitEmpowerDetailResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -1186,7 +1378,7 @@ func file_resource_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_resource_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   11,
+			NumMessages:   13,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 38 - 0
rpc/pb/resource_grpc.pb.go

@@ -40,6 +40,8 @@ type ResourceClient interface {
 	EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error)
 	//所有的权益
 	Haspowers(ctx context.Context, in *HaspowersReq, opts ...grpc.CallOption) (*HaspowersResp, error)
+	//获取待授权详情
+	WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error)
 }
 
 type resourceClient struct {
@@ -131,6 +133,15 @@ func (c *resourceClient) Haspowers(ctx context.Context, in *HaspowersReq, opts .
 	return out, nil
 }
 
+func (c *resourceClient) WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error) {
+	out := new(WaitEmpowerDetailResp)
+	err := c.cc.Invoke(ctx, "/Resource/WaitEmpowerDetail", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // ResourceServer is the server API for Resource service.
 // All implementations must embed UnimplementedResourceServer
 // for forward compatibility
@@ -153,6 +164,8 @@ type ResourceServer interface {
 	EmpowerList(context.Context, *EmpowerListReq) (*EmpowerListResp, error)
 	//所有的权益
 	Haspowers(context.Context, *HaspowersReq) (*HaspowersResp, error)
+	//获取待授权详情
+	WaitEmpowerDetail(context.Context, *WaitEmpowerDetailReq) (*WaitEmpowerDetailResp, error)
 	mustEmbedUnimplementedResourceServer()
 }
 
@@ -187,6 +200,9 @@ func (UnimplementedResourceServer) EmpowerList(context.Context, *EmpowerListReq)
 func (UnimplementedResourceServer) Haspowers(context.Context, *HaspowersReq) (*HaspowersResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method Haspowers not implemented")
 }
+func (UnimplementedResourceServer) WaitEmpowerDetail(context.Context, *WaitEmpowerDetailReq) (*WaitEmpowerDetailResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method WaitEmpowerDetail not implemented")
+}
 func (UnimplementedResourceServer) mustEmbedUnimplementedResourceServer() {}
 
 // UnsafeResourceServer may be embedded to opt out of forward compatibility for this service.
@@ -362,6 +378,24 @@ func _Resource_Haspowers_Handler(srv interface{}, ctx context.Context, dec func(
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Resource_WaitEmpowerDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(WaitEmpowerDetailReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ResourceServer).WaitEmpowerDetail(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/Resource/WaitEmpowerDetail",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ResourceServer).WaitEmpowerDetail(ctx, req.(*WaitEmpowerDetailReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Resource_ServiceDesc is the grpc.ServiceDesc for Resource service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -405,6 +439,10 @@ var Resource_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "Haspowers",
 			Handler:    _Resource_Haspowers_Handler,
 		},
+		{
+			MethodName: "WaitEmpowerDetail",
+			Handler:    _Resource_WaitEmpowerDetail_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "resource.proto",

+ 30 - 14
rpc/resource.proto

@@ -8,14 +8,14 @@ message Empower {
 
 message PowerReq {
   string appid = 1;
-  string goods_code = 2; 	//商品代码
-  int64 goods_spec_id = 3;  //商品规格id
-  int64 ent_id = 4;         //企业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 end_time = 9;      //权益到期时间 格式:2006-01-02 15:04:05
+  string goods_code = 2; 	     //商品代码
+  int64 goods_spec_id = 3;       //商品规格id
+  int64 ent_id = 4;              //企业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 end_time = 9;           //权益到期时间 格式:2006-01-02 15:04:05
   int64 ent_account_id = 10;     //企业账户id
 }
 
@@ -48,8 +48,8 @@ message RechargeReq {
 
 message EmpowerReq {
   string appid = 1;
-  string function_code = 2; //功能代码
-  int64 ent_id = 3;         //企业id
+  string function_code = 2;       //功能代码
+  int64 ent_id = 3;               //企业id
   repeated int64 ent_user_id = 4; //企业用户id
 }
 
@@ -67,9 +67,9 @@ message EmpowerListResp {
 }
 
 message Resp {
-  int64 status = 1;        //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
-  int64 use_count = 2;     //使用数量
-  int64 surplus_count = 3; //剩余数量
+  int64 status = 1;         //0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权 -4:超额
+  int64 use_count = 2;      //使用数量
+  int64 surplus_count = 3;  //剩余数量
   string start_time = 4;    //权益开始时间
   string end_time = 5;      //权益到期时间
 }
@@ -86,6 +86,20 @@ message HaspowersResp {
   repeated string powers = 1; //所有权益
 }
 
+message WaitEmpowerDetailReq {
+  string appid = 1;
+  string function_code = 2; //功能代码
+  int64 ent_id = 4;         //企业id
+}
+
+message WaitEmpowerDetailResp {
+  string start_time = 1;      //开始时间
+  string end_time = 2;        //结束时间
+  int64 empower_count = 3;    //授权数量
+  int64 use_count = 4;        //使用数量
+  string limit_strategy = 5;  //频率限制
+}
+
 service Resource {
   //开通或者取消用户/企业权益
   rpc PowerHandle(PowerReq) returns(Resp);
@@ -105,4 +119,6 @@ service Resource {
   rpc EmpowerList(EmpowerListReq) returns(EmpowerListResp);
   //所有的权益
   rpc Haspowers(HaspowersReq) returns(HaspowersResp);
-}
+  //获取待授权详情
+  rpc WaitEmpowerDetail(WaitEmpowerDetailReq) returns(WaitEmpowerDetailResp);
+}

+ 21 - 11
rpc/resource/resource.go

@@ -13,17 +13,19 @@ import (
 )
 
 type (
-	CheckPowerReq   = pb.CheckPowerReq
-	DeductionReq    = pb.DeductionReq
-	Empower         = pb.Empower
-	EmpowerListReq  = pb.EmpowerListReq
-	EmpowerListResp = pb.EmpowerListResp
-	EmpowerReq      = pb.EmpowerReq
-	HaspowersReq    = pb.HaspowersReq
-	HaspowersResp   = pb.HaspowersResp
-	PowerReq        = pb.PowerReq
-	RechargeReq     = pb.RechargeReq
-	Resp            = pb.Resp
+	CheckPowerReq         = pb.CheckPowerReq
+	DeductionReq          = pb.DeductionReq
+	Empower               = pb.Empower
+	EmpowerListReq        = pb.EmpowerListReq
+	EmpowerListResp       = pb.EmpowerListResp
+	EmpowerReq            = pb.EmpowerReq
+	HaspowersReq          = pb.HaspowersReq
+	HaspowersResp         = pb.HaspowersResp
+	PowerReq              = pb.PowerReq
+	RechargeReq           = pb.RechargeReq
+	Resp                  = pb.Resp
+	WaitEmpowerDetailReq  = pb.WaitEmpowerDetailReq
+	WaitEmpowerDetailResp = pb.WaitEmpowerDetailResp
 
 	Resource interface {
 		// 开通或者取消用户/企业权益
@@ -44,6 +46,8 @@ type (
 		EmpowerList(ctx context.Context, in *EmpowerListReq, opts ...grpc.CallOption) (*EmpowerListResp, error)
 		// 所有的权益
 		Haspowers(ctx context.Context, in *HaspowersReq, opts ...grpc.CallOption) (*HaspowersResp, error)
+		// 获取待授权详情
+		WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error)
 	}
 
 	defaultResource struct {
@@ -110,3 +114,9 @@ func (m *defaultResource) Haspowers(ctx context.Context, in *HaspowersReq, opts
 	client := pb.NewResourceClient(m.cli.Conn())
 	return client.Haspowers(ctx, in, opts...)
 }
+
+// 获取待授权详情
+func (m *defaultResource) WaitEmpowerDetail(ctx context.Context, in *WaitEmpowerDetailReq, opts ...grpc.CallOption) (*WaitEmpowerDetailResp, error) {
+	client := pb.NewResourceClient(m.cli.Conn())
+	return client.WaitEmpowerDetail(ctx, in, opts...)
+}