Browse Source

运营商专属

wangchuanjin 1 year ago
parent
commit
3595a4b7d8
3 changed files with 200 additions and 179 deletions
  1. 1 0
      rpc/entManageApplication.proto
  2. 85 74
      rpc/pb/entManageApplication.pb.go
  3. 114 105
      service/service.go

+ 1 - 0
rpc/entManageApplication.proto

@@ -19,6 +19,7 @@ message BuyProductList {
 	int64 empower_count = 4;
 	int64 empower_count = 4;
 	int64 province_count = 5;
 	int64 province_count = 5;
 	string end_time = 6;
 	string end_time = 6;
+	int64 empower_nolimit = 7;
 }
 }
 
 
 message UsePersonListReq {
 message UsePersonListReq {

+ 85 - 74
rpc/pb/entManageApplication.pb.go

@@ -135,12 +135,13 @@ type BuyProductList struct {
 	sizeCache     protoimpl.SizeCache
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 	unknownFields protoimpl.UnknownFields
 
 
-	WaitEmpowerId int64  `protobuf:"varint,1,opt,name=wait_empower_id,json=waitEmpowerId,proto3" json:"wait_empower_id,omitempty"`
-	ProductType   string `protobuf:"bytes,2,opt,name=product_type,json=productType,proto3" json:"product_type,omitempty"`
-	UseCount      int64  `protobuf:"varint,3,opt,name=use_count,json=useCount,proto3" json:"use_count,omitempty"`
-	EmpowerCount  int64  `protobuf:"varint,4,opt,name=empower_count,json=empowerCount,proto3" json:"empower_count,omitempty"`
-	ProvinceCount int64  `protobuf:"varint,5,opt,name=province_count,json=provinceCount,proto3" json:"province_count,omitempty"`
-	EndTime       string `protobuf:"bytes,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
+	WaitEmpowerId  int64  `protobuf:"varint,1,opt,name=wait_empower_id,json=waitEmpowerId,proto3" json:"wait_empower_id,omitempty"`
+	ProductType    string `protobuf:"bytes,2,opt,name=product_type,json=productType,proto3" json:"product_type,omitempty"`
+	UseCount       int64  `protobuf:"varint,3,opt,name=use_count,json=useCount,proto3" json:"use_count,omitempty"`
+	EmpowerCount   int64  `protobuf:"varint,4,opt,name=empower_count,json=empowerCount,proto3" json:"empower_count,omitempty"`
+	ProvinceCount  int64  `protobuf:"varint,5,opt,name=province_count,json=provinceCount,proto3" json:"province_count,omitempty"`
+	EndTime        string `protobuf:"bytes,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
+	EmpowerNolimit int64  `protobuf:"varint,7,opt,name=empower_nolimit,json=empowerNolimit,proto3" json:"empower_nolimit,omitempty"`
 }
 }
 
 
 func (x *BuyProductList) Reset() {
 func (x *BuyProductList) Reset() {
@@ -217,6 +218,13 @@ func (x *BuyProductList) GetEndTime() string {
 	return ""
 	return ""
 }
 }
 
 
+func (x *BuyProductList) GetEmpowerNolimit() int64 {
+	if x != nil {
+		return x.EmpowerNolimit
+	}
+	return 0
+}
+
 type UsePersonListReq struct {
 type UsePersonListReq struct {
 	state         protoimpl.MessageState
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	sizeCache     protoimpl.SizeCache
@@ -711,8 +719,8 @@ var file_entManageApplication_proto_rawDesc = []byte{
 	0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74,
 	0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74,
 	0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f,
 	0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f,
-	0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xdf,
-	0x01, 0x0a, 0x0e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73,
+	0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x88,
+	0x02, 0x0a, 0x0e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73,
 	0x74, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65,
 	0x74, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65,
 	0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x77, 0x61, 0x69, 0x74,
 	0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x77, 0x61, 0x69, 0x74,
 	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f,
 	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f,
@@ -726,74 +734,77 @@ var file_entManageApplication_proto_rawDesc = []byte{
 	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65,
 	0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65,
 	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d,
 	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d,
 	0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
 	0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
-	0x22, 0x50, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73,
-	0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x61,
-	0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72,
-	0x49, 0x64, 0x22, 0x73, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c,
-	0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72,
-	0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72,
-	0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f,
-	0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72,
-	0x4d, 0x73, 0x67, 0x12, 0x22, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28,
-	0x0b, 0x32, 0x0e, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73,
-	0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc7, 0x01, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x50,
-	0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x74,
+	0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x6c, 0x69,
+	0x6d, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x65, 0x6d, 0x70, 0x6f, 0x77,
+	0x65, 0x72, 0x4e, 0x6f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x50, 0x0a, 0x10, 0x55, 0x73, 0x65,
+	0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
+	0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e,
+	0x74, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x6f,
+	0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x77, 0x61,
+	0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x22, 0x73, 0x0a, 0x11, 0x55,
+	0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
+	0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x22, 0x0a, 0x04,
+	0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x55, 0x73, 0x65,
+	0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
+	0x22, 0xc7, 0x01, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69,
+	0x73, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x5f, 0x70,
+	0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x65,
+	0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12,
+	0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
+	0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e,
+	0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1e,
+	0x0a, 0x0a, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12,
+	0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f,
+	0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x6f, 0x0a, 0x0f, 0x41, 0x64,
+	0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a,
+	0x0f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f,
+	0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65,
+	0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55,
+	0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x03,
+	0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x71, 0x0a, 0x10, 0x41,
+	0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b,
+	0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x21, 0x0a, 0x04, 0x64,
+	0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x64, 0x64, 0x55,
+	0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x26,
+	0x0a, 0x0c, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x16,
+	0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
+	0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3d, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x55, 0x73, 0x65,
+	0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x74,
 	0x6e, 0x69, 0x63, 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
 	0x6e, 0x69, 0x63, 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
 	0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x50, 0x6f,
 	0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x50, 0x6f,
-	0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61,
-	0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12,
-	0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
-	0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d,
-	0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x61, 0x72,
-	0x74, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x06, 0x20,
-	0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
-	0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
-	0x73, 0x22, 0x6f, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f,
-	0x6e, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70,
-	0x6f, 0x77, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x77,
-	0x61, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0b,
-	0x65, 0x6e, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
-	0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74,
-	0x49, 0x64, 0x22, 0x71, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f,
-	0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f,
-	0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d,
-	0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d,
-	0x73, 0x67, 0x12, 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
-	0x32, 0x0d, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52,
-	0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x26, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50,
-	0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3d, 0x0a,
-	0x0f, 0x44, 0x65, 0x6c, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71,
-	0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6e, 0x74, 0x6e, 0x69, 0x63, 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x77,
-	0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x65, 0x6e, 0x74,
-	0x6e, 0x69, 0x63, 0x68, 0x65, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x49, 0x64, 0x22, 0x22, 0x0a, 0x0e,
-	0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x10,
-	0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x69, 0x64, 0x73,
-	0x32, 0xa7, 0x02, 0x0a, 0x14, 0x45, 0x6e, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x41, 0x70,
-	0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0e, 0x62, 0x75, 0x79,
-	0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x2e, 0x42, 0x75,
-	0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a,
-	0x13, 0x2e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f,
-	0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f,
-	0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x65,
-	0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0c,
-	0x61, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x2e, 0x41,
-	0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x11,
-	0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73,
-	0x70, 0x12, 0x33, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f,
-	0x6e, 0x12, 0x10, 0x2e, 0x44, 0x65, 0x6c, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e,
-	0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x0e, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65,
-	0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x0f, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77,
-	0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x1a, 0x0f, 0x2e, 0x45, 0x6d, 0x70, 0x6f,
-	0x77, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
-	0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x77, 0x65, 0x72, 0x49, 0x64, 0x22, 0x22, 0x0a, 0x0e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72,
+	0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01,
+	0x20, 0x03, 0x28, 0x03, 0x52, 0x03, 0x69, 0x64, 0x73, 0x32, 0xa7, 0x02, 0x0a, 0x14, 0x45, 0x6e,
+	0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0e, 0x62, 0x75, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+	0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x2e, 0x42, 0x75, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+	0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x42, 0x75, 0x79, 0x50, 0x72,
+	0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a,
+	0x0d, 0x75, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11,
+	0x2e, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
+	0x71, 0x1a, 0x12, 0x2e, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4c, 0x69, 0x73,
+	0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0c, 0x61, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50,
+	0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65,
+	0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65,
+	0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0c, 0x64, 0x65,
+	0x6c, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x2e, 0x44, 0x65, 0x6c,
+	0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x41,
+	0x64, 0x64, 0x55, 0x73, 0x65, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x32, 0x0a, 0x0e, 0x65, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
+	0x73, 0x12, 0x0f, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x49,
+	0x64, 0x73, 0x1a, 0x0f, 0x2e, 0x45, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72,
+	0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
+	0x74, 0x6f, 0x33,
 }
 }
 
 
 var (
 var (

+ 114 - 105
service/service.go

@@ -28,7 +28,7 @@ import (
 )
 )
 
 
 const (
 const (
-	YYSSJDZYFX = "运营商数据定制及分析"
+	YYSZSYY = "运营商专属应用"
 )
 )
 
 
 func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp {
 func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp {
@@ -56,8 +56,9 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 				}
 				}
 				//
 				//
 				entUserId, _ := strconv.Atoi(v)
 				entUserId, _ := strconv.Atoi(v)
-				if common.ObjToString((*sourceData)["product_type"]) != YYSSJDZYFX {
-					datas := JyMysql.SelectBySql(`select a.end_time from `+EntnicheWaitEmpower+` a inner join `+EntnichePower+` b on (a.product_type<>? and b.ent_user_id=? and b.status=1 and a.id=b.wait_empower_id)`, YYSSJDZYFX, entUserId)
+				isYyszsyy := common.ObjToString((*sourceData)["product_type"]) == YYSZSYY
+				if !isYyszsyy {
+					datas := JyMysql.SelectBySql(`select a.end_time from `+EntnicheWaitEmpower+` a inner join `+EntnichePower+` b on (a.product_type<>? and b.ent_user_id=? and b.status=1 and a.id=b.wait_empower_id)`, YYSZSYY, entUserId)
 					if datas != nil && len(*datas) > 0 {
 					if datas != nil && len(*datas) > 0 {
 						end_time := common.ObjToString((*datas)[0]["end_time"])
 						end_time := common.ObjToString((*datas)[0]["end_time"])
 						res, _ := time.ParseInLocation("2006-01-02 15:04:05", end_time, time.Local)
 						res, _ := time.ParseInLocation("2006-01-02 15:04:05", end_time, time.Local)
@@ -77,7 +78,11 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 						"create_time":     timeStr,
 						"create_time":     timeStr,
 						"update_time":     timeStr,
 						"update_time":     timeStr,
 					})
 					})
-					addPower(this.WaitEmpowerId, entUserId, this.EntId)
+					identity := getPositionId(entUserId)
+					if isYyszsyy {
+						ResourcePowerHandle(identity, 1, common.ObjToString((*sourceData)["start_time"]), common.ObjToString((*sourceData)["end_time"]))
+					}
+					addPower(this.WaitEmpowerId, identity)
 				}
 				}
 			}
 			}
 		}
 		}
