Quellcode durchsuchen

门店与拓展信息

shish vor 5 Jahren
Ursprung
Commit
1090eed54a

+ 12 - 0
biz/shop/classes/ShopExtClass.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace biz\shop\classes;
+use Yii;
+use biz\base\classes\BaseClass;
+
+class ShopExtClass extends BaseClass
+{
+
+    public static $baseFile = '\biz\shop\models\ShopExt';
+
+}

+ 13 - 0
biz/shop/models/ShopExt.php

@@ -0,0 +1,13 @@
+<?php
+namespace biz\shop\models;
+use biz\base\models\Base;
+
+class ShopExt extends Base
+{
+
+	public static function tableName()
+	{
+		return 'xhShopExt';
+	}
+
+}

+ 14 - 0
biz/shop/services/ShopExtService.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace biz\shop\services;
+
+use biz\base\services\BaseService;
+use common\components\util;
+use Yii;
+
+class ShopExtService extends BaseService
+{
+
+	public static $baseFile = '\biz\shop\classes\ShopExtClass';
+
+}

+ 5 - 0
biz/sj/services/MerchantService.php

@@ -2,6 +2,7 @@
 
 namespace biz\sj\services;
 
+use biz\shop\classes\ShopExtClass;
 use biz\sj\classes\SjClass;
 use biz\wx\classes\WxMessageClass;
 use bizGhs\custom\services\CustomService;
@@ -172,6 +173,10 @@ class MerchantService extends BaseService
         ];
         $shopRespond = \biz\shop\classes\ShopClass::addShop($shopData);
         $shopId = $shopRespond->id;
+        $extData = [
+            'shopId' => $shopId,
+        ];
+        ShopExtClass::add($extData);
 
         //供应商添加客户时暂时先不初始化
         if (isset($applyData['replace']) == false || $applyData['replace'] != 1) {

+ 31 - 0
console/controllers/ShopExtController.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace console\controllers;
+
+use biz\shop\classes\ShopClass;
+use biz\shop\classes\ShopExtClass;
+use yii\console\Controller;
+use Yii;
+
+class ShopExtController extends Controller
+{
+
+    //补充门店拓展信息 shish ./yii shop-ext/bc
+    public function actionBc()
+    {
+        $list = ShopClass::getAllByCondition([], null, '*', null, true);
+        if (!empty($list)) {
+            foreach ($list as $shop) {
+                $shopId = $shop->id;
+                $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
+                if (empty($ext)) {
+                    $extData = [
+                        'shopId' => $shopId
+                    ];
+                    ShopExtClass::add($extData);
+                }
+            }
+        }
+    }
+
+}