充值记录优化
This commit is contained in:
parent
a574dabfe9
commit
b6f28d7266
@ -169,3 +169,8 @@ func IsSameDay(timestamp1, timestamp2 int64) bool {
|
|||||||
|
|
||||||
return t1.Year() == t2.Year() && t1.YearDay() == t2.YearDay()
|
return t1.Year() == t2.Year() && t1.YearDay() == t2.YearDay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsFirstDayOfMonth() bool {
|
||||||
|
now := time.Now()
|
||||||
|
return now.Day() == 1
|
||||||
|
}
|
||||||
|
|||||||
@ -4413,7 +4413,7 @@ func ReqId2Verify(player *Player, buf []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
BaseMod := player.PlayMod.getBaseMod()
|
BaseMod := player.PlayMod.getBaseMod()
|
||||||
BaseMod.SetId2Verify(req.Id, req.Name)
|
BaseMod.SetId2Verify(req.Name, req.Id)
|
||||||
player.TeLog("id2verify", map[string]interface{}{
|
player.TeLog("id2verify", map[string]interface{}{
|
||||||
"Id": req.Id,
|
"Id": req.Id,
|
||||||
"Name": req.Name,
|
"Name": req.Name,
|
||||||
|
|||||||
@ -18,6 +18,7 @@ type ChargeMod struct {
|
|||||||
MaxCharge float64 // 最大充值金额
|
MaxCharge float64 // 最大充值金额
|
||||||
Charge float64 // 总充值金额
|
Charge float64 // 总充值金额
|
||||||
TodayCharge float64 // 当日充值金额
|
TodayCharge float64 // 当日充值金额
|
||||||
|
MonthCharge float64 // 当月充值金额
|
||||||
Total int // 总充值次数
|
Total int // 总充值次数
|
||||||
LastSpecialCharge int64 // 近35天最大充值的充值时间
|
LastSpecialCharge int64 // 近35天最大充值的充值时间
|
||||||
SpecialCharge float64 // 近35天最大充值金额
|
SpecialCharge float64 // 近35天最大充值金额
|
||||||
@ -101,6 +102,9 @@ func (c *ChargeMod) ZeroUpdate(Emit []int) {
|
|||||||
if c.LastCharge != 0 && Now-c.LastCharge > 35*24*3600 {
|
if c.LastCharge != 0 && Now-c.LastCharge > 35*24*3600 {
|
||||||
c.SpecialCharge = 0
|
c.SpecialCharge = 0
|
||||||
}
|
}
|
||||||
|
if GoUtil.IsFirstDayOfMonth() {
|
||||||
|
c.MonthCharge = 0
|
||||||
|
}
|
||||||
c.FreeShop = 0
|
c.FreeShop = 0
|
||||||
SpecialGrade := 1
|
SpecialGrade := 1
|
||||||
c.TodayCharge = 0
|
c.TodayCharge = 0
|
||||||
@ -134,6 +138,7 @@ func (c *ChargeMod) Fire(ChargeId int) (Item []*item.Item) {
|
|||||||
}
|
}
|
||||||
c.Charge += Money
|
c.Charge += Money
|
||||||
c.TodayCharge += Money
|
c.TodayCharge += Money
|
||||||
|
c.MonthCharge += Money
|
||||||
c.Total++
|
c.Total++
|
||||||
Now := GoUtil.Now()
|
Now := GoUtil.Now()
|
||||||
if c.FirstCharge == 0 {
|
if c.FirstCharge == 0 {
|
||||||
@ -269,6 +274,8 @@ func (c *ChargeMod) BackData() *msg.ResCharge {
|
|||||||
Ad: c.Ad,
|
Ad: c.Ad,
|
||||||
SpecialCharge: float32(c.SpecialCharge),
|
SpecialCharge: float32(c.SpecialCharge),
|
||||||
SpecialChargeWeek: int32(GoUtil.FullWeeksSince(c.LastSpecialCharge)),
|
SpecialChargeWeek: int32(GoUtil.FullWeeksSince(c.LastSpecialCharge)),
|
||||||
|
TodayCharge: float32(c.TodayCharge),
|
||||||
|
MonthCharge: float32(c.MonthCharge),
|
||||||
Wish: &msg.WishList{
|
Wish: &msg.WishList{
|
||||||
Id: int32(c.WishList.ItemId),
|
Id: int32(c.WishList.ItemId),
|
||||||
Count: int32(c.WishList.Count),
|
Count: int32(c.WishList.Count),
|
||||||
|
|||||||
@ -14863,6 +14863,8 @@ type ResCharge struct {
|
|||||||
Wish *WishList `protobuf:"bytes,9,opt,name=Wish,proto3" json:"Wish,omitempty"` // 心愿单
|
Wish *WishList `protobuf:"bytes,9,opt,name=Wish,proto3" json:"Wish,omitempty"` // 心愿单
|
||||||
SpecialCharge float32 `protobuf:"fixed32,10,opt,name=SpecialCharge,proto3" json:"SpecialCharge,omitempty"` // 特35天最大充值金额
|
SpecialCharge float32 `protobuf:"fixed32,10,opt,name=SpecialCharge,proto3" json:"SpecialCharge,omitempty"` // 特35天最大充值金额
|
||||||
SpecialChargeWeek int32 `protobuf:"varint,11,opt,name=SpecialChargeWeek,proto3" json:"SpecialChargeWeek,omitempty"` // 距离现在多少周
|
SpecialChargeWeek int32 `protobuf:"varint,11,opt,name=SpecialChargeWeek,proto3" json:"SpecialChargeWeek,omitempty"` // 距离现在多少周
|
||||||
|
TodayCharge float32 `protobuf:"fixed32,12,opt,name=TodayCharge,proto3" json:"TodayCharge,omitempty"` // 今日充值金额
|
||||||
|
MonthCharge float32 `protobuf:"fixed32,13,opt,name=MonthCharge,proto3" json:"MonthCharge,omitempty"` // 本月充值金额
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -14974,6 +14976,20 @@ func (x *ResCharge) GetSpecialChargeWeek() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ResCharge) GetTodayCharge() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TodayCharge
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ResCharge) GetMonthCharge() float32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MonthCharge
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type WishList struct {
|
type WishList struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 物品id
|
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 物品id
|
||||||
@ -24373,7 +24389,7 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
|||||||
"\rResDeleteMail\x12&\n" +
|
"\rResDeleteMail\x12&\n" +
|
||||||
"\x04Code\x18\x01 \x01(\x0e2\x12.tutorial.RES_CODER\x04Code\x12\x10\n" +
|
"\x04Code\x18\x01 \x01(\x0e2\x12.tutorial.RES_CODER\x04Code\x12\x10\n" +
|
||||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\x12\x0e\n" +
|
"\x03Msg\x18\x02 \x01(\tR\x03Msg\x12\x0e\n" +
|
||||||
"\x02Id\x18\x03 \x01(\x05R\x02Id\"\x9d\x05\n" +
|
"\x02Id\x18\x03 \x01(\x05R\x02Id\"\xe1\x05\n" +
|
||||||
"\tResCharge\x12\x16\n" +
|
"\tResCharge\x12\x16\n" +
|
||||||
"\x06Charge\x18\x01 \x01(\x02R\x06Charge\x12\x14\n" +
|
"\x06Charge\x18\x01 \x01(\x02R\x06Charge\x12\x14\n" +
|
||||||
"\x05Total\x18\x02 \x01(\x05R\x05Total\x12\x14\n" +
|
"\x05Total\x18\x02 \x01(\x05R\x05Total\x12\x14\n" +
|
||||||
@ -24386,7 +24402,9 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
|||||||
"\x04Wish\x18\t \x01(\v2\x12.tutorial.WishListR\x04Wish\x12$\n" +
|
"\x04Wish\x18\t \x01(\v2\x12.tutorial.WishListR\x04Wish\x12$\n" +
|
||||||
"\rSpecialCharge\x18\n" +
|
"\rSpecialCharge\x18\n" +
|
||||||
" \x01(\x02R\rSpecialCharge\x12,\n" +
|
" \x01(\x02R\rSpecialCharge\x12,\n" +
|
||||||
"\x11SpecialChargeWeek\x18\v \x01(\x05R\x11SpecialChargeWeek\x1aX\n" +
|
"\x11SpecialChargeWeek\x18\v \x01(\x05R\x11SpecialChargeWeek\x12 \n" +
|
||||||
|
"\vTodayCharge\x18\f \x01(\x02R\vTodayCharge\x12 \n" +
|
||||||
|
"\vMonthCharge\x18\r \x01(\x02R\vMonthCharge\x1aX\n" +
|
||||||
"\x10SpecialShopEntry\x12\x10\n" +
|
"\x10SpecialShopEntry\x12\x10\n" +
|
||||||
"\x03key\x18\x01 \x01(\x05R\x03key\x12.\n" +
|
"\x03key\x18\x01 \x01(\x05R\x03key\x12.\n" +
|
||||||
"\x05value\x18\x02 \x01(\v2\x18.tutorial.ResSpecialShopR\x05value:\x028\x01\x1aT\n" +
|
"\x05value\x18\x02 \x01(\v2\x18.tutorial.ResSpecialShopR\x05value:\x028\x01\x1aT\n" +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user