@@ -119,10 +124,10 @@ func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplic
 		LEFT JOIN entniche_department g on (g.id=f.dept_id) 
 		LEFT JOIN entniche_department g on (g.id=f.dept_id) 
 		LEFT JOIN entniche_wait_empower h on (h.id=a.wait_empower_id) 
 		LEFT JOIN entniche_wait_empower h on (h.id=a.wait_empower_id) 
 		where a.status = 1 and a.ent_id = ? and h.end_time >= ?`
 		where a.status = 1 and a.ent_id = ? and h.end_time >= ?`
-	if common.ObjToString((*sourceData)["product_type"]) == YYSSJDZYFX {
-		q += ` and h.product_type='` + YYSSJDZYFX + `'`
+	if common.ObjToString((*sourceData)["product_type"]) == YYSZSYY {
+		q += ` and h.product_type='` + YYSZSYY + `'`
 	} else {
 	} else {
-		q += ` and h.product_type<>'` + YYSSJDZYFX + `'`
+		q += ` and h.product_type<>'` + YYSZSYY + `'`
 	}
 	}
 	q += ` order by a.update_time,a.id desc`
 	q += ` order by a.update_time,a.id desc`
 	data := JyMysql.SelectBySql(q, this.EntId, nowTime)
 	data := JyMysql.SelectBySql(q, this.EntId, nowTime)
