From 58ffa224b6db8cdd6b4fbf88f73c63d2385c85f5 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sun, 25 Jun 2023 10:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/meituan_fenxiao.go | 34 ++++++++++++++++++++++++++++++ meituan_fenxiao/meituan_fenxiao.go | 12 +++++++++++ recharge/api.go | 8 +++++-- recharge/recharge.go | 28 ++++++++++++------------ 4 files changed, 66 insertions(+), 16 deletions(-) diff --git a/md/meituan_fenxiao.go b/md/meituan_fenxiao.go index ebd4145..ae6335f 100644 --- a/md/meituan_fenxiao.go +++ b/md/meituan_fenxiao.go @@ -5,3 +5,37 @@ type MeituanFenXiaoGeoInfo struct { Lng float64 `json:"lng"` Lat float64 `json:"lat"` } +type MeituanFenXiaoOrderResult struct { + RecordCount int `json:"recordCount"` + Page int `json:"page"` + PageSize int `json:"pageSize"` + Records []struct { + UtmSource int `json:"utmSource"` + UtmMedium string `json:"utmMedium"` + DisplayOrderId string `json:"displayOrderId"` + OrderItemId string `json:"orderItemId"` + DealName string `json:"dealName"` + DealPicUrl string `json:"dealPicUrl"` + ActualItemAmount int `json:"actualItemAmount"` + DealOriginPrice int `json:"dealOriginPrice"` + DealMerchantAllowance int `json:"dealMerchantAllowance"` + DealPlatformAllowance int `json:"dealPlatformAllowance"` + PoiUuid string `json:"poiUuid"` + ShopName string `json:"shopName"` + PoiBrandName string `json:"poiBrandName"` + ShopCityName string `json:"shopCityName"` + PoiCate0 string `json:"poiCate0"` + PoiCate1 string `json:"poiCate1"` + TransactionTime string `json:"transactionTime"` + TransactionType int `json:"transactionType"` + TransactionAmount int `json:"transactionAmount"` + MediaName string `json:"mediaName"` + PromotionName string `json:"promotionName"` + OrderMtUserId string `json:"orderMtUserId"` + EstimatedCommission int `json:"estimatedCommission"` + CommissionRatio float64 `json:"commissionRatio"` + SettleStatus int `json:"settleStatus"` + ExtraInfo string `json:"extraInfo"` + } `json:"records"` + PositionIndex string `json:"positionIndex"` +} diff --git a/meituan_fenxiao/meituan_fenxiao.go b/meituan_fenxiao/meituan_fenxiao.go index 33224e2..78fe722 100644 --- a/meituan_fenxiao/meituan_fenxiao.go +++ b/meituan_fenxiao/meituan_fenxiao.go @@ -1,6 +1,18 @@ package meituan_fenxiao +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md" + "encoding/json" +) + func MeituanFenXiaoGoods(param map[string]interface{}) (string, error) { send, err := MeituanFenXiaoSend("api/search/open/odp/products", param) return send, err } + +func MeituanFenXiaoOrder(param map[string]interface{}) (md.MeituanFenXiaoOrderResult, error) { + send, err := MeituanFenXiaoSend("ajax/odp/order/flow/fetch", param) + var data md.MeituanFenXiaoOrderResult + json.Unmarshal([]byte(send), &data) + return data, err +} diff --git a/recharge/api.go b/recharge/api.go index 878e4a7..1521dda 100644 --- a/recharge/api.go +++ b/recharge/api.go @@ -7,8 +7,12 @@ import ( "strings" ) -func send(method string, apiKey string, param map[string]string) (string, error) { - url := "http://8.130.97.197/yrapi.php/" + method +func send(url, method string, apiKey string, param map[string]string) (string, error) { + if url == "" { + url = "http://szcz.jjffb.com/yrapi.php/" + } + url = url + method + //url := "http://szcz.jjffb.com/yrapi.php/" + method param["sign"] = GetRechargeSign(apiKey, param) post, err := zhios_third_party_utils.CurlPost(url, param, map[string]string{}) return string(post), err diff --git a/recharge/recharge.go b/recharge/recharge.go index 375199a..ba1b710 100644 --- a/recharge/recharge.go +++ b/recharge/recharge.go @@ -5,8 +5,8 @@ import "fmt" /*** 查询用户信息 */ -func GetUser(apiKey string, param map[string]string) (string, error) { - s, err := send("index/user", apiKey, param) +func GetUser(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/user", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -17,8 +17,8 @@ func GetUser(apiKey string, param map[string]string) (string, error) { type int 1 false 产品类型ID,非必须 cate_id int 10 false 分类ID,非必须 */ -func GetProduct(apiKey string, param map[string]string) (string, error) { - s, err := send("index/product", apiKey, param) +func GetProduct(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/product", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -28,8 +28,8 @@ func GetProduct(apiKey string, param map[string]string) (string, error) { 产品ID查询【新增】 id int 1 true 产品ID */ -func GetPrice(apiKey string, param map[string]string) (string, error) { - s, err := send("index/price", apiKey, param) +func GetPrice(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/price", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -38,8 +38,8 @@ func GetPrice(apiKey string, param map[string]string) (string, error) { /*** 获取产品类型和产品分类 */ -func GetProductCate(apiKey string, param map[string]string) (string, error) { - s, err := send("index/typecate", apiKey, param) +func GetProductCate(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/typecate", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -49,8 +49,8 @@ func GetProductCate(apiKey string, param map[string]string) (string, error) { 自发查询订单状态 out_trade_nums string CZH668877,CZH9988666 true 商户订单号;多个用英文,分割 */ -func GetOrder(apiKey string, param map[string]string) (string, error) { - s, err := send("index/check", apiKey, param) +func GetOrder(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/check", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -59,8 +59,8 @@ func GetOrder(apiKey string, param map[string]string) (string, error) { /*** 电费支持地区查询 */ -func GetArea(apiKey string, param map[string]string) (string, error) { - s, err := send("index/elecity", apiKey, param) +func GetArea(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/elecity", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err @@ -83,8 +83,8 @@ param1 string * false 扩展参数,后台查看提交的产品类目是否需 param2 string * false 扩展参数,后台查看提交的产品类目是否需要提交此参数 param3 string * false 扩展参数,后台查看提交的产品类目是否需要提交此参数 */ -func Pay(apiKey string, param map[string]string) (string, error) { - s, err := send("index/recharge", apiKey, param) +func Pay(url, apiKey string, param map[string]string) (string, error) { + s, err := send(url, "index/recharge", apiKey, param) fmt.Println(s) fmt.Println(err) return s, err