活动更新通知
This commit is contained in:
parent
feac8878c8
commit
959775f19c
@ -427,6 +427,8 @@ const ( //Rpc
|
||||
|
||||
// 石阵秘境结算
|
||||
Rpc_ModuleStoneBossSettlement core.Rpc_Key = "Rpc_ModuleStoneBossSettlement"
|
||||
|
||||
Rpc_Activity core.Rpc_Key = "Rpc_Activity"
|
||||
)
|
||||
|
||||
// 事件类型定义处
|
||||
|
@ -1,8 +1,10 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/event"
|
||||
"go_dreamfactory/modules"
|
||||
@ -18,7 +20,7 @@ type Activity struct {
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
|
||||
service core.IService
|
||||
service base.IRPCXService
|
||||
modelhdList *modelHdList
|
||||
modelhdData *modelhdData
|
||||
|
||||
@ -40,7 +42,7 @@ func (this *Activity) GetType() core.M_Modules {
|
||||
|
||||
func (this *Activity) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service
|
||||
this.service = service.(base.IRPCXService)
|
||||
|
||||
// ticker := time.NewTicker(time.Second * 10)
|
||||
// go func() {
|
||||
@ -56,6 +58,8 @@ func (this *Activity) Init(service core.IService, module core.IModule, options c
|
||||
}
|
||||
func (this *Activity) Start() (err error) {
|
||||
err = this.ModuleBase.Start()
|
||||
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_Activity), this.Rpc_Activity)
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
||||
return
|
||||
@ -427,3 +431,8 @@ func (this *Activity) GetHdData(session comm.IUserSession, oids []string) (resul
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Activity) Rpc_Activity(ctx context.Context, args string) (err error) {
|
||||
this.modelhdList.LoadActivityData()
|
||||
return
|
||||
}
|
||||
|
45
modules/web/api_activitynotify.go
Normal file
45
modules/web/api_activitynotify.go
Normal file
@ -0,0 +1,45 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/gin/engine"
|
||||
"go_dreamfactory/pb"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// 活动通知
|
||||
type ActivityNotifyReq struct {
|
||||
Id string `json:"_id"` // oid
|
||||
}
|
||||
|
||||
//创建邮件
|
||||
func (this *Api_Comp) ActivityNotify(c *engine.Context) {
|
||||
|
||||
req := &ActivityNotifyReq{}
|
||||
err := c.BindJSON(&req)
|
||||
this.module.Debugf("ActivityNotify:%+v err:%v", req, err)
|
||||
var (
|
||||
errdata *pb.ErrorData
|
||||
data interface{}
|
||||
)
|
||||
|
||||
defer c.JSON(http.StatusOK, &Respond{Code: errdata.Code, Message: errdata.Message, Data: data})
|
||||
|
||||
if _, err = this.module.service.RpcGo(
|
||||
context.Background(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_Activity),
|
||||
req.Id, nil); err != nil {
|
||||
this.module.Errorln(err)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_RpcFuncExecutionError,
|
||||
Title: pb.ErrorCode_RpcFuncExecutionError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_Success,
|
||||
Title: pb.ErrorCode_Success.ToString(),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user