上传item 写入mgo日志异常bug修复
This commit is contained in:
parent
158a66407c
commit
398783c256
@ -92,6 +92,7 @@ func (this *ServiceBase) Start() (err error) {
|
||||
|
||||
//运行模块
|
||||
func (this *ServiceBase) Run(mod ...core.IModule) {
|
||||
go func() {
|
||||
for _, v := range mod { //初始化模块对象 分配配置参数
|
||||
if sf, ok := this.service.GetSettings().Modules[string(v.GetType())]; ok {
|
||||
this.modules[v.GetType()] = &defaultModule{
|
||||
@ -129,6 +130,7 @@ func (this *ServiceBase) Run(mod ...core.IModule) {
|
||||
go v.run()
|
||||
}
|
||||
event.TriggerEvent(core.Event_ServiceStartEnd) //广播服务启动完毕事件
|
||||
}()
|
||||
//监听外部关闭服务信号
|
||||
c := make(chan os.Signal, 1)
|
||||
//添加进程结束信号
|
||||
|
@ -26,16 +26,13 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
|
||||
dels []*pb.DB_UserItemData
|
||||
)
|
||||
defer func() {
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ItemsGetlistResp{Grids: items})
|
||||
if code == pb.ErrorCode_Success {
|
||||
go func() { //异步处理修改数据
|
||||
if len(modifys) > 0 {
|
||||
this.module.modelItems.UpdateUserPack(session.GetUserId(), modifys...)
|
||||
}
|
||||
if len(dels) > 0 {
|
||||
this.module.modelItems.DeleteUserPack(session.GetUserId(), dels...)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}()
|
||||
|
||||
@ -61,5 +58,6 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
|
||||
}
|
||||
}
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ItemsGetlistResp{Grids: items})
|
||||
return
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package items
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
@ -68,11 +67,6 @@ func (this *ModelItemsComp) DelUserPack(uId string, ids ...string) (err error) {
|
||||
|
||||
//更新用户的背包信息
|
||||
func (this *ModelItemsComp) UpdateUserPack(uid string, itmes ...*pb.DB_UserItemData) (err error) {
|
||||
if len(uid) == 0 {
|
||||
err = errors.New("UpdateUserPack uid is nil")
|
||||
this.module.Panicf("err:%v", err)
|
||||
return
|
||||
}
|
||||
for _, v := range itmes {
|
||||
this.ChangeList(uid, v.GridId, map[string]interface{}{
|
||||
"amount": v.Amount,
|
||||
|
Loading…
Reference in New Issue
Block a user