@@ -174,13 +179,18 @@ func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageappl
 					productTypeSuffix = "省份版"
 					productTypeSuffix = "省份版"
 				}
 				}
 			}
 			}
+			var empowerNolimit int64
+			if product_type == YYSZSYY {
+				empowerNolimit = 1
+			}
 			obj := &entmanageapplication.BuyProductList{
 			obj := &entmanageapplication.BuyProductList{
-				WaitEmpowerId: common.Int64All(v["id"]),
-				ProductType:   fmt.Sprintf("%s%s", product_type, productTypeSuffix),
-				UseCount:      common.Int64All(v["use_count"]),
-				EmpowerCount:  common.Int64All(v["empower_count"]),
-				ProvinceCount: common.Int64All(v["province_count"]),
-				EndTime:       common.ObjToString(v["end_time"]),
+				WaitEmpowerId:  common.Int64All(v["id"]),
+				ProductType:    fmt.Sprintf("%s%s", product_type, productTypeSuffix),
+				UseCount:       common.Int64All(v["use_count"]),
+				EmpowerCount:   common.Int64All(v["empower_count"]),
+				ProvinceCount:  common.Int64All(v["province_count"]),
+				EndTime:        common.ObjToString(v["end_time"]),
+				EmpowerNolimit: empowerNolimit,
 			}
 			}
 			arr = append(arr, obj)
 			arr = append(arr, obj)
 		}
 		}
