Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
ed5b3342b4
@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
||||
totalCount int32 // 当前购买的总次数
|
||||
update map[string]interface{}
|
||||
price []int32 // 购买所需的价钱
|
||||
totalCost float32 // 购买打折系数
|
||||
totalCost float64 // 购买打折系数
|
||||
udata *pb.DBUser
|
||||
)
|
||||
update = make(map[string]interface{})
|
||||
@ -75,16 +75,17 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
||||
for i := record.Onebuy; i < req.BuyCount; i++ {
|
||||
|
||||
if i >= int32(len(price)) {
|
||||
totalCost += float32(price[len(price)-1]) / 1000
|
||||
totalCost += float64(price[len(price)-1]) / 1000
|
||||
continue
|
||||
}
|
||||
totalCost += float32(price[i]) / 1000
|
||||
totalCost += float64(price[i]) / 1000
|
||||
}
|
||||
need = make([]*cfg.Gameatn, len(conf.Need))
|
||||
for i, v := range conf.Need {
|
||||
need[i] = &cfg.Gameatn{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: int32(math.Ceil(float64(v.N) * float64(totalCost))),
|
||||
N: int32(math.Ceil(float64(v.N) * totalCost)),
|
||||
}
|
||||
}
|
||||
// 消耗
|
||||
|
53
modules/mail/api_delallmail.go
Normal file
53
modules/mail/api_delallmail.go
Normal file
@ -0,0 +1,53 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) DelAllMailCheck(session comm.IUserSession, req *pb.MailDelAllMailReq) (code pb.ErrorCode) {
|
||||
if session.GetUserId() == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 删除邮件
|
||||
func (this *apiComp) DelAllMail(session comm.IUserSession, req *pb.MailDelAllMailReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mailinfo []*pb.DBMailData
|
||||
err error
|
||||
mailData []*pb.DBMailData
|
||||
)
|
||||
code = this.DelAllMailCheck(session, req) // check
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
mailinfo, err = this.module.modelMail.MailQueryUserMail(session.GetUserId())
|
||||
if err != nil {
|
||||
this.module.Errorf("Mail_GetList_Resp err:%v", err)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range mailinfo {
|
||||
if v.Check == false || (v.Reward && len(v.Items) > 0) {
|
||||
bRet := this.module.modelMail.MailDelUserMail(v.ObjId)
|
||||
if !bRet {
|
||||
code = pb.ErrorCode_MailErr // 邮件不存在
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
mailData = append(mailData, v)
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "delallmail", &pb.MailDelAllMailResp{
|
||||
Mails: mailData,
|
||||
})
|
||||
return
|
||||
}
|
@ -28,6 +28,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
var (
|
||||
err error
|
||||
user *pb.DBUser
|
||||
lastLoginTime int64
|
||||
)
|
||||
|
||||
rsp := &pb.UserLoginResp{}
|
||||
@ -102,7 +103,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
|
||||
//不是新账号
|
||||
if !isNewUser {
|
||||
lastLoginTime := user.Logintime
|
||||
lastLoginTime = user.Logintime
|
||||
user.Logintime = configure.Now().Unix()
|
||||
user.Lastloginip = session.GetIP()
|
||||
user.Offlinetime = 0
|
||||
@ -150,6 +151,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
// 检查特权 并发送每日邮件
|
||||
this.module.ModulePrivilege.QueryPrivilege(session)
|
||||
//推送登录公告
|
||||
if this.module.modelUser.isLoginFirst(lastLoginTime) {
|
||||
this.chat.SendSysChatToUser(session, comm.ChatSystem2, 0, 0)
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: primitive.NewObjectID().Hex(),
|
||||
@ -162,6 +164,6 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
Reward: false,
|
||||
}
|
||||
this.mail.CreateNewMail(session, mail)
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -533,6 +533,91 @@ func (x *MailGetAllMailAttachmentResp) GetIds() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
type MailDelAllMailReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *MailDelAllMailReq) Reset() {
|
||||
*x = MailDelAllMailReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_mail_mail_msg_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MailDelAllMailReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MailDelAllMailReq) ProtoMessage() {}
|
||||
|
||||
func (x *MailDelAllMailReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_mail_mail_msg_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MailDelAllMailReq.ProtoReflect.Descriptor instead.
|
||||
func (*MailDelAllMailReq) Descriptor() ([]byte, []int) {
|
||||
return file_mail_mail_msg_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
type MailDelAllMailResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Mails []*DBMailData `protobuf:"bytes,1,rep,name=Mails,proto3" json:"Mails"`
|
||||
}
|
||||
|
||||
func (x *MailDelAllMailResp) Reset() {
|
||||
*x = MailDelAllMailResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_mail_mail_msg_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MailDelAllMailResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MailDelAllMailResp) ProtoMessage() {}
|
||||
|
||||
func (x *MailDelAllMailResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_mail_mail_msg_proto_msgTypes[12]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MailDelAllMailResp.ProtoReflect.Descriptor instead.
|
||||
func (*MailDelAllMailResp) Descriptor() ([]byte, []int) {
|
||||
return file_mail_mail_msg_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *MailDelAllMailResp) GetMails() []*DBMailData {
|
||||
if x != nil {
|
||||
return x.Mails
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_mail_mail_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_mail_mail_msg_proto_rawDesc = []byte{
|
||||
@ -572,8 +657,13 @@ var file_mail_mail_msg_proto_rawDesc = []byte{
|
||||
0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x03, 0x72, 0x65,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73,
|
||||
0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x4d,
|
||||
0x61, 0x69, 0x6c, 0x44, 0x65, 0x6c, 0x41, 0x6c, 0x6c, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71,
|
||||
0x22, 0x37, 0x0a, 0x12, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x65, 0x6c, 0x41, 0x6c, 0x6c, 0x4d, 0x61,
|
||||
0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x05, 0x4d, 0x61, 0x69, 0x6c, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61,
|
||||
0x74, 0x61, 0x52, 0x05, 0x4d, 0x61, 0x69, 0x6c, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -588,7 +678,7 @@ func file_mail_mail_msg_proto_rawDescGZIP() []byte {
|
||||
return file_mail_mail_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_mail_mail_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_mail_mail_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_mail_mail_msg_proto_goTypes = []interface{}{
|
||||
(*MailGetListReq)(nil), // 0: MailGetListReq
|
||||
(*MailGetListResp)(nil), // 1: MailGetListResp
|
||||
@ -601,20 +691,23 @@ var file_mail_mail_msg_proto_goTypes = []interface{}{
|
||||
(*MailGetNewMailPush)(nil), // 8: MailGetNewMailPush
|
||||
(*MailGetAllMailAttachmentReq)(nil), // 9: MailGetAllMailAttachmentReq
|
||||
(*MailGetAllMailAttachmentResp)(nil), // 10: MailGetAllMailAttachmentResp
|
||||
(*DBMailData)(nil), // 11: DBMailData
|
||||
(*UserAssets)(nil), // 12: UserAssets
|
||||
(*MailDelAllMailReq)(nil), // 11: MailDelAllMailReq
|
||||
(*MailDelAllMailResp)(nil), // 12: MailDelAllMailResp
|
||||
(*DBMailData)(nil), // 13: DBMailData
|
||||
(*UserAssets)(nil), // 14: UserAssets
|
||||
}
|
||||
var file_mail_mail_msg_proto_depIdxs = []int32{
|
||||
11, // 0: MailGetListResp.Mails:type_name -> DBMailData
|
||||
11, // 1: MailReadMailResp.Mail:type_name -> DBMailData
|
||||
11, // 2: MailGetUserMailAttachmentResp.Mail:type_name -> DBMailData
|
||||
11, // 3: MailGetNewMailPush.Mail:type_name -> DBMailData
|
||||
12, // 4: MailGetAllMailAttachmentResp.res:type_name -> UserAssets
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
13, // 0: MailGetListResp.Mails:type_name -> DBMailData
|
||||
13, // 1: MailReadMailResp.Mail:type_name -> DBMailData
|
||||
13, // 2: MailGetUserMailAttachmentResp.Mail:type_name -> DBMailData
|
||||
13, // 3: MailGetNewMailPush.Mail:type_name -> DBMailData
|
||||
14, // 4: MailGetAllMailAttachmentResp.res:type_name -> UserAssets
|
||||
13, // 5: MailDelAllMailResp.Mails:type_name -> DBMailData
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_mail_mail_msg_proto_init() }
|
||||
@ -757,6 +850,30 @@ func file_mail_mail_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_mail_mail_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MailDelAllMailReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_mail_mail_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MailDelAllMailResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -764,7 +881,7 @@ func file_mail_mail_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_mail_mail_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 11,
|
||||
NumMessages: 13,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user