【開源】GreaterWMS 抖音SDK呼叫教程

傲嬌的程式媛發表於2022-03-31

應用介紹

GreaterWMS 抖音SDK呼叫教程

SDK具體功能:

  • 1,一倉多店,多倉多店
  • 2,庫存同步,商品同步
  • 3,快遞發貨,物流軌跡
  • 4,訂單攔截
  • 5,位元組雲倉
  • 6,精選聯盟
  • 7,供應分銷
  • 8,售後退款,賬單

對應的API連結

建立抖店

  • 去抖音官方建立個商家應用
  • 抖店應用會給到3個Key,APPID,APP_SECRET,SHOP_ID
  • 在GreaterWMS電商店鋪中,抖音頁面新增一個店鋪
  • 填入之前獲得的3個Key和店鋪名稱
  • GreaterWMS會給這個店鋪生成一個唯一值,用來實現一倉多店的唯一性

沙箱環境開啟

  • 沙箱環境為了安全起見,並不能通過前端去修改,以免使用者誤點
  • 向以下路徑post一個json data

{

  "t_code": "{ 你剛才在GreaterWMS會給這個店鋪生成一個唯一值 }",

  "sandbox": "{ 將sandbox調整成開啟還是關閉,開始是1,關閉是0 }"

}

  • 由此來控制店鋪是否正式運營上線,預設是正式環境

代理IP開啟

  • 代理IP為了安全起見,並不能通過前端去修改,以免使用者誤點
  • 向以下路徑post一個json data

{

  "t_code": "{ 你剛才在GreaterWMS會給這個店鋪生成一個唯一值 }",

  "proxy": "{ 將代理調整成開啟還是關閉,開始是1,關閉是0 }",

  "proxy_ip": "{ 代理ip,是一個json資料 }"

}

  • 代理設定,None或者{"https": " "},詳細格式參見
  • 由此來控制店鋪是否正式使用代理,預設是不使用


安裝

  • 下載外掛
  •    
  • 放到GreaterWMS根目錄下面

    pip install GreaterWMS_DouYin-1.0.0-py3-none-any.whl


  • 版本的更新,安裝的外掛名會不同,請自行調整版本
  • 註冊app

INSTALLED_APPS = [

    '...',

    '...',

    'douyin'

]

API呼叫例子

# 在views.py

from douyin.views.ding_dan.order_searchList import OrderSearchList


class Test(OrderSearchList):

    def __init__(self):

        self.params = {}

        self.param.product_id = "3539925204033339668"

        self.param.out_product_id = "11111"

        self.param.show_draft = "true"


# urls.py

from django.urls import path

from .views import Test


urlpatterns = [

    path(r'test/', Test.as_view({"post": "create"}), name="test")

]

  • 接下來只要向這個介面POST一個之前提到的店鋪唯一值,"t_code" 就可以獲取資料
回撥的示例

{

  "data": {

    "account_template_id": "1",

    "after_sale_service": "{\"supply_7day_return\":\"2\"}",

    "appoint_delivery_day": "2",

    "brand_id": "12344",

    "car_vin_code": "VIN11111111111111",

    "category_detail": {

      "first_cid": "23264",

      "first_cname": "教育培訓",

      "fourth_cid": "0",

      "fourth_cname": "-",

      "second_cid": "0",

      "second_cname": "學習卡",

      "third_cid": "0",

      "third_cname": "-"

    },

    "cdf_category": "1",

    "check_status": "1",

    "create_time": "2021-03-29 15:52:52",

    "delivery_delay_day": "2",

    "delivery_method": "7",

    "description": "<img src=\\\"\\\" style=\\\"width:100%;\\\">",

    "discount_price": "12000",

    "draft_status": "2",

    "extra": "-",

    "img": "

    "is_create": "1",

    "is_sub_product": "true",

    "limit_per_buyer": "5",

    "logistics_info": {

      "brand_country_id": "123",

      "customs_clear_type": "1",

      "net_weight_qty": "100",

      "origin_country_id": "123",

      "source_country_id": "123",

      "tax_payer": "0"

    },

    "market_price": "12000",

    "maximum_per_order": "5",

    "minimum_per_order": "1",

    "mobile": "15677775555",

    "name": "xxx爽膚水",

    "need_recharge_mode": "false",

    "open_user_id": "1",

    "out_product_id": "11111",

    "outer_product_id": "11111",

    "pay_type": "1",

    "pic": "[\"\"]",

    "poi_resource": {

      "coupon_return_methods": "[1]"

    },

    "presell_config_level": "2",

    "presell_delay": "4",

    "presell_type": "1",

    "price_has_tax": "0",

    "product_format": "{\"貨號\":\"8888\"}",

    "product_format_new": "{\"1088\":[{\"Value\":0,\"Name\":\"小33學二年級\",\"PropertyId\":1088,\"PropertyName\":\"適用學齡段\",\"diy_type\":1}],\"1319\":[{\"Value\":0,\"Name\":\"1\",\"PropertyId\":1319,\"PropertyName\":\"適用地區\",\"diy_type\":0}],\"1618\":[{\"Value\":0,\"Name\":\"9787218122861\",\"PropertyId\":1618,\"PropertyName\":\"ISBN編號\",\"diy_type\":0}],\"1831\":[{\"Value\":0,\"Name\":\"小學英語看圖說話寫話二年級\",\"PropertyId\":1831,\"PropertyName\":\"書名\",\"diy_type\":0}],\"2000\":[{\"Value\":34762,\"Name\":\"無\",\"PropertyId\":2000,\"PropertyName\":\"作者地區\",\"diy_type\":0}],\"2229\":[{\"Value\":0,\"Name\":\"1\",\"PropertyId\":2229,\"PropertyName\":\"編者\",\"diy_type\":0}],\"3271\":[{\"Value\":0,\"Name\":\"1\",\"PropertyId\":3271,\"PropertyName\":\"出版時間\",\"diy_type\":0}],\"449\":[{\"Value\":0,\"Name\":\"1\",\"PropertyId\":449,\"PropertyName\":\"作者\",\"diy_type\":0}],\"501\":[{\"Value\":7310,\"Name\":\"否\",\"PropertyId\":501,\"PropertyName\":\"是否是套裝\",\"diy_type\":0}],\"855\":[{\"Value\":0,\"Name\":\"陝西人民教育出版社\",\"PropertyId\":855,\"PropertyName\":\"出版社名稱\",\"diy_type\":0}]}",

    "product_id": "3539925204033339668",

    "product_id_str": "3539925204033339668",

    "quality_list": [

      {

        "quality_attachments": [

          {

            "media_type": "1",

            "url": "***.com/YYYY"

          }

        ],

        "quality_key": "3457***9470978",

        "quality_name": "進貨憑證"

      }

    ],

    "recommend_remark": "真的很好啊",

    "spec_id": "1",

    "spec_pics": [

      {

        "pic": "temai/b637513c50b994f4c89de56a17886caca5d6569awww800-800",

        "spec_detail_id": "1695459998447656"

      }

    ],

    "spec_prices": [

      {

        "code": "aaa",

        "customs_report_info": {

          "bar_code": "-",

          "first_measure_qty": "1",

          "first_measure_unit": "-",

          "g_model": "-",

          "hs_code": "1564564",

          "report_brand_name": "-",

          "report_name": "-",

          "second_measure_qty": "1",

          "second_measure_unit": "-",

          "unit": "-",

          "usage": "-"

        },

        "lock_step_stock_num": "1",

        "lock_stock_num": "1",

        "out_sku_id": "0",

        "outer_sku_id": "0",

        "presell_delay": "5",

        "price": "102",

        "prom_step_stock_num": "0",

        "prom_stock_num": "0",

        "promotion_step_stock_num": "0",

        "promotion_stock_num": "0",

        "sku_id": "1695459998495774",

        "sku_type": "0",

        "spec_detail_id1": "1695459998494734",

        "spec_detail_id2": "1695459998494734",

        "spec_detail_id3": "0",

        "spec_detail_ids": "[1695459998494734, 1695459998494766]",

        "step_stock_num": "0",

        "stock_num": "13",

        "stock_num_map": {},

        "supplier_id": "123",

        "tax_exemption_sku_info": {

          "is_suit": "1",

          "suit_num": "10",

          "volume": "100"

        }

      }

    ],

    "specs": [

      {

        "id": "1713023986705415",

        "is_leaf": "0",

        "name": "顏色",

        "pid": "1713023986705415",

        "spec_id": "1713023983665214",

        "values": [

          {

            "id": "1695459998447656",

            "is_leaf": "1",

            "name": "紅色",

            "pid": "1695459998447640",

            "spec_id": "1713023983665214",

            "status": "1"

          }

        ]

      }

    ],

    "standard_brand_id": "121354",

    "status": "1",

    "update_time": "2021-03-29T15:52:52+08:00"

  },

  "err_no": 0,

  "message": "success",

  "code": 10000,

  "msg": "success",

  "sub_code": "",

  "sub_msg": ""

}

  • 一定要POST店鋪唯一值,這樣系統才會判斷是哪個店鋪發起的請求


訊息推送

# 在views.py

from douyin.views.notify import NotifyAPI


class Notify(NotifyAPI):

    def __init__(self):

        self.params = {}


# urls.py

from django.urls import path

from .views import Notify


urlpatterns = [

    path(r'notify/', Notify.as_view({"post": "create"}), name="notify")

]

  • 接下來只要向這個介面POST一個之前提到的店鋪唯一值,"t_code" 就可以獲取資料
  • 一定要POST店鋪唯一值,這樣系統才會判斷是哪個店鋪發起的請求


下載地址

 


技術交流群↓



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70016074/viewspace-2885235/,如需轉載,請註明出處,否則將追究法律責任。

相關文章