|
|
@@ -13,6 +13,7 @@ use ghs\models\delivery\CreateOrderForm;
|
|
|
use ghs\models\delivery\OrderDetailForm;
|
|
|
use Yii;
|
|
|
use yii\web\Response;
|
|
|
+use yii\helpers\ArrayHelper;
|
|
|
|
|
|
/**
|
|
|
* 聚合配送(自配 + 聚合动力)
|
|
|
@@ -86,7 +87,12 @@ class DeliveryController extends BaseController
|
|
|
{
|
|
|
//闪送授权(商户授权:授权后能为商户下所有门店发单)
|
|
|
$auth = new \common\components\delivery\platform\shansong\Auth();
|
|
|
- $redirectUrl = 'https://api.shop.hzghd.com/delivery/shansong-auth-callback';
|
|
|
+ if(getenv('YII_ENV') == 'production') {
|
|
|
+ $apiHost = Yii::$app->params['ghsHost'];
|
|
|
+ } else {
|
|
|
+ $apiHost = Yii::$app->params['ghsHost'];
|
|
|
+ }
|
|
|
+ $redirectUrl = $apiHost . '/delivery/shansong-auth-callback';
|
|
|
$authUrl = $auth->generateMerchantAuthUrl($this->mainId, $redirectUrl);
|
|
|
|
|
|
// 重定向用户
|
|
|
@@ -98,7 +104,8 @@ class DeliveryController extends BaseController
|
|
|
{
|
|
|
$huoLalaAuth = new \common\components\delivery\platform\huolala\Auth();
|
|
|
$mainId = $this->mainId;
|
|
|
- $redirectUrl = 'https://api.shop.hzghd.com/delivery/huolala-auth-callback' . '?mainId=' . $mainId;
|
|
|
+ $apiHost = Yii::$app->params['ghsHost'];
|
|
|
+ $redirectUrl = $apiHost . '/delivery/huolala-auth-callback' . '?mainId=' . $mainId;
|
|
|
$authUrl = $huoLalaAuth->generateAuthUrl($redirectUrl);
|
|
|
|
|
|
//header('Location: ' . $authUrl);
|
|
|
@@ -109,7 +116,7 @@ class DeliveryController extends BaseController
|
|
|
{
|
|
|
$fengnaioAuth = new \common\components\delivery\platform\fengniao\Auth();
|
|
|
$mainId = $this->mainId;
|
|
|
- $redirectUrl = 'https://api.shop.hzghd.com/delivery/fengniao-auth-callback' . '?mainId=' . $mainId;
|
|
|
+ $redirectUrl = Yii::$app->params['ghsHost'] . '/delivery/fengniao-auth-callback' . '?mainId=' . $mainId;
|
|
|
$authUrl = $fengnaioAuth->generateAuthUrl($redirectUrl);
|
|
|
|
|
|
util::success(['url'=>$authUrl]);
|
|
|
@@ -121,7 +128,7 @@ class DeliveryController extends BaseController
|
|
|
$ticket = $dadaAuth->getTicket();
|
|
|
|
|
|
$mainId = $this->mainId;
|
|
|
- $redirectUrl = 'https://api.shop.hzghd.com/delivery/dada-auth-callback' . '?mainId=' . $mainId;
|
|
|
+ $redirectUrl = Yii::$app->params['ghsHost'] . '/delivery/dada-auth-callback' . '?mainId=' . $mainId;
|
|
|
$shopNumber = '40d8391f9b05477b';
|
|
|
$state = 'huidiao_biaoshi';
|
|
|
$authUrl = $dadaAuth->generateAuthUrl($ticket, $state, $shopNumber);
|
|
|
@@ -252,6 +259,9 @@ class DeliveryController extends BaseController
|
|
|
|
|
|
$ds = new DispatchService($this->mainId);
|
|
|
$platformQuotes = $ds->getAllPlatformPrice($order, $shop, $orderTime);
|
|
|
+ if(isset($platformQuotes['error'])){
|
|
|
+ util::fail($platformQuotes['error']);
|
|
|
+ }
|
|
|
|
|
|
$deliveryList = [];
|
|
|
foreach ($platformQuotes['quotes'] as $item) {
|
|
|
@@ -339,6 +349,9 @@ class DeliveryController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 按 price 从低到高排序
|
|
|
+ ArrayHelper::multisort($deliveryList, 'price', SORT_ASC);
|
|
|
+
|
|
|
$ret['deliveryList'] = $deliveryList;
|
|
|
util::success($ret, "success");
|
|
|
}
|