1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * 达达商户管理接口
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2020/11/12
- * Time: 10:52 AM
- */
- namespace Util\DaDa;
- use Mall\Framework\Core\ResultWrapper;
- use Util\DaDa\Common;
- class Merchant
- {
- private $objCommon;
- // 基础域名
- private $baseUrl = 'http://newopen.qa.imdada.cn';
- //公共header头
- private $commonHeader = [
- CURLOPT_HTTPHEADER => [
- 'Content-Type: application/json'
- ],
- ];
- public function __construct($appKey='', $appSecret = '', $sourceId)
- {
- $this->objCommon = new Common($appKey, $appSecret, $sourceId);
- }
- /**
- * 官方文档地址: http://newopen.imdada.cn/#/development/file/cityList?_k=m88rtv
- * 获取城市信息列表
- *
- */
- public function cityCodeList()
- {
- $postData = $this->objCommon->CommonRequestParams();
- $postData['body'] = '';
- $postData['signature'] = $this->objCommon->getSignature($postData);
- $url = $this->baseUrl . '/api/cityCode/list';
- $response = request($url, json_encode($postData, JSON_UNESCAPED_UNICODE), 5, true, $this->commonHeader);
- $result = $this->objCommon->commonResponse($response);
- if (!$result->isSuccess()) {
- return ResultWrapper::fail($result->getData(), $result->getErrorCode());
- }
- return ResultWrapper::success($result->getData());
- }
- }
|