1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace Util\DaDa;
- use Mall\Framework\Core\ResultWrapper;
- use Util\DaDa\Common;
- class Merchant
- {
- private $objCommon;
-
- private $baseUrl = 'http://newopen.qa.imdada.cn';
-
- private $commonHeader = [
- CURLOPT_HTTPHEADER => [
- 'Content-Type: application/json'
- ],
- ];
- public function __construct($appKey='', $appSecret = '', $sourceId)
- {
- $this->objCommon = new Common($appKey, $appSecret, $sourceId);
- }
-
- 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());
- }
- }
|