Merge branch 'dev_wx_pay' into mall
# Conflicts: # model/autogenerated_mall.go
This commit is contained in:
commit
a0d61387b8
|
@ -17,7 +17,7 @@ func UserRedeemCodeList(c *gin.Context) {
|
|||
}
|
||||
codeList, err := model.UserRedeemCodeList(uc.Uid)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func UserConvertRedeemCode(c *gin.Context) {
|
|||
}
|
||||
err := model.UserRedeemCodeConvert(uc.Uid, req.SerialCode)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ func CooperativeGameCardGoodsStockAdds(c *gin.Context) {
|
|||
}
|
||||
err := cardGoods.Adds(req.Cards)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func CooperativeRentCardOrderList(c *gin.Context) {
|
|||
req.AssistantUid = uc.Uid
|
||||
list, count, err := req.List()
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
|
92
controller/game_test.go
Normal file
92
controller/game_test.go
Normal file
|
@ -0,0 +1,92 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/codinl/go-logger"
|
||||
"mh-server/lib/wxpay"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPushWXPayNoticeTest(t *testing.T) {
|
||||
PushWXPayNoticeTest()
|
||||
}
|
||||
|
||||
func PushWXPayNoticeTest() {
|
||||
// body := []byte(` <xml><appid><![CDATA[wx806c079463b5b56c]]></appid>
|
||||
//<attach><![CDATA[member_pay]]></attach>
|
||||
//<bank_type><![CDATA[OTHERS]]></bank_type>
|
||||
//<cash_fee><![CDATA[69900]]></cash_fee>
|
||||
//<device_info><![CDATA[WEB]]></device_info>
|
||||
//<fee_type><![CDATA[CNY]]></fee_type>
|
||||
//<is_subscribe><![CDATA[N]]></is_subscribe>
|
||||
//<mch_id><![CDATA[1609877389]]></mch_id>
|
||||
//<nonce_str><![CDATA[3lQ34r7u3GFcHU5Tk3tjM2o2Gu7Jc8gE]]></nonce_str>
|
||||
//<openid><![CDATA[ohuHh4sLeBcMR-C7rZsZOexMTuds]]></openid>
|
||||
//<out_trade_no><![CDATA[7729C9C324]]></out_trade_no>
|
||||
//<result_code><![CDATA[SUCCESS]]></result_code>
|
||||
//<return_code><![CDATA[SUCCESS]]></return_code>
|
||||
//<sign><![CDATA[A31D026246DF11B147A8D9FC5234C389]]></sign>
|
||||
//<time_end><![CDATA[20220527205519]]></time_end>
|
||||
//<total_fee>69900</total_fee>
|
||||
//<trade_type><![CDATA[JSAPI]]></trade_type>
|
||||
//<transaction_id><![CDATA[4200001516202205272284493470]]></transaction_id>
|
||||
//</xml>`)
|
||||
body := []byte(`<xml>
|
||||
<appid><![CDATA[wx806c079463b5b56c]]></appid>
|
||||
<attach><![CDATA[member_pay]]></attach>
|
||||
<bank_type><![CDATA[WHZB_DEBIT]]></bank_type>
|
||||
<cash_fee><![CDATA[63900]]></cash_fee>
|
||||
<coupon_count><![CDATA[3]]></coupon_count>
|
||||
<coupon_fee>6000</coupon_fee>
|
||||
<coupon_fee_0><![CDATA[2000]]></coupon_fee_0>
|
||||
<coupon_fee_1><![CDATA[2000]]></coupon_fee_1>
|
||||
<coupon_fee_2><![CDATA[2000]]></coupon_fee_2>
|
||||
<coupon_id_0><![CDATA[34002152204]]></coupon_id_0>
|
||||
<coupon_id_1><![CDATA[34003509554]]></coupon_id_1>
|
||||
<coupon_id_2><![CDATA[34002433276]]></coupon_id_2>
|
||||
<device_info><![CDATA[WEB]]></device_info>
|
||||
<fee_type><![CDATA[CNY]]></fee_type>
|
||||
<is_subscribe><![CDATA[N]]></is_subscribe>
|
||||
<mch_id><![CDATA[1609877389]]></mch_id>
|
||||
<nonce_str><![CDATA[Q4POvEGK7hTPX0hy54H2mn13fG4m8Nm7]]></nonce_str>
|
||||
<openid><![CDATA[ohuHh4jYz8Tad6kYZ8P_jNNNCI7s]]></openid>
|
||||
<out_trade_no><![CDATA[772A907CA8]]></out_trade_no>
|
||||
<result_code><![CDATA[SUCCESS]]></result_code>
|
||||
<return_code><![CDATA[SUCCESS]]></return_code>
|
||||
<sign><![CDATA[3ABCA7885BBE8658E76D384FE55AFDDE]]></sign>
|
||||
<time_end><![CDATA[20220527214915]]></time_end>
|
||||
<total_fee>69900</total_fee>
|
||||
<trade_type><![CDATA[JSAPI]]></trade_type>
|
||||
<transaction_id><![CDATA[4200001522202205275372221444]]></transaction_id>
|
||||
</xml>`)
|
||||
var notifyInfo wxpay.WechatNotifyInfo
|
||||
err := xml.Unmarshal(body, ¬ifyInfo)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
}
|
||||
//ret := WXPayNoticeResp{
|
||||
// ReturnCode: "FAIL",
|
||||
//}
|
||||
|
||||
//fmt.Println("notifyInfo:", notifyInfo)
|
||||
//fmt.Printf("notifyInfo:%#v", notifyInfo)
|
||||
notifyInfoJson, _ := json.Marshal(¬ifyInfo)
|
||||
|
||||
fmt.Println("notifyInfoJson:", string(notifyInfoJson))
|
||||
//correctSign, err := PayCallBackHandle(notifyInfo, config.AppConfig.WxMchSecret)
|
||||
correctSign, err := PayCallBackHandle(notifyInfo, "DeovoMingHuiRengTianTang45675456")
|
||||
if err != nil {
|
||||
logger.Error("PushWXPayNotice sign create fail")
|
||||
return
|
||||
}
|
||||
if notifyInfo.Sign != correctSign {
|
||||
fmt.Println("Sign-----:", notifyInfo.Sign)
|
||||
fmt.Println("correctSign:", correctSign)
|
||||
logger.Error("PushWXPayNotice sign verification fail")
|
||||
return
|
||||
}
|
||||
fmt.Println("Sign:", notifyInfo.Sign)
|
||||
fmt.Println("correctSign:", correctSign)
|
||||
}
|
|
@ -238,7 +238,7 @@ func MallOrderCreate(c *gin.Context) {
|
|||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
ret := map[string]interface{}{
|
||||
"order_id": order.ID,
|
||||
"order": order,
|
||||
|
|
|
@ -385,14 +385,14 @@ func RentCardOrderCreate(c *gin.Context) {
|
|||
err := model.GameCardGoodsInventoryReduction(req.GameCardList, req.StoreId, tx)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
logger.Error("inventory reduction err:%s", err.Error())
|
||||
logger.Error("inventory reduction err:", err.Error())
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
err = order.CreatOrderCard(req.GameCardList, req.StoreId, tx)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
logger.Error("inventory reduction err:%s", err.Error())
|
||||
logger.Error("inventory reduction err:", err.Error())
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -450,14 +450,14 @@ func RentCardOrderCreate(c *gin.Context) {
|
|||
err = order.CreatOrderCard(req.GameCardList, req.StoreId, begin)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("inventory reduction err:%s", err.Error())
|
||||
logger.Error("inventory reduction err:", err.Error())
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -600,7 +600,7 @@ func RefundDeposit(c *gin.Context) {
|
|||
|
||||
resp, err := model.MemberExpireDelaying(uc.Uid)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ func UserDepositRefundRecordList(c *gin.Context) {
|
|||
|
||||
resp, err := model.GetDepositRefundRecordList(uc.Uid)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ func UserMemberExpireDelayingInfo(c *gin.Context) {
|
|||
|
||||
resp, err := model.MemberExpireDelaying(uc.Uid)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ func MemberConfigList(c *gin.Context) {
|
|||
|
||||
resp, err := model.MemberConfigInfo()
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
@ -997,7 +997,7 @@ func InviteMemberReportList(c *gin.Context) {
|
|||
}
|
||||
list, totalPage, err := req.List()
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
logger.Errorf("err:%#v", err)
|
||||
RespJson(c, status.InternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -244,13 +244,9 @@ type (
|
|||
|
||||
CouponFee uint `xml:"coupon_fee,CDATA" json:"coupon_fee"`
|
||||
CouponCount uint `xml:"coupon_count,CDATA" json:"coupon_count"`
|
||||
CouponType0 uint `xml:"coupon_type_0,CDATA" json:"coupon_type"`
|
||||
CouponId0 string `xml:"coupon_id_0,CDATA" json:"coupon_id"`
|
||||
CouponFee0 uint `xml:"coupon_fee_0,CDATA" json:"coupon_fee0"`
|
||||
//CouponCount string `json:"coupon_count"`
|
||||
//CouponFee string `json:"coupon_fee"`
|
||||
//CouponFee0 string `json:"coupon_fee_0"`
|
||||
//CouponId0 string `json:"coupon_id_0"`
|
||||
CouponType0 uint `xml:"coupon_type_0,CDATA" json:"coupon_type_0"`
|
||||
CouponId0 string `xml:"coupon_id_0,CDATA" json:"coupon_id_0"`
|
||||
CouponFee0 uint `xml:"coupon_fee_0,CDATA" json:"coupon_fee_0"`
|
||||
|
||||
CouponFee1 uint `xml:"coupon_fee_1,CDATA" json:"coupon_fee_1"`
|
||||
CouponId1 string `xml:"coupon_id_1,CDATA" json:"coupon_id_1"`
|
||||
|
@ -260,6 +256,8 @@ type (
|
|||
CouponId3 string `xml:"coupon_id_3,CDATA" json:"coupon_id_3"`
|
||||
CouponFee4 uint `xml:"coupon_fee_4,CDATA" json:"coupon_fee_4"`
|
||||
CouponId4 string `xml:"coupon_id_4,CDATA" json:"coupon_id_4"`
|
||||
CouponFee5 uint `xml:"coupon_fee_5,CDATA" json:"coupon_fee_5"`
|
||||
CouponId5 string `xml:"coupon_id_5,CDATA" json:"coupon_id_5"`
|
||||
|
||||
TransactionId string `xml:"transaction_id,CDATA" json:"transaction_id"`
|
||||
OutTradeNo string `xml:"out_trade_no,CDATA" json:"out_trade_no"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user