发放月卡资源
This commit is contained in:
parent
d556686fe7
commit
04e260f895
@ -1,8 +1,7 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"id": "yueka_lv1",
|
||||
"name": "经典月卡",
|
||||
"proid": "yueka_lv1",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
@ -24,9 +23,8 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"id": "yueka_lv2",
|
||||
"name": "典藏月卡",
|
||||
"proid": "yueka_lv2",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
|
@ -30,6 +30,7 @@ const (
|
||||
ItemType = "item" //道具物品资源
|
||||
HeroType = "hero" //卡片资源 例如英雄卡,检验卡
|
||||
EquipmentType = "equi" //武器资源
|
||||
VipType = "vip" //vip
|
||||
)
|
||||
|
||||
type Autogenerated struct {
|
||||
|
@ -236,9 +236,9 @@ type (
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
this.Debugf("create CMD :%s", cmd) // 打印个日志方便查询
|
||||
datas := strings.Split(keys[1], ",")
|
||||
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])
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
|
@ -37,6 +37,7 @@ type ModuleBase struct {
|
||||
ModuleFriend comm.IFriend //好友
|
||||
ModuleRtask comm.IRtask //随机任务
|
||||
ModuleSociaty comm.ISociaty //公会
|
||||
ModulePrivilege comm.IPrivilege // 月卡
|
||||
}
|
||||
|
||||
//重构模块配置对象
|
||||
@ -106,6 +107,11 @@ func (this *ModuleBase) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.ModuleSociaty = module.(comm.ISociaty)
|
||||
|
||||
if module, err = this.service.GetModule(comm.ModulePrivilege); err != nil {
|
||||
return
|
||||
}
|
||||
this.ModulePrivilege = module.(comm.IPrivilege)
|
||||
return
|
||||
}
|
||||
|
||||
@ -315,11 +321,13 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
heros map[string]int32 // 英雄
|
||||
attrs map[string]int32 // 属性
|
||||
equips map[string]uint32 // 装备
|
||||
vip map[string]int32 // vip
|
||||
)
|
||||
items = make(map[string]int32, 0)
|
||||
heros = make(map[string]int32, 0)
|
||||
attrs = make(map[string]int32, 0)
|
||||
equips = make(map[string]uint32, 0)
|
||||
vip = make(map[string]int32, 0)
|
||||
|
||||
for _, v := range res {
|
||||
switch v.A {
|
||||
@ -333,6 +341,8 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
if v.N > 0 { // 不允许减少装备
|
||||
equips[v.T] += uint32(v.N)
|
||||
}
|
||||
case comm.VipType:
|
||||
vip[v.T] += v.N
|
||||
default:
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetPrivilegeCard(id int32) (configure *cfg.GamePrivilegeCardData, err error) {
|
||||
func (this *configureComp) GetPrivilegeCard(id string) (configure *cfg.GamePrivilegeCardData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
|
@ -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) {
|
||||
var (
|
||||
data *pb.DBPrivilege
|
||||
bFind bool
|
||||
)
|
||||
atn := &pb.UserAssets{
|
||||
A: "vip",
|
||||
T: "",
|
||||
N: 1,
|
||||
}
|
||||
|
||||
conf, err := this.configure.GetPrivilegeCard(cId)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return nil, code
|
||||
}
|
||||
// 是不是购买过
|
||||
list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range list {
|
||||
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,
|
||||
CId: cId,
|
||||
PrivilegeID: []int32{},
|
||||
CTime: configure.Now().Unix(),
|
||||
ETime: 0,
|
||||
RewardTime: configure.Now().Unix(),
|
||||
}
|
||||
conf, err := this.configure.GetPrivilegeCard(cid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return nil, code
|
||||
}
|
||||
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)
|
||||
code = this.DispenseRes(session, []*cfg.Gameatn{conf.DisposableReward}, true)
|
||||
}
|
||||
|
||||
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}})
|
||||
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())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.Cid == cid {
|
||||
conf, err := this.configure.GetPrivilegeCard(cid)
|
||||
if v.CId == cId {
|
||||
conf, err := this.configure.GetPrivilegeCard(cId)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return nil, code
|
||||
@ -95,20 +146,26 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cid int32)
|
||||
mapData["eTime"] = v.ETime
|
||||
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}})
|
||||
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 {
|
||||
code = pb.ErrorCode_PrivilegeRenewTime
|
||||
data = nil
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
code = pb.ErrorCode_PrivilegeNotFound
|
||||
data = nil
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ type EquipmentAttributeEntry struct {
|
||||
Lv int32 `protobuf:"varint,4,opt,name=Lv,proto3" json:"Lv"` //属性等级
|
||||
Value int32 `protobuf:"varint,5,opt,name=Value,proto3" json:"Value"` //属性值
|
||||
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() {
|
||||
@ -108,6 +109,13 @@ func (x *EquipmentAttributeEntry) GetBaseValue() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *EquipmentAttributeEntry) GetEnchValue() int32 {
|
||||
if x != nil {
|
||||
return x.EnchValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//装备技能词条 特殊装备/武器or饰品
|
||||
type EquipmentSkillEntry struct {
|
||||
state protoimpl.MessageState
|
||||
@ -336,7 +344,7 @@ var File_equipment_equipment_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_equipment_equipment_db_proto_rawDesc = []byte{
|
||||
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,
|
||||
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,
|
||||
@ -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,
|
||||
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,
|
||||
0x61, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x45, 0x71, 0x75,
|
||||
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 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, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b,
|
||||
0x69, 0x6c, 0x6c, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69,
|
||||
0x6c, 0x6c, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x02, 0x4c, 0x76, 0x22, 0x92, 0x04, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69,
|
||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72,
|
||||
0x6f, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49,
|
||||
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c,
|
||||
0x76, 0x12, 0x20, 0x0a, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c,
|
||||
0x4e, 0x75, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x52, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x61,
|
||||
0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65,
|
||||
0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f,
|
||||
0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x68, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75,
|
||||
0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79,
|
||||
0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49,
|
||||
0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69,
|
||||
0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x12, 0x36, 0x0a, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69,
|
||||
0x6c, 0x6c, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b,
|
||||
0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x1a, 0x3c, 0x0a, 0x0e, 0x45,
|
||||
0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||
0x14, 0x0a, 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,
|
||||
0x61, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x6e, 0x63, 0x68,
|
||||
0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x45, 0x6e, 0x63,
|
||||
0x68, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 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, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x41, 0x74, 0x74, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c,
|
||||
0x6c, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c,
|
||||
0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
|
||||
0x4c, 0x76, 0x22, 0x92, 0x04, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49,
|
||||
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12,
|
||||
0x20, 0x0a, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75,
|
||||
0x6d, 0x12, 0x36, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09,
|
||||
0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x61, 0x64, 0x76,
|
||||
0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18,
|
||||
0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
|
||||
0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x3a, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71,
|
||||
0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x6e, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18,
|
||||
0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75,
|
||||
0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69,
|
||||
0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x6c,
|
||||
0x6f, 0x63, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x12, 0x36, 0x0a, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c,
|
||||
0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64,
|
||||
0x76, 0x65, 0x72, 0x62, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x1a, 0x3c, 0x0a, 0x0e, 0x45, 0x6e, 0x63,
|
||||
0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
||||
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 (
|
||||
|
@ -28,8 +28,8 @@ type DBPrivilege struct {
|
||||
|
||||
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
|
||||
Cid int32 `protobuf:"varint,3,opt,name=cid,proto3" json:"cid" bson:"privilegeID"` //特权id
|
||||
PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"`
|
||||
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"` //特权ID
|
||||
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"` ////到期时间
|
||||
RewardTime int64 `protobuf:"varint,7,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间
|
||||
@ -81,11 +81,11 @@ func (x *DBPrivilege) GetUid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBPrivilege) GetCid() int32 {
|
||||
func (x *DBPrivilege) GetCId() string {
|
||||
if x != nil {
|
||||
return x.Cid
|
||||
return x.CId
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
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,
|
||||
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,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63,
|
||||
0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
|
||||
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,
|
||||
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,
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
"go_dreamfactory/modules/notify"
|
||||
"go_dreamfactory/modules/pagoda"
|
||||
"go_dreamfactory/modules/pay"
|
||||
"go_dreamfactory/modules/privilege"
|
||||
"go_dreamfactory/modules/rtask"
|
||||
"go_dreamfactory/modules/shop"
|
||||
"go_dreamfactory/modules/smithy"
|
||||
@ -96,7 +97,7 @@ func main() {
|
||||
sociaty.NewModule(),
|
||||
horoscope.NewModule(),
|
||||
pay.NewModule(),
|
||||
//privilege.NewModule(),
|
||||
privilege.NewModule(),
|
||||
growtask.NewModule(),
|
||||
worldtask.NewModule(),
|
||||
academy.NewModule(),
|
||||
|
@ -9,13 +9,13 @@
|
||||
package cfg
|
||||
|
||||
type GamePrivilegeCard struct {
|
||||
_dataMap map[int32]*GamePrivilegeCardData
|
||||
_dataMap map[string]*GamePrivilegeCardData
|
||||
_dataList []*GamePrivilegeCardData
|
||||
}
|
||||
|
||||
func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, error) {
|
||||
_dataList := make([]*GamePrivilegeCardData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamePrivilegeCardData)
|
||||
dataMap := make(map[string]*GamePrivilegeCardData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamePrivilegeCardData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
@ -27,7 +27,7 @@ func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, er
|
||||
return &GamePrivilegeCard{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) GetDataMap() map[int32]*GamePrivilegeCardData {
|
||||
func (table *GamePrivilegeCard) GetDataMap() map[string]*GamePrivilegeCardData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ func (table *GamePrivilegeCard) GetDataList() []*GamePrivilegeCardData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) Get(key int32) *GamePrivilegeCardData {
|
||||
func (table *GamePrivilegeCard) Get(key string) *GamePrivilegeCardData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,8 @@ package cfg
|
||||
import "errors"
|
||||
|
||||
type GamePrivilegeCardData struct {
|
||||
Id int32
|
||||
Id string
|
||||
Name string
|
||||
Proid string
|
||||
AssertDay int32
|
||||
RenewDay int32
|
||||
DayReward []*Gameatn
|
||||
@ -28,9 +27,8 @@ func (*GamePrivilegeCardData) GetTypeId() int32 {
|
||||
}
|
||||
|
||||
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.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["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user