Ver Fonte

删除多余字段

shish há 4 anos atrás
pai
commit
5168064221

+ 39 - 38
app-ghs/controllers/AdminRoleController.php

@@ -12,43 +12,44 @@ use yii\web\Controller;
 
 class AdminRoleController extends BaseController
 {
-	
-	//角色列表 ssh 2019.12.9
-	public function actionList()
-	{
-		$list = AdminRoleService::getRoleList($this->sjId);
-		util::success($list);
-	}
-	
-	//添加员工 ssh 2019.12.10
-	public function actionAdd()
-	{
-		$post = Yii::$app->request->post();
-		$post['sjId'] = $this->sjId;
-		$respond = AdminRoleService::addRole($post);
-		util::success($respond);
-	}
-	
-	//修改角色 ssh 2019.12.10
-	public function actionUpdate()
-	{
-		$post = Yii::$app->request->post();
-		$id = isset($post['id']) ? $post['id'] : 0;
-		unset($post['id']);
-		$role = AdminRoleService::getById($id);
-		AdminRoleService::valid($role, $this->sjId);
-		AdminRoleService::updateRole($role, $post);
-		util::complete('修改成功');
-	}
-	
-	//角色删除 ssh 2019.12.10
-	public function actionDelete()
-	{
-		$id = Yii::$app->request->post('id', 0);
-		$role = AdminRoleService::getById($id);
-		AdminRoleService::valid($role, $this->sjId);
-		AdminRoleService::deleteRole($role);
-		util::complete('删除成功');
-	}
+
+    //角色列表 ssh 2019.12.9
+    public function actionList()
+    {
+        $list = AdminRoleService::getRoleList($this->mainId);
+        util::success($list);
+    }
+
+    //添加员工 ssh 2019.12.10
+    public function actionAdd()
+    {
+        $post = Yii::$app->request->post();
+        $post['sjId'] = $this->sjId;
+        $post['mainId'] = $this->mainId;
+        $respond = AdminRoleService::addRole($post);
+        util::success($respond);
+    }
+
+    //修改角色 ssh 2019.12.10
+    public function actionUpdate()
+    {
+        $post = Yii::$app->request->post();
+        $id = isset($post['id']) ? $post['id'] : 0;
+        unset($post['id']);
+        $role = AdminRoleService::getById($id);
+        AdminRoleService::valid($role, $this->sjId);
+        AdminRoleService::updateRole($role, $post);
+        util::complete('修改成功');
+    }
+
+    //角色删除 ssh 2019.12.10
+    public function actionDelete()
+    {
+        $id = Yii::$app->request->post('id', 0);
+        $role = AdminRoleService::getById($id);
+        AdminRoleService::valid($role, $this->sjId);
+        AdminRoleService::deleteRole($role);
+        util::complete('删除成功');
+    }
 
 }

+ 39 - 38
app-hd/controllers/AdminRoleController.php

@@ -12,43 +12,44 @@ use yii\web\Controller;
 
 class AdminRoleController extends BaseController
 {
-	
-	//角色列表 ssh 2019.12.9
-	public function actionList()
-	{
-		$list = AdminRoleService::getRoleList($this->sjId);
-		util::success($list);
-	}
-	
-	//添加员工 ssh 2019.12.10
-	public function actionAdd()
-	{
-		$post = Yii::$app->request->post();
-		$post['sjId'] = $this->sjId;
-		$respond = AdminRoleService::addRole($post);
-		util::success($respond);
-	}
-	
-	//修改角色 ssh 2019.12.10
-	public function actionUpdate()
-	{
-		$post = Yii::$app->request->post();
-		$id = isset($post['id']) ? $post['id'] : 0;
-		unset($post['id']);
-		$role = AdminRoleService::getById($id);
-		AdminRoleService::valid($role, $this->sjId);
-		AdminRoleService::updateRole($role, $post);
-		util::complete('修改成功');
-	}
-	
-	//角色删除 ssh 2019.12.10
-	public function actionDelete()
-	{
-		$id = Yii::$app->request->post('id', 0);
-		$role = AdminRoleService::getById($id);
-		AdminRoleService::valid($role, $this->sjId);
-		AdminRoleService::deleteRole($role);
-		util::complete('删除成功');
-	}
+
+    //角色列表 ssh 2019.12.9
+    public function actionList()
+    {
+        $list = AdminRoleService::getRoleList($this->mainId);
+        util::success($list);
+    }
+
+    //添加员工 ssh 2019.12.10
+    public function actionAdd()
+    {
+        $post = Yii::$app->request->post();
+        $post['sjId'] = $this->sjId;
+        $post['mainId'] = $this->mainId;
+        $respond = AdminRoleService::addRole($post);
+        util::success($respond);
+    }
+
+    //修改角色 ssh 2019.12.10
+    public function actionUpdate()
+    {
+        $post = Yii::$app->request->post();
+        $id = isset($post['id']) ? $post['id'] : 0;
+        unset($post['id']);
+        $role = AdminRoleService::getById($id);
+        AdminRoleService::valid($role, $this->sjId);
+        AdminRoleService::updateRole($role, $post);
+        util::complete('修改成功');
+    }
+
+    //角色删除 ssh 2019.12.10
+    public function actionDelete()
+    {
+        $id = Yii::$app->request->post('id', 0);
+        $role = AdminRoleService::getById($id);
+        AdminRoleService::valid($role, $this->sjId);
+        AdminRoleService::deleteRole($role);
+        util::complete('删除成功');
+    }
 
 }

