上传接口调整

This commit is contained in:
liwei1dao 2022-06-28 17:18:48 +08:00
parent 95f071b3bc
commit 51e5536701
9 changed files with 34 additions and 34 deletions

View File

@ -23,7 +23,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, agrs map[string]interfac
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_GetList_Resp{Equipments: items}) session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_GetList_Resp{Equipments: items})
} }
}() }()
if items, err = this.module.modelequipment.QueryUserEquipments(session.GetUserId()); err != nil { if items, err = this.module.modelEquipment.QueryUserEquipments(session.GetUserId()); err != nil {
log.Errorf("QueryUserPackReq err:%v", err) log.Errorf("QueryUserPackReq err:%v", err)
code = pb.ErrorCode_CacheReadError code = pb.ErrorCode_CacheReadError
return return

View File

@ -19,7 +19,7 @@ type ModelFriend struct {
} }
func (this *ModelFriend) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *ModelFriend) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.Model_Comp.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.TableName = string(TableFriend) this.TableName = string(TableFriend)
return return
} }

View File

@ -9,21 +9,21 @@ import (
/* /*
API API
*/ */
type Api_Comp struct { type apiComp struct {
modules.MComp_GateComp modules.MCompGate
service core.IService service core.IService
module *Game module *Game
} }
//组件初始化接口 //组件初始化接口
func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MComp_GateComp.Init(service, module, comp, options) this.MCompGate.Init(service, module, comp, options)
this.module = module.(*Game) this.module = module.(*Game)
this.service = service this.service = service
return return
} }
func (this *Api_Comp) Start() (err error) { func (this *apiComp) Start() (err error) {
err = this.MComp_GateComp.Start() err = this.MCompGate.Start()
return return
} }

View File

@ -11,12 +11,12 @@ const (
) )
///配置管理组件 ///配置管理组件
type Configure_Comp struct { type configureComp struct {
modules.MComp_Configure modules.MCompConfigure
} }
//组件初始化接口 //组件初始化接口
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, options) this.ModuleCompBase.Init(service, module, comp, options)
return return

View File

@ -18,8 +18,8 @@ func NewModule() core.IModule {
type Game struct { type Game struct {
modules.ModuleBase modules.ModuleBase
api *ApiComp api *apiComp
configure *ConfigureComp configure *configureComp
} }
//模块名 //模块名
@ -36,6 +36,6 @@ func (this *Game) Init(service core.IService, module core.IModule, options core.
//装备组件 //装备组件
func (this *Game) OnInstallComp() { func (this *Game) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(ApiComp)).(*ApiComp) this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(ConfigureComp)).(*ConfigureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
} }

View File

@ -12,19 +12,19 @@ const (
) )
///背包配置管理组件 ///背包配置管理组件
type Configure_Comp struct { type configureComp struct {
modules.MComp_Configure modules.MCompConfigure
} }
//组件初始化接口 //组件初始化接口
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, options) this.ModuleCompBase.Init(service, module, comp, options)
this.LoadConfigure(game_msgdistrib, cfg.NewGame_msgDistrib) this.LoadConfigure(game_msgdistrib, cfg.NewGame_msgDistrib)
return return
} }
//获取消息分发规则读取配置表 //获取消息分发规则读取配置表
func (this *Configure_Comp) GetMsgDistribRule(mtype, stype string) (rule string, ok bool) { func (this *configureComp) GetMsgDistribRule(mtype, stype string) (rule string, ok bool) {
var ( var (
err error err error
v interface{} v interface{}

View File

@ -24,7 +24,7 @@ type Gateway struct {
service base.IRPCXService service base.IRPCXService
wsservice *WSServiceComp //websocket 服务组件 提供websocket服务监听 wsservice *WSServiceComp //websocket 服务组件 提供websocket服务监听
agentmgr *AgentMgrComp //用户代理对象管理组件 管理用户socekt对象 agentmgr *AgentMgrComp //用户代理对象管理组件 管理用户socekt对象
configure *ConfigureComp configure *configureComp
} }
//模块名 //模块名
@ -72,7 +72,7 @@ func (this *Gateway) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.agentmgr = this.RegisterComp(new(AgentMgrComp)).(*AgentMgrComp) this.agentmgr = this.RegisterComp(new(AgentMgrComp)).(*AgentMgrComp)
this.wsservice = this.RegisterComp(new(WSServiceComp)).(*WSServiceComp) this.wsservice = this.RegisterComp(new(WSServiceComp)).(*WSServiceComp)
this.configure = this.RegisterComp(new(ConfigureComp)).(*ConfigureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
} }
//有新的连接对象进入 //有新的连接对象进入

View File

@ -18,12 +18,12 @@ const (
DB_MailTable core.SqlTable = "mail" DB_MailTable core.SqlTable = "mail"
) )
type ModelMail struct { type modelMail struct {
modules.Model_Comp modules.MCompModel
} }
func (this *ModelMail) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *modelMail) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.Model_Comp.Init(service, module, comp, options) this.MCompModel.Init(service, module, comp, options)
this.TableName = "mail" this.TableName = "mail"
//创建uid索引 //创建uid索引
this.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{ this.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{
@ -32,7 +32,7 @@ func (this *ModelMail) Init(service core.IService, module core.IModule, comp cor
return return
} }
func (this *ModelMail) Mail_QueryUserMail(uId string) (mail []*pb.DB_MailData, err error) { func (this *modelMail) Mail_QueryUserMail(uId string) (mail []*pb.DB_MailData, err error) {
if _data, err := this.DB.Find(DB_MailTable, bson.M{"userid": uId}); err == nil { if _data, err := this.DB.Find(DB_MailTable, bson.M{"userid": uId}); err == nil {
for _data.Next(context.TODO()) { for _data.Next(context.TODO()) {
@ -46,7 +46,7 @@ func (this *ModelMail) Mail_QueryUserMail(uId string) (mail []*pb.DB_MailData, e
} }
// 插入一封新的邮件 // 插入一封新的邮件
func (this *ModelMail) Mail_InsertUserMail(mail *pb.DB_MailData) (err error) { func (this *modelMail) Mail_InsertUserMail(mail *pb.DB_MailData) (err error) {
mail.ObjId = primitive.NewObjectID().Hex() mail.ObjId = primitive.NewObjectID().Hex()
mail.Check = false mail.Check = false
@ -60,7 +60,7 @@ func (this *ModelMail) Mail_InsertUserMail(mail *pb.DB_MailData) (err error) {
return err return err
} }
func (this *ModelMail) Mail_ReadOneMail(objId string) (mail *pb.DB_MailData, err error) { func (this *modelMail) Mail_ReadOneMail(objId string) (mail *pb.DB_MailData, err error) {
err = this.DB.FindOneAndUpdate( err = this.DB.FindOneAndUpdate(
DB_MailTable, DB_MailTable,
@ -75,7 +75,7 @@ func (this *ModelMail) Mail_ReadOneMail(objId string) (mail *pb.DB_MailData, err
} }
// 查询附件信息 // 查询附件信息
func (this *ModelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.MailAttachment, err error) { func (this *modelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.MailAttachment, err error) {
obj := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}) obj := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId})
var nd *pb.DB_MailData var nd *pb.DB_MailData
@ -86,7 +86,7 @@ func (this *ModelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.MailAtt
} }
// 查看领取附件状态 // 查看领取附件状态
func (this *ModelMail) Mail_GetMailAttachmentState(objId string) bool { func (this *modelMail) Mail_GetMailAttachmentState(objId string) bool {
var nd *pb.DB_MailData var nd *pb.DB_MailData
err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(nd) err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(nd)
if err != nil { if err != nil {
@ -96,7 +96,7 @@ func (this *ModelMail) Mail_GetMailAttachmentState(objId string) bool {
} }
// 更新领取附件状态 // 更新领取附件状态
func (this *ModelMail) Mail_UpdateMailAttachmentState(objId string) bool { func (this *modelMail) Mail_UpdateMailAttachmentState(objId string) bool {
this.DB.FindOneAndUpdate( this.DB.FindOneAndUpdate(
DB_MailTable, DB_MailTable,
bson.M{"_id": objId}, bson.M{"_id": objId},
@ -110,7 +110,7 @@ func (this *ModelMail) Mail_UpdateMailAttachmentState(objId string) bool {
} }
// 删除一封邮件 // 删除一封邮件
func (this *ModelMail) Mail_DelUserMail(objId string) bool { func (this *modelMail) Mail_DelUserMail(objId string) bool {
var obj *pb.DB_MailData var obj *pb.DB_MailData
err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(obj) err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(obj)
if err != nil { if err != nil {

View File

@ -25,7 +25,7 @@ func NewModule() core.IModule {
type Mail struct { type Mail struct {
modules.ModuleBase modules.ModuleBase
api *apiComp api *apiComp
modelMail *ModelMail modelMail *modelMail
configure_comp *Configure_Comp configure_comp *Configure_Comp
} }
@ -36,7 +36,7 @@ func (this *Mail) GetType() core.M_Modules {
func (this *Mail) OnInstallComp() { func (this *Mail) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelMail = this.RegisterComp(new(ModelMail)).(*ModelMail) this.modelMail = this.RegisterComp(new(modelMail)).(*modelMail)
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp) this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
} }