1
This commit is contained in:
@@ -44,6 +44,14 @@ func (c *ProductListV2Request) GetParams() *ProductListV2Param {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
//草稿箱:status=0 and check_status=1 and draft_status=1或0
|
||||
//在售:status=0&&check_status=3
|
||||
//审核中:status=0 and check_status=2 and draft_status=2
|
||||
//新版本审核中:status=0 and check_status=3 and draft_status=2
|
||||
//封禁中:status=1 and check_status=5 and draft_status=0
|
||||
//上架的商品被下架放入仓库中:status=1 and check_status=1 and draft_status=0
|
||||
//延迟上架,放入仓库中(start_sale_type=1):status=1 and check_status=7 and draft_status=0
|
||||
//删除:status=2 and check_status=1 and draft_status=0
|
||||
type ProductListV2Param struct {
|
||||
// 商品在店铺中状态: 0-在线;1-下线;2-删除;详见商品状态机:https://op.jinritemai.com/docs/question-docs/92/2070
|
||||
Status int64 `json:"status"`
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// 京西速食(蔬菜)
|
||||
var token1 = `{"access_token":"ntx7g036841j7t4nq1hehos0000yhugi-11","expires_in":1745854497,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"u2d0v1sjz11j7t4nq1hehos0000yhugi-12","authority_id":""}`
|
||||
var token1 = `{"access_token":"tb0o54fcco1j7t4nq1hehos0000yhugi-11","expires_in":1746456141,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"fep4bvr9yf1j7t4nq1hehos0000yhugi-12","authority_id":""}`
|
||||
|
||||
// 美好菜市
|
||||
//var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`
|
||||
|
||||
@@ -174,7 +174,7 @@ func TestBatchDecrypt(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
var c = []int64{190504428}
|
||||
var c = []int64{173965249}
|
||||
|
||||
// 删除已经创建商品,重新同步
|
||||
func TestDeleteSkuAndUploadSku(t *testing.T) {
|
||||
@@ -183,7 +183,8 @@ func TestDeleteSkuAndUploadSku(t *testing.T) {
|
||||
for _, v := range c {
|
||||
for i := 1; i < 100; i++ {
|
||||
result, err := a.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
|
||||
CheckStatus: 4, // 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架
|
||||
Status: 1,
|
||||
CheckStatus: 1, // 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架
|
||||
Page: int64(i),
|
||||
Size: 100,
|
||||
StoreId: v,
|
||||
|
||||
@@ -280,3 +280,32 @@ type OnLineOrderRefundResult struct {
|
||||
Bankcode string `json:"bankcode"` // 所属银行
|
||||
Sign string `json:"sign"` // 签名
|
||||
}
|
||||
|
||||
// AddTermReq 添加采集设备
|
||||
type AddTermReq struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Devicetype string `json:"devicetype"` // 设备类型 否
|
||||
Termsn string `json:"termsn"` // 终端序列号 终端类型(device_type)填写为 02、03、04、05、06、08、09 或 10时,必须填写终端序列号。
|
||||
Operation string `json:"operation"` // 本次操作标识,取值范围:00:新增;01:修改;02:注销;(注销时,仅需上送termno字段)
|
||||
Termstate string `json:"termstate"` // 取值范围:00:启用;01:注销;注:终端注销时非必填
|
||||
Termaddress string `json:"termaddress"` // 终端地址
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
// AddTermQuery 采集设备查询
|
||||
type AddTermQuery struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
Querytype string `json:"querytype"`
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ const (
|
||||
OnlinePayUrl = `https://vsp.allinpay.com/apiweb/unitorder/scanqrpay` // 扫码支付
|
||||
OnLineTransactionQuery = `https://vsp.allinpay.com/apiweb/tranx/query` // 交易查询,查询订单的支付状态
|
||||
OnLineRefund = `https://vsp.allinpay.com/apiweb/tranx/refund` // 同一退款接口
|
||||
OnLineAddterm = `https://vsp.allinpay.com/cusapi/merchantapi/addterm` // 添加设备终端
|
||||
OnLineAddTerm = `https://vsp.allinpay.com/cusapi/merchantapi/addterm` // 添加设备终端
|
||||
OnLineQuerYTerm = `https://vsp.allinpay.com/cusapi/merchantapi/qryterm` // 查询设备终端
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -127,7 +128,7 @@ func (a *API) OrderRefund(param *OnLineOrderRefundParam) (statusCode, errRemake
|
||||
// TLAddTerm 采集门店终端设备信息
|
||||
func (a *API) TLAddTerm(param *AddTermReq) error {
|
||||
onlineReq := utils.Struct2Map(param, "", false)
|
||||
result, err := a.AccessAPI2(OnLineAddterm, onlineReq)
|
||||
result, err := a.AccessAPI2(OnLineAddTerm, onlineReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -137,51 +138,24 @@ func (a *API) TLAddTerm(param *AddTermReq) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddTermReq struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Devicetype string `json:"devicetype"` // 设备类型 否
|
||||
Termsn string `json:"termsn"` // 终端序列号 终端类型(device_type)填写为 02、03、04、05、06、08、09 或 10时,必须填写终端序列号。
|
||||
Operation string `json:"operation"` // 本次操作标识,取值范围:00:新增;01:修改;02:注销;(注销时,仅需上送termno字段)
|
||||
Termstate string `json:"termstate"` // 取值范围:00:启用;01:注销;注:终端注销时非必填
|
||||
Termaddress string `json:"termaddress"` // 终端地址
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
// TLQueryTerm 采集门店终端设备信息查询
|
||||
func (a *API) TLQueryTerm(param *AddTermQuery) error {
|
||||
func (a *API) TLQueryTerm(param *AddTermQuery) (string, error) {
|
||||
onlineReq := utils.Struct2Map(param, "", false)
|
||||
result, err := a.AccessAPI2("https://vsp.allinpay.com/cusapi/merchantapi/qryterm", onlineReq)
|
||||
result, err := a.AccessAPI2(OnLineQuerYTerm, onlineReq)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
if result["retcode"].(string) != "SUCCESS" {
|
||||
return fmt.Errorf(result["retmsg"].(string))
|
||||
return "", fmt.Errorf(result["retmsg"].(string))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddTermQuery struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
Querytype string `json:"querytype"`
|
||||
return fmt.Sprintf("微信报备:%s,阿里报备:%s", result["wxmsg"].(string), result["almsg"].(string)), nil
|
||||
}
|
||||
|
||||
func (a *API) AccessAPI2(action string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||
params := make(map[string]interface{})
|
||||
params["appid"] = a.appID
|
||||
params["cusid"] = a.cusID
|
||||
if action != OnLineAddterm {
|
||||
if action != OnLineAddTerm {
|
||||
params["randomstr"] = utils.GetUUID()
|
||||
}
|
||||
params["version"] = "12"
|
||||
|
||||
Reference in New Issue
Block a user