79 lines
2.9 KiB
Go
79 lines
2.9 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"gitea.cdlsxd.cn/sdk/plugin/instance"
|
|
"gitea.cdlsxd.cn/sdk/plugin/manage"
|
|
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
|
"log"
|
|
)
|
|
|
|
var zltxCardConf = &manage.Config{
|
|
Cmd: "pkg/mac/zltx_card_v1.so",
|
|
Tag: "zltx_card_v1",
|
|
Version: 1,
|
|
CookieKey: "zltx_card_v1",
|
|
CookieValue: "zltx_card_v1",
|
|
}
|
|
|
|
func zlxtCardCf() []byte {
|
|
|
|
return []byte(`{"app_id":"101","app_key":"95E7EC7D4A394FF8D11788E5E436DE99","base_uri":"https://openapi.1688sup.com","merchant_id":25943,"notify_url":"https://market.86698.cn/v1/order/direct/notify"}`)
|
|
|
|
//type Config struct {
|
|
// AppId string `json:"app_id"`
|
|
// AppKey string `json:"app_key"`
|
|
// BaseUri string `json:"base_uri"`
|
|
// NotifyUrl string `json:"notify_url"`
|
|
// MerchantId int64 `json:"merchant_id"`
|
|
//}
|
|
//c := &Config{
|
|
// AppId: "101",
|
|
// AppKey: "95E7EC7D4A394FF8D11788E5E436DE99",
|
|
// BaseUri: "https://openapi.1688sup.com",
|
|
// NotifyUrl: "https://gateway.dev.cdlsxd.cn/yxh5api/v1/order/direct/notify",
|
|
// MerchantId: 25943,
|
|
//}
|
|
//marshal, _ := json.Marshal(c)
|
|
//return marshal
|
|
}
|
|
|
|
// main 这只是一个演示
|
|
func zltxCardNotify() {
|
|
|
|
err := manage.Add(zltxCardConf)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
defer func() {
|
|
fmt.Println("zltx_card_v1 close start")
|
|
manage.Close()
|
|
fmt.Println("zltx_card_v1 close end")
|
|
}()
|
|
|
|
//req := &proto.NotifyRequest{
|
|
// Config: zlxtCardCf(),
|
|
// Queries: []byte(``),
|
|
// Headers: []byte(`{"Accept-Encoding":["gzip, deflate, br"],"Authorization":["MD5 appid=101,sign=1A821E1E6FA824C7099D7F17F58E1650"],"Connection":["close"],"Content-Length":["183"],"Content-Type":["application/json"],"Cookie":[""],"User-Agent":["GuzzleHttp/6.5.5 curl/7.69.1 PHP/7.2.34"],"X-Forwarded-For":["47.96.248.136"],"X-Real-Ip":["47.96.248.136"],"X-Remoteaddr":["172.18.0.1"]}`),
|
|
// Body: []byte(`{"merchantId":25943,"outTradeNo":"202506161700247580010056","tradeNo":"789175179564695553","status":"01","cardCode":"XPHrv0+uPVQOqfymz1jJAsLOOuGpfvgXi9RIF1m4tRCsDdvcZDDNY21M/22F56M1"`),
|
|
//}
|
|
// transport: error while dialing: dial unix /tmp/plugin2702936918: connect: connection refused
|
|
for i := 0; i < 5; i++ {
|
|
req := &proto.NotifyRequest{
|
|
Config: zlxtCardCf(),
|
|
Queries: []byte(``),
|
|
Headers: []byte(`{"Accept":["*/*"],"Accept-Encoding":["gzip, deflate, br"],"Authorization":["MD5 appid=101,sign=7EF17E77501F943FF98620D6D7D45140"],"Connection":["close"],"Content-Length":["152"],"Content-Type":["application/json"],"User-Agent":["Apifox/1.0.0 (https://apifox.com)"],"X-Forwarded-For":["117.175.169.61"],"X-Real-Ip":["117.175.169.61"],"X-Remoteaddr":["172.18.0.1"]}`),
|
|
Body: []byte(`{"cardCode":"krorwUJwLmlr7pec6pjcOTOdsc4RrkPFOb27YhFGts3ljozBAeGFmAzZKlFK/RFU","merchantId":25943,"outTradeNo":"202506160907157760019451","status":"01"}`),
|
|
}
|
|
res, err := instance.Notify(context.Background(), zltxCardConf.Tag, req)
|
|
if err != nil {
|
|
log.Printf("Order err:%+v i:%d", err, i)
|
|
} else {
|
|
log.Printf("Order res:%+v i:%d", res, i)
|
|
}
|
|
}
|
|
|
|
}
|