37 lines
913 B
Go
37 lines
913 B
Go
|
package services
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"qteam/app/http/entities/front"
|
||
|
"qteam/app/models/ordersmodel"
|
||
|
"qteam/app/third/youchu"
|
||
|
"qteam/config"
|
||
|
)
|
||
|
|
||
|
func DecryptYouChuData(data string) (info front.YouChuDecryptData) {
|
||
|
// 先解Base64,再解Hex16进
|
||
|
decrypt, err := SM2Decrypt(data)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
err = json.Unmarshal([]byte(decrypt), &info)
|
||
|
if err != nil {
|
||
|
fmt.Println("解析JSON错误:", err)
|
||
|
return
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func YouChuOrderQuery(order ordersmodel.Orders) (code int, response front.YouChuOrderQueryResponse) {
|
||
|
client := youchu.NewYouChuClient(config.GetConf().YouChu)
|
||
|
code, response = client.OrderQuery(order)
|
||
|
return code, response
|
||
|
}
|
||
|
|
||
|
func YouChuOrderRefund(order ordersmodel.Orders) (code int, response front.YouChuOrderRefundResponse) {
|
||
|
client := youchu.NewYouChuClient(config.GetConf().YouChu)
|
||
|
code, response = client.OrderRefund(order)
|
||
|
return code, response
|
||
|
}
|