@@ -191,9 +201,7 @@ func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageappl
 	}
 	}
 }
 }
 
 
-func addPower(waitEmpowerId int64, entUserId int, entId int64) {
-	identity := getPositionId(entUserId)
-	ResourcePowerHandle(identity, waitEmpowerId, 1)
+func addPower(waitEmpowerId int64, identity *usercenter.Identity) {
 	data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
 	data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
 	if data != nil && len(*data) > 0 {
 	if data != nil && len(*data) > 0 {
 		orderId := common.Int64All((*data)["order_id"])
 		orderId := common.Int64All((*data)["order_id"])
@@ -202,10 +210,32 @@ func addPower(waitEmpowerId int64, entUserId int, entId int64) {
 			productType := common.ObjToString((*orderData)["product_type"])
 			productType := common.ObjToString((*orderData)["product_type"])
 			if productType == "VIP订阅" {
 			if productType == "VIP订阅" {
 				log.Println("开通超级订阅", identity.PositionId)
 				log.Println("开通超级订阅", identity.PositionId)
-				setRule(1, int64(entUserId), entId, *orderData, identity.PositionId)
+				set, setEntUser := vipSetMap(*orderData)
+				setRule(identity, set, setEntUser)
+				now1 := time.Now()
+				currentYear, currentMonth, _ := now1.Date()
+				currentLocation := now1.Location()
+				firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
+				lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
+				endTime := lastOfMonth.Format("2006-01-02")
+				vipTime := time.Unix(common.Int64All(setEntUser["l_vip_endtime"]), 0).Format("2006-01-02")
+				ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+				ResourceCenterRpc.PurchaseUserBalance(ctx, &resourcesCenterclient.Resources{
+					AppId:        "10000",
+					UserId:       fmt.Sprint(identity.PositionId),
+					ResourceType: "附件下载包",
+					AccountId:    fmt.Sprint(identity.PositionId),
+					Name:         "附件下载包",
+					Number:       10,
+					Spec:         "个",
+					EndTime:      endTime,
+					VipTime:      vipTime,
+					Model:        3,
+				})
 			} else if productType == "大会员" {
 			} else if productType == "大会员" {
 				log.Println("开通大会员", identity.PositionId)
 				log.Println("开通大会员", identity.PositionId)
-				setRule(2, int64(entUserId), entId, *orderData, identity.PositionId)
+				set, setEntUser := memberSetMap(identity.PositionId, *orderData)
+				setRule(identity, set, setEntUser)
 			}
 			}
 		}
 		}
 	}
 	}
@@ -250,40 +280,33 @@ func MergeKws(entId, entUserId int64) {
 }
 }
 
 
 func delPower(id int64) {
 func delPower(id int64) {
-	data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": id}, "", "")
-	if data != nil && len(*data) > 0 {
-		waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
-		entUserId := common.IntAll((*data)["ent_user_id"])
+	datas := JyMysql.SelectBySql(`select b.id,b.product_type,a.ent_user_id,a.ent_id from entniche_power a inner join entniche_wait_empower b on (a.id=? and a.wait_empower_id=b.id)`, id)
+	if datas != nil && len(*datas) > 0 {
+		entUserId := common.IntAll((*datas)[0]["ent_user_id"])
+		productType := common.ObjToString((*datas)[0]["product_type"])
+		entId := common.Int64All((*datas)[0]["ent_id"])
 		identity := getPositionId(entUserId)
 		identity := getPositionId(entUserId)
-		eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
-		if eOData != nil && len(*eOData) > 0 {
-			orderId := common.Int64All((*eOData)["order_id"])
-			orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
-			set := map[string]interface{}{}
-			if orderData != nil && len(*orderData) > 0 {
-				productType := common.ObjToString((*orderData)["product_type"])
-				entId := common.Int64All((*orderData)["ent_id"])
-				if productType == "VIP订阅" {
-					set["l_vip_endtime"] = time.Now().Unix()
-					set["i_vip_status"] = 0
-				} else if productType == "大会员" {
-					set["i_member_endtime"] = time.Now().Unix()
-					set["i_member_status"] = 0
-					JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": common.InterfaceToStr(identity.PositionId)}, map[string]interface{}{"i_status": -1})
-				}
-
-				Mgo.Update("ent_user", map[string]interface{}{
-					"i_entid":  entId,
-					"i_userid": entUserId,
-				}, map[string]interface{}{
-					"$set": set,
-				}, true, false)
-
-				posititonIdStr := strconv.Itoa(int(identity.PositionId))
-				RedisDel(posititonIdStr)
-			}
+		if productType == YYSZSYY {
+			ResourcePowerHandle(identity, -1, "", "")
+		}
+		set := map[string]interface{}{}
+		if strings.Contains(productType, "VIP订阅") {
+			set["l_vip_endtime"] = time.Now().Unix()
+			set["i_vip_status"] = 0
+		} else if strings.Contains(productType, "大会员") || productType == YYSZSYY {
+			set["i_member_endtime"] = time.Now().Unix()
+			set["i_member_status"] = 0
+			JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": common.InterfaceToStr(identity.PositionId)}, map[string]interface{}{"i_status": -1, "l_endtime": NowFormat(Date_Full_Layout)})
+		}
+		if len(set) > 0 {
+			Mgo.Update("ent_user", map[string]interface{}{
+				"i_entid":  entId,
+				"i_userid": entUserId,
+			}, map[string]interface{}{
+				"$set": set,
+			}, true, false)
+			RedisDel(strconv.Itoa(int(identity.PositionId)))
 		}
 		}
-		ResourcePowerHandle(identity, waitEmpowerId, -1)
 	}
 	}
 }
 }
 
 
@@ -299,55 +322,22 @@ func getPositionId(entUserId int) *usercenter.Identity {
 
 
 // 订阅设置
 // 订阅设置
 // types:1超级订阅 2大会员
 // types:1超级订阅 2大会员
-func setRule(types int64, entUserId, entId int64, orderData map[string]interface{}, posititonId int64) bool {
+func setRule(identity *usercenter.Identity, set, setEntUser map[string]interface{}) bool {
 	//订阅设置
 	//订阅设置
 	query := map[string]interface{}{
 	query := map[string]interface{}{
-		"i_entid":  entId,
-		"i_userid": entUserId,
+		"i_entid":  identity.EntId,
+		"i_userid": identity.EntUserId,
 	}
 	}
 	//orderData相关权益
 	//orderData相关权益
-	set := map[string]interface{}{}
-	setEntUser := map[string]interface{}{}
-	//超级订阅
-	if types == 1 {
-		set, setEntUser = vipSetMap(orderData)
-	} else if types == 2 {
-		set, setEntUser = memberSetMap(posititonId, orderData)
-	}
-
 	ok1 := Mgo.Update("entniche_rule", query, map[string]interface{}{
 	ok1 := Mgo.Update("entniche_rule", query, map[string]interface{}{
 		"$set": set,
 		"$set": set,
 	}, true, false)
 	}, true, false)
 	ok2 := Mgo.Update("ent_user", query, map[string]interface{}{
 	ok2 := Mgo.Update("ent_user", query, map[string]interface{}{
 		"$set": setEntUser,
 		"$set": setEntUser,
 	}, true, false)
 	}, true, false)
-
 	go func() {
 	go func() {
-		MergeKws(entId, entUserId)
-		posititonIdStr := strconv.Itoa(int(posititonId))
-		RedisDel(posititonIdStr)
-		if types == 1 {
-			now1 := time.Now()
-			currentYear, currentMonth, _ := now1.Date()
-			currentLocation := now1.Location()
-			firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
-			lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
-			endTime := lastOfMonth.Format("2006-01-02")
-			vipTime := time.Unix(common.Int64All(setEntUser["l_vip_endtime"]), 0).Format("2006-01-02")
-			ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
-			ResourceCenterRpc.PurchaseUserBalance(ctx, &resourcesCenterclient.Resources{
-				AppId:        "10000",
-				UserId:       common.InterfaceToStr(posititonId),
-				ResourceType: "附件下载包",
-				AccountId:    common.InterfaceToStr(posititonId),
-				Name:         "附件下载包",
-				Number:       10,
-				Spec:         "个",
-				EndTime:      endTime,
-				VipTime:      vipTime,
-				Model:        3,
-			})
-		}
+		MergeKws(identity.EntId, identity.EntUserId)
+		RedisDel(strconv.Itoa(int(identity.PositionId)))
 	}()
 	}()
 	return ok1 && ok2
 	return ok1 && ok2
 }
 }
@@ -460,7 +450,7 @@ func memberSetMap(userId int64, orderData map[string]interface{}) (set map[strin
 				}
 				}
 			}
 			}
 			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
 			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
-			serverDatas := JyMysql.SelectBySql(sqls, serverId, common.InterfaceToStr(userId))
+			serverDatas := JyMysql.SelectBySql(sqls, serverId, fmt.Sprint(userId))
 			if serverDatas != nil && len(*serverDatas) > 0 {
 			if serverDatas != nil && len(*serverDatas) > 0 {
 				i_status := common.If(dataType == 1, 0, 1)
 				i_status := common.If(dataType == 1, 0, 1)
 				sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
 				sql := "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
@@ -593,23 +583,42 @@ func delRedisByPowerCheck(positionId string) bool {
 }
 }
 
 
 //
 //
-func ResourcePowerHandle(identity *usercenter.Identity, waitEmpowerId, t int64) {
-	//如果是运营商数据定制及分析产品,调用资源中台,取消对应菜单权限
-	if JyMysql.CountBySql(`select count(1) as count from `+EntnicheWaitEmpower+` where id=? and product_type=?`, waitEmpowerId, YYSSJDZYFX) > 0 {
-		if t == 1 {
-			entity.ResourceRpc.Empower(context.Background(), &pb.EmpowerReq{
-				Appid:        "10000",
-				FunctionCode: "bi_sj_yyszs",
-				EntId:        identity.EntId,
-				EntUserId:    []int64{identity.EntUserId},
-			})
-		} else {
-			entity.ResourceRpc.CancelEmpower(context.Background(), &pb.EmpowerReq{
-				Appid:        "10000",
-				FunctionCode: "bi_sj_yyszs",
-				EntId:        identity.EntId,
-				EntUserId:    []int64{identity.EntUserId},
+func ResourcePowerHandle(identity *usercenter.Identity, t int64, startTime, endTime string) {
+	if t == 1 {
+		resp, err := entity.ResourceRpc.Empower(context.Background(), &pb.EmpowerReq{
+			Appid:        "10000",
+			FunctionCode: "bi_sj_yyszs",
+			EntId:        identity.EntId,
+			EntUserId:    []int64{identity.EntUserId},
+		})
+		if err == nil || resp.Status == 1 {
+			nowFormat := NowFormat(Date_Full_Layout)
+			positionId := fmt.Sprint(identity.PositionId)
+			r1, r2 := JyMysql.InsertBatch("jianyu.bigmember_service_user", []string{"s_userid", "s_serviceid", "i_frequency", "l_starttime", "l_endtime", "i_status", "l_createtime", "l_updatetime"}, []interface{}{
+				positionId, 1, 0, startTime, endTime, 0, nowFormat, nowFormat,
+				positionId, 3, 0, startTime, endTime, 0, nowFormat, nowFormat,
+				positionId, 13, 500, startTime, endTime, 0, nowFormat, nowFormat,
+				positionId, 14, 500, startTime, endTime, 0, nowFormat, nowFormat,
 			})
 			})
+			if r1 > 0 && r2 > 0 {
+				start, err1 := time.ParseInLocation(Date_Full_Layout, startTime, time.Local)
+				end, err2 := time.ParseInLocation(Date_Full_Layout, endTime, time.Local)
+				if err1 == nil && err2 == nil {
+					setRule(identity, map[string]interface{}{"i_type": 1}, map[string]interface{}{
+						"i_member_status":    5,
+						"i_member_starttime": start.Unix(),
+						"i_member_endtime":   end.Unix(),
+						"l_createtime":       time.Now().Unix(),
+					})
+				}
+			}
 		}
 		}
+	} else {
+		entity.ResourceRpc.CancelEmpower(context.Background(), &pb.EmpowerReq{
+			Appid:        "10000",
+			FunctionCode: "bi_sj_yyszs",
+			EntId:        identity.EntId,
+			EntUserId:    []int64{identity.EntUserId},
+		})
 	}
 	}
 }
 }