package reward import ( "context" "fmt" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "server/api/reward/v1" ) func (c *ControllerV1) RewardCallback(ctx context.Context, req *v1.RewardCallbackReq) (res *v1.RewardCallbackRes, err error) { appId := g.RequestFromCtx(ctx).GetHeader("Custom-Data-Appid") timestamp := g.RequestFromCtx(ctx).GetHeader("Custom-Data-Timestamp") nonce := g.RequestFromCtx(ctx).GetHeader("Custom-Data-Nonce") auth := g.RequestFromCtx(ctx).GetHeader("Custom-Data-Auth") glog.Infof(ctx, "appId: %s, timestamp: %s, nonce: %s, auth: %s", appId, timestamp, nonce, auth) secret := "" data := fmt.Sprintf("%s%s%s%s%d%d%d%s%s%s#%s", req.UId, req.OrderId, req.PrizeId, req.PrizeChannelId, req.PrizeType, req.PrizeSubType, req.Num, appId, timestamp, nonce, secret) if data != auth { } return nil, gerror.NewCode(gcode.CodeNotImplemented) }