50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
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 func() {
|
|
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(),
|
|
}
|
|
// 通知更新活动
|
|
this.module.modelweb.ReloadActivityData()
|
|
}
|