暂存
This commit is contained in:
parent
29ef73838e
commit
7fce25f60e
@ -14,17 +14,25 @@ func (this *apiComp) GetHdDataCheck(session comm.IUserSession, req *pb.ActivityG
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdDataReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdDataReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
list *pb.DBActivityData
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if req.Oid == "" {
|
||||||
|
|
||||||
list, err := this.module.modelhdData.getHddataByOid(session.GetUserId(), req.Oid)
|
} else {
|
||||||
if err != nil {
|
list, err = this.module.modelhdData.getHddataByOid(session.GetUserId(), req.Oid)
|
||||||
errdata = &pb.ErrorData{
|
if err != nil {
|
||||||
Code: pb.ErrorCode_DBError,
|
errdata = &pb.ErrorData{
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
// 校验活动是否过期
|
// 校验活动是否过期
|
||||||
if a, err := this.module.modelhdList.getHdInfoByHdId(req.Oid); err != nil {
|
if a, err := this.module.modelhdList.getHdListByHdId(req.Oid); err != nil {
|
||||||
curTime := configure.Now().Unix()
|
curTime := configure.Now().Unix()
|
||||||
|
|
||||||
if a.Htype == comm.HdTypeSign && a.Stime <= curTime && curTime <= a.Etime {
|
if a.Htype == comm.HdTypeSign && a.Stime <= curTime && curTime <= a.Etime {
|
||||||
@ -38,9 +46,8 @@ func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "gethddata", &pb.ActivityGetHdDataResp{
|
session.SendMsg(string(this.module.GetType()), "gethddata", &pb.ActivityGetHdDataResp{
|
||||||
Data: list,
|
Data: []*pb.DBActivityData{list},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.ActivityGetRew
|
|||||||
reward []*cfg.Gameatn
|
reward []*cfg.Gameatn
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
)
|
)
|
||||||
if activity, err = this.module.modelhdList.getHdInfoByHdId(req.Oid); err != nil {
|
if activity, err = this.module.modelhdList.getHdListByHdId(req.Oid); err != nil {
|
||||||
curTime := configure.Now().Unix()
|
curTime := configure.Now().Unix()
|
||||||
|
|
||||||
if activity.Stime <= curTime && curTime <= activity.Etime {
|
if activity.Stime <= curTime && curTime <= activity.Etime {
|
||||||
|
@ -47,7 +47,7 @@ func (this *modelHdList) getHdInfo() (result []*pb.DBHuodong, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通过活动ID查找
|
// 通过活动ID查找
|
||||||
func (this *modelHdList) getHdInfoByHdId(oid string) (result *pb.DBHuodong, err error) {
|
func (this *modelHdList) getHdListByHdId(oid string) (result *pb.DBHuodong, err error) {
|
||||||
|
|
||||||
_data := this.DBModel.DB.FindOne(comm.TableHdInfo, bson.M{"_id": oid})
|
_data := this.DBModel.DB.FindOne(comm.TableHdInfo, bson.M{"_id": oid})
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
)
|
)
|
||||||
@ -145,39 +144,53 @@ func (this *Activity) GetAllHdInfo() (result []*pb.DBHuodong, err error) {
|
|||||||
|
|
||||||
// 通过活动ID查找
|
// 通过活动ID查找
|
||||||
func (this *Activity) GetHdInfoByHdId(oid string) (result *pb.DBHuodong, err error) {
|
func (this *Activity) GetHdInfoByHdId(oid string) (result *pb.DBHuodong, err error) {
|
||||||
result, err = this.modelhdList.getHdInfoByHdId(oid)
|
result, err = this.modelhdList.getHdListByHdId(oid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新签到进度
|
|
||||||
func (this *Activity) UpdateSingnActivitySlider(session comm.IUserSession) {
|
|
||||||
curTime := configure.Now().Unix()
|
|
||||||
if rst, err := this.modelhdList.getHdInfoByHdType(comm.HdTypeSign); err == nil {
|
|
||||||
if rst.Stime <= curTime && curTime <= rst.Etime {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 大转盘奖励
|
// 大转盘奖励
|
||||||
func (this *Activity) Turntable(drawIndex int32, reward []int32) (item *cfg.Gameatn, err error) {
|
func (this *Activity) Turntable(drawIndex int32, reward []int32) (item *cfg.Gameatn, err error) {
|
||||||
var (
|
var (
|
||||||
conf *cfg.GameVenturegiftsDrawData
|
conf *cfg.GameVenturegiftsDrawData
|
||||||
|
szW []int32 // 权重
|
||||||
|
szpool []int32 // drawkey
|
||||||
)
|
)
|
||||||
if conf, err = this.configure.GetVenturegiftsDraw(drawIndex); err != nil {
|
if conf, err = this.configure.GetVenturegiftsDraw(drawIndex); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 过滤已经获得的道具
|
|
||||||
if conf.Type == 1 { // 只取第一个卡池
|
|
||||||
|
|
||||||
for _, v := range this.configure.pool1 {
|
// 过滤已经获得的道具
|
||||||
|
for _, v := range this.configure.pool1 {
|
||||||
|
bFound := false
|
||||||
|
for _, v1 := range reward {
|
||||||
|
if v.Drawkey == v1 {
|
||||||
|
bFound = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bFound {
|
||||||
|
szW = append(szW, v.Weight)
|
||||||
|
szpool = append(szpool, v.Drawkey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if conf.Type == 2 {
|
||||||
|
for _, v := range this.configure.pool2 {
|
||||||
|
bFound := false
|
||||||
for _, v1 := range reward {
|
for _, v1 := range reward {
|
||||||
if v.Drawkey == v1 {
|
if v.Drawkey == v1 {
|
||||||
|
bFound = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !bFound {
|
||||||
|
szW = append(szW, v.Weight)
|
||||||
|
szpool = append(szpool, v.Drawkey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item = conf.Id // 最终获得的道具
|
if c, err := this.configure.GetVenturegiftsDraw(szpool[comm.GetRandW(szW)]); err != nil {
|
||||||
|
item = c.Id // 最终获得的道具
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -106,12 +106,13 @@ func (x *ActivityGetListResp) GetData() []*DBHuodong {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 玩家活动数据
|
||||||
type ActivityGetHdDataReq struct {
|
type ActivityGetHdDataReq struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"`
|
Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"` // obj 为空 取所有的活动
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActivityGetHdDataReq) Reset() {
|
func (x *ActivityGetHdDataReq) Reset() {
|
||||||
@ -159,7 +160,7 @@ type ActivityGetHdDataResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Data *DBActivityData `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
Data []*DBActivityData `protobuf:"bytes,1,rep,name=data,proto3" json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActivityGetHdDataResp) Reset() {
|
func (x *ActivityGetHdDataResp) Reset() {
|
||||||
@ -194,7 +195,7 @@ func (*ActivityGetHdDataResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_activity_activity_msg_proto_rawDescGZIP(), []int{3}
|
return file_activity_activity_msg_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActivityGetHdDataResp) GetData() *DBActivityData {
|
func (x *ActivityGetHdDataResp) GetData() []*DBActivityData {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Data
|
return x.Data
|
||||||
}
|
}
|
||||||
@ -330,7 +331,7 @@ var file_activity_activity_msg_proto_rawDesc = []byte{
|
|||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x15,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x15,
|
||||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x48, 0x64, 0x44, 0x61, 0x74,
|
0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x48, 0x64, 0x44, 0x61, 0x74,
|
||||||
0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
|
0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
|
0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79,
|
||||||
0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a, 0x14, 0x41, 0x63,
|
0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3a, 0x0a, 0x14, 0x41, 0x63,
|
||||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52,
|
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52,
|
||||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
Loading…
Reference in New Issue
Block a user