+ 72 - 72
biz-ghs/admin/classes/AdminRoleClass.php

@@ -8,76 +8,76 @@ use bizGhs\base\classes\BaseClass;
 
 class AdminRoleClass extends BaseClass
 {
-	
-	public static $baseFile = '\bizGhs\admin\models\AdminRole';
-	
-	//验证权限 ssh 2019.12.9
-	public static function valid($role, $sjId)
-	{
-		if (empty($role)) {
-			util::fail('角色无效');
-		}
-		if ($role['sjId'] != $sjId) {
-			util::fail('没有权限操作');
-		}
-	}
-	
-	//添加角色 ssh 2019.12.10
-	public static function addRole($data)
-	{
-		$roleName = $data['roleName'];
-		$sjId = $data['sjId'];
-		$nameList = self::getNameList($sjId);
-		if (in_array($roleName, $nameList)) {
-			util::fail('角色已经存在');
-		}
-		$data['addTime'] = time();
-		return self::add($data);
-	}
-	
-	//获取商家角色列表 ssh 2019.12.10
-	public static function getRoleList($sjId)
-	{
-		$where = ['sjId' => $sjId, 'delStatus' => 0];
-		return self::getList('*', $where, 'addTime DESC');
-	}
-	
-	//获取商家所有的角色名称 ssh 2019.12.10
-	public static function getNameList($sjId)
-	{
-		$respond = self::getRoleList($sjId);
-		return isset($respond['list']) && !empty($respond['list']) ? array_column($respond['list'], 'roleName') : [];
-	}
-	
-	//更新角色 ssh 2019.12.10
-	public static function updateRole($role, $data)
-	{
-		$sjId = $role['sjId'];
-		if ($role['roleName'] != $data['roleName']) {
-			$name = $data['roleName'];
-			$nameList = self::getNameList($sjId);
-			if (in_array($name, $nameList)) {
-				util::fail('名称已经存在');
-			}
-		}
-		$id = $role['id'];
-		return self::updateById($id, $data);
-	}
-	
-	//删除角色 ssh 2019.12.10
-	public static function deleteRole($role)
-	{
-		if (isset($role['num']) && !empty($role['num'])) {
-			util::fail('还有成员,不能删除');
-		}
-		$id = $role['id'];
-		return self::updateById($id, ['delStatus' => 1]);
-	}
-	
-	//创建管理员角色 ssh 2020.2.8
-	public static function addAdminRole($data)
-	{
-		return self::add($data);
-	}
-	
+
+    public static $baseFile = '\bizGhs\admin\models\AdminRole';
+
+    //验证权限 ssh 2019.12.9
+    public static function valid($role, $sjId)
+    {
+        if (empty($role)) {
+            util::fail('角色无效');
+        }
+        if ($role['sjId'] != $sjId) {
+            util::fail('没有权限操作');
+        }
+    }
+
+    //添加角色 ssh 2019.12.10
+    public static function addRole($data)
+    {
+        $roleName = $data['roleName'];
+        $sjId = $data['sjId'];
+        $nameList = self::getNameList($sjId);
+        if (in_array($roleName, $nameList)) {
+            util::fail('角色已经存在');
+        }
+        $data['addTime'] = time();
+        return self::add($data);
+    }
+
+    //获取商家角色列表 ssh 2019.12.10
+    public static function getRoleList($mainId)
+    {
+        $where = ['mainId' => $mainId, 'delStatus' => 0];
+        return self::getList('*', $where, 'addTime DESC');
+    }
+
+    //获取商家所有的角色名称 ssh 2019.12.10
+    public static function getNameList($sjId)
+    {
+        $respond = self::getRoleList($sjId);
+        return isset($respond['list']) && !empty($respond['list']) ? array_column($respond['list'], 'roleName') : [];
+    }
+
+    //更新角色 ssh 2019.12.10
+    public static function updateRole($role, $data)
+    {
+        $sjId = $role['sjId'];
+        if ($role['roleName'] != $data['roleName']) {
+            $name = $data['roleName'];
+            $nameList = self::getNameList($sjId);
+            if (in_array($name, $nameList)) {
+                util::fail('名称已经存在');
+            }
+        }
+        $id = $role['id'];
+        return self::updateById($id, $data);
+    }
+
+    //删除角色 ssh 2019.12.10
+    public static function deleteRole($role)
+    {
+        if (isset($role['num']) && !empty($role['num'])) {
+            util::fail('还有成员,不能删除');
+        }
+        $id = $role['id'];
+        return self::updateById($id, ['delStatus' => 1]);
+    }
+
+    //创建管理员角色 ssh 2020.2.8
+    public static function addAdminRole($data)
+    {
+        return self::add($data);
+    }
+
 }

+ 2 - 2
biz-ghs/admin/services/AdminRoleService.php

@@ -17,9 +17,9 @@ class AdminRoleService extends BaseService
 	}
 	
 	//角色列表 ssh 2019.12.9
-	public static function getRoleList($sjId)
+	public static function getRoleList($mainId)
 	{
-		return AdminRoleClass::getRoleList($sjId);
+		return AdminRoleClass::getRoleList($mainId);
 	}
 	
 	//添加角色 ssh 2019.12.10

+ 71 - 71
biz-hd/admin/classes/AdminRoleClass.php

@@ -8,76 +8,76 @@ use bizHd\base\classes\BaseClass;
 
 class AdminRoleClass extends BaseClass
 {
-	
-	public static $baseFile = '\bizHd\admin\models\AdminRole';
-	
-	//验证权限 ssh 2019.12.9
-	public static function valid($role, $sjId)
-	{
-		if (empty($role)) {
-			util::fail('角色无效');
-		}
-		if ($role['sjId'] != $sjId) {
-			util::fail('没有权限操作');
-		}
-	}
-	
-	//添加角色 ssh 2019.12.10
-	public static function addRole($data)
-	{
-		$roleName = $data['roleName'];
-		$sjId = $data['sjId'];
-		$nameList = self::getNameList($sjId);
-		if (in_array($roleName, $nameList)) {
-			util::fail('角色已经存在');
-		}
-		$data['addTime'] = time();
-		return self::add($data);
-	}
-	
-	//获取商家角色列表 ssh 2019.12.10
-	public static function getRoleList($sjId)
-	{
-		$where = ['sjId' => $sjId, 'delStatus' => 0];
-		return self::getList('*', $where, 'addTime DESC');
-	}
 
-	//获取商家所有的角色名称 ssh 2019.12.10
-	public static function getNameList($sjId)
-	{
-		$list = self::getRoleList($sjId);
-		return !empty($list) ? array_column($list, 'roleName') : [];
-	}
-	
-	//更新角色 ssh 2019.12.10
-	public static function updateRole($role, $data)
-	{
-		$sjId = $role['sjId'];
-		if ($role['roleName'] != $data['roleName']) {
-			$name = $data['roleName'];
-			$nameList = self::getNameList($sjId);
-			if (in_array($name, $nameList)) {
-				util::fail('名称已经存在');
-			}
-		}
-		$id = $role['id'];
-		return self::updateById($id, $data);
-	}
-	
-	//删除角色 ssh 2019.12.10
-	public static function deleteRole($role)
-	{
-		if (isset($role['num']) && !empty($role['num'])) {
-			util::fail('还有成员,不能删除');
-		}
-		$id = $role['id'];
-		return self::updateById($id, ['delStatus' => 1]);
-	}
-	
-	//创建管理员角色 ssh 2020.2.8
-	public static function addAdminRole($data)
-	{
-		return self::add($data);
-	}
-	
+    public static $baseFile = '\bizHd\admin\models\AdminRole';
+
+    //验证权限 ssh 2019.12.9
+    public static function valid($role, $sjId)
+    {
+        if (empty($role)) {
+            util::fail('角色无效');
+        }
+        if ($role['sjId'] != $sjId) {
+            util::fail('没有权限操作');
+        }
+    }
+
+    //添加角色 ssh 2019.12.10
+    public static function addRole($data)
+    {
+        $roleName = $data['roleName'];
+        $sjId = $data['sjId'];
+        $nameList = self::getNameList($sjId);
+        if (in_array($roleName, $nameList)) {
+            util::fail('角色已经存在');
+        }
+        $data['addTime'] = time();
+        return self::add($data);
+    }
+
+    //获取商家角色列表 ssh 2019.12.10
+    public static function getRoleList($mainId)
+    {
+        $where = ['mainId' => $mainId, 'delStatus' => 0];
+        return self::getList('*', $where, 'addTime DESC');
+    }
+
+    //获取商家所有的角色名称 ssh 2019.12.10
+    public static function getNameList($sjId)
+    {
+        $list = self::getRoleList($sjId);
+        return !empty($list) ? array_column($list, 'roleName') : [];
+    }
+
+    //更新角色 ssh 2019.12.10
+    public static function updateRole($role, $data)
+    {
+        $sjId = $role['sjId'];
+        if ($role['roleName'] != $data['roleName']) {
+            $name = $data['roleName'];
+            $nameList = self::getNameList($sjId);
+            if (in_array($name, $nameList)) {
+                util::fail('名称已经存在');
+            }
+        }
+        $id = $role['id'];
+        return self::updateById($id, $data);
+    }
+
+    //删除角色 ssh 2019.12.10
+    public static function deleteRole($role)
+    {
+        if (isset($role['num']) && !empty($role['num'])) {
+            util::fail('还有成员,不能删除');
+        }
+        $id = $role['id'];
+        return self::updateById($id, ['delStatus' => 1]);
+    }
+
+    //创建管理员角色 ssh 2020.2.8
+    public static function addAdminRole($data)
+    {
+        return self::add($data);
+    }
+
 }

+ 2 - 2
biz-hd/admin/services/AdminRoleService.php

@@ -17,9 +17,9 @@ class AdminRoleService extends BaseService
 	}
 	
 	//角色列表 ssh 2019.12.9
-	public static function getRoleList($sjId)
+	public static function getRoleList($mainId)
 	{
-		return AdminRoleClass::getRoleList($sjId);
+		return AdminRoleClass::getRoleList($mainId);
 	}
 	
 	//添加角色 ssh 2019.12.10

+ 58 - 9
console/controllers/InitController.php

@@ -289,6 +289,16 @@ class InitController extends Controller
         }
     }
 
+    public static function setHd($sjId, $shopId, $mainId)
+    {
+        GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
+        GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
+        CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
+        GoodsSettingClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
+        FestRiseClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
+        GhsClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
+    }
+
     public static function migration($main, $shop)
     {
         //shop数据迁移到main
@@ -317,16 +327,55 @@ class InitController extends Controller
         $main->cashAccount = $shop->cashAccount ?? '';
         $main->cashBank = $shop->cashBank ?? '';
         $main->save();
-    }
 
-    public static function setHd($sjId, $shopId, $mainId)
-    {
-        GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
-        GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
-        CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
-        GoodsSettingClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
-        FestRiseClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
-        GhsClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
+        $sql = "ALTER TABLE xhShop DROP COLUMN `balance`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `freezeBalance`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `txBalance`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `fixBalance`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalRecharge`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalIncome`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalExpend`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalPurchase`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalPurchasePlant`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalItem`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalSale`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalStockIn`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalStockOut`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalRefund`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalWast`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalPdSub`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalPdAdd`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalPurchaseOrder`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalUser`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalVisit`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `totalView`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `cashName`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `cashAccount`;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "ALTER TABLE xhShop DROP COLUMN `cashBank`;";
+        Yii::$app->db->createCommand($sql)->execute();
     }
 
 }

+ 1 - 0
sql.sql

@@ -968,5 +968,6 @@ ALTER TABLE xhAdmin ADD `currentGhsShopId` INT(11) NOT NULL DEFAULT '0' COMMENT
 ALTER TABLE xhAdmin ADD `openGhsShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过' AFTER `currentGhsShopId`;
 
 ALTER TABLE xhGoodsSetting DROP INDEX `merchantId`;
+ALTER TABLE xhAdminRole ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `sjId`;
 
 -- ssh 20220424