发放月卡资源

This commit is contained in:
meixiongfeng 2022-11-09 16:32:10 +08:00
parent d556686fe7
commit 04e260f895
12 changed files with 179 additions and 98 deletions

View File

@ -1,8 +1,7 @@
[ [
{ {
"id": 1, "id": "yueka_lv1",
"name": "经典月卡", "name": "经典月卡",
"proid": "yueka_lv1",
"assert_day": 30, "assert_day": 30,
"renew_day": 3, "renew_day": 3,
"day_reward": [ "day_reward": [
@ -24,9 +23,8 @@
] ]
}, },
{ {
"id": 2, "id": "yueka_lv2",
"name": "典藏月卡", "name": "典藏月卡",
"proid": "yueka_lv2",
"assert_day": 30, "assert_day": 30,
"renew_day": 3, "renew_day": 3,
"day_reward": [ "day_reward": [

View File

@ -30,6 +30,7 @@ const (
ItemType = "item" //道具物品资源 ItemType = "item" //道具物品资源
HeroType = "hero" //卡片资源 例如英雄卡,检验卡 HeroType = "hero" //卡片资源 例如英雄卡,检验卡
EquipmentType = "equi" //武器资源 EquipmentType = "equi" //武器资源
VipType = "vip" //vip
) )
type Autogenerated struct { type Autogenerated struct {

View File

@ -236,9 +236,9 @@ type (
} }
IPrivilege interface { IPrivilege interface {
// 创建一个新的特权卡 // 创建一个新的特权卡
CreatePrivilegeCard(session IUserSession, cid int32) (data *pb.DBPrivilege, code pb.ErrorCode) CreatePrivilegeCard(session IUserSession, cId string) (res []*pb.UserAssets, code pb.ErrorCode)
// 续费特权卡 // 续费特权卡
RenewPrivilegeCard(session IUserSession, cid int32) (data *pb.DBPrivilege, code pb.ErrorCode) RenewPrivilegeCard(session IUserSession, cId string) (res []*pb.UserAssets, code pb.ErrorCode)
// 检查特权 // 检查特权
CheckPrivilege(session IUserSession) CheckPrivilege(session IUserSession)
} }

View File

@ -68,7 +68,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询 this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询
datas := strings.Split(keys[1], ",") datas := strings.Split(keys[1], ",")
if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType || if len(datas) == 3 && (datas[0] == comm.AttrType || datas[0] == comm.ItemType ||
datas[0] == comm.HeroType || datas[0] == comm.EquipmentType) { datas[0] == comm.HeroType || datas[0] == comm.EquipmentType || datas[0] == comm.VipType) {
num, err := strconv.Atoi(datas[2]) num, err := strconv.Atoi(datas[2])
if err != nil { if err != nil {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError

View File

@ -37,6 +37,7 @@ type ModuleBase struct {
ModuleFriend comm.IFriend //好友 ModuleFriend comm.IFriend //好友
ModuleRtask comm.IRtask //随机任务 ModuleRtask comm.IRtask //随机任务
ModuleSociaty comm.ISociaty //公会 ModuleSociaty comm.ISociaty //公会
ModulePrivilege comm.IPrivilege // 月卡
} }
//重构模块配置对象 //重构模块配置对象
@ -106,6 +107,11 @@ func (this *ModuleBase) Start() (err error) {
return return
} }
this.ModuleSociaty = module.(comm.ISociaty) this.ModuleSociaty = module.(comm.ISociaty)
if module, err = this.service.GetModule(comm.ModulePrivilege); err != nil {
return
}
this.ModulePrivilege = module.(comm.IPrivilege)
return return
} }
@ -315,11 +321,13 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
heros map[string]int32 // 英雄 heros map[string]int32 // 英雄
attrs map[string]int32 // 属性 attrs map[string]int32 // 属性
equips map[string]uint32 // 装备 equips map[string]uint32 // 装备
vip map[string]int32 // vip
) )
items = make(map[string]int32, 0) items = make(map[string]int32, 0)
heros = make(map[string]int32, 0) heros = make(map[string]int32, 0)
attrs = make(map[string]int32, 0) attrs = make(map[string]int32, 0)
equips = make(map[string]uint32, 0) equips = make(map[string]uint32, 0)
vip = make(map[string]int32, 0)
for _, v := range res { for _, v := range res {
switch v.A { switch v.A {
@ -333,6 +341,8 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
if v.N > 0 { // 不允许减少装备 if v.N > 0 { // 不允许减少装备
equips[v.T] += uint32(v.N) equips[v.T] += uint32(v.N)
} }
case comm.VipType:
vip[v.T] += v.N
default: default:
this.Errorf("not found res type") // 找不到资源类型 this.Errorf("not found res type") // 找不到资源类型
} }
@ -354,7 +364,13 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
code = this.ModuleEquipment.AddNewEquipments(session, equips, bPush) code = this.ModuleEquipment.AddNewEquipments(session, equips, bPush)
this.Debugf("发放装备资源: %v [%v]", equips, code) this.Debugf("发放装备资源: %v [%v]", equips, code)
} }
if len(vip) > 0 { //卡片资源
for k := range vip {
_, code = this.ModulePrivilege.CreatePrivilegeCard(session, k)
this.Debugf("发放月卡资源: %v [%v]", k, code)
}
}
return return
} }

View File

@ -28,7 +28,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
return return
} }
func (this *configureComp) GetPrivilegeCard(id int32) (configure *cfg.GamePrivilegeCardData, err error) { func (this *configureComp) GetPrivilegeCard(id string) (configure *cfg.GamePrivilegeCardData, err error) {
var ( var (
v interface{} v interface{}
ok bool ok bool

View File

@ -49,42 +49,93 @@ func (this *Privilege) EventUserOffline(session comm.IUserSession) {
} }
// 购买了一个新的特权 // 购买了一个新的特权
func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cid int32) (data *pb.DBPrivilege, code pb.ErrorCode) { func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string) (res []*pb.UserAssets, code pb.ErrorCode) {
data = &pb.DBPrivilege{ var (
Id: primitive.NewObjectID().Hex(), data *pb.DBPrivilege
Uid: session.GetUserId(), bFind bool
Cid: cid, )
PrivilegeID: []int32{}, atn := &pb.UserAssets{
CTime: configure.Now().Unix(), A: "vip",
ETime: 0, T: "",
RewardTime: configure.Now().Unix(), N: 1,
} }
conf, err := this.configure.GetPrivilegeCard(cid)
conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil { if err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return nil, code return nil, code
} }
data.ETime = configure.Now().Unix() + int64(conf.AssertDay*24*3600) // 设置过期时间 // 是不是购买过
for _, v := range conf.PrivilegeId { list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
data.PrivilegeID = append(data.PrivilegeID, v) if err != nil {
code = pb.ErrorCode_DBError
return
} }
this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data) for _, v := range list {
code = this.DispenseRes(session, []*cfg.Gameatn{conf.DisposableReward}, true) if v.CId == cId {
if v.ETime > configure.Now().Unix() { // 加时间
v.ETime += int64(conf.AssertDay) * 24 * 3600
} else {
v.ETime = configure.Now().Unix() + int64(conf.AssertDay)*24*3600
}
if err = this.modelPrivilege.Change(session.GetUserId(), map[string]interface{}{
"eTime": v.ETime,
}); err != nil {
this.Errorf("err:%v", err)
return
}
data = v
bFind = true
break
}
}
if !bFind {
data = &pb.DBPrivilege{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
CId: cId,
PrivilegeID: []int32{},
CTime: configure.Now().Unix(),
ETime: 0,
RewardTime: configure.Now().Unix(),
}
data.ETime = configure.Now().Unix() + int64(conf.AssertDay*24*3600) // 设置过期时间
for _, v := range conf.PrivilegeId {
data.PrivilegeID = append(data.PrivilegeID, v)
}
this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data)
}
if code = this.DispenseRes(session, []*cfg.Gameatn{conf.DisposableReward}, true); code != pb.ErrorCode_Success {
return
}
atn.T = conf.Id
res = append(res, atn) // 加资源
res = append(res, &pb.UserAssets{
A: conf.DisposableReward.A,
T: conf.DisposableReward.T,
N: conf.DisposableReward.N,
})
// 推送 // 推送
session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: []*pb.DBPrivilege{data}}) session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: []*pb.DBPrivilege{data}})
return return
} }
// 续费特权 // 续费特权
func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cid int32) (data *pb.DBPrivilege, code pb.ErrorCode) { func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string) (res []*pb.UserAssets, code pb.ErrorCode) {
atn := &pb.UserAssets{
A: "vip",
T: "",
N: 1,
}
list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId()) list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil { if err != nil {
return return
} }
for _, v := range list { for _, v := range list {
if v.Cid == cid { if v.CId == cId {
conf, err := this.configure.GetPrivilegeCard(cid) conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil { if err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return nil, code return nil, code
@ -95,20 +146,26 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cid int32)
mapData["eTime"] = v.ETime mapData["eTime"] = v.ETime
this.modelPrivilege.modifyPrivilegeData(session.GetUserId(), v.Id, mapData) this.modelPrivilege.modifyPrivilegeData(session.GetUserId(), v.Id, mapData)
// 发放奖励 // 发放奖励
code = this.DispenseRes(session, []*cfg.Gameatn{conf.DisposableReward}, true) if code = this.DispenseRes(session, []*cfg.Gameatn{conf.DisposableReward}, true); code != pb.ErrorCode_Success {
break
}
data = v
session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: []*pb.DBPrivilege{v}}) session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: []*pb.DBPrivilege{v}})
return atn.T = conf.Id
res = append(res, atn) // 加资源
res = append(res, &pb.UserAssets{
A: conf.DisposableReward.A,
T: conf.DisposableReward.T,
N: conf.DisposableReward.N,
})
} else { } else {
code = pb.ErrorCode_PrivilegeRenewTime code = pb.ErrorCode_PrivilegeRenewTime
data = nil
return
} }
break
} }
} }
code = pb.ErrorCode_PrivilegeNotFound code = pb.ErrorCode_PrivilegeNotFound
data = nil
return return
} }

View File

@ -32,6 +32,7 @@ type EquipmentAttributeEntry struct {
Lv int32 `protobuf:"varint,4,opt,name=Lv,proto3" json:"Lv"` //属性等级 Lv int32 `protobuf:"varint,4,opt,name=Lv,proto3" json:"Lv"` //属性等级
Value int32 `protobuf:"varint,5,opt,name=Value,proto3" json:"Value"` //属性值 Value int32 `protobuf:"varint,5,opt,name=Value,proto3" json:"Value"` //属性值
BaseValue int32 `protobuf:"varint,6,opt,name=BaseValue,proto3" json:"BaseValue"` //基础属性 BaseValue int32 `protobuf:"varint,6,opt,name=BaseValue,proto3" json:"BaseValue"` //基础属性
EnchValue int32 `protobuf:"varint,7,opt,name=EnchValue,proto3" json:"EnchValue"` //附魔属性
} }
func (x *EquipmentAttributeEntry) Reset() { func (x *EquipmentAttributeEntry) Reset() {
@ -108,6 +109,13 @@ func (x *EquipmentAttributeEntry) GetBaseValue() int32 {
return 0 return 0
} }
func (x *EquipmentAttributeEntry) GetEnchValue() int32 {
if x != nil {
return x.EnchValue
}
return 0
}
//装备技能词条 特殊装备/武器or饰品 //装备技能词条 特殊装备/武器or饰品
type EquipmentSkillEntry struct { type EquipmentSkillEntry struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -336,7 +344,7 @@ var File_equipment_equipment_db_proto protoreflect.FileDescriptor
var file_equipment_equipment_db_proto_rawDesc = []byte{ var file_equipment_equipment_db_proto_rawDesc = []byte{
0x0a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69, 0x0a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5,
0x01, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x01, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69,
@ -347,50 +355,52 @@ var file_equipment_equipment_db_proto_rawDesc = []byte{
0x52, 0x02, 0x4c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x52, 0x02, 0x4c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x01, 0x28, 0x05, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61,
0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42,
0x61, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x61, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x68,
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x45, 0x6e, 0x63,
0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x68, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70,
0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x18, 0x02, 0x20, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e,
0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c,
0x0a, 0x08, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x0a, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x52, 0x08, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x05, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x69, 0x6c, 0x6c, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x6c, 0x6c, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c,
0x52, 0x02, 0x4c, 0x76, 0x22, 0x92, 0x04, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x6c, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x4c, 0x76, 0x22, 0x92, 0x04, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x28, 0x09, 0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x6f, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49,
0x76, 0x12, 0x20, 0x0a, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12,
0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12,
0x4e, 0x75, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x20, 0x0a, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75,
0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07,
0x52, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x61, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09,
0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x61, 0x64, 0x76,
0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18,
0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62,
0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74,
0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71,
0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72,
0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72,
0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18,
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75,
0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74,
0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69,
0x6f, 0x63, 0x6b, 0x12, 0x36, 0x0a, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x6c,
0x6c, 0x6c, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6f, 0x63, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63,
0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6b, 0x12, 0x36, 0x0a, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c,
0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x1a, 0x3c, 0x0a, 0x0e, 0x45, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65,
0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x1a, 0x3c, 0x0a, 0x0e, 0x45, 0x6e, 0x63,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -26,13 +26,13 @@ type DBPrivilege struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Cid int32 `protobuf:"varint,3,opt,name=cid,proto3" json:"cid" bson:"privilegeID"` //特权id CId string `protobuf:"bytes,3,opt,name=cId,proto3" json:"cId" bson:"cId"` //计费点数ID
PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` //特权ID
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间 CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间
ETime int64 `protobuf:"varint,6,opt,name=eTime,proto3" json:"eTime" bson:"eTime"` ////到期时间 ETime int64 `protobuf:"varint,6,opt,name=eTime,proto3" json:"eTime" bson:"eTime"` ////到期时间
RewardTime int64 `protobuf:"varint,7,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间 RewardTime int64 `protobuf:"varint,7,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间
} }
func (x *DBPrivilege) Reset() { func (x *DBPrivilege) Reset() {
@ -81,11 +81,11 @@ func (x *DBPrivilege) GetUid() string {
return "" return ""
} }
func (x *DBPrivilege) GetCid() int32 { func (x *DBPrivilege) GetCId() string {
if x != nil { if x != nil {
return x.Cid return x.CId
} }
return 0 return ""
} }
func (x *DBPrivilege) GetPrivilegeID() []int32 { func (x *DBPrivilege) GetPrivilegeID() []int32 {
@ -124,8 +124,8 @@ var file_privilege_privilege_db_proto_rawDesc = []byte{
0x01, 0x0a, 0x0b, 0x44, 0x42, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x0e, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49,
0x44, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x44, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65,
0x67, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x67, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54,

View File

@ -26,6 +26,7 @@ import (
"go_dreamfactory/modules/notify" "go_dreamfactory/modules/notify"
"go_dreamfactory/modules/pagoda" "go_dreamfactory/modules/pagoda"
"go_dreamfactory/modules/pay" "go_dreamfactory/modules/pay"
"go_dreamfactory/modules/privilege"
"go_dreamfactory/modules/rtask" "go_dreamfactory/modules/rtask"
"go_dreamfactory/modules/shop" "go_dreamfactory/modules/shop"
"go_dreamfactory/modules/smithy" "go_dreamfactory/modules/smithy"
@ -96,7 +97,7 @@ func main() {
sociaty.NewModule(), sociaty.NewModule(),
horoscope.NewModule(), horoscope.NewModule(),
pay.NewModule(), pay.NewModule(),
//privilege.NewModule(), privilege.NewModule(),
growtask.NewModule(), growtask.NewModule(),
worldtask.NewModule(), worldtask.NewModule(),
academy.NewModule(), academy.NewModule(),

View File

@ -9,13 +9,13 @@
package cfg package cfg
type GamePrivilegeCard struct { type GamePrivilegeCard struct {
_dataMap map[int32]*GamePrivilegeCardData _dataMap map[string]*GamePrivilegeCardData
_dataList []*GamePrivilegeCardData _dataList []*GamePrivilegeCardData
} }
func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, error) { func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, error) {
_dataList := make([]*GamePrivilegeCardData, 0, len(_buf)) _dataList := make([]*GamePrivilegeCardData, 0, len(_buf))
dataMap := make(map[int32]*GamePrivilegeCardData) dataMap := make(map[string]*GamePrivilegeCardData)
for _, _ele_ := range _buf { for _, _ele_ := range _buf {
if _v, err2 := DeserializeGamePrivilegeCardData(_ele_); err2 != nil { if _v, err2 := DeserializeGamePrivilegeCardData(_ele_); err2 != nil {
return nil, err2 return nil, err2
@ -27,7 +27,7 @@ func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, er
return &GamePrivilegeCard{_dataList:_dataList, _dataMap:dataMap}, nil return &GamePrivilegeCard{_dataList:_dataList, _dataMap:dataMap}, nil
} }
func (table *GamePrivilegeCard) GetDataMap() map[int32]*GamePrivilegeCardData { func (table *GamePrivilegeCard) GetDataMap() map[string]*GamePrivilegeCardData {
return table._dataMap return table._dataMap
} }
@ -35,7 +35,7 @@ func (table *GamePrivilegeCard) GetDataList() []*GamePrivilegeCardData {
return table._dataList return table._dataList
} }
func (table *GamePrivilegeCard) Get(key int32) *GamePrivilegeCardData { func (table *GamePrivilegeCard) Get(key string) *GamePrivilegeCardData {
return table._dataMap[key] return table._dataMap[key]
} }

View File

@ -11,9 +11,8 @@ package cfg
import "errors" import "errors"
type GamePrivilegeCardData struct { type GamePrivilegeCardData struct {
Id int32 Id string
Name string Name string
Proid string
AssertDay int32 AssertDay int32
RenewDay int32 RenewDay int32
DayReward []*Gameatn DayReward []*Gameatn
@ -28,9 +27,8 @@ func (*GamePrivilegeCardData) GetTypeId() int32 {
} }
func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) { func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{ var _ok_ bool; if _v.Proid, _ok_ = _buf["proid"].(string); !_ok_ { err = errors.New("proid error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }
{ {