| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764 |
- <?php
- namespace common\components;
- use yii\helpers\Json;
- use linslin\yii2\curl;
- use bizHd\wx\classes\WxOpenClass;
- class IntraCityExpress
- {
- /**
- * 获取 access_token
- * @param $merchant
- * @param int $ptStyle
- * @return string
- */
- public static function getAccessToken($merchant, $ptStyle = 0)
- {
- if ($ptStyle == 0) {
- $ptStyle = dict::getDict('ptStyle', 'hd');
- }
- // 直接复用 miniUtil 的获取小程序 access_token 方法
- return miniUtil::getMiniProgramAccessToken($merchant, $ptStyle);
- }
- public static function getMerchant()
- {
- $merchant = WxOpenClass::getWxInfo();
- return $merchant;
- }
- private static function generateSign($method, $url, $timestamp, $nonce, $body, $merchant)
- {
- $appId = $merchant['miniAppId'];
- $serialNo = $merchant['serial_no'];
- $privateKey = $merchant['private_key']; // Ensure this is the raw private key content
- $parsedUrl = parse_url($url);
- $path = $parsedUrl['path'] . (isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : '');
- $message = "{$method}\n{$path}\n{$timestamp}\n{$nonce}\n{$body}\n";
- openssl_sign($message, $signature, $privateKey, 'sha256WithRSAEncryption');
- $base64Signature = base64_encode($signature);
- return sprintf(
- 'WECHATPAY2-SHA256-RSA2048 appid=%s,timestamp="%d",nonce_str="%s",signature="%s",serial_no="%s"',
- $appId,
- $timestamp,
- $nonce,
- $base64Signature,
- $serialNo
- );
- }
- /**
- * 发送HTTP请求
- * @param string $url 请求URL
- * @param array $data 请求数据
- * @param string $accessToken access_token
- * @return array
- */
- public static function sendRequest($url, $data, $accessToken, $merchant = null)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $curl = new curl\Curl();
- // 添加access_token到URL
- $urlWithToken = $url . (strpos($url, '?') !== false ? '&' : '?') . 'access_token=' . $accessToken;
- $timestamp = time();
- $nonce = \Yii::$app->security->generateRandomString();
- $body = Json::encode($data);
- if ($body === '[]') {
- $body = '{}';
- }
- //$signature = self::generateSign('POST', $urlWithToken, $timestamp, $nonce, $body, $merchant);
- $response = $curl->setOption(CURLOPT_POSTFIELDS, $body)
- ->setOption(CURLOPT_HTTPHEADER, [
- 'Content-Type: application/json',
- 'Accept: application/json',
- //'Authorization: ' . $signature
- ])
- ->post($urlWithToken);
- // 确保响应是字符串格式再进行JSON解码
- if (is_array($response)) {
- return $response;
- }
- return Json::decode($response, true);
- }
- public static function emptyRequest($url, $accessToken)
- {
- $curl = new curl\Curl();
- // 添加access_token到URL
- $urlWithToken = $url . (strpos($url, '?') !== false ? '&' : '?') . 'access_token=' . $accessToken;
- $response = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode(new \stdClass()))
- ->setOption(CURLOPT_HTTPHEADER, ['Content-Type: application/json'])
- ->post($urlWithToken);
- // 确保响应是字符串格式再进行JSON解码
- if (is_array($response)) {
- return $response;
- }
-
- return Json::decode($response, true);
- }
- // ==================== API URL常量 ====================
- const API_BASE_URL = 'https://api.weixin.qq.com/cgi-bin/express/intracity';
- // 门店管理
- const API_CREATE_STORE = self::API_BASE_URL . '/createstore';
- const API_UPDATE_STORE = self::API_BASE_URL . '/updatestore';
- const API_QUERY_STORE = self::API_BASE_URL . '/querystore';
- // 开通门店权限
- const API_APPLY_STORE = self::API_BASE_URL . '/apply';
- // 订单管理
- const API_ADD_ORDER = self::API_BASE_URL . '/addorder';
- const API_CANCEL_ORDER = self::API_BASE_URL . '/cancelorder';
- const API_GET_ORDER = self::API_BASE_URL . '/queryorder';
- // 预下单
- const API_PRE_ADD_ORDER = self::API_BASE_URL . '/preaddorder';
- // 资金管理
- const API_GET_BALANCE = self::API_BASE_URL . '/getbalance';
- const API_CHARGE_STORE = self::API_BASE_URL . '/chargestore';
- const API_REFUND_STORE = self::API_BASE_URL . '/refundstore';
- const API_GET_CHARGE_RECORD = self::API_BASE_URL . '/getchargerecord';
- // 测试接口
- const API_MOCK_NOTIFY = self::API_BASE_URL . '/mocknotify';
- // ==================== 门店管理接口 ====================
- /**
- * 创建门店
- * @param array $storeData 门店信息
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function createStore($storeData, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- // $re = self::applyStore($merchant, $ptStyle);
- // if (!is_array($re)) {
- // $re = Json::decode($re, true);
- // }
- // if ($re['errcode'] != 0) {
- // return $re;
- // }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [
- 'out_store_id' => $storeData['out_store_id'],
- 'store_name' => $storeData['store_name'],
- 'store_address' => $storeData['store_address'],
- 'store_longitude' => $storeData['store_longitude'],
- 'store_latitude' => $storeData['store_latitude'],
- 'store_phone' => $storeData['store_phone'],
- 'service_type' => $storeData['service_type'] ?? 1, // 默认同城配送
- ];
-
- return self::sendRequest(self::API_CREATE_STORE, $data, $accessToken, $merchant);
- }
- /**
- * 更新门店
- * @param array $storeData 门店信息
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function updateStore($storeData, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $data = [
- 'out_store_id' => $storeData['out_store_id'],
- 'store_name' => $storeData['store_name'] ?? null,
- 'store_address' => $storeData['store_address'] ?? null,
- 'store_longitude' => $storeData['store_longitude'] ?? null,
- 'store_latitude' => $storeData['store_latitude'] ?? null,
- 'store_phone' => $storeData['store_phone'] ?? null,
- ];
-
- return self::sendRequest(self::API_UPDATE_STORE, $data, $accessToken, $merchant);
- }
- /**
- * 查询门店
- * @param string $outStoreId 门店ID
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function getStore($outStoreId, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [
- 'out_store_id' => $outStoreId,
- ];
-
- return self::sendRequest(self::API_QUERY_STORE, $data, $accessToken, $merchant);
- }
- /**
- * 开通门店权限
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function applyStore($merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- return self::sendRequest(self::API_APPLY_STORE, new \stdClass(), $accessToken, $merchant);
- //return self::getRequest(self::API_APPLY_STORE, $accessToken);
- }
- // ==================== 订单管理接口 ====================
- /**
- * 创建订单
- * @param array $orderData 订单信息
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function createOrder($orderData, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [
- 'out_store_id' => $orderData['out_store_id'],
- 'store_order_id' => $orderData['store_order_id'], // 注意:文档是 store_order_id,不是 out_order_id
- 'delivery_service_code' => $orderData['delivery_service_code'],
- 'receiver' => [
- 'name' => $orderData['to_user_name'],
- 'phone' => $orderData['to_user_phone'],
- 'address' => $orderData['to_user_address'],
- 'lng' => $orderData['to_user_longitude'],
- 'lat' => $orderData['to_user_latitude'],
- ],
- 'cargo' => [
- 'goods_value' => $orderData['goods_value'],
- 'goods_weight' => $orderData['goods_weight'],
- 'goods_pickup_info' => $orderData['goods_pickup_info'],
- 'goods_delivery_info' => $orderData['goods_delivery_info'],
- 'cargo_first_class' => $orderData['cargo_first_class'] ?? '',
- 'cargo_second_class' => $orderData['cargo_second_class'] ?? '',
- 'goods_type' => $orderData['goods_type'] ?? 99,
- ],
- 'order' => [
- 'order_type' => $orderData['order_type'] ?? 0,
- 'expected_pickup_time' => $orderData['expected_pickup_time'] ?? 0,
- 'expected_delivery_time' => $orderData['expected_delivery_time'] ?? 0,
- 'tips' => $orderData['tips'] ?? 0,
- 'is_insured' => $orderData['is_insured'] ?? 0,
- 'declared_value' => $orderData['declared_value'] ?? 0,
- 'cash_on_delivery' => $orderData['cash_on_delivery'] ?? 0,
- 'cash_on_delivery_value' => $orderData['cash_on_delivery_value'] ?? 0,
- ],
- 'sub_biz_id' => $orderData['sub_biz_id'] ?? '',
- ];
-
- return self::sendRequest(self::API_ADD_ORDER, $data, $accessToken, $merchant);
- }
- /**
- * 预下单(查询运费)
- * @param array $orderData
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function preAddOrder($orderData, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- // 构建与 createOrder 相同的请求体
- $data = [
- 'out_store_id' => $orderData['out_store_id'],
- 'store_order_id' => $orderData['store_order_id'],
- 'delivery_service_code' => $orderData['delivery_service_code'],
- 'receiver' => [
- 'name' => $orderData['to_user_name'],
- 'phone' => $orderData['to_user_phone'],
- 'address' => $orderData['to_user_address'],
- 'lng' => $orderData['to_user_longitude'],
- 'lat' => $orderData['to_user_latitude'],
- ],
- 'cargo' => [
- 'goods_value' => $orderData['goods_value'],
- 'goods_weight' => $orderData['goods_weight'],
- 'goods_pickup_info' => $orderData['goods_pickup_info'],
- 'goods_delivery_info' => $orderData['goods_delivery_info'],
- 'cargo_first_class' => $orderData['cargo_first_class'] ?? '',
- 'cargo_second_class' => $orderData['cargo_second_class'] ?? '',
- 'goods_type' => $orderData['goods_type'] ?? 99,
- ],
- 'order' => [
- 'order_type' => $orderData['order_type'] ?? 0,
- 'expected_pickup_time' => $orderData['expected_pickup_time'] ?? 0,
- 'expected_delivery_time' => $orderData['expected_delivery_time'] ?? 0,
- 'tips' => $orderData['tips'] ?? 0,
- 'is_insured' => $orderData['is_insured'] ?? 0,
- 'declared_value' => $orderData['declared_value'] ?? 0,
- 'cash_on_delivery' => $orderData['cash_on_delivery'] ?? 0,
- 'cash_on_delivery_value' => $orderData['cash_on_delivery_value'] ?? 0,
- ],
- 'sub_biz_id' => $orderData['sub_biz_id'] ?? '',
- ];
- return self::sendRequest(self::API_PRE_ADD_ORDER, $data, $accessToken, $merchant);
- }
- /**
- * 取消订单
- * @param string $wxOrderId 微信订单号
- * @param string $outOrderId 商户订单号
- * @param string $outStoreId 门店ID
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function cancelOrder($wxOrderId = '', $outOrderId = '', $outStoreId = '', $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [];
- if (!empty($wxOrderId)) {
- $data['wx_order_id'] = $wxOrderId;
- }
- if (!empty($outOrderId)) {
- $data['store_order_id'] = $outOrderId;
- }
- if (!empty($outStoreId)) {
- $data['out_store_id'] = $outStoreId;
- }
-
- return self::sendRequest(self::API_CANCEL_ORDER, $data, $accessToken, $merchant);
- }
- /**
- * 查询订单
- * @param string $wxOrderId 微信订单号
- * @param string $outOrderId 商户订单号
- * @param string $outStoreId 门店ID
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function getOrder($wxOrderId = '', $outOrderId = '', $outStoreId = '', $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [];
- if (!empty($wxOrderId)) {
- $data['wx_order_id'] = $wxOrderId;
- }
- if (!empty($outOrderId)) {
- $data['store_order_id'] = $outOrderId;
- }
- if (!empty($outStoreId)) {
- $data['out_store_id'] = $outStoreId;
- }
-
- return self::sendRequest(self::API_GET_ORDER, $data, $accessToken, $merchant);
- }
- /**
- * 获取订单列表
- * @param int $offset 偏移量
- * @param int $limit 限制数量
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function getOrderList($offset = 0, $limit = 20, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $url = 'https://api.weixin.qq.com/cgi-bin/express/intracity/order/list';
-
- $data = [
- 'offset' => $offset,
- 'limit' => $limit,
- ];
-
- return self::sendRequest($url, $data, $accessToken, $merchant);
- }
- // ==================== 运力管理接口 ====================
- /**
- * 获取运力列表
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function getDeliveryList($merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $url = 'https://api.weixin.qq.com/cgi-bin/express/intracity/delivery/list';
-
- return self::sendRequest($url, new \stdClass(), $accessToken, $merchant);
- }
- /**
- * 获取运力服务范围
- * @param string $deliveryId 运力ID
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function getDeliveryServiceArea($deliveryId, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $url = 'https://api.weixin.qq.com/cgi-bin/express/intracity/delivery/service_area';
-
- $data = [
- 'delivery_id' => $deliveryId,
- ];
-
- return self::sendRequest($url, $data, $accessToken, $merchant);
- }
- // ==================== 资金管理接口 ====================
- /**
- * 查询门店余额
- * @param string $outStoreId
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function getBalance($outStoreId, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $data = ['out_store_id' => $outStoreId];
- return self::sendRequest(self::API_GET_BALANCE, $data, $accessToken, $merchant);
- }
- /**
- * 门店充值
- * @param string $outStoreId
- * @param string $outChargeId
- * @param int $amount
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function chargeStore($outStoreId, $outChargeId, $amount, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $data = [
- 'out_store_id' => $outStoreId,
- 'out_charge_id' => $outChargeId,
- 'amount' => $amount,
- ];
- return self::sendRequest(self::API_CHARGE_STORE, $data, $accessToken, $merchant);
- }
- /**
- * 门店退款
- * @param string $outStoreId
- * @param string $outRefundId
- * @param string $outChargeId
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function refundStore($outStoreId, $outRefundId, $outChargeId, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $data = [
- 'out_store_id' => $outStoreId,
- 'out_refund_id' => $outRefundId,
- 'out_charge_id' => $outChargeId,
- ];
- return self::sendRequest(self::API_REFUND_STORE, $data, $accessToken, $merchant);
- }
- /**
- * 查询充值记录
- * @param string $outChargeId
- * @param null $merchant
- * @param int $ptStyle
- * @return array
- */
- public static function getChargeRecord($outChargeId, $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
- $accessToken = self::getAccessToken($merchant, $ptStyle);
- $data = ['out_charge_id' => $outChargeId];
- return self::sendRequest(self::API_GET_CHARGE_RECORD, $data, $accessToken, $merchant);
- }
- // ==================== 测试接口 ====================
- /**
- * 模拟回调接口
- * @param string $wxOrderId 微信订单号
- * @param string $outStoreId 门店ID
- * @param string $outOrderId 商户订单号
- * @param int $orderStatus 订单状态
- * @param string $merchant 商户信息
- * @param int $ptStyle
- * @return array
- */
- public static function mockNotify($orderStatus, $wxOrderId = '', $outStoreId = '', $outOrderId = '', $merchant = null, $ptStyle = 0)
- {
- if ($merchant === null) {
- $merchant = self::getMerchant();
- }
-
- $accessToken = self::getAccessToken($merchant, $ptStyle);
-
- $data = [
- 'order_status' => $orderStatus,
- ];
-
- if (!empty($wxOrderId)) {
- $data['wx_order_id'] = $wxOrderId;
- }
- // 注意:文档中模拟回调使用的是 wx_store_id 和 store_order_id
- if (!empty($outStoreId) && !empty($outOrderId)) {
- $data['wx_store_id'] = $outStoreId;
- $data['store_order_id'] = $outOrderId;
- }
-
- return self::sendRequest(self::API_MOCK_NOTIFY, $data, $accessToken, $merchant);
- }
- /**
- * 生成回调签名
- * @param array $params 回调参数
- * @param string $token 安全token
- * @return string
- */
- public static function generateCallbackSignature($params, $token)
- {
- // 1. 筛选出参与签名的字段
- $signParams = [];
- $fieldsToSign = ['appid', 'order_status', 'service_trans_id', 'status_change_time', 'store_order_id', 'timestamp', 'wx_order_id', 'wx_store_id'];
- foreach ($fieldsToSign as $field) {
- if (isset($params[$field])) {
- $signParams[$field] = $params[$field];
- }
- }
-
- // 2. 按字典序排序参数
- ksort($signParams);
-
- // 3. 拼接参数字符串
- $signStr = '';
- foreach ($signParams as $key => $value) {
- $signStr .= $key . '=' . $value . '&';
- }
- $signStr .= 'token=' . $token;
-
- // 4. 计算MD5并转为小写
- return strtolower(md5($signStr));
- }
- // ==================== 回调验证接口 ====================
- /**
- * 验证回调签名
- * @param array $params 回调参数
- * @param string $token 安全token
- * @return bool
- */
- public static function verifyCallback($params, $token)
- {
- if (!isset($params['sign'])) {
- return false;
- }
-
- $receivedSign = $params['sign'];
- unset($params['sign']);
-
- $calculatedSign = self::generateCallbackSignature($params, $token);
-
- return $receivedSign === $calculatedSign;
- }
- /**
- * 处理订单状态回调
- * @param array $callbackData 回调数据
- * @param string $token 安全token
- * @return array
- */
- public static function handleOrderCallback($callbackData, $token)
- {
- // 验证签名
- if (!self::verifyCallback($callbackData, $token)) {
- return [
- 'return_code' => 1,
- 'return_msg' => '签名验证失败'
- ];
- }
-
- // 处理订单状态变化
- $orderStatus = $callbackData['order_status'];
- $wxOrderId = $callbackData['wx_order_id'];
- $outOrderId = $callbackData['store_order_id'] ?? '';
- $outStoreId = $callbackData['wx_store_id'] ?? '';
-
- // 这里可以添加具体的业务逻辑处理
- // 例如:更新数据库中的订单状态、发送通知等
-
- // 伪代码示例:
- /*
- switch ($orderStatus) {
- case 10000: // 订单创建成功
- // 处理订单创建成功逻辑
- break;
- case 30000: // 配送员接单
- // 处理配送员接单逻辑
- break;
- case 40000: // 配送员到店
- // 处理配送员到店逻辑
- break;
- case 50000: // 配送中
- // 处理配送中逻辑
- break;
- case 70000: // 配送完成
- // 处理配送完成逻辑
- break;
- case 20000: // 商家取消订单
- case 20001: // 配送方取消订单
- case 60000: // 配送员撤单
- // 处理订单取消逻辑
- break;
- case 90000: // 配送异常
- // 处理配送异常逻辑
- break;
- }
- */
-
- return [
- 'return_code' => 0,
- 'return_msg' => 'OK'
- ];
- }
- // ==================== 常量定义 ====================
- /**
- * 订单状态常量
- */
- const ORDER_STATUS_CREATED = 10000; // 订单创建成功
- const ORDER_STATUS_CANCELED_BY_MERCHANT = 20000; // 商家取消订单
- const ORDER_STATUS_CANCELED_BY_DELIVERY = 20001; // 配送方取消订单
- const ORDER_STATUS_ACCEPTED = 30000; // 配送员接单
- const ORDER_STATUS_ARRIVED = 40000; // 配送员到店
- const ORDER_STATUS_DELIVERING = 50000; // 配送中
- const ORDER_STATUS_WITHDRAWN = 60000; // 配送员撤单
- const ORDER_STATUS_COMPLETED = 70000; // 配送完成
- const ORDER_STATUS_EXCEPTION = 90000; // 配送异常
- /**
- * 物品类型常量
- */
- const GOODS_TYPE_FAST_FOOD = 1; // 快餐
- const GOODS_TYPE_MEDICINE = 2; // 药品
- const GOODS_TYPE_GENERAL = 3; // 百货
- const GOODS_TYPE_FRESH = 6; // 生鲜
- const GOODS_TYPE_WINE = 8; // 酒品
- const GOODS_TYPE_DOCUMENT = 12; // 文件
- const GOODS_TYPE_CAKE = 13; // 蛋糕
- const GOODS_TYPE_FLOWER = 14; // 鲜花
- const GOODS_TYPE_DIGITAL = 15; // 数码
- const GOODS_TYPE_CLOTHING = 16; // 服装
- const GOODS_TYPE_AUTO_PARTS = 17; // 汽配
- const GOODS_TYPE_JEWELRY = 18; // 珠宝
- const GOODS_TYPE_DRINK = 32; // 饮料
- const GOODS_TYPE_LICENSE = 36; // 证照
- const GOODS_TYPE_PET = 55; // 宠物用品
- const GOODS_TYPE_MATERNITY = 56; // 母婴用品
- const GOODS_TYPE_COSMETICS = 57; // 美妆用品
- const GOODS_TYPE_HOME = 58; // 家居建材
- const GOODS_TYPE_OTHER = 99; // 其他
- /**
- * 运力常量
- */
- const DELIVERY_DADA = 'DADA'; // 达达
- const DELIVERY_SFTC = 'SFTC'; // 顺丰同城
- }
|