Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aimuz committed Sep 19, 2018
1 parent 692df56 commit 97f4d26
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 8 additions & 0 deletions pay/pay.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/aimuz/wechat-sdk/utils"
"github.com/jinzhu/copier"
)

type (
Expand Down Expand Up @@ -111,6 +112,13 @@ func (m *WePay) AppPay(totalFee int) (results *AppPayRet, outTradeNo string, err
return
}

// AppPayStruct 自定义参数实现,需要自定义
func (m *WePay) AppPayStruct(order AppUnifiedOrder) (results *AppPayRet, outTradeNo string, err error) {
unifiedOrder := new(AppUnifiedOrder)
copier.Copy(order, &unifiedOrder)
return
}

// WaxPay 小程序支付
func (m *WePay) WaxPay(totalFee int, openID string) (results *WaxPayRet, outTradeNo string, err error) {

Expand Down
4 changes: 1 addition & 3 deletions pay/redpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pay
import (
"encoding/xml"
"fmt"

"github.com/aimuz/wechat-sdk/common"
"github.com/aimuz/wechat-sdk/utils"
)
Expand Down Expand Up @@ -108,13 +109,10 @@ func (m *SendRedPackReq) Send(payKey string, certFile, keyFile, rootCaFile strin
return nil, err
}

fmt.Println(tMap)

m.Sign, err = utils.GenWeChatPaySign(tMap, payKey)
if err != nil {
return nil, err
}
fmt.Println(m.Sign)

data, err := xml.Marshal(m)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/aimuz/wechat-sdk/common"
"io/ioutil"
"math/rand"
"net/http"
"sort"
"strconv"
"strings"
"time"

"github.com/aimuz/wechat-sdk/common"
)

// NewRequest 请求包装
Expand Down Expand Up @@ -142,7 +143,6 @@ func Struct2Map(r interface{}) (s map[string]string, err error) {
for k, v := range temp {
switch v2 := v.(type) {
case string:
//fmt.Printf("%s=%s\n", k, v2)
result[k] = v2
break
case int8, uint8, int, uint, int32, uint32, int64, uint64:
Expand All @@ -153,7 +153,6 @@ func Struct2Map(r interface{}) (s map[string]string, err error) {
break
}
}
//fmt.Println(result)
return result, nil
}

Expand Down

0 comments on commit 97f4d26

Please sign in to comment.