调整奖励领取接口
This commit is contained in:
@ -3,6 +3,7 @@ package gamelife
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"server/internal/dao"
|
||||
@ -423,6 +424,22 @@ func (s *gamelifeClient) RequestActivity(ctx context.Context, in *model.QQNetbar
|
||||
if err != nil || resp.IsError() {
|
||||
return nil, ecode.Fail.Sub("请求出现异常")
|
||||
}
|
||||
|
||||
// 判断是否为 -1 的异常
|
||||
type RespData struct {
|
||||
Ret int `json:"ret"`
|
||||
ErrMsg string `json:"err_msg"`
|
||||
ErrDesc string `json:"err_desc"`
|
||||
}
|
||||
var respData RespData
|
||||
if err = json.Unmarshal(resp.Body(), &respData); err != nil {
|
||||
return nil, ecode.Fail.Sub("解析请求结果失败")
|
||||
}
|
||||
if respData.Ret == -1 {
|
||||
glog.Info(ctx, "奖励领取超出限制,-1")
|
||||
return nil, errors.New("奖励领取超出限制,-1")
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
return nil, ecode.Fail.Sub("请求结果为空")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user