瀏覽代碼

更新

master
huangjiajun 1 年之前
父節點
當前提交
7238cf8f29
共有 1 個文件被更改,包括 19 次插入9 次删除
  1. +19
    -9
      lianlian/api.go

+ 19
- 9
lianlian/api.go 查看文件

@@ -5,6 +5,7 @@ import (
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"errors"
"fmt"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
@@ -151,7 +152,7 @@ func ProductStatus(params map[string]string) string {
}

//创建渠道订单
func CreateOrder(params map[string]string) string {
func CreateOrder(params map[string]string) (string, error) {
args := map[string]interface{}{}
for k, v := range params {
if v != "" {
@@ -163,12 +164,15 @@ func CreateOrder(params map[string]string) string {
send, err := Send("channelOrder/createOrder", tmp)
if err != nil || gjson.Get(send, "code").Int() != 200 {
fmt.Println(send)
return ""
if err == nil {
err = errors.New(gjson.Get(send, "message").String())
}
return "", err
}
encryptedData := CommEncryptedData(send)
return encryptedData
return encryptedData, nil
}
func CheckCreateOrder(params map[string]string) string {
func CheckCreateOrder(params map[string]string) (string, error) {
args := map[string]interface{}{}
for k, v := range params {
if v != "" {
@@ -180,10 +184,13 @@ func CheckCreateOrder(params map[string]string) string {
send, err := Send("channelOrder/checkCreateOrder", tmp)
if err != nil || gjson.Get(send, "code").Int() != 200 {
fmt.Println(send)
return ""
if err == nil {
err = errors.New(gjson.Get(send, "message").String())
}
return "", err
}
//encryptedData := CommEncryptedData(send)
return send
return send, nil
}

//订单详情
@@ -225,7 +232,7 @@ func OrderExpress(params map[string]string) string {
}

//订单退款
func OrderApplyRefund(params map[string]interface{}) string {
func OrderApplyRefund(params map[string]interface{}) (string, error) {
args := map[string]interface{}{}
for k, v := range params {
if v != "" {
@@ -237,10 +244,13 @@ func OrderApplyRefund(params map[string]interface{}) string {
send, err := Send("order/applyRefund", tmp)
if err != nil || gjson.Get(send, "code").Int() != 200 {
fmt.Println(send)
return ""
if err == nil {
err = errors.New(gjson.Get(send, "message").String())
}
return "", err
}
encryptedData := CommEncryptedData(send)
return encryptedData
return encryptedData, nil
}
func CommEncryptedData(send string) string {
Aeckey1, _ := php2go.Base64Decode(Aeckey)


Loading…
取消
儲存