|
|
@@ -2,8 +2,11 @@
|
|
|
|
|
|
namespace hd\controllers;
|
|
|
|
|
|
+use bizHd\express\classes\ExpressClass;
|
|
|
use bizHd\merchant\services\ExpressService;
|
|
|
use bizHd\merchant\services\ShopService;
|
|
|
+use bizHd\purchase\classes\PurchaseClass;
|
|
|
+use common\components\dict;
|
|
|
use Yii;
|
|
|
use yii\web\Controller;
|
|
|
use common\components\util;
|
|
|
@@ -11,19 +14,50 @@ use common\components\util;
|
|
|
class ExpressController extends BaseController
|
|
|
{
|
|
|
|
|
|
- //计算客户距离和运费 ssh 2020.5.14
|
|
|
- public function actionGetUserDistance()
|
|
|
- {
|
|
|
- //经度
|
|
|
- $lng = Yii::$app->request->get('lng', '');
|
|
|
- //纬度
|
|
|
- $lat = Yii::$app->request->get('lat', '');
|
|
|
- if (empty($lng) || empty($lat)) {
|
|
|
- util::fail('经度或纬度不能为空');
|
|
|
- }
|
|
|
- $shopId = ShopService::getDefaultShopId($this->sj);
|
|
|
- $respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->sjExtend);
|
|
|
- util::success($respond);
|
|
|
- }
|
|
|
+ //获取采购单物流运单的轨迹 ssh 20250705
|
|
|
+ public function actionGetCgExpressTrack()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $cg = PurchaseClass::getById($id, true);
|
|
|
+ if (empty($cg)) {
|
|
|
+ util::fail('没有找到订单');
|
|
|
+ }
|
|
|
+ if ($cg->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单');
|
|
|
+ }
|
|
|
+ $bizIdMap = dict::getDict('expressBizIdMap');
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ $bizId = $bizIdMap[$mainId] ?? 0;
|
|
|
+ if (empty($bizId)) {
|
|
|
+ util::fail('没有找到月结账号');
|
|
|
+ }
|
|
|
+ //暂时只支持顺丰
|
|
|
+ $deliveryId = 'SF';
|
|
|
+ } else {
|
|
|
+ $deliveryId = 'TEST';
|
|
|
+ $bizId = 'test_biz_id';
|
|
|
+ }
|
|
|
+ $params = [
|
|
|
+ 'deliveryId' => $deliveryId,
|
|
|
+ 'bizId' => $bizId,
|
|
|
+ ];
|
|
|
+ ExpressClass::getTrack($params);
|
|
|
+ }
|
|
|
+
|
|
|
+ //计算客户距离和运费 ssh 2020.5.14
|
|
|
+ public function actionGetUserDistance()
|
|
|
+ {
|
|
|
+ //经度
|
|
|
+ $lng = Yii::$app->request->get('lng', '');
|
|
|
+ //纬度
|
|
|
+ $lat = Yii::$app->request->get('lat', '');
|
|
|
+ if (empty($lng) || empty($lat)) {
|
|
|
+ util::fail('经度或纬度不能为空');
|
|
|
+ }
|
|
|
+ $shopId = ShopService::getDefaultShopId($this->sj);
|
|
|
+ $respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->sjExtend);
|
|
|
+ util::success($respond);
|
|
|
+ }
|
|
|
|
|
|
}
|