支付调整

This commit is contained in:
meixiongfeng 2023-11-22 14:17:12 +08:00
parent 42d521e01f
commit 8d9d61ced2
4 changed files with 40 additions and 23 deletions

View File

@ -17,7 +17,7 @@ func (this *apiComp) BuyYuekaCheck(session comm.IUserSession, req *pb.PrivilegeB
return
}
///获取特权列表
/// 此协议不用 走正常充值逻辑
func (this *apiComp) BuyYueka(session comm.IUserSession, req *pb.PrivilegeBuyYuekaReq) (errdata *pb.ErrorData) {
if errdata = this.BuyYuekaCheck(session, req); errdata != nil {
return

View File

@ -53,19 +53,18 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
return
}
// 接口调整 稍后补充
func (this *configureComp) GetPrivilegeCard(id string) (data *cfg.GamePrivilegeCardData, err error) {
// var (
// v interface{}
// )
// if v, err = this.GetConfigure(game_privilegecard); err == nil {
// if configure, ok := v.(*cfg.GamePrivilegeCard); ok {
// if data = configure.Get(id); data != nil {
// return
// }
// }
// }
err = comm.NewNotFoundConfErr(moduleName, game_privilegecard, id)
func (this *configureComp) GetPrivilegeCard(itype int32) (data *cfg.GamePrivilegeCardData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_privilegecard); err == nil {
if configure, ok := v.(*cfg.GamePrivilegeCard); ok {
if data = configure.Get(itype); data != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_privilegecard, itype)
return
}
@ -95,3 +94,19 @@ func (this *configureComp) GetPrivilegeByType(iType int32) (result map[int32]int
return result
}
func (this *configureComp) GetPrivilegeCardByPid(pid string) (itype int32) {
if v, err := this.GetConfigure(game_privilegecard); err == nil {
if configure, ok := v.(*cfg.GamePrivilegeCard); ok {
for _, v := range configure.GetDataList() {
if v.Id == pid {
itype = v.PType
return
}
}
}
}
return
}

View File

@ -70,11 +70,13 @@ func (this *Privilege) EventUserOffline(uid, sessionid string) {
}
// 购买了一个新的特权
func (this *Privilege) Delivery(session comm.IUserSession, cId string) (errdata *pb.ErrorData, items []*pb.UserAssets) {
func (this *Privilege) Delivery(session comm.IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets) {
var (
bFind bool
cId int32
)
// 通过计费点获取
cId = this.configure.GetPrivilegeCardByPid(pid)
conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil {
errdata = &pb.ErrorData{
@ -199,7 +201,7 @@ func (this *Privilege) Delivery(session comm.IUserSession, cId string) (errdata
}
// 续费特权
func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string) (errdata *pb.ErrorData) {
func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId int32) (errdata *pb.ErrorData) {
list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil {
return
@ -246,7 +248,7 @@ func (this *Privilege) RenewPrivilegeCard(session comm.IUserSession, cId string)
}
// 查询特权特权
func (this *Privilege) CheckPrivilege(session comm.IUserSession, cId string) bool {
func (this *Privilege) CheckPrivilege(session comm.IUserSession, cId int32) bool {
list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil {
return false
@ -331,7 +333,7 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
return
}
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, count int32, pType int32) {
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId int32, count int32, pType int32) {
conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil {
return

View File

@ -28,7 +28,7 @@ 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 string `protobuf:"bytes,3,opt,name=cId,proto3" json:"cId" bson:"cId"` //计费点数ID
CId int32 `protobuf:"varint,3,opt,name=cId,proto3" json:"cId" bson:"cId"` //月卡类型
CTime int64 `protobuf:"varint,4,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间
ETime int64 `protobuf:"varint,5,opt,name=eTime,proto3" json:"eTime" bson:"eTime"` ////到期时间
RewardTime int64 `protobuf:"varint,6,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间
@ -80,11 +80,11 @@ func (x *DBPrivilege) GetUid() string {
return ""
}
func (x *DBPrivilege) GetCId() string {
func (x *DBPrivilege) GetCId() int32 {
if x != nil {
return x.CId
}
return ""
return 0
}
func (x *DBPrivilege) GetCTime() int64 {
@ -250,7 +250,7 @@ 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, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63,
0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e,