Browse Source

perfect

master
黄梓健 5 years ago
parent
commit
118ccf525c
  1. 1
      controllers/common/wechat_oauth.go
  2. 1
      models/live_config.go
  3. 8
      services/pay/order.go

1
controllers/common/wechat_oauth.go

@ -106,6 +106,7 @@ func (t *WeChatOauthCtl) CallbackRefund() {
_, err := pay_service.NotifyRefund(t.Request.BODY) _, err := pay_service.NotifyRefund(t.Request.BODY)
param := new(CallbackParam) param := new(CallbackParam)
if err != nil { if err != nil {
logger.Error(err)
refundFailedCounter.Add(1) refundFailedCounter.Add(1)
logger.Error(fmt.Sprintf("call refund失败微信响应次数: %v", refundFailedCounter.Load())) logger.Error(fmt.Sprintf("call refund失败微信响应次数: %v", refundFailedCounter.Load()))
param.ReturnCode = CDATA{Text: define.CODE_FAIL} param.ReturnCode = CDATA{Text: define.CODE_FAIL}

1
models/live_config.go

@ -35,6 +35,7 @@ type LiveConfig struct {
ActivityDesc string `json:"activity_desc" xorm:"not null default '' comment('活动介绍页图片') VARCHAR(255)"` ActivityDesc string `json:"activity_desc" xorm:"not null default '' comment('活动介绍页图片') VARCHAR(255)"`
SharePosterImg string `json:"share_poster_img" xorm:"not null default '' comment('分享的海报图片') VARCHAR(255)"` SharePosterImg string `json:"share_poster_img" xorm:"not null default '' comment('分享的海报图片') VARCHAR(255)"`
Status int `json:"status" xorm:"not null default 1 comment('直播的状态1未开始2进行中3已结束') TINYINT(1)"` Status int `json:"status" xorm:"not null default 1 comment('直播的状态1未开始2进行中3已结束') TINYINT(1)"`
LiveMode int `json:"live_mode" xorm:"not null default 1 comment('直播方式1标准直播2快直播') TINYINT(1)"`
Announcement string `json:"announcement" xorm:"not null default '' comment('公告内容') VARCHAR(255)"` Announcement string `json:"announcement" xorm:"not null default '' comment('公告内容') VARCHAR(255)"`
WatchNum int `json:"watch_num" xorm:"not null default 0 comment('观看人数') INT(11)"` WatchNum int `json:"watch_num" xorm:"not null default 0 comment('观看人数') INT(11)"`
LikeNum int `json:"like_num" xorm:"not null default 0 comment('点赞数') INT(11)"` LikeNum int `json:"like_num" xorm:"not null default 0 comment('点赞数') INT(11)"`

8
services/pay/order.go

@ -303,26 +303,26 @@ func NotifyRefund(body string) (*models.UserOrder, error) {
err := xml.Unmarshal([]byte(body), &res) err := xml.Unmarshal([]byte(body), &res)
if err != nil { if err != nil {
err = fmt.Errorf("xml unmarsal error: %+v", err) err = fmt.Errorf("xml unmarsal error: %+v", err)
logger.Error(err)
return nil, err return nil, err
} }
logger.Error("return-->", res.ReturnCode == define.CODE_SUCCESS)
logger.Error("result-->", res.ResultCode == define.CODE_SUCCESS)
logger.Error(res)
if res.ReturnCode != define.CODE_SUCCESS { if res.ReturnCode != define.CODE_SUCCESS {
err = fmt.Errorf("network error, retrun_code: %+v and return_msg: %+v", res.ReturnCode, res.ReturnMsg) err = fmt.Errorf("network error, retrun_code: %+v and return_msg: %+v", res.ReturnCode, res.ReturnMsg)
logger.Error(err)
return nil, err return nil, err
} }
if res.ResultCode != define.CODE_SUCCESS { if res.ResultCode != define.CODE_SUCCESS {
err = fmt.Errorf("trade error, result_code: %+v and err_code: %+v and err_desc: %+v", err = fmt.Errorf("trade error, result_code: %+v and err_code: %+v and err_desc: %+v",
res.ResultCode, res.ErrCode, res.ErrCodeDes) res.ResultCode, res.ErrCode, res.ErrCodeDes)
logger.Error(err)
return nil, err return nil, err
} }
order := new(models.UserOrder) order := new(models.UserOrder)
exist, err := order.GetByOutTradeNo(res.OutTradeNo) exist, err := order.GetByOutTradeNo(res.OutTradeNo)
if err == nil || !exist {
if err != nil || !exist {
err = fmt.Errorf("user order get by out_trade_no: %+v, error: %+v, exist: %+v", res.OutTradeNo, err, exist) err = fmt.Errorf("user order get by out_trade_no: %+v, error: %+v, exist: %+v", res.OutTradeNo, err, exist)
return nil, err return nil, err
} }

Loading…
Cancel
Save