package controllers import ( "fmt" "hongze/hongze_open_api/services/quanshi" "hongze/hongze_open_api/utils" ) // QuanShiControllerCommon 报告模块 type QuanShiControllerCommon struct { BaseCommon } // CallBack // @Title 全时回调接口 // @Description 全时回调接口 // @router /callback [post] func (c *QuanShiControllerCommon) CallBack() { //回调中url参数要做签名(get请求中的参数,按照自己的方式签名,避免链接被别人拿去随意请求) utils.FileLog.Info(fmt.Sprintf("全时回调参数:%s", string(c.Ctx.Input.RequestBody))) //c.OkDetailed("ok", "获取成功") activityId, _ := c.GetInt("activity_id") timeInt, _ := c.GetInt("time") paramStr := fmt.Sprintf(`activity_id=%d&time=%d`, activityId, timeInt) signStr := quanshi.GetSign(paramStr) ownSign := c.GetString("sign") if ownSign != signStr { c.FailWithMessage("请求异常") return } c.Ok() }