1
This commit is contained in:
@@ -22,8 +22,10 @@ const (
|
|||||||
CmdShopUnbindMsg = "shop.unbind.msg"
|
CmdShopUnbindMsg = "shop.unbind.msg"
|
||||||
|
|
||||||
//IM消息回调通知
|
//IM消息回调通知
|
||||||
CmdImMessageSendEvent = "im.message.send.event" //用户/骑手消息通知
|
CmdImMessageSendEvent = "im.message.send.event" // 用户/骑手消息通知
|
||||||
CmdImMessageReadEvent = "im.message.read.event" //用户/骑手已读通知
|
CmdImMessageReadEvent = "im.message.read.event" // 用户/骑手已读通知
|
||||||
|
CmdImInvoicApply = "invoice.apply.push" // 用户发送发票申请
|
||||||
|
CmdImInvoicEmail = "invoice.email.push" // 发票用户重发邮件
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
114
platformapi/ebaiapi/invoice.go
Normal file
114
platformapi/ebaiapi/invoice.go
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
package ebaiapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UploadInvoice 上传发票回复
|
||||||
|
func (a *API) UploadInvoice(baiduShopId, applicationNo, fileUrl string) (*UploadInvoiceResult, error) {
|
||||||
|
param := &UpdateInvoice{
|
||||||
|
BaiduShopId: baiduShopId,
|
||||||
|
ShopId: "",
|
||||||
|
RequestList: nil,
|
||||||
|
}
|
||||||
|
requestList := make([]ApplicationList, 0, 0)
|
||||||
|
requestList = append(requestList, ApplicationList{
|
||||||
|
ApplicationNo: applicationNo,
|
||||||
|
Status: "",
|
||||||
|
InvoiceList: nil,
|
||||||
|
FileUrl: fileUrl,
|
||||||
|
InvoiceClass: "",
|
||||||
|
InvoiceCode: "",
|
||||||
|
InvoiceDate: "",
|
||||||
|
InvoiceMaterial: "",
|
||||||
|
InvoiceNo: "",
|
||||||
|
Memo: "",
|
||||||
|
LineList: nil,
|
||||||
|
MachineCode: "",
|
||||||
|
SellerInfo: SellerInfo{},
|
||||||
|
TaxAmount: "",
|
||||||
|
ValidationCode: "",
|
||||||
|
})
|
||||||
|
param.RequestList = requestList
|
||||||
|
|
||||||
|
data, err := a.AccessAPI("invoice.apply.batchUpdate", utils.Struct2Map(param, "", false))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if data.ErrNo != 0 {
|
||||||
|
return nil, fmt.Errorf(data.Error)
|
||||||
|
}
|
||||||
|
result := &UploadInvoiceResult{}
|
||||||
|
if err = utils.UnmarshalUseNumber(utils.MustMarshal(data.Data), result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UploadInvoiceResult struct {
|
||||||
|
SuccessfulApplicationNoList []string `json:"successful_application_no_list"`
|
||||||
|
FailedApplicationNoList []string `json:"failed_application_no_list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateInvoice 申请
|
||||||
|
type UpdateInvoice struct {
|
||||||
|
BaiduShopId string `json:"baidu_shop_id"`
|
||||||
|
ShopId string `json:"shop_id"`
|
||||||
|
RequestList []ApplicationList `json:"request_list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApplicationList struct {
|
||||||
|
ApplicationNo string `json:"application_no"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
InvoiceList []InvoiceList `json:"buyer_title"`
|
||||||
|
FileUrl string `json:"file_url"`
|
||||||
|
InvoiceClass string `json:"invoice_class"`
|
||||||
|
InvoiceCode string `json:"invoice_code"`
|
||||||
|
InvoiceDate string `json:"invoice_date"`
|
||||||
|
InvoiceMaterial string `json:"invoice_material"`
|
||||||
|
InvoiceNo string `json:"invoice_no"`
|
||||||
|
Memo string `json:"memo"`
|
||||||
|
LineList []LineList `json:"line_list"`
|
||||||
|
MachineCode string `json:"machine_code"`
|
||||||
|
SellerInfo SellerInfo `json:"seller_info"`
|
||||||
|
TaxAmount string `json:"tax_amount"`
|
||||||
|
ValidationCode string `json:"validation_code"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type InvoiceList struct {
|
||||||
|
AmountWithTax float64 `json:"amount_with_tax"`
|
||||||
|
AmountWithoutTax float64 `json:"amount_without_tax"`
|
||||||
|
BuyerTitle struct {
|
||||||
|
BankAccount string `json:"bank_account"`
|
||||||
|
BankName string `json:"bank_name"`
|
||||||
|
RegisterAddress string `json:"register_address"`
|
||||||
|
RegisterPhone string `json:"register_phone"`
|
||||||
|
TaxPayerNum string `json:"tax_payer_num"`
|
||||||
|
TitleName string `json:"title_name"`
|
||||||
|
TitleType string `json:"title_type"`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type LineList struct {
|
||||||
|
AmountWithoutTax float64 `json:"amount_without_tax"`
|
||||||
|
CargoName string `json:"cargo_name"`
|
||||||
|
CargoNo string `json:"cargo_no"`
|
||||||
|
Quantity int `json:"quantity"`
|
||||||
|
Specification string `json:"specification"`
|
||||||
|
TaxAmount int `json:"tax_amount"`
|
||||||
|
TaxRate float64 `json:"tax_rate"`
|
||||||
|
Unit string `json:"unit"`
|
||||||
|
UnitPrice float64 `json:"unit_price"`
|
||||||
|
}
|
||||||
|
type SellerInfo struct {
|
||||||
|
BankAccount string `json:"bank_account"`
|
||||||
|
BankName string `json:"bank_name"`
|
||||||
|
Checker string `json:"checker"`
|
||||||
|
Clerk string `json:"clerk"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Payee string `json:"payee"`
|
||||||
|
RegisterAddress string `json:"register_address"`
|
||||||
|
RegisterPhone string `json:"register_phone"`
|
||||||
|
TaxPayerNum string `json:"tax_payer_num"`
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package ebaiapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -327,6 +328,7 @@ func (a *API) SkuCreate(trackInfo, shopID string, customSkuID int64, params map[
|
|||||||
KeyShopID: shopID,
|
KeyShopID: shopID,
|
||||||
KeyCustomSkuID: customSkuID,
|
KeyCustomSkuID: customSkuID,
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("----SkuCreate,params1 -- : %s", utils.Format4Output(params, false))
|
||||||
if params["upc"] == nil {
|
if params["upc"] == nil {
|
||||||
defParams["upc"] = "upc-" + utils.Int2Str(int(customSkuID))
|
defParams["upc"] = "upc-" + utils.Int2Str(int(customSkuID))
|
||||||
}
|
}
|
||||||
@@ -337,6 +339,7 @@ func (a *API) SkuCreate(trackInfo, shopID string, customSkuID int64, params map[
|
|||||||
defParams["brand_name"] = "无" // 很狗血的是,你还必须填个无才行。。。
|
defParams["brand_name"] = "无" // 很狗血的是,你还必须填个无才行。。。
|
||||||
}*/
|
}*/
|
||||||
params = utils.MergeMaps(params, defParams)
|
params = utils.MergeMaps(params, defParams)
|
||||||
|
globals.SugarLogger.Debugf("----SkuCreate,params2 -- : %s", utils.Format4Output(params, false))
|
||||||
result, err := a.AccessAPI2("sku.create", params, trackInfo)
|
result, err := a.AccessAPI2("sku.create", params, trackInfo)
|
||||||
if err == nil && result.Data != nil {
|
if err == nil && result.Data != nil {
|
||||||
return utils.Interface2Int64WithDefault(result.Data.(map[string]interface{})[KeySkuID], 0), nil
|
return utils.Interface2Int64WithDefault(result.Data.(map[string]interface{})[KeySkuID], 0), nil
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ func TestDeleteStoreSku(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteSku(t *testing.T) {
|
func TestDeleteSku(t *testing.T) {
|
||||||
shopId := "669283"
|
shopId := "667410"
|
||||||
param1 := &SkuListParams{
|
param1 := &SkuListParams{
|
||||||
Page: 1,
|
Page: 1,
|
||||||
PageSize: 100,
|
PageSize: 100,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mtwmapi
|
package mtwmapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -8,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func TestBillList(t *testing.T) {
|
func TestBillList(t *testing.T) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
from := time.Date(now.Year(), now.Month(), now.Day()-2, 0, 0, 0, 0, time.Local)
|
from := time.Date(now.Year(), now.Month(), now.Day()-5, 0, 0, 0, 0, time.Local)
|
||||||
to := time.Date(now.Year(), now.Month(), now.Day()-2, 23, 59, 59, 59, time.Local)
|
to := time.Date(now.Year(), now.Month(), now.Day()-2, 23, 59, 59, 59, time.Local)
|
||||||
param := &Bill{
|
param := &Bill{
|
||||||
AppPoiCode: "4418003",
|
AppPoiCode: "4418003",
|
||||||
@@ -19,13 +20,13 @@ func TestBillList(t *testing.T) {
|
|||||||
AccessToken: api.token,
|
AccessToken: api.token,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, _, err := api.GetStoreBillList(param)
|
_, fine, _, err := api.GetStoreBillList(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Debugf("err := %v", err)
|
globals.SugarLogger.Debugf("err := %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//globals.SugarLogger.Debugf("settleId := %d", settleId)
|
globals.SugarLogger.Debugf("settleId := %s", utils.Format4Output(fine, false))
|
||||||
//for _, v := range data {
|
//for _, v := range data {
|
||||||
// globals.SugarLogger.Debugf("OrderId : %s , TimingFee : %d , DeliveryFee : %d , PlatformSettlement : %d ", v.OrderId, v.TimingFee, v.DeliveryFee, v.PlatformSettlement)
|
// globals.SugarLogger.Debugf("OrderId : %s , TimingFee : %d , DeliveryFee : %d , PlatformSettlement : %d ", v.OrderId, v.TimingFee, v.DeliveryFee, v.PlatformSettlement)
|
||||||
//}
|
//}
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ func TestRdbSet(t *testing.T) {
|
|||||||
func TestSendMsg(t *testing.T) {
|
func TestSendMsg(t *testing.T) {
|
||||||
data := PushContentReq{
|
data := PushContentReq{
|
||||||
AppID: 589,
|
AppID: 589,
|
||||||
AppPoiCode: "7290541",
|
AppPoiCode: "29066882",
|
||||||
MsgID: 1729566539763500,
|
MsgID: 175758059520401,
|
||||||
MsgContent: "cqH27xu/6vS+eqmykE39nA==",
|
MsgContent: "v+JsErdWUcxwSLVPfXgw7+0chcSyHbInTQOgcOGGLaGnb92NO9Iut8rgpGDQbvYYjjPzX7XCcEud/ECwcZskl+HoQF6Qa+La1++qGurBov0=",
|
||||||
MsgSource: 1,
|
MsgSource: 1,
|
||||||
MsgType: 1,
|
MsgType: 2,
|
||||||
Cts: int(time.Now().Unix()),
|
Cts: int(time.Now().Unix()),
|
||||||
OrderID: 3801305470340611516,
|
OrderID: 0,
|
||||||
OpenUserID: 9548822498,
|
OpenUserID: 9020915181,
|
||||||
}
|
}
|
||||||
dataMar, err := json.Marshal(data)
|
dataMar, err := json.Marshal(data)
|
||||||
fmt.Println(string(dataMar))
|
fmt.Println(string(dataMar))
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ func (a *API) UploadInvoice(orderId, invoiceUrl, invoiceId, taskId string) (err
|
|||||||
for _, v := range resp.(map[string]interface{})["error_list"].([]interface{}) {
|
for _, v := range resp.(map[string]interface{})["error_list"].([]interface{}) {
|
||||||
errMsg = append(errMsg, v.(map[string]interface{})["msg"].(string))
|
errMsg = append(errMsg, v.(map[string]interface{})["msg"].(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return fmt.Errorf("%s", strings.Join(errMsg, ","))
|
return fmt.Errorf("%s", strings.Join(errMsg, ","))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -149,7 +150,7 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{
|
|||||||
}
|
}
|
||||||
signURL := a.genURL(cmd) + "?"
|
signURL := a.genURL(cmd) + "?"
|
||||||
params[signKey] = a.signParams(signURL, params)
|
params[signKey] = a.signParams(signURL, params)
|
||||||
//globals.SugarLogger.Debugf("test mtCancelAct cmd=%s sig=%s", cmd, utils.Format4Output(params, false))
|
globals.SugarLogger.Debugf("-----sing := %s", params[signKey].(string))
|
||||||
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
func() *http.Request {
|
func() *http.Request {
|
||||||
var request *http.Request
|
var request *http.Request
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nld07Y5m8rEQZJMMrvZGmA")
|
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nld07Y5m8rEQZJMMrvZGmA")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package mtwmapi
|
package mtwmapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -471,6 +472,52 @@ type CategoryAttrValueListResult struct {
|
|||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RetailProductRules 根据末级美团分类ID获取图片发布规则
|
||||||
|
func (a *API) RetailProductRules(tagID int64) (*ProductRulesObj, error) {
|
||||||
|
result, err := a.AccessAPI2("retail/product/rules", true, map[string]interface{}{
|
||||||
|
"tag_id": tagID,
|
||||||
|
}, "success_map", "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rules := &ProductRulesObj{}
|
||||||
|
if result != nil {
|
||||||
|
resultByte, _ := json.Marshal(result)
|
||||||
|
err = utils.UnmarshalUseNumber(resultByte, rules)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rules, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductRulesObj struct {
|
||||||
|
StructRules []struct {
|
||||||
|
RuleId int `json:"rule_id"`
|
||||||
|
RuleName string `json:"rule_name"`
|
||||||
|
ValueList []struct {
|
||||||
|
IsByDefault bool `json:"is_by_default"`
|
||||||
|
ValueId int `json:"value_id"`
|
||||||
|
ValueName string `json:"value_name"`
|
||||||
|
} `json:"value_list"`
|
||||||
|
} `json:"struct_rules"`
|
||||||
|
UnstructRules struct {
|
||||||
|
QualificationPicturesRule struct {
|
||||||
|
IsQualificationPicturesNeed int `json:"is_qualification_pictures_need"`
|
||||||
|
} `json:"qualification_pictures_rule"`
|
||||||
|
SpecialPicturesRules []struct {
|
||||||
|
IsDisplayed int `json:"is_displayed"`
|
||||||
|
IsRequired int `json:"is_required"`
|
||||||
|
NumLimit int `json:"num_limit"`
|
||||||
|
SpecialPictureDescription string `json:"special_picture_description"`
|
||||||
|
SpecialPictureExample string `json:"special_picture_example"`
|
||||||
|
SpecialPictureTitle string `json:"special_picture_title"`
|
||||||
|
SpecialPictureType int `json:"special_picture_type"`
|
||||||
|
} `json:"special_pictures_rules"`
|
||||||
|
} `json:"unstruct_rules"`
|
||||||
|
}
|
||||||
|
|
||||||
//category/attr/value/list 查询特殊属性的属性值列表
|
//category/attr/value/list 查询特殊属性的属性值列表
|
||||||
//https://open-shangou.meituan.com/home/docDetail/387
|
//https://open-shangou.meituan.com/home/docDetail/387
|
||||||
func (a *API) CategoryAttrValueList(attr_id int64, keyword string) (categoryAttrValueListResult []*CategoryAttrValueListResult, err error) {
|
func (a *API) CategoryAttrValueList(attr_id int64, keyword string) (categoryAttrValueListResult []*CategoryAttrValueListResult, err error) {
|
||||||
|
|||||||
@@ -462,3 +462,9 @@ func TestDeleteCat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRetailProductRules(t *testing.T) {
|
||||||
|
result, err := api.RetailProductRules(200002538)
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
t.Log(err)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user