|
@@ -5,6 +5,7 @@ import ( |
|
|
"crypto/aes" |
|
|
"crypto/aes" |
|
|
"crypto/cipher" |
|
|
"crypto/cipher" |
|
|
"encoding/base64" |
|
|
"encoding/base64" |
|
|
|
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/syyongx/php2go" |
|
|
"github.com/tidwall/gjson" |
|
|
"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{}{} |
|
|
args := map[string]interface{}{} |
|
|
for k, v := range params { |
|
|
for k, v := range params { |
|
|
if v != "" { |
|
|
if v != "" { |
|
@@ -163,12 +164,15 @@ func CreateOrder(params map[string]string) string { |
|
|
send, err := Send("channelOrder/createOrder", tmp) |
|
|
send, err := Send("channelOrder/createOrder", tmp) |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
fmt.Println(send) |
|
|
fmt.Println(send) |
|
|
return "" |
|
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
err = errors.New(gjson.Get(send, "message").String()) |
|
|
|
|
|
} |
|
|
|
|
|
return "", err |
|
|
} |
|
|
} |
|
|
encryptedData := CommEncryptedData(send) |
|
|
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{}{} |
|
|
args := map[string]interface{}{} |
|
|
for k, v := range params { |
|
|
for k, v := range params { |
|
|
if v != "" { |
|
|
if v != "" { |
|
@@ -180,10 +184,13 @@ func CheckCreateOrder(params map[string]string) string { |
|
|
send, err := Send("channelOrder/checkCreateOrder", tmp) |
|
|
send, err := Send("channelOrder/checkCreateOrder", tmp) |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
fmt.Println(send) |
|
|
fmt.Println(send) |
|
|
return "" |
|
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
err = errors.New(gjson.Get(send, "message").String()) |
|
|
|
|
|
} |
|
|
|
|
|
return "", err |
|
|
} |
|
|
} |
|
|
//encryptedData := CommEncryptedData(send) |
|
|
//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{}{} |
|
|
args := map[string]interface{}{} |
|
|
for k, v := range params { |
|
|
for k, v := range params { |
|
|
if v != "" { |
|
|
if v != "" { |
|
@@ -237,10 +244,13 @@ func OrderApplyRefund(params map[string]interface{}) string { |
|
|
send, err := Send("order/applyRefund", tmp) |
|
|
send, err := Send("order/applyRefund", tmp) |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
if err != nil || gjson.Get(send, "code").Int() != 200 { |
|
|
fmt.Println(send) |
|
|
fmt.Println(send) |
|
|
return "" |
|
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
err = errors.New(gjson.Get(send, "message").String()) |
|
|
|
|
|
} |
|
|
|
|
|
return "", err |
|
|
} |
|
|
} |
|
|
encryptedData := CommEncryptedData(send) |
|
|
encryptedData := CommEncryptedData(send) |
|
|
return encryptedData |
|
|
|
|
|
|
|
|
return encryptedData, nil |
|
|
} |
|
|
} |
|
|
func CommEncryptedData(send string) string { |
|
|
func CommEncryptedData(send string) string { |
|
|
Aeckey1, _ := php2go.Base64Decode(Aeckey) |
|
|
Aeckey1, _ := php2go.Base64Decode(Aeckey) |
|
|