|
|
@@ -0,0 +1,42 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace hd\controllers;
|
|
|
+
|
|
|
+use bizGhs\order\classes\ShMethodClass;
|
|
|
+use bizHd\ghs\classes\GhsClass;
|
|
|
+use Yii;
|
|
|
+use common\components\util;
|
|
|
+
|
|
|
+class ShMethodController extends BaseController
|
|
|
+{
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取供货商所有的5种配送方式配置
|
|
|
+ * 如果数据库里没有,则取默认配置进行初始化
|
|
|
+ */
|
|
|
+ public function actionGetAllConfig()
|
|
|
+ {
|
|
|
+ $ghsId = Yii::$app->request->get('ghsId', 0);
|
|
|
+ $ghs = GhsClass::getById($ghsId);
|
|
|
+ if (empty($ghs)) {
|
|
|
+ util::fail('没有供货商信息');
|
|
|
+ }
|
|
|
+ if ($ghs['ownMainId'] != $this->mainId) {
|
|
|
+ util::fail('不是你的供货商');
|
|
|
+ }
|
|
|
+ $shopId = $ghs['shopId'] ?? 0;
|
|
|
+ $mainId = $ghs['mainId'] ?? 0;
|
|
|
+
|
|
|
+ if (!in_array($shopId, [36523, 0])) {
|
|
|
+ util::success([]);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ $configs = ShMethodClass::getAllConfigs($shopId, $mainId);
|
|
|
+ util::success(['method' => $configs]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ util::fail($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|