Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c1c5481f44
@ -1,157 +1,157 @@
|
||||
[
|
||||
{
|
||||
"key": 1,
|
||||
"id": "10001",
|
||||
"id": "13001",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 2,
|
||||
"id": "10002",
|
||||
"id": "13002",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 3,
|
||||
"id": "10003",
|
||||
"id": "13003",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 4,
|
||||
"id": "10004",
|
||||
"id": "13004",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 5,
|
||||
"id": "10005",
|
||||
"id": "13005",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 6,
|
||||
"id": "10006",
|
||||
"id": "14001",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 7,
|
||||
"id": "10007",
|
||||
"id": "14002",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 8,
|
||||
"id": "10008",
|
||||
"id": "14003",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 9,
|
||||
"id": "10009",
|
||||
"id": "14004",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 10,
|
||||
"id": "10010",
|
||||
"id": "14005",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 11,
|
||||
"id": "10011",
|
||||
"id": "14006",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 12,
|
||||
"id": "10012",
|
||||
"id": "14007",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 13,
|
||||
"id": "10013",
|
||||
"id": "15001",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 14,
|
||||
"id": "10014",
|
||||
"id": "15002",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 15,
|
||||
"id": "10015",
|
||||
"id": "15003",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 16,
|
||||
"id": "10016",
|
||||
"id": "15004",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 17,
|
||||
"id": "10017",
|
||||
"id": "23001",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 18,
|
||||
"id": "10018",
|
||||
"id": "23002",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 19,
|
||||
"id": "10019",
|
||||
"id": "23003",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 20,
|
||||
"id": "10020",
|
||||
"id": "23004",
|
||||
"type_id": 1,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 21,
|
||||
"id": "10001",
|
||||
"id": "24001",
|
||||
"type_id": 2,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 22,
|
||||
"id": "10002",
|
||||
"id": "24002",
|
||||
"type_id": 2,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 23,
|
||||
"id": "10001",
|
||||
"id": "24003",
|
||||
"type_id": 11,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 24,
|
||||
"id": "10002",
|
||||
"id": "24004",
|
||||
"type_id": 11,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 25,
|
||||
"id": "10003",
|
||||
"id": "24005",
|
||||
"type_id": 11,
|
||||
"weight": 1000
|
||||
},
|
||||
{
|
||||
"key": 26,
|
||||
"id": "10004",
|
||||
"id": "24006",
|
||||
"type_id": 11,
|
||||
"weight": 1000
|
||||
},
|
||||
|
@ -33,15 +33,15 @@ var (
|
||||
mainType: string(comm.ModuleHero),
|
||||
subType: hero.StrengthenUplv,
|
||||
req: &pb.HeroStrengthenUplvReq{
|
||||
HeroObjID: "62de35b92f462b70c1105aa8",
|
||||
HeroObjID: "62e778117cc92ac48c4b2464",
|
||||
ExpCards: []*pb.MapStringInt32{
|
||||
{
|
||||
Key: "62de35b92f462b70c1105ab8",
|
||||
Key: "62e778117cc92ac48c4b2479",
|
||||
Value: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
rsp: &pb.HeroStrengthenUplvResp{},
|
||||
rsp: &pb.HeroStrengthenUplvResp{},
|
||||
// enabled: true,
|
||||
}
|
||||
tcs = append(tcs, tc)
|
||||
@ -134,8 +134,8 @@ var (
|
||||
req: &pb.GMCmdReq{
|
||||
Cmod: "bingo:attr,gold,100",
|
||||
},
|
||||
rsp: &pb.GMCmdResp{},
|
||||
enabled: true,
|
||||
rsp: &pb.GMCmdResp{},
|
||||
// enabled: true,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
@ -17,9 +17,9 @@ var (
|
||||
subType: task.TaskSubTypeList,
|
||||
req: &pb.TaskListReq{
|
||||
//设置任务类型
|
||||
// TaskTag: int32(comm.TASK_DAILY), //每天任务
|
||||
TaskTag: int32(comm.TASK_DAILY), //每天任务
|
||||
// TaskTag: int32(comm.TASK_WEEKLY), //周任务
|
||||
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
// TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
// TaskTag: int32(comm.TASK_STRATEGY),
|
||||
},
|
||||
rsp: &pb.TaskListResp{},
|
||||
@ -40,10 +40,10 @@ var (
|
||||
subType: task.TaskSubTypeReceive,
|
||||
req: &pb.TaskReceiveReq{
|
||||
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
Id: "62e0d79d7eefc9f4ef5803e3",
|
||||
Id: "62e778167cc92ac48c4b249b",
|
||||
},
|
||||
rsp: &pb.TaskReceiveResp{},
|
||||
// enabled: true,
|
||||
rsp: &pb.TaskReceiveResp{},
|
||||
enabled: true,
|
||||
}
|
||||
tcs = append(tcs, tc)
|
||||
// }
|
||||
|
@ -39,7 +39,7 @@ var user_builders = []*TestCase{
|
||||
subType: "gettujian",
|
||||
req: &pb.UserGetTujianReq{},
|
||||
rsp: &pb.UserGetTujianResp{},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
},
|
||||
{
|
||||
desc: "添加资源",
|
||||
|
@ -67,7 +67,7 @@ type (
|
||||
//获取用户expand
|
||||
GetUserExpand(uid string) (result *pb.DBUserExpand, err error)
|
||||
//更新用户expand
|
||||
ChanageUserExpand(uid string, value map[string]interface{}) error
|
||||
ChangeUserExpand(uid string, value map[string]interface{}) error
|
||||
}
|
||||
//武器模块
|
||||
IEquipment interface {
|
||||
|
@ -28,7 +28,7 @@ func (this *apiComp) ChanageChannel(session comm.IUserSession, req *pb.ChatChana
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"chatchannel": req.ChannelId,
|
||||
})
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"chatchannel": channel,
|
||||
})
|
||||
session.SendMsg(string(this.module.GetType()), "crosschannel", &pb.ChatCrossChannelResp{ChannelId: channel})
|
||||
|
@ -11,11 +11,9 @@ import (
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/lego/sys/redis"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/cache"
|
||||
"go_dreamfactory/sys/db"
|
||||
"reflect"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/modern-go/reflect2"
|
||||
@ -671,31 +669,31 @@ func (this *MCompModel) logOpt(uid string, data interface{}, attrs ...*cache.Ope
|
||||
}
|
||||
|
||||
//获取用户通过扩展表
|
||||
func (this *MCompModel) GetUserRecord(uid string) (result *pb.DBUserRecord, err error) {
|
||||
result = &pb.DBUserRecord{}
|
||||
key := fmt.Sprintf("userrecord:%s{userrecord}", uid)
|
||||
if err = this.Redis.HGetAll(key, result); err != nil && err != redis.RedisNil {
|
||||
return
|
||||
}
|
||||
if err == redis.RedisNil {
|
||||
if err = this.DB.FindOne(core.SqlTable("userrecord"), bson.M{"uid": uid}).Decode(result); err != nil {
|
||||
return
|
||||
}
|
||||
err = this.Redis.HMSet(key, result)
|
||||
}
|
||||
return
|
||||
}
|
||||
// func (this *MCompModel) GetUserRecord(uid string) (result *pb.DBUserRecord, err error) {
|
||||
// result = &pb.DBUserRecord{}
|
||||
// key := fmt.Sprintf("userrecord:%s{userrecord}", uid)
|
||||
// if err = this.Redis.HGetAll(key, result); err != nil && err != redis.RedisNil {
|
||||
// return
|
||||
// }
|
||||
// if err == redis.RedisNil {
|
||||
// if err = this.DB.FindOne(core.SqlTable("userrecord"), bson.M{"uid": uid}).Decode(result); err != nil {
|
||||
// return
|
||||
// }
|
||||
// err = this.Redis.HMSet(key, result)
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
//修改用户扩展数据
|
||||
func (this *MCompModel) ChangeUserRecord(uid string, value map[string]interface{}) (err error) {
|
||||
value["mtime"] = time.Now().Unix() // 更新时间
|
||||
key := fmt.Sprintf("userrecord:%s{userrecord}", uid)
|
||||
if err = this.Redis.HMSet(key, value); err != nil && err != redis.RedisNil {
|
||||
return
|
||||
}
|
||||
err = this.UpdateModelLogs("userrecord", uid, bson.M{"uid": uid}, value)
|
||||
return
|
||||
}
|
||||
// //修改用户扩展数据
|
||||
// func (this *MCompModel) ChangeUserRecord(uid string, value map[string]interface{}) (err error) {
|
||||
// value["mtime"] = time.Now().Unix() // 更新时间
|
||||
// key := fmt.Sprintf("userrecord:%s{userrecord}", uid)
|
||||
// if err = this.Redis.HMSet(key, value); err != nil && err != redis.RedisNil {
|
||||
// return
|
||||
// }
|
||||
// err = this.UpdateModelLogs("userrecord", uid, bson.M{"uid": uid}, value)
|
||||
// return
|
||||
// }
|
||||
|
||||
// 删除玩家缓存信息
|
||||
func (this *MCompModel) CleanUserRecord(uid string) (err error) {
|
||||
|
@ -35,6 +35,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
upDraw []*cfg.Game_drawUpdrawData // 活动数据 英雄抽卡权重增加
|
||||
cardW map[string]int32 // 当前卡牌卡池卡牌对应的权重
|
||||
)
|
||||
cardW = make(map[string]int32, 0)
|
||||
upDraw = make([]*cfg.Game_drawUpdrawData, 0)
|
||||
szCards = make([]string, 0)
|
||||
rsp := &pb.HeroDrawCardResp{}
|
||||
@ -53,27 +54,39 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
}
|
||||
}
|
||||
// =======活动数据记录完成
|
||||
rst, _ := this.module.modelHero.GetUserRecord(session.GetUserId())
|
||||
rst, _ := this.module.modelRecord.GetUserRecord(session.GetUserId())
|
||||
if req.DrawType%2 == 0 { // 转成对应阵营信息 1~5
|
||||
race = int32((int(req.DrawType)) / 2)
|
||||
} else {
|
||||
race = int32(int(req.DrawType+1) / 2)
|
||||
}
|
||||
|
||||
if race == comm.RacePt { // 普通卡池
|
||||
curStar4Count = rst.Race0.H4
|
||||
curStar5Count = rst.Race0.H5
|
||||
if rst.Race0 != nil {
|
||||
curStar4Count = rst.Race0.H4
|
||||
curStar5Count = rst.Race0.H5
|
||||
}
|
||||
|
||||
} else if race == comm.RaceZr { // 灼热
|
||||
curStar4Count = rst.Race1.H4
|
||||
curStar5Count = rst.Race1.H5
|
||||
if rst.Race1 != nil {
|
||||
curStar4Count = rst.Race1.H4
|
||||
curStar5Count = rst.Race1.H5
|
||||
}
|
||||
} else if race == comm.RaceYd { // 涌动
|
||||
curStar4Count = rst.Race2.H4
|
||||
curStar5Count = rst.Race2.H5
|
||||
if rst.Race2 != nil {
|
||||
curStar4Count = rst.Race2.H4
|
||||
curStar5Count = rst.Race2.H5
|
||||
}
|
||||
} else if race == comm.RaceHx { // 呼啸
|
||||
curStar4Count = rst.Race3.H4
|
||||
curStar5Count = rst.Race3.H5
|
||||
if rst.Race3 != nil {
|
||||
curStar4Count = rst.Race3.H4
|
||||
curStar5Count = rst.Race3.H5
|
||||
}
|
||||
} else if race == comm.RaceSy { // 闪耀
|
||||
curStar4Count = rst.Race4.H4
|
||||
curStar5Count = rst.Race4.H5
|
||||
if rst.Race4 != nil {
|
||||
curStar4Count = rst.Race4.H4
|
||||
curStar5Count = rst.Race4.H5
|
||||
}
|
||||
}
|
||||
// 获取配置文件的权重信息
|
||||
_conf, err := this.module.configure.GetHeroDrawConfig(race)
|
||||
@ -84,6 +97,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
// 权重赋值
|
||||
for _, v := range _conf {
|
||||
cardW[v.Id] += v.Weight
|
||||
totalWeight += int64(cardW[v.Id])
|
||||
}
|
||||
|
||||
_costConf, err := this.module.configure.GetDrawCostConfigByID(req.DrawType) // 抽卡消耗
|
||||
@ -108,28 +122,26 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
|
||||
drawTimes = _costConf.Count // 抽卡次数
|
||||
|
||||
drawTimes = 1
|
||||
for i := 0; i < int(drawTimes); i++ {
|
||||
n, _ := rand.Int(rand.Reader, big.NewInt(totalWeight)) // [0,totalWeight)
|
||||
curWeigth = 0
|
||||
for k, v := range cardW {
|
||||
curWeigth += int64(v)
|
||||
if curWeigth < n.Int64() { // 命中
|
||||
// 获取当前星级
|
||||
_getCardCfg := this.module.configure.GetHero(k) //获取的英雄信息
|
||||
if _getCardCfg != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
||||
curStar4Count = 0
|
||||
continue
|
||||
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
||||
curStar5Count = 0 // 清0
|
||||
if _getCardCfg == nil {
|
||||
continue
|
||||
}
|
||||
curStar4Count++
|
||||
curStar5Count++
|
||||
bGet := false
|
||||
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
||||
curStar4Count = 0
|
||||
|
||||
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
||||
curStar5Count = 0 // 清0
|
||||
}
|
||||
|
||||
// 达标保底次数
|
||||
if curStar4Count >= config4Count {
|
||||
//_costConf.Floor4cards
|
||||
@ -146,7 +158,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
_tmpW += int64(v.Weight)
|
||||
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||
szCards = append(szCards, v.Id)
|
||||
bGet = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -165,15 +176,13 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
_tmpW += int64(v.Weight)
|
||||
if n.Int64() > _tmpW { // 种族保底卡池命中
|
||||
szCards = append(szCards, v.Id)
|
||||
bGet = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !bGet {
|
||||
szCards = append(szCards, k)
|
||||
}
|
||||
szCards = append(szCards, k)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -185,7 +194,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
update := map[string]interface{}{}
|
||||
|
||||
update["race"+strconv.Itoa(int(race)-1)] = raceData
|
||||
this.module.modelHero.ChangeUserRecord(session.GetUserId(), update)
|
||||
this.module.modelRecord.ChangeUserRecord(session.GetUserId(), update)
|
||||
// 消耗道具
|
||||
code = this.module.ConsumeRes(session, sz, true)
|
||||
if code != pb.ErrorCode_Success {
|
||||
|
@ -123,7 +123,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
||||
"tujian": sz,
|
||||
}
|
||||
|
||||
this.moduleHero.ModuleUser.ChanageUserExpand(uid, initUpdate)
|
||||
this.moduleHero.ModuleUser.ChangeUserExpand(uid, initUpdate)
|
||||
}
|
||||
}
|
||||
hero.SameCount = count
|
||||
|
@ -1,4 +1,4 @@
|
||||
package user
|
||||
package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
@ -27,3 +27,21 @@ func (this *ModelRecord) getUserSession(uid string) (cuser *pb.CacheUser) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//获取用户通过扩展表
|
||||
func (this *ModelRecord) GetUserRecord(uid string) (result *pb.DBUserRecord, err error) {
|
||||
result = &pb.DBUserRecord{}
|
||||
if err = this.Get(uid, result); err != nil {
|
||||
return
|
||||
}
|
||||
return result, err
|
||||
}
|
||||
|
||||
//修改用户扩展数据
|
||||
func (this *ModelRecord) ChangeUserRecord(uid string, value map[string]interface{}) (err error) {
|
||||
if len(value) == 0 {
|
||||
return nil
|
||||
}
|
||||
return this.Change(uid, value)
|
||||
|
||||
}
|
@ -16,9 +16,10 @@ func NewModule() core.IModule {
|
||||
|
||||
type Hero struct {
|
||||
modules.ModuleBase
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modelHero *ModelHero
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modelHero *ModelHero
|
||||
modelRecord *ModelRecord
|
||||
}
|
||||
|
||||
//模块名
|
||||
@ -37,6 +38,7 @@ func (this *Hero) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelHero = this.RegisterComp(new(ModelHero)).(*ModelHero)
|
||||
this.modelRecord = this.RegisterComp(new(ModelRecord)).(*ModelRecord)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -21,17 +22,19 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
err error
|
||||
mail *pb.DBMailData
|
||||
)
|
||||
defer func() {
|
||||
session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail})
|
||||
}()
|
||||
|
||||
code = this.ReadMailCheck(session, req) // check
|
||||
if code != pb.ErrorCode_Success {
|
||||
log.Debugf("read mail failed%d", code)
|
||||
return
|
||||
}
|
||||
mail, err = this.module.modelMail.Mail_ReadOneMail(req.ObjID)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
|
||||
log.Debugf("read mail %v", mail)
|
||||
mail.Check = true
|
||||
session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail})
|
||||
return
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Game_atn)
|
||||
// code = pb.ErrorCode_ConfigurationException
|
||||
// return
|
||||
// }
|
||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetSessionId(), v.T)); amount < v.N {
|
||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetUserId(), v.T)); amount < v.N {
|
||||
code = pb.ErrorCode_ResNoEnough
|
||||
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
||||
return
|
||||
@ -199,7 +199,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Game_at
|
||||
// code = pb.ErrorCode_ConfigurationException
|
||||
// return
|
||||
// }
|
||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetSessionId(), v.T)); amount < v.N {
|
||||
if amount = int32(this.ModuleItems.QueryItemAmount(source, session.GetUserId(), v.T)); amount < v.N {
|
||||
code = pb.ErrorCode_ResNoEnough
|
||||
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
||||
return
|
||||
|
@ -34,7 +34,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.NotifyGetListReq
|
||||
userexpand = &pb.DBUserExpand{}
|
||||
}
|
||||
//修改最后公告读取时间
|
||||
this.module.ModuleUser.ChanageUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"lastreadnotiftime": time.Now().Unix(),
|
||||
})
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.NotifyGetListResp{LastReadTime: userexpand.Lastreadnotiftime, SysNotify: notify})
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//活跃度
|
||||
//活跃度列表
|
||||
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (code pb.ErrorCode) {
|
||||
if req.TaskTag == 0 {
|
||||
if req.TaskTag <= 0 || req.TaskTag > 2 {
|
||||
code = pb.ErrorCode_TaskTagEmpty
|
||||
}
|
||||
return
|
||||
@ -22,26 +22,29 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
|
||||
|
||||
resp := &pb.TaskActiveListResp{}
|
||||
defer func() {
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveList, resp)
|
||||
if err != nil {
|
||||
if err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveList, resp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
// resp.Active = this.moduleTask.modelTask.countActive(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||
// 获取玩家活跃度
|
||||
expand, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||
resp.Active = expand.Activeday
|
||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||
resp.Active = expand.Activeweek
|
||||
if expand != nil {
|
||||
// 返回活跃度
|
||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||
resp.Active = expand.Activeday
|
||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||
resp.Active = expand.Activeweek
|
||||
}
|
||||
}
|
||||
|
||||
//遍历活跃度奖励表
|
||||
//获取当前Tag的活跃度列表
|
||||
resp.List = this.moduleTask.modelTaskActive.getActiveListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||
|
||||
return
|
||||
|
@ -2,6 +2,7 @@ package task
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -11,7 +12,7 @@ import (
|
||||
func (this *apiComp) ActiveReceiveCheck(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (code pb.ErrorCode) {
|
||||
if req.Id == "" {
|
||||
code = pb.ErrorCode_TaskIdEmpty
|
||||
} else if req.TaskTag == 0 {
|
||||
} else if req.TaskTag <= 0 || req.TaskTag > 2 {
|
||||
code = pb.ErrorCode_TaskTagEmpty
|
||||
}
|
||||
return
|
||||
@ -25,12 +26,12 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
TaskTag: req.TaskTag,
|
||||
Id: req.Id,
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
// utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp)
|
||||
}()
|
||||
|
||||
ua := this.moduleTask.modelTaskActive.getUserActive(session.GetUserId(), req.Id, comm.TaskTag(req.TaskTag))
|
||||
@ -39,14 +40,44 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
return
|
||||
}
|
||||
|
||||
//判断是否已领取
|
||||
if ua.Received == 1 {
|
||||
code = pb.ErrorCode_TaskReceived
|
||||
return
|
||||
}
|
||||
|
||||
conf := this.moduleTask.configure.getTaskActiveById(ua.RId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
code = this.moduleTask.modelTaskActive.receiveHandle(session.GetUserId(), req.Id, conf, ua, comm.TaskTag(req.TaskTag))
|
||||
if code != pb.ErrorCode_Success {
|
||||
// get user expand
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
if ue == nil {
|
||||
code = pb.ErrorCode_UserExpandNull
|
||||
return
|
||||
}
|
||||
|
||||
if ue.Activeday >= conf.Active {
|
||||
update := map[string]interface{}{
|
||||
"received": 1, //标识已领取
|
||||
}
|
||||
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(),
|
||||
ua.Id,
|
||||
comm.TaskTag(req.TaskTag),
|
||||
update); err != nil {
|
||||
log.Errorf("updateReceive err %v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,10 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// 任务列表
|
||||
|
||||
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.TaskListReq) (code pb.ErrorCode) {
|
||||
if req.TaskTag == 0 {
|
||||
if req.TaskTag <= 0 || req.TaskTag > 3 {
|
||||
code = pb.ErrorCode_TaskTagEmpty
|
||||
}
|
||||
return
|
||||
@ -24,8 +26,8 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeList, rsp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
// utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeList, req, rsp)
|
||||
}()
|
||||
|
||||
rsp.List = this.moduleTask.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||
|
@ -3,11 +3,13 @@ package task
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//任务奖励领取
|
||||
|
||||
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.TaskReceiveReq) (code pb.ErrorCode) {
|
||||
if req.Id == "" {
|
||||
code = pb.ErrorCode_TaskIdEmpty
|
||||
@ -27,69 +29,81 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeReceive, resp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
// 获取待领取的任务
|
||||
userTask := this.moduleTask.modelTask.getUserTask(session.GetUserId(), req.Id)
|
||||
if userTask != nil {
|
||||
//判断是否完成
|
||||
if userTask.Status == 0 {
|
||||
code = pb.ErrorCode_TaskHandle
|
||||
return
|
||||
}
|
||||
//判断任务是否领取
|
||||
if userTask.Received == 1 {
|
||||
code = pb.ErrorCode_TaskReceived
|
||||
return
|
||||
}
|
||||
// 待领取的任务配置
|
||||
conf := this.moduleTask.configure.getTaskById(userTask.TaskId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if conf.Active > 0 {
|
||||
//更新活跃度
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if ue != nil {
|
||||
update := make(map[string]interface{})
|
||||
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
||||
update["activeday"] = ue.Activeday + conf.Active
|
||||
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||
update["activeweek"] = ue.Activeweek + conf.Active
|
||||
}
|
||||
if len(update) > 0 {
|
||||
if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if userTask == nil {
|
||||
code = pb.ErrorCode_TaskNotFound
|
||||
return
|
||||
}
|
||||
|
||||
//奖励
|
||||
if code = this.moduleTask.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
//判断是否完成
|
||||
if userTask.Status == 0 {
|
||||
code = pb.ErrorCode_TaskNoFinished
|
||||
return
|
||||
}
|
||||
//判断任务是否领取
|
||||
if userTask.Received == 1 {
|
||||
code = pb.ErrorCode_TaskReceived
|
||||
return
|
||||
}
|
||||
|
||||
// 待领取的任务配置
|
||||
conf := this.moduleTask.configure.getTaskById(userTask.TaskId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
//更新用户领取状态
|
||||
update := map[string]interface{}{
|
||||
"received": 1,
|
||||
}
|
||||
if err := this.moduleTask.modelTask.modifyUserTask(session.GetUserId(), userTask.Id, update); err != nil {
|
||||
if conf.Active > 0 {
|
||||
//更新活跃度
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
resp.TaskId = userTask.TaskId
|
||||
|
||||
// 监听玩家经验
|
||||
this.moduleTask.ModuleUser.EventUserChanged(session)
|
||||
update := make(map[string]interface{})
|
||||
if ue != nil {
|
||||
ue.Activeday = ue.Activeday + conf.Active
|
||||
ue.Activeweek = ue.Activeweek + conf.Active
|
||||
update = utils.StructToMap(ue)
|
||||
} else {
|
||||
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
||||
update["activeday"] = ue.Activeday + conf.Active
|
||||
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||
update["activeweek"] = ue.Activeweek + conf.Active
|
||||
}
|
||||
}
|
||||
if len(update) > 0 {
|
||||
if err = this.moduleTask.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//奖励
|
||||
if code = this.moduleTask.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
//更新用户领取状态
|
||||
update := map[string]interface{}{
|
||||
"received": 1,
|
||||
}
|
||||
if err := this.moduleTask.modelTask.modifyUserTask(session.GetUserId(), userTask.Id, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
resp.TaskId = userTask.TaskId
|
||||
|
||||
// 监听玩家经验
|
||||
this.moduleTask.ModuleUser.EventUserChanged(session)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
@ -46,14 +45,6 @@ func (this *ModelTaskActive) initActiveReward(uid string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *ModelTaskActive) getActiveList(uid string) (list []*pb.DBTaskActive) {
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
log.Errorf("getActiveList err:%v", err)
|
||||
return list
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//获取玩家活跃度列表
|
||||
func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.DBTaskActive) {
|
||||
al := []*pb.DBTaskActive{}
|
||||
@ -89,41 +80,6 @@ func (this *ModelTaskActive) updateReceive(uid, id string, taskTag comm.TaskTag,
|
||||
return this.moduleTask.modelTaskActive.ChangeList(uid, id, data)
|
||||
}
|
||||
|
||||
//领取处理
|
||||
func (this *ModelTaskActive) receiveHandle(uid, id string, conf *cfg.Game_activeRewardData,
|
||||
ua *pb.DBTaskActive, taskTag comm.TaskTag) (code pb.ErrorCode) {
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
//玩家活跃度数
|
||||
// userActiveTotal := this.moduleTask.modelTask.countActive(uid, taskTag)
|
||||
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if ua.Received == 0 { //未领取
|
||||
if ue.Activeday >= conf.Active {
|
||||
//更新玩家领取状态
|
||||
update := map[string]interface{}{
|
||||
"received": 1, //标识已领取
|
||||
}
|
||||
if err := this.updateReceive(uid, ua.Id, taskTag, update); err != nil {
|
||||
log.Errorf("updateReceive err %v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_TaskReceived
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//清空任务
|
||||
func (this *ModelTaskActive) clearTask(uid string, taskTag ...comm.TaskTag) {
|
||||
if len(taskTag) == 0 {
|
||||
|
@ -27,15 +27,6 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
|
||||
return
|
||||
}
|
||||
|
||||
// 玩家的所有任务列表
|
||||
func (this *ModelTask) getTaskList(uid string) (list []*pb.DBTask) {
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
log.Errorf("getTaskList err %v", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//获取玩家任务列表
|
||||
func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newlist []*pb.DBTask) {
|
||||
list := []*pb.DBTask{}
|
||||
@ -44,10 +35,12 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newli
|
||||
return
|
||||
}
|
||||
|
||||
// 排序
|
||||
sort.SliceStable(list, func(i, j int) bool {
|
||||
return list[i].Sort < list[j].Sort
|
||||
})
|
||||
|
||||
// 筛选出指定tag的任务
|
||||
var taskList []*pb.DBTask
|
||||
for _, v := range list {
|
||||
if v.Tag == int32(taskTag) {
|
||||
@ -77,6 +70,7 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newli
|
||||
return false
|
||||
}
|
||||
|
||||
// 成就列表
|
||||
if taskTag == comm.TASK_ACHIEVE {
|
||||
for _, v := range taskList {
|
||||
if curTask := this.moduleTask.configure.getTaskById(v.TaskId); curTask != nil {
|
||||
@ -163,17 +157,6 @@ func (this *ModelTask) getUnFinishTasks(uid string, taskId int32) (list []*pb.DB
|
||||
return
|
||||
}
|
||||
|
||||
//活跃度统计
|
||||
func (this *ModelTask) countActive(uid string, taskTag comm.TaskTag) (total int32) {
|
||||
taskList := this.getTaskListByTag(uid, taskTag)
|
||||
for _, v := range taskList {
|
||||
if v.Status == 1 {
|
||||
total += v.Active
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//检查任务状态 返回等待处理的任务
|
||||
func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.DBTask, bool) {
|
||||
taskList := this.getUnFinishTasks(uid, taskId)
|
||||
|
@ -72,7 +72,7 @@ func (this *ModuleTask) resetActive(uid string, taskTag comm.TaskTag) {
|
||||
update["activeweek"] = 0
|
||||
}
|
||||
if len(update) > 0 {
|
||||
this.ModuleUser.ChanageUserExpand(uid, update)
|
||||
this.ModuleUser.ChangeUserExpand(uid, update)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
||||
initUpdate := map[string]interface{}{
|
||||
"modifynameCount": 1, //修改名称1次
|
||||
}
|
||||
if err := this.module.modelExpand.ChanageUserExpand(session.GetUserId(), initUpdate); err != nil {
|
||||
if err := this.module.modelExpand.ChangeUserExpand(session.GetUserId(), initUpdate); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func (this *apiComp) Figure(session comm.IUserSession, req *pb.UserFigureReq) (c
|
||||
|
||||
update = utils.StructToMap(curFigure)
|
||||
|
||||
this.module.modelExpand.ChanageUserExpand(session.GetUserId(), update)
|
||||
this.module.modelExpand.ChangeUserExpand(session.GetUserId(), update)
|
||||
}
|
||||
|
||||
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeFigure, rsp); err != nil {
|
||||
|
@ -56,7 +56,7 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam
|
||||
mc := map[string]interface{}{
|
||||
"modifynameCount": left,
|
||||
}
|
||||
if err := this.module.modelExpand.ChanageUserExpand(session.GetUserId(), mc); err != nil {
|
||||
if err := this.module.modelExpand.ChangeUserExpand(session.GetUserId(), mc); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func (this *apiComp) Modifysign(session comm.IUserSession, req *pb.UserModifysig
|
||||
update := map[string]interface{}{
|
||||
"sign": req.Sign,
|
||||
}
|
||||
this.module.ChanageUserExpand(session.GetUserId(), update)
|
||||
this.module.ChangeUserExpand(session.GetUserId(), update)
|
||||
}
|
||||
|
||||
if err = session.SendMsg(string(this.module.GetType()), UserSubTypeModifySign, &pb.UserModifysignResp{
|
||||
|
@ -36,11 +36,12 @@ func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err
|
||||
if err = this.moduleUser.modelExpand.Get(uid, result); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return result, err
|
||||
}
|
||||
|
||||
//修改用户扩展数据
|
||||
func (this *ModelExpand) ChanageUserExpand(uid string, value map[string]interface{}) (err error) {
|
||||
func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface{}) (err error) {
|
||||
if len(value) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ func (this *ModelUser) InitFigure(uid string) {
|
||||
update := map[string]interface{}{
|
||||
"preinstall": figureMap,
|
||||
}
|
||||
this.moduleUser.modelExpand.ChanageUserExpand(uid, update)
|
||||
this.moduleUser.modelExpand.ChangeUserExpand(uid, update)
|
||||
}
|
||||
|
||||
// change exp
|
||||
|
@ -73,6 +73,7 @@ func (this *User) CleanSession(session comm.IUserSession) {
|
||||
this.modelSession.Del(session.GetUserId(), modules.SetDBMgoLog(false))
|
||||
this.modelUser.Del(session.GetUserId(), modules.SetDBMgoLog(false))
|
||||
//this.modelExpand.Del(session.GetUserId(), modules.SetDBMgoLog(false)) // 暂时不清
|
||||
this.modelSetting.Del(session.GetUserId(), modules.SetDBMgoLog(false))
|
||||
}
|
||||
|
||||
//查询用户属性值 例如 金币 经验
|
||||
@ -176,6 +177,6 @@ func (this *User) GetUserExpand(uid string) (result *pb.DBUserExpand, err error)
|
||||
return this.modelExpand.GetUserExpand(uid)
|
||||
}
|
||||
|
||||
func (this *User) ChanageUserExpand(uid string, value map[string]interface{}) error {
|
||||
return this.modelExpand.ChanageUserExpand(uid, value)
|
||||
func (this *User) ChangeUserExpand(uid string, value map[string]interface{}) error {
|
||||
return this.modelExpand.ChangeUserExpand(uid, value)
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ const (
|
||||
ErrorCode_UserResetData ErrorCode = 1009 //初始化用户失败
|
||||
ErrorCode_UserModiNameCount ErrorCode = 1010 //名称修改次数不足
|
||||
ErrorCode_UserNickNameEmpty ErrorCode = 1011 //昵称空
|
||||
ErrorCode_UserExpandNull ErrorCode = 1012 //扩展数据空
|
||||
// friend
|
||||
ErrorCode_FriendNotSelf ErrorCode = 1100 //不能是自己
|
||||
ErrorCode_FriendSelfMax ErrorCode = 1101 //超出好友最大数量
|
||||
@ -125,6 +126,7 @@ const (
|
||||
ErrorCode_TaskFinished ErrorCode = 1608 //已完成
|
||||
ErrorCode_TaskTagEmpty ErrorCode = 1609 //任务类型空
|
||||
ErrorCode_TaskIdEmpty ErrorCode = 1610 //任务ID空
|
||||
ErrorCode_TaskNotFound ErrorCode = 1611 //未找到用户任务
|
||||
// shop
|
||||
ErrorCode_ShopGoodsIsSoldOut ErrorCode = 1700 //商品已售罄
|
||||
ErrorCode_ShopNoSurplusRefreshNum ErrorCode = 1701 //剩余刷新次数已用完
|
||||
@ -170,6 +172,7 @@ var (
|
||||
1009: "UserResetData",
|
||||
1010: "UserModiNameCount",
|
||||
1011: "UserNickNameEmpty",
|
||||
1012: "UserExpandNull",
|
||||
1100: "FriendNotSelf",
|
||||
1101: "FriendSelfMax",
|
||||
1102: "FriendTargetMax",
|
||||
@ -230,6 +233,7 @@ var (
|
||||
1608: "TaskFinished",
|
||||
1609: "TaskTagEmpty",
|
||||
1610: "TaskIdEmpty",
|
||||
1611: "TaskNotFound",
|
||||
1700: "ShopGoodsIsSoldOut",
|
||||
1701: "ShopNoSurplusRefreshNum",
|
||||
1800: "MailErr",
|
||||
@ -270,6 +274,7 @@ var (
|
||||
"UserResetData": 1009,
|
||||
"UserModiNameCount": 1010,
|
||||
"UserNickNameEmpty": 1011,
|
||||
"UserExpandNull": 1012,
|
||||
"FriendNotSelf": 1100,
|
||||
"FriendSelfMax": 1101,
|
||||
"FriendTargetMax": 1102,
|
||||
@ -330,6 +335,7 @@ var (
|
||||
"TaskFinished": 1608,
|
||||
"TaskTagEmpty": 1609,
|
||||
"TaskIdEmpty": 1610,
|
||||
"TaskNotFound": 1611,
|
||||
"ShopGoodsIsSoldOut": 1700,
|
||||
"ShopNoSurplusRefreshNum": 1701,
|
||||
"MailErr": 1800,
|
||||
@ -367,7 +373,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2a, 0x9e, 0x10, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xc6, 0x10, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
@ -411,94 +417,96 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x12, 0x16, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xf2, 0x07, 0x12, 0x16, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72,
|
||||
0x4e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xf3, 0x07,
|
||||
0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x53, 0x65, 0x6c,
|
||||
0x66, 0x10, 0xcc, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65,
|
||||
0x6c, 0x66, 0x4d, 0x61, 0x78, 0x10, 0xcd, 0x08, 0x12, 0x14, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x10, 0xce, 0x08, 0x12, 0x15,
|
||||
0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x4e, 0x6f, 0x44, 0x61,
|
||||
0x74, 0x61, 0x10, 0xcf, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xd0, 0x08, 0x12, 0x0e,
|
||||
0x0a, 0x09, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x59, 0x65, 0x74, 0x10, 0xd1, 0x08, 0x12, 0x13,
|
||||
0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x59, 0x65, 0x74,
|
||||
0x10, 0xd2, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c,
|
||||
0x66, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd3, 0x08, 0x12, 0x19, 0x0a, 0x14,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x42, 0x6c, 0x61, 0x63,
|
||||
0x6b, 0x59, 0x65, 0x74, 0x10, 0xd4, 0x08, 0x12, 0x15, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e,
|
||||
0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xd5, 0x08, 0x12, 0x13,
|
||||
0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x4d, 0x61, 0x78,
|
||||
0x10, 0xd6, 0x08, 0x12, 0x1a, 0x0a, 0x15, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x61,
|
||||
0x72, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xd7, 0x08, 0x12,
|
||||
0x12, 0x0a, 0x0d, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68,
|
||||
0x10, 0xb0, 0x09, 0x12, 0x15, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, 0x6f, 0x46, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x47, 0x69, 0x72, 0x64, 0x10, 0xb1, 0x09, 0x12, 0x16, 0x0a, 0x11, 0x49, 0x74,
|
||||
0x65, 0x6d, 0x73, 0x47, 0x72, 0x69, 0x64, 0x4e, 0x75, 0x6d, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10,
|
||||
0xb2, 0x09, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x47, 0x69, 0x72, 0x64, 0x41,
|
||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10, 0xb3, 0x09, 0x12, 0x19, 0x0a,
|
||||
0x14, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x4e, 0x6f, 0x74, 0x53, 0x75, 0x70, 0x70,
|
||||
0x6f, 0x72, 0x74, 0x65, 0x64, 0x10, 0xb4, 0x09, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f,
|
||||
0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x94, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65,
|
||||
0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x95, 0x0a, 0x12, 0x0e, 0x0a,
|
||||
0x09, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x96, 0x0a, 0x12, 0x12, 0x0a,
|
||||
0x0d, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x10, 0x97,
|
||||
0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x45, 0x72,
|
||||
0x72, 0x10, 0x98, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x6b, 0x69, 0x6c,
|
||||
0x6c, 0x55, 0x70, 0x45, 0x72, 0x72, 0x10, 0x99, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72,
|
||||
0x6f, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9a, 0x0a, 0x12,
|
||||
0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74,
|
||||
0x65, 0x10, 0x9b, 0x0a, 0x12, 0x18, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x74, 0x4e,
|
||||
0x65, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9c, 0x0a, 0x12, 0x11,
|
||||
0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x10, 0x9d,
|
||||
0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x10,
|
||||
0x9e, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f,
|
||||
0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10, 0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a,
|
||||
0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b, 0x10, 0xa1, 0x0a, 0x12, 0x11, 0x0a,
|
||||
0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xa2, 0x0a,
|
||||
0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65,
|
||||
0x45, 0x72, 0x72, 0x10, 0xa3, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74,
|
||||
0x61, 0x72, 0x45, 0x72, 0x72, 0x10, 0xa4, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f,
|
||||
0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa5, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65,
|
||||
0x72, 0x6f, 0x45, 0x78, 0x70, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa6, 0x0a, 0x12,
|
||||
0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x64, 0x64, 0x4d, 0x61, 0x78, 0x45, 0x78, 0x70,
|
||||
0x10, 0xa7, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x4c,
|
||||
0x76, 0x45, 0x72, 0x72, 0x10, 0xa8, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d,
|
||||
0x61, 0x78, 0x53, 0x74, 0x61, 0x72, 0x4c, 0x76, 0x10, 0xa9, 0x0a, 0x12, 0x19, 0x0a, 0x14, 0x44,
|
||||
0x72, 0x61, 0x77, 0x43, 0x61, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x10, 0xaa, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65,
|
||||
0x64, 0x10, 0xf9, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61,
|
||||
0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61,
|
||||
0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c,
|
||||
0x69, 0x6e, 0x65, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15,
|
||||
0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75,
|
||||
0x6e, 0x64, 0x10, 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e,
|
||||
0x65, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12,
|
||||
0x19, 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61,
|
||||
0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61,
|
||||
0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
|
||||
0x77, 0x61, 0x72, 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49,
|
||||
0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65,
|
||||
0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61,
|
||||
0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52,
|
||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12,
|
||||
0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41,
|
||||
0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c,
|
||||
0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
|
||||
0x65, 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e,
|
||||
0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x54, 0x61, 0x67, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, 0x0c, 0x12, 0x10, 0x0a, 0x0b, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xca, 0x0c, 0x12, 0x17, 0x0a,
|
||||
0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64,
|
||||
0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, 0x1c, 0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, 0x4e, 0x6f,
|
||||
0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75,
|
||||
0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, 0x72, 0x10,
|
||||
0x88, 0x0e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x12, 0x13, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x4e, 0x75,
|
||||
0x6c, 0x6c, 0x10, 0xf4, 0x07, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4e,
|
||||
0x6f, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x10, 0xcc, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69,
|
||||
0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x4d, 0x61, 0x78, 0x10, 0xcd, 0x08, 0x12, 0x14, 0x0a,
|
||||
0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x61, 0x78,
|
||||
0x10, 0xce, 0x08, 0x12, 0x15, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c,
|
||||
0x66, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xcf, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72,
|
||||
0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61,
|
||||
0x10, 0xd0, 0x08, 0x12, 0x0e, 0x0a, 0x09, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x59, 0x65, 0x74,
|
||||
0x10, 0xd1, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70,
|
||||
0x6c, 0x79, 0x59, 0x65, 0x74, 0x10, 0xd2, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd3,
|
||||
0x08, 0x12, 0x19, 0x0a, 0x14, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd4, 0x08, 0x12, 0x15, 0x0a, 0x10,
|
||||
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x10, 0xd5, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61,
|
||||
0x63, 0x6b, 0x4d, 0x61, 0x78, 0x10, 0xd6, 0x08, 0x12, 0x1a, 0x0a, 0x15, 0x46, 0x72, 0x69, 0x65,
|
||||
0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6d, 0x70, 0x74,
|
||||
0x79, 0x10, 0xd7, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, 0x6f, 0x45,
|
||||
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xb0, 0x09, 0x12, 0x15, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d,
|
||||
0x73, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x72, 0x64, 0x10, 0xb1, 0x09, 0x12,
|
||||
0x16, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x47, 0x72, 0x69, 0x64, 0x4e, 0x75, 0x6d, 0x55,
|
||||
0x70, 0x70, 0x65, 0x72, 0x10, 0xb2, 0x09, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x74, 0x65, 0x6d, 0x73,
|
||||
0x47, 0x69, 0x72, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10,
|
||||
0xb3, 0x09, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x4e, 0x6f,
|
||||
0x74, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x10, 0xb4, 0x09, 0x12, 0x10, 0x0a,
|
||||
0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x94, 0x0a, 0x12,
|
||||
0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10,
|
||||
0x95, 0x0a, 0x12, 0x0e, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10,
|
||||
0x96, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x72,
|
||||
0x65, 0x61, 0x74, 0x10, 0x97, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f,
|
||||
0x6c, 0x6f, 0x72, 0x45, 0x72, 0x72, 0x10, 0x98, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72,
|
||||
0x6f, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x70, 0x45, 0x72, 0x72, 0x10, 0x99, 0x0a, 0x12, 0x14,
|
||||
0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74,
|
||||
0x65, 0x10, 0x9a, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x52, 0x65,
|
||||
0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9b, 0x0a, 0x12, 0x18, 0x0a, 0x13, 0x48, 0x65, 0x72,
|
||||
0x6f, 0x4e, 0x6f, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65,
|
||||
0x10, 0x9c, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, 0x65,
|
||||
0x72, 0x67, 0x79, 0x10, 0x9d, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x72,
|
||||
0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12, 0x0a,
|
||||
0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10, 0xa0,
|
||||
0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b, 0x10,
|
||||
0xa1, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x10, 0xa2, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x73,
|
||||
0x74, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa3, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48,
|
||||
0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x45, 0x72, 0x72, 0x10, 0xa4, 0x0a, 0x12, 0x10, 0x0a,
|
||||
0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa5, 0x0a, 0x12,
|
||||
0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x78, 0x70, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72,
|
||||
0x72, 0x10, 0xa6, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x64, 0x64, 0x4d,
|
||||
0x61, 0x78, 0x45, 0x78, 0x70, 0x10, 0xa7, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f,
|
||||
0x53, 0x74, 0x61, 0x72, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0xa8, 0x0a, 0x12, 0x12, 0x0a, 0x0d,
|
||||
0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x53, 0x74, 0x61, 0x72, 0x4c, 0x76, 0x10, 0xa9, 0x0a,
|
||||
0x12, 0x19, 0x0a, 0x14, 0x44, 0x72, 0x61, 0x77, 0x43, 0x61, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65,
|
||||
0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xaa, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45,
|
||||
0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52,
|
||||
0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x45, 0x71, 0x75,
|
||||
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6e, 0x10, 0xfa, 0x0a, 0x12,
|
||||
0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69,
|
||||
0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10,
|
||||
0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64,
|
||||
0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e,
|
||||
0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xde, 0x0b, 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61,
|
||||
0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e,
|
||||
0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12,
|
||||
0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c,
|
||||
0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12,
|
||||
0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69,
|
||||
0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69,
|
||||
0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75,
|
||||
0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46,
|
||||
0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x11, 0x0a,
|
||||
0x0c, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0xc9, 0x0c,
|
||||
0x12, 0x10, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10,
|
||||
0xca, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75,
|
||||
0x6e, 0x64, 0x10, 0xcb, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x6f, 0x6f,
|
||||
0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64, 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, 0x12, 0x1c,
|
||||
0x0a, 0x17, 0x53, 0x68, 0x6f, 0x70, 0x4e, 0x6f, 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52,
|
||||
0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07,
|
||||
0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72, 0x72, 0x10, 0x88, 0x0e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1,16 +1,21 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/pb"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
var db *DB
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
imgo, err := mgo.NewSys(mgo.SetMongodbUrl("mongodb://admin:123456@10.0.0.9:27018"), mgo.SetMongodbDatabase("dreamfactory"))
|
||||
imgo, err := mgo.NewSys(mgo.SetMongodbUrl("mongodb://10.0.0.9:10013"), mgo.SetMongodbDatabase("dreamfactory"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -20,3 +25,15 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
defer os.Exit(m.Run())
|
||||
}
|
||||
func TestMail(t *testing.T) {
|
||||
mail := &pb.DBMailData{}
|
||||
err := db.mgo.FindOneAndUpdate(
|
||||
"mail",
|
||||
bson.M{"_id": "62e784aa78d6d7bf12fb1f0e"},
|
||||
bson.M{"$set": bson.M{
|
||||
"check": true,
|
||||
}},
|
||||
options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After),
|
||||
).Decode(&mail)
|
||||
fmt.Printf("%v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user