go_dreamfactory/modules/web/api_activitynotify.go
2023-12-12 18:21:24 +08:00

50 lines
957 B
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})
}()
_, err = this.module.service.RpcGo(
context.Background(),
comm.Service_Worker,
string(comm.Rpc_Activity),
pb.RPCGeneralReqA1{
Param1: req.Id,
},
nil)
if err != nil {
this.module.Errorln(err)
return
}
errdata = &pb.ErrorData{
Code: pb.ErrorCode_Success,
Title: pb.ErrorCode_Success.ToString(),
}
// 通知更新活动
this.module.modelweb.ReloadActivityData(req.Id)
}