shish 5 лет назад
Родитель
Сommit
272164149c

+ 20 - 37
app-ghs/controllers/BaseController.php

@@ -45,51 +45,34 @@ class BaseController extends PublicController
             util::fail('帐号无效');
         }
         $this->admin = $admin;
-        $header = httpUtil::getHeader();
-        $lookShopId = $header['shop-id'] ?? 0;
-        if (!empty($lookShopId)) {
-            //商城和下单页
+
+        //后台
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        if (empty($currentShopId)) {
             if (in_array($action->id, $this->guestAccess) == false) {
-                util::fail('您没有权限访问哦~');
+                util::fail('您没有权限访问哦');
             }
-            $shop = ShopClass::getById($lookShopId);
+        } else {
+            $this->shopId = $currentShopId;
+            $shop = ShopClass::getShopInfo($currentShopId);
+            $this->shop = $shop;
             if (empty($shop)) {
-                util::fail('没有找到店铺');
+                util::fail('没有找到您管理的门店');
+            }
+            $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
+            if (empty($shopAdmin)) {
+                util::fail('没有找到员工信息');
             }
-            $this->lookShopId = $lookShopId;
-            $sjId = $shop['merchantId'] ?? 0;
+            $this->shopAdmin = $shopAdmin;
+            $this->shopAdminId = $shopAdmin['id'] ?? 0;
+            $sjId = $shop['merchantId'];
+            $this->sjId = $sjId;
             $sj = MerchantService::getMerchantById($sjId);
-            $sjExtend = MerchantExtendClass::getByMerchantId($sjId);
             $this->sj = $sj;
+            $sjExtend = MerchantExtendService::getByMerchantId($sjId);
             $this->sjExtend = $sjExtend;
-        } else {
-            //后台
-            $currentShopId = $admin['currentShopId'] ?? 0;
-            if(empty($currentShopId)){
-                if( in_array($action->id, $this->guestAccess) == false){
-                    util::fail('您没有权限访问哦!');
-                }
-            }else{
-                $this->shopId = $currentShopId;
-                $shop = ShopClass::getShopInfo($currentShopId);
-                $this->shop = $shop;
-                if (empty($shop)) {
-                    util::fail('没有找到您管理的门店');
-                }
-                $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
-                if (empty($shopAdmin)) {
-                    util::fail('没有找到员工信息');
-                }
-                $this->shopAdmin = $shopAdmin;
-                $this->shopAdminId = $shopAdmin['id'] ?? 0;
-                $sjId = $shop['merchantId'];
-                $this->sjId = $sjId;
-                $sj = MerchantService::getMerchantById($sjId);
-                $this->sj = $sj;
-                $sjExtend = MerchantExtendService::getByMerchantId($sjId);
-                $this->sjExtend = $sjExtend;
-            }
         }
+
         return parent::beforeAction($action);
     }
 

+ 16 - 49
app-hd/controllers/BaseController.php

@@ -3,17 +3,10 @@
 namespace hd\controllers;
 
 use bizHd\admin\classes\AdminClass;
-use bizHd\admin\services\ShopAdminService;
-use bizHd\custom\classes\CustomClass;
 use biz\shop\classes\ShopAdminClass;
 use biz\sj\classes\MerchantExtendClass;
-use bizHd\merchant\classes\ShopClass;
-use bizHd\merchant\services\AdminService;
-use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
 use bizHd\merchant\services\ShopService;
-use bizHd\wx\services\WxOpenService;
-use common\components\httpUtil;
 use common\components\jwt;
 use Yii;
 use common\components\util;
@@ -47,58 +40,32 @@ class BaseController extends PublicController
         $adminId = $admin['id'];
         $this->admin = $admin;
         $this->adminId = $adminId;
-        $header = httpUtil::getHeader();
-        $lookShopId = $header['shop-id'] ?? 0;
 
-        if (!empty($lookShopId)) {
-            //商城
+        //后台
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        if (empty($currentShopId)) {
             if (in_array($action->id, $this->guestAccess) == false) {
-                util::fail('您没有权限访问');
+                util::fail('您不是员工没有权限访问');
             }
-            $shop = ShopClass::getById($lookShopId);
+        } else {
+            $this->shopId = $currentShopId;
+            $shop = ShopService::getById($currentShopId);
+            $this->shop = $shop;
             if (empty($shop)) {
                 util::fail('没有找到店铺');
             }
-            $sjId = $shop['merchantId'] ?? 0;
-            //新增并获取客户信息
-            $custom = CustomClass::replaceCustom($sjId, $admin);
-            $customId = $custom['id'] ?? 0;
-            if (empty($customId)) {
-                util::fail('没有找到客户信息');
+            $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
+            if (empty($shopAdmin)) {
+                util::fail('没有找到员工信息');
             }
-            $this->custom = $custom;
-            $this->customId = $customId;
+            $this->shopAdmin = $shopAdmin;
+            $this->shopAdminId = $shopAdmin['id'] ?? 0;
+            $sjId = $shop['merchantId'];
             $this->sjId = $sjId;
             $sj = MerchantService::getMerchantById($sjId);
             $this->sj = $sj;
-            $this->sjExtend = MerchantExtendClass::getByMerchantId($sjId);
-        } else {
-            //后台
-            $currentShopId = $admin['currentShopId'] ?? 0;
-            if (empty($currentShopId)) {
-                if (in_array($action->id, $this->guestAccess) == false) {
-                    util::fail('您不是员工没有权限访问');
-                }
-            } else {
-                $this->shopId = $currentShopId;
-                $shop = ShopService::getById($currentShopId);
-                $this->shop = $shop;
-                if (empty($shop)) {
-                    util::fail('没有找到店铺');
-                }
-                $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
-                if (empty($shopAdmin)) {
-                    util::fail('没有找到员工信息');
-                }
-                $this->shopAdmin = $shopAdmin;
-                $this->shopAdminId = $shopAdmin['id'] ?? 0;
-                $sjId = $shop['merchantId'];
-                $this->sjId = $sjId;
-                $sj = MerchantService::getMerchantById($sjId);
-                $this->sj = $sj;
-                $sjExtend = MerchantExtendClass::getByMerchantId($sjId);
-                $this->sjExtend = $sjExtend;
-            }
+            $sjExtend = MerchantExtendClass::getByMerchantId($sjId);
+            $this->sjExtend = $sjExtend;
         }
 
         return parent::beforeAction($action);

+ 1 - 0
app-hd/controllers/CategoryController.php

@@ -13,6 +13,7 @@ class CategoryController extends BaseController
     //分类列表
     public function actionList()
     {
+
         $list = CategoryService::getCategoryList($this->sjId);
         util::success($list);
     }

+ 2 - 2
app-hd/controllers/ProductController.php

@@ -120,14 +120,14 @@ class ProductController extends BaseController
             if (empty($id)) {
                 if (!empty($this->shopId)) {
                     $ghs = GhsClass::build($shopId, $this->shopId, $this->sjId);
-                    $sjId = $ghs['ghsSjId'] ?? 0;
+                    $sjId = $ghs['sjId'] ?? 0;
                 } else {
                     $shop = ShopClass::getShopInfo($shopId);
                     $sjId = $shop['merchantId'] ?? 0;
                 }
             } else {
                 $ghs = GhsClass::getGhsInfo($id);
-                $sjId = $ghs['ghsSjId'] ?? 0;
+                $sjId = $ghs['sjId'] ?? 0;
             }
             $transaction->commit();
 

+ 2 - 2
app-hd/controllers/PurchaseController.php

@@ -25,7 +25,7 @@ class PurchaseController extends BaseController
         if (empty($supplier)) {
             util::fail('没有找到供货商');
         }
-        $ghsShopId = $supplier['ghsShopId'] ?? 0;
+        $currentShopId = $supplier['shopId'] ?? 0;
         $post['merchantId'] = $this->sjId;
         $post['shopId'] = $this->shopId;
         $post['shopAdminId'] = $this->shopAdminId;
@@ -35,7 +35,7 @@ class PurchaseController extends BaseController
         $product = $post['product'] ?? '';
         $productList = json_decode($product, true);
         //判断product数据是不是同个供货商的
-        ProductClass::valid($productList, $ghsShopId);
+        ProductClass::valid($productList, $currentShopId);
         $post['product'] = $productList;
         $respond = PurchaseClass::addPurchase($post);
         $orderSn = $respond['orderSn'] ?? '';

+ 15 - 19
app-pt/controllers/GhsController.php

@@ -15,55 +15,51 @@ class GhsController extends BaseController
 
     public $guestAccess = [];
 
-    //绑定供货商 shish 2021.3.29
+    //绑定供货商 shish 2021.3.29 !!!!!!!!!!!!!!!!!!!!!!这个方法有问题,绑了供货商,没互绑客户 todo
     public function actionBindGhs()
     {
         $get = Yii::$app->request->get();
+        $ownSjId = $get['ownSjId'] ?? '';
         $sjId = $get['sjId'] ?? '';
-        $ghsSjId = $get['ghsSjId'] ?? '';
-        if ($sjId == $ghsSjId) {
+        if ($ownSjId == $sjId) {
             util::fail('不能绑自己');
         }
-        $sj = MerchantClass::getMerchantById($sjId);
+        $sj = MerchantClass::getMerchantById($ownSjId);
         if (isset($sj['style']) == false || $sj['style'] != SjClass::STYLE_SUPPLIER) {
             util::fail('城市供货商才能发起绑定');
         }
-        $ghsSj = MerchantClass::getMerchantById($ghsSjId);
+        $ghsSj = MerchantClass::getMerchantById($sjId);
         if (isset($ghsSj['style']) == false || $ghsSj['style'] != SjClass::STYLE_KM_SUPPLIER) {
             util::fail('请选择昆明供货商');
         }
-        $count = ShopClass::getCount(['delStatus' => 0, 'merchantId' => $sjId]);
+        $count = ShopClass::getCount(['delStatus' => 0, 'merchantId' => $ownSjId]);
         if ($count > 1) {
             util::fail('发起人已经不止一家门店,不能再进行绑定');
         }
-        $shop = ShopClass::getByCondition(['delStatus' => 0, 'merchantId' => $sjId]);
+        $shop = ShopClass::getByCondition(['delStatus' => 0, 'merchantId' => $ownSjId]);
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
-        $shopId = $shop['id'] ?? 0;
-
-        $count = ShopClass::getCount(['delStatus' => 0, 'merchantId' => $ghsSjId]);
+        $count = ShopClass::getCount(['delStatus' => 0, 'merchantId' => $sjId]);
         if ($count > 1) {
             util::fail('供货商已经不止一家门店,不能再进行绑定');
         }
-        $ghsShop = ShopClass::getByCondition(['delStatus' => 0, 'merchantId' => $ghsSjId]);
-        if (empty($ghsShop)) {
+        $currentShop = ShopClass::getByCondition(['delStatus' => 0, 'merchantId' => $sjId]);
+        if (empty($currentShop)) {
             util::fail('没有找到门店');
         }
-        $ghsShopId = $ghsShop['id'] ?? 0;
-
-        $has = GhsClass::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'ghsSjId' => $ghsSjId, 'ghsShopId' => $ghsShopId]);
+        $currentShopId = $currentShop['id'] ?? 0;
+        $has = GhsClass::getByCondition(['ownSjId' => $ownSjId, 'sjId' => $sjId, 'shopId' => $currentShopId]);
         if (!empty($has)) {
             util::fail('您已经绑定这个供货商了');
         }
         $name = $ghsSj['name'] ?? '';
         $data = [
             'name' => $name,
-            'sjId' => $sjId,
-            'ghsSjId' => $ghsSjId,
             'py' => stringUtil::getSpelling($name),
-            'shopId' => $shopId,
-            'ghsShopId' => $ghsShopId,
+            'shopId' => $currentShopId,
+            'sjId' => $sjId,
+            'ownSjId' => $ownSjId,
         ];
         GhsClass::addGhs($data);
         util::complete();

+ 16 - 16
biz-ghs/custom/classes/CustomClass.php

@@ -22,12 +22,12 @@ class CustomClass extends BaseClass
     {
         if ($applyData['style'] == SjClass::STYLE_RETAIL) {
             if ($applyData['introStyle'] == SjClass::STYLE_SUPPLIER) {
-                $has = CustomClass::getByCondition(['sjId' => $applyData['introSjId'], 'customSjId' => $sjId, 'customShopId' => $shopId]);
+                $has = CustomClass::getByCondition(['ownSjId' => $applyData['introSjId'], 'sjId' => $sjId, 'shopId' => $shopId]);
                 if (empty($has)) {
                     $customData = [
-                        'customSjId' => $sjId,//零售商家id
-                        'customShopId' => $shopId,//零售门店id
-                        'sjId' => $applyData['introSjId'],//供货商id
+                        'sjId' => $sjId,//零售商家id
+                        'shopId' => $shopId,//零售门店id
+                        'ownSjId' => $applyData['introSjId'],//供货商id
                         'name' => $applyData['name'],
                         'mobile' => $applyData['mobile'],
                         'province' => $applyData['province'] ?? '',
@@ -45,10 +45,10 @@ class CustomClass extends BaseClass
                         util::fail('没有找到门店');
                     }
                     $ghsData = [
-                        'ghsSjId' => $ghsShop['merchantId'],
-                        'ghsShopId' => $ghsShop['id'],
-                        'sjId' => $sjId,
-                        'shopId' => $sjId,
+                        'sjId' => $ghsShop['merchantId'],
+                        'shopId' => $ghsShop['id'],
+                        'ownSjId' => $sjId,
+                        'ownShopId' => $sjId,
                         'mobile' => $ghsShop['mobile'] ?? '',
                         'province' => $ghsShop['province'] ?? '',
                         'city' => $ghsShop['city'] ?? '',
@@ -65,7 +65,7 @@ class CustomClass extends BaseClass
         }
         if ($applyData['style'] == SjClass::STYLE_SUPPLIER) {
             if ($applyData['introStyle'] == SjClass::STYLE_RETAIL) {
-                $has = CustomClass::getByCondition(['sjId' => $sjId, 'customSjId' => $applyData['introSjId'], 'customShopId' => $applyData['introShopId']]);
+                $has = CustomClass::getByCondition(['ownSjId' => $sjId, 'sjId' => $applyData['introSjId'], 'shopId' => $applyData['introShopId']]);
                 if (empty($has)) {
                     $introSjId = $applyData['introSjId'] ?? 0;
                     $introShopId = $applyData['introShopId'] ?? 0;
@@ -74,9 +74,9 @@ class CustomClass extends BaseClass
                     $super = ShopClass::getSuper($introShopId);
                     $mobile = $super['mobile'] ?? '';
                     $customData = [
-                        'customSjId' => $introSjId,//零售商id
-                        'customShopId' => $introShopId,//零售门店id
-                        'sjId' => $sjId,//供货商id
+                        'sjId' => $introSjId,//零售商id
+                        'shopId' => $introShopId,//零售门店id
+                        'ownSjId' => $sjId,//供货商id
                         'name' => $name,
                         'mobile' => $mobile,
                         'isOpen' => 1,
@@ -96,10 +96,10 @@ class CustomClass extends BaseClass
                     }
 
                     $ghsData = [
-                        'ghsSjId' => $sjId,
-                        'ghsShopId' => $shopId,
-                        'sjId' => $introSjId,
-                        'shopId' => $introShopId,
+                        'sjId' => $sjId,
+                        'shopId' => $shopId,
+                        'ownSjId' => $introSjId,
+                        'ownShopId' => $introShopId,
                         'mobile' => $ghsShop['mobile'] ?? '',
                         'province' => $ghsShop['province'] ?? '',
                         'city' => $ghsShop['city'] ?? '',

+ 4 - 44
biz-hd/purchase/classes/PurchaseClass.php

@@ -56,8 +56,8 @@ class PurchaseClass extends BaseClass
             util::fail('没有找到供货商');
         }
         $ghs = GhsClass::getGhsInfo($ghsId);
-        $ghsSjId = $ghs['ghsSjId'] ?? 0;
-        $ghsShopId = $ghs['ghsShopId'];
+        $sjId = $ghs['sjId'] ?? 0;
+        $shopId = $ghs['shopId'];
         $getType = $data['getType'];
         $orderData = [
             'prePrice' => 0.01,
@@ -65,11 +65,11 @@ class PurchaseClass extends BaseClass
             'num' => 1,
             'smallNum' => 3,
             'product' => $productList,
-            'merchantId' => $ghsSjId,
+            'merchantId' => $sjId,
             'sendType' => $getType,
         ];
 
-        \bizGhs\order\classes\OrderClass::addOrder($orderData, $ghsShopId, true);
+        \bizGhs\order\classes\OrderClass::addOrder($orderData, $shopId, true);
 
         return $respond;
     }
@@ -155,47 +155,7 @@ class PurchaseClass extends BaseClass
     //采购订单支付成功后回调处理流程
     public static function complete($purchase)
     {
-        $ghsId = $purchase->ghsId;
-        if (empty($ghsId)) {
-
-            //补充供货商关系
-            $ghsSjId = $purchase->ghsSjId;
-            $supplierSj = MerchantClass::getMerchantById($ghsSjId);
-            $upName = $supplierSj['name'] ?? '';
-            $ghsShopId = $purchase->ghsShopId;
-            $shopId = $purchase->shopId;
-            $merchantId = $purchase->merchantId;
-            $py = !empty($upName) ? stringUtil::getSpelling($upName) : '';
-            $has = GhsClass::getByCondition(['merchantId' => $merchantId, 'ghsSjId' => $ghsSjId, 'ghsShopId' => $ghsShopId]);
-            if (empty($has)) {
-                $supplierData = [
-                    'ghsSjId' => $ghsSjId,
-                    'name' => $upName,
-                    'py' => $py,
-                    'ghsShopId' => $ghsShopId,
-                    'merchantId' => $merchantId,
-                ];
-                GhsClass::add($supplierData);
-            }
 
-            //补充客户关系
-            $customSj = MerchantClass::getMerchantById($merchantId);
-            $customSjName = $customSj['name'] ?? '';
-            $py = !empty($customSjName) ? stringUtil::getSpelling($customSjName) : '';
-            $has = CustomClass::getByCondition(['sjId' => $ghsSjId, 'customSjId' => $merchantId, 'customShopId' => $shopId]);
-            if (empty($has)) {
-                $customData = [
-                    'customSjId' => $merchantId,
-                    'customShopId' => $shopId,
-                    'sjId' => $ghsSjId,
-                    'name' => $customSjName,
-                    'mobile' => 0,
-                    'isOpen' => 0,
-                    'py' => $py,
-                ];
-                CustomClass::add($customData);
-            }
-        }
     }
 
 }

+ 16 - 16
biz/ghs/classes/GhsClass.php

@@ -17,25 +17,25 @@ class GhsClass extends BaseClass
     public static $baseFile = '\biz\ghs\models\Ghs';
 
     //新建供货商 shish 2021.4.13
-    public static function build($ghsShopId, $shopId, $sjId)
+    public static function build($thisShopId, $shopId, $sjId)
     {
-        $ghs = self::getByCondition(['ghsShopId' => $ghsShopId, 'shopId' => $shopId]);
-        if (!empty($ghs)) {
-            return $ghs;
-        }
-        $ghsShop = ShopClass::getShopInfo($ghsShopId);
+        $ghsShop = ShopClass::getShopInfo($thisShopId);
         if (empty($ghsShop)) {
             util::fail('没有找到供货商门店');
         }
+        $thisSjId = $ghsShop['merchantId'] ?? 0;
+        $ghs = self::getByCondition(['ownSjId' => $sjId, 'sjId' => $thisSjId, 'shopId' => $thisShopId]);
+        if (!empty($ghs)) {
+            return $ghs;
+        }
         $name = $ghsShop['merchantName'] . ' ' . $ghsShop['shopName'];
         $py = stringUtil::getSpelling($name);
         $data = [
-            'ghsSjId' => $ghsShop['merchantId'],
-            'ghsShopId' => $ghsShopId,
-            'sjId' => $sjId,
+            'sjId' => $thisSjId,
+            'shopId' => $thisShopId,
+            'ownSjId' => $sjId,
             'name' => $name,
             'py' => $py,
-            'shopId' => $ghsShopId,
             'mobile' => $ghsShop['mobile'] ?? '',
             'province' => $ghsShop['province'] ?? '',
             'city' => $ghsShop['city'] ?? '',
@@ -52,9 +52,9 @@ class GhsClass extends BaseClass
         $mobile = $shop['mobile'] ?? '';
 
         $customData = [
-            'customSjId' => $sjId,
-            'customShopId' => $shopId,
-            'sjId' => $ghsShop['merchantId'],
+            'sjId' => $sjId,
+            'shopId' => $shopId,
+            'ownSjId' => $thisSjId,
             'name' => $name,
             'py' => $py,
             'mobile' => $mobile,
@@ -74,7 +74,7 @@ class GhsClass extends BaseClass
     public static function addGhs($data)
     {
         //供货商客户+1
-        ShopService::totalUserPlus($data['ghsShopId']);
+        ShopService::totalUserPlus($data['shopId']);
         return self::add($data);
     }
 
@@ -117,7 +117,7 @@ class GhsClass extends BaseClass
     public static function getGhsInfo($id)
     {
         $info = self::getById($id);
-        if(empty($info)){
+        if (empty($info)) {
             return [];
         }
         $list = self::groupBaseInfo([$info]);
@@ -142,7 +142,7 @@ class GhsClass extends BaseClass
     //验证权限 shish 2021.4.11
     public static function valid($info, $sjId)
     {
-        if(empty($info)){
+        if (empty($info)) {
             util::fail('供应商不存在');
         }
         if ($info['sjId'] == $sjId) {

+ 4 - 4
biz/sj/services/MerchantService.php

@@ -45,11 +45,11 @@ class MerchantService extends BaseService
         if (empty($custom)) {
             util::fail('补充营业执照时没有找到客户');
         }
-        $customSjId = $custom['customSjId'] ?? 0;
-        $customShopId = $custom['customShopId'] ?? 0;
-        MerchantClass::initHdMore($apply, $customSjId, $customShopId);
+        $sjId = $custom['sjId'] ?? 0;
+        $shopId = $custom['shopId'] ?? 0;
+        MerchantClass::initHdMore($apply, $sjId, $shopId);
         //标识有客户关系的开店状态
-        CustomClass::updateByCondition(['customSjId' => $customSjId], ['isOpen' => 1]);
+        CustomClass::updateByCondition(['sjId' => $sjId], ['isOpen' => 1]);
     }
 
     //初始化商家信息 ssh 2020.2.11

+ 9 - 1
sql.sql

@@ -2247,4 +2247,12 @@ ADD COLUMN `supplierInfo`  varchar(500) NOT NULL DEFAULT '' COMMENT '供应商
 ALTER TABLE xhGhsPurchaseOrder CHANGE `supplierId` `ghsId` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '供货商ID';
 ALTER TABLE xhGhsPurchaseOrder CHANGE `supplierInfo` `ghsInfo` VARCHAR(5000) NOT NULL DEFAULT '' COMMENT '供应商信息';
 ALTER TABLE xhPurchase CHANGE `supplierId` `ghsId` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '供货商ID';
-ALTER TABLE xhPurchase ADD `ghsInfo` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '供应商信息' AFTER `ghsId`;
+ALTER TABLE xhPurchase ADD `ghsInfo` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '供应商信息' AFTER `ghsId`;
+ALTER TABLE xhGhsCustom CHANGE `sjId` `ownSjId` INT(11) NOT NULL DEFAULT '0' COMMENT '所有者商家id';
+ALTER TABLE xhGhsCustom CHANGE `customSjId` `sjId` INT(11) NOT NULL DEFAULT '0' COMMENT '客户商家id';
+ALTER TABLE xhGhsCustom CHANGE `customShopId` `shopId` INT(11) NOT NULL DEFAULT '0' COMMENT '客户门店id';
+ALTER TABLE `xhGhs` CHANGE `sjId` `ownSjId` INT(11) NOT NULL DEFAULT '0' COMMENT '所有者商家id';
+ALTER TABLE `xhGhs` CHANGE `shopId` `ownShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '所有者门店id';
+ALTER TABLE `xhGhs` CHANGE `ghsSjId` `sjId` INT(11) NOT NULL DEFAULT '0' COMMENT '供货商商家id';
+ALTER TABLE `xhGhs` CHANGE `ghsShopId` `shopId` INT(11) NOT NULL DEFAULT '0' COMMENT '供货商门店id';
+ALTER TABLE `xhGhs` DROP COLUMN `ownShopId`;