addShopExample.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. header("Content-Type: text/html;charset=utf-8");
  3. //参考文档 http://newopen.imdada.cn/#/development/file/shopAdd?_k=zumioz
  4. define("BASE_DIR", dirname(__FILE__) . "/");
  5. require_once BASE_DIR . 'api/shopAddApi.php';
  6. require_once BASE_DIR . 'client/dadaRequestClient.php';
  7. require_once BASE_DIR . 'client/dadaResponse.php';
  8. require_once BASE_DIR . 'config/config.php';
  9. require_once BASE_DIR . 'model/shopAddModel.php';
  10. //*********************1.配置项*************************
  11. $config = new Config(0, false);
  12. //*********************2.实例化一个model*************************
  13. $shopModel = new ShopAddModel();
  14. $shopModel->setStationName('xxxxxxxxxxxxxx'); // 门店名称
  15. $shopModel->setBusiness(1);
  16. $shopModel->setCityName('xxxxxxxxxx'); // 根据实际情况填写
  17. $shopModel->setAreaName('xxxxxxxxxx');
  18. $shopModel->setStationAddress("xxxxxxxxxxxx");
  19. $shopModel->setLat(0);
  20. $shopModel->setLng(0);
  21. $shopModel->setContactName('xxxxxxxxxxxxxx');
  22. $shopModel->setPhone('xxxxxxxxxxxx');
  23. $shopModel->setOriginShopId('xxxxxxxxxx'); // 第三方门店编号,发单时候使用
  24. // 批量接口
  25. $shopList = array($shopModel);
  26. //*********************3.实例化一个api*************************
  27. $shopAddApi = new AddShopApi(json_encode($shopList));
  28. //***********************4.实例化客户端请求************************
  29. $dada_client = new DadaRequestClient($config, $shopAddApi);
  30. $resp = $dada_client->makeRequest();
  31. echo json_encode($resp);