Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
9223e1648f
@ -244,8 +244,12 @@ const ( //Rpc
|
|||||||
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
|
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
|
||||||
// 公会信息
|
// 公会信息
|
||||||
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
|
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
|
||||||
|
|
||||||
// 公会更新
|
// 公会更新
|
||||||
Rpc_ModuleSociatyUpdate core.Rpc_Key = "Rpc_ModuleSociatyUpdate"
|
Rpc_ModuleSociatyUpdate core.Rpc_Key = "Rpc_ModuleSociatyUpdate"
|
||||||
|
|
||||||
|
// RPC 通知来了邮件
|
||||||
|
Rpc_Mail core.Rpc_Key = "Rpc_Mail"
|
||||||
)
|
)
|
||||||
|
|
||||||
//事件类型定义处
|
//事件类型定义处
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
14、bingo:arena,100 // 设置竞技场用户积分
|
14、bingo:arena,100 // 设置竞技场用户积分
|
||||||
15、bingo:sociatyexp,100 // 设置工会经验
|
15、bingo:sociatyexp,100 // 设置工会经验
|
||||||
15、bingo:sociatyactivity,100 // 设置工会活跃
|
15、bingo:sociatyactivity,100 // 设置工会活跃
|
||||||
15、bingo:alltask // bingo所有任务
|
16、bingo:alltask // bingo所有任务
|
||||||
*/
|
*/
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
|
||||||
@ -47,6 +47,6 @@ func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (code pb.E
|
|||||||
this.module.CreateCmd(session, req.Cmod)
|
this.module.CreateCmd(session, req.Cmod)
|
||||||
|
|
||||||
//this.module.ModuleHero.GetSpecifiedHero(session.GetUserId(), heroid, star, lv)
|
//this.module.ModuleHero.GetSpecifiedHero(session.GetUserId(), heroid, star, lv)
|
||||||
session.SendMsg(string(this.module.GetType()), "cmd", &pb.GMCmdResp{IsSucc: false})
|
session.SendMsg(string(this.module.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package mail
|
package mail
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
@ -9,6 +10,7 @@ import (
|
|||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ type Mail struct {
|
|||||||
api *apiComp
|
api *apiComp
|
||||||
modelMail *modelMail
|
modelMail *modelMail
|
||||||
configure_comp *Configure_Comp
|
configure_comp *Configure_Comp
|
||||||
|
service base.IRPCXService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Mail) GetType() core.M_Modules {
|
func (this *Mail) GetType() core.M_Modules {
|
||||||
@ -78,6 +81,16 @@ func (this *Mail) CreateNewMail(session comm.IUserSession, mail *pb.DBMailData)
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
func (this *Mail) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *Mail) Start() (err error) {
|
||||||
|
err = this.ModuleBase.Start()
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_Mail), this.Rpc_Mail)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 获得新邮件 推送给玩家
|
// 获得新邮件 推送给玩家
|
||||||
func (this *Mail) AddNewMailPush(session comm.IUserSession, mail *pb.DBMailData) {
|
func (this *Mail) AddNewMailPush(session comm.IUserSession, mail *pb.DBMailData) {
|
||||||
@ -141,3 +154,22 @@ func (this *Mail) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Mail) Rpc_Mail(ctx context.Context, args *pb.DBMailData) (err error) {
|
||||||
|
this.Debug("Rpc_Mail", log.Fields{"args": args.String()})
|
||||||
|
var (
|
||||||
|
session comm.IUserSession
|
||||||
|
online bool
|
||||||
|
)
|
||||||
|
tag, _, b := utils.UIdSplit(args.Uid)
|
||||||
|
if b {
|
||||||
|
if conn, err := db.ServerDBConn(tag); err == nil {
|
||||||
|
dbModel := db.NewDBModel(comm.TableMail, time.Hour, conn)
|
||||||
|
_, err = dbModel.DB.InsertOne(comm.TableMail, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if session, online = this.GetUserSession(args.Uid); online {
|
||||||
|
session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: args})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/sys/gin"
|
"go_dreamfactory/lego/sys/gin"
|
||||||
"go_dreamfactory/lego/sys/gin/engine"
|
"go_dreamfactory/lego/sys/gin/engine"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -22,6 +25,7 @@ type CrateMailReq struct {
|
|||||||
|
|
||||||
//创建邮件
|
//创建邮件
|
||||||
func (this *Api_Comp) CreateMail(c *engine.Context) {
|
func (this *Api_Comp) CreateMail(c *engine.Context) {
|
||||||
|
|
||||||
req := &CrateMailReq{}
|
req := &CrateMailReq{}
|
||||||
err := c.BindJSON(&req)
|
err := c.BindJSON(&req)
|
||||||
this.module.Debugf("CrateMail:%+v err:%v", req, err)
|
this.module.Debugf("CrateMail:%+v err:%v", req, err)
|
||||||
@ -30,14 +34,17 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
|
|||||||
msg string
|
msg string
|
||||||
data interface{}
|
data interface{}
|
||||||
)
|
)
|
||||||
|
if db.IsCross() { // 跨服服务器不能发邮件
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
msg = pb.GetErrorCodeMsg(code)
|
||||||
|
return
|
||||||
|
}
|
||||||
defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
|
defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
|
||||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{
|
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{
|
||||||
"Uid": req.Uid,
|
"Uid": req.Uid,
|
||||||
"Title": req.Title,
|
"Title": req.Title,
|
||||||
"Contex": req.Contex,
|
"Contex": req.Contex,
|
||||||
"Items": req.Items,
|
|
||||||
"Cid": req.Cid,
|
"Cid": req.Cid,
|
||||||
"Param": req.Param,
|
|
||||||
}); sign != req.Sign {
|
}); sign != req.Sign {
|
||||||
this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
|
this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
|
||||||
code = pb.ErrorCode_SignError
|
code = pb.ErrorCode_SignError
|
||||||
@ -65,6 +72,7 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
|
|||||||
if len(req.Items) > 0 {
|
if len(req.Items) > 0 {
|
||||||
mail.Reward = true
|
mail.Reward = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = this.module.modelMail.CreateGMMail(mail); err != nil {
|
if err = this.module.modelMail.CreateGMMail(mail); err != nil {
|
||||||
this.module.Errorf("LoginByCaptchaReq CreateMail err:%v", err)
|
this.module.Errorf("LoginByCaptchaReq CreateMail err:%v", err)
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
@ -72,4 +80,13 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
msg = pb.GetErrorCodeMsg(code)
|
msg = pb.GetErrorCodeMsg(code)
|
||||||
|
|
||||||
|
if _, err = this.module.service.RpcGo(
|
||||||
|
context.Background(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_Mail),
|
||||||
|
mail, nil); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
code = pb.ErrorCode_RpcFuncExecutionError
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) {
|
|||||||
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{}
|
payresp *pb.PayDeliveryResp = &pb.PayDeliveryResp{}
|
||||||
)
|
)
|
||||||
defer c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: nil})
|
defer c.JSON(http.StatusOK, &Respond{Code: payresp.Code, Message: payresp.Msg, Data: nil})
|
||||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "uid": req.Uid}); sign != req.Sign {
|
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"orderid": req.Order, "productid": req.ProductID, "uid": req.Uid}); sign != req.Sign {
|
||||||
this.module.Errorf("PayDelivery SignError sgin:%s", sign)
|
this.module.Errorf("PayDelivery SignError sgin:%s", sign)
|
||||||
payresp.Code = pb.ErrorCode_SignError
|
payresp.Code = pb.ErrorCode_SignError
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user