InitController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <?php
  2. namespace console\controllers;
  3. use biz\admin\classes\AdminClass;
  4. use biz\admin\classes\AdminRoleClass;
  5. use biz\product\classes\XjClass;
  6. use biz\pt\classes\PtYeChangeClass;
  7. use biz\recharge\classes\RechargeClass;
  8. use biz\shop\classes\MainClass;
  9. use biz\shop\classes\ShopAdminClass;
  10. use biz\shop\classes\ShopClass;
  11. use biz\shop\classes\ShopYeChangeClass;
  12. use biz\sj\classes\CashClass;
  13. use biz\sj\classes\SjClass;
  14. use biz\stat\classes\StatCgClass;
  15. use biz\stat\classes\StatCgGhsClass;
  16. use biz\stat\classes\StatCgGhsMonthClass;
  17. use biz\stat\classes\StatCgMonthClass;
  18. use biz\stat\classes\StatOrderCountClass;
  19. use biz\stat\classes\StatOutClass;
  20. use biz\stat\classes\StatOutMonthClass;
  21. use biz\stat\classes\StatPdAddClass;
  22. use biz\stat\classes\StatPdAddMonthClass;
  23. use biz\stat\classes\StatPdSubClass;
  24. use biz\stat\classes\StatPdSubMonthClass;
  25. use biz\stat\classes\StatRefundClass;
  26. use biz\stat\classes\StatRefundMonthClass;
  27. use biz\stat\classes\StatSaleClass;
  28. use biz\stat\classes\StatSaleMonthClass;
  29. use biz\stat\classes\StatStockInClass;
  30. use biz\stat\classes\StatStockInMonthClass;
  31. use biz\stat\classes\StatStockOutClass;
  32. use biz\stat\classes\StatStockOutMonthClass;
  33. use bizGhs\cg\classes\CgClass;
  34. use bizGhs\custom\classes\CustomClass;
  35. use bizGhs\item\classes\ItemClass;
  36. use bizGhs\item\classes\ItemClassClass;
  37. use bizGhs\order\classes\CheckOrderClass;
  38. use bizGhs\order\classes\RefundOrderClass;
  39. use bizGhs\order\classes\StockWastageOrderClass;
  40. use bizGhs\order\classes\StockWastageOrderItemClass;
  41. use bizGhs\stat\classes\StatYjClass;
  42. use bizGhs\stat\classes\StatYjMonthClass;
  43. use bizHd\ghs\classes\GhsClass;
  44. use bizHd\goods\classes\CategoryClass;
  45. use bizHd\goods\classes\GoodsCategoryClass;
  46. use bizHd\goods\classes\GoodsClass;
  47. use bizHd\goods\classes\GoodsSettingClass;
  48. use bizHd\saas\classes\FestRiseClass;
  49. use bizHd\stat\classes\StatOrderClass;
  50. use bizHd\stat\classes\StatOrderMonthClass;
  51. use bizHd\stat\classes\StatUserClass;
  52. use bizHd\stat\classes\StatUserMonthClass;
  53. use bizHd\stat\classes\StatVisitClass;
  54. use bizHd\stat\classes\StatVisitMonthClass;
  55. use bizHd\user\classes\UserClass;
  56. use common\components\dict;
  57. use Yii;
  58. use yii\console\Controller;
  59. class InitController extends Controller
  60. {
  61. //花材菜单 ./yii init/menu
  62. public function actionMenu()
  63. {
  64. $sql = "ALTER TABLE xhGhsItemClass ADD shopId INT NOT NULL DEFAULT 0 COMMENT '门店id' AFTER sjId;";
  65. Yii::$app->db->createCommand($sql)->execute();
  66. $sql = "ALTER TABLE xhAdminRole ADD shopId INT NOT NULL DEFAULT 0 COMMENT '门店id' AFTER `sjId`;";
  67. Yii::$app->db->createCommand($sql)->execute();
  68. $list = SjClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  69. if (!empty($list)) {
  70. foreach ($list as $sj) {
  71. $sjId = $sj->id ?? 0;
  72. if (empty($sjId)) {
  73. continue;
  74. }
  75. $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
  76. if (empty($shopList)) {
  77. continue;
  78. }
  79. //补花材
  80. $classList = ItemClassClass::getAllByCondition(['sjId' => $sjId], null, '*');
  81. if (!empty($classList)) {
  82. foreach ($shopList as $shop) {
  83. $shopId = $shop->id ?? 0;
  84. foreach ($classList as $class) {
  85. $classId = $class['id'] ?? 0;
  86. $name = $class['name'] ?? '';
  87. $inTurn = $class['inTurn'] ?? '';
  88. $isDefault = $class['isDefault'] ?? 0;
  89. $data = [
  90. 'shopId' => $shopId,
  91. 'sjId' => $sjId,
  92. 'name' => $name,
  93. 'inTurn' => $inTurn,
  94. 'isDefault' => $isDefault,
  95. ];
  96. $r = ItemClassClass::add($data, true);
  97. $newId = $r->id ?? 0;
  98. ItemClass::updateByCondition(['shopId' => $shopId, 'classId' => $classId], ['classId' => $newId]);
  99. }
  100. }
  101. }
  102. //补角色
  103. $roleList = AdminRoleClass::getAllByCondition(['sjId' => $sjId], null, '*');
  104. if (!empty($roleList)) {
  105. foreach ($shopList as $shop) {
  106. $shopId = $shop->id ?? 0;
  107. foreach ($roleList as $role) {
  108. $roleName = $role['roleName'] ?? '';
  109. $roleId = $role['id'] ?? 0;
  110. $roleData = [
  111. 'shopId' => $shopId,
  112. 'sjId' => $sjId,
  113. 'roleName' => $roleName,
  114. ];
  115. $new = AdminRoleClass::add($roleData, true);
  116. $newId = $new->id ?? 0;
  117. ShopAdminClass::updateByCondition(['shopId' => $shopId, 'roleId' => $roleId], ['roleId' => $newId]);
  118. }
  119. }
  120. }
  121. }
  122. }
  123. //清除零售商城相关的数据
  124. $sql = "TRUNCATE xhUser;TRUNCATE xhCustom;";
  125. Yii::$app->db->createCommand($sql)->execute();
  126. $sql = "UPDATE xhOrder SET customId=0,customName='',alipayId=0;";
  127. Yii::$app->db->createCommand($sql)->execute();
  128. //补已经存在花店的默认客户
  129. $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
  130. if (!empty($lsShopList)) {
  131. foreach ($lsShopList as $lsShop) {
  132. $mobile = $lsShop->mobile ?? 0;
  133. if (empty($mobile)) {
  134. continue;
  135. }
  136. $user = UserClass::replaceUser(['mobile' => $mobile]);
  137. $custom = \bizHd\custom\classes\CustomClass::replaceCustom($lsShop, $user);
  138. $customId = $custom->id ?? 0;
  139. $lsShop->defaultCustomId = $customId;
  140. $lsShop->save();
  141. }
  142. }
  143. }
  144. //初始化 ./yii init/main
  145. public function actionMain()
  146. {
  147. //基地批发商
  148. $jdShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'kmGhs')], 'default DESC', '*', null, true);
  149. if (!empty($jdShopList)) {
  150. foreach ($jdShopList as $jdShop) {
  151. $main = MainClass::add(['id' => null], true);
  152. $mainId = $main->id ?? 0;
  153. if (empty($mainId)) {
  154. echo "mainId没有生成 \n";
  155. exit();
  156. }
  157. $jdShop->mainId = $mainId;
  158. $jdShop->save();
  159. }
  160. }
  161. //批发商
  162. $pfShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'ghs')], 'default DESC', '*', null, true);
  163. if (!empty($pfShopList)) {
  164. foreach ($pfShopList as $pfShop) {
  165. $pfShopId = $pfShop->id ?? 0;
  166. $main = MainClass::add(['id' => null], true);
  167. $mainId = $main->id ?? 0;
  168. if (empty($mainId)) {
  169. echo "mainId没有生成 \n";
  170. exit();
  171. }
  172. $pfShop->mainId = $mainId;
  173. $pfShop->save();
  174. //将shop资产信息迁移到main
  175. self::migration($main, $pfShop);
  176. //员工数据迁移到currentGhsShopId,删除零售和基地供应商的管理员信息
  177. $staffList = ShopAdminClass::getAllByCondition(['shopId' => $pfShopId], null, '*');
  178. if (!empty($staffList)) {
  179. foreach ($staffList as $staff) {
  180. $pfAdminId = $staff['adminId'] ?? 0;
  181. $pfAdmin = AdminClass::getById($pfAdminId, true);
  182. if (!empty($pfAdmin)) {
  183. if (empty($pfAdmin->currentGhsShopId)) {
  184. $pfAdmin->currentGhsShopId = $pfShopId;
  185. $pfAdmin->ghsMiniOpenId = $pfAdmin->miniOpenId ?? '';
  186. $pfAdmin->miniOpenId = '';
  187. $pfAdmin->save();
  188. }
  189. } else {
  190. echo "没有找到shopId:{$pfShopId}批发店的员工\n";
  191. }
  192. $staffMobile = $staff['mobile'] ?? '';
  193. if (!empty($staffMobile)) {
  194. $h = AdminClass::getAllByCondition(['mobile' => $staffMobile, 'style' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
  195. if (!empty($h)) {
  196. foreach ($h as $he) {
  197. $currentAdminId = $he->id ?? 0;
  198. ShopAdminClass::deleteByCondition(['adminId' => $currentAdminId]);
  199. $he->delete();
  200. }
  201. }
  202. $j = AdminClass::getAllByCondition(['mobile' => $staffMobile, 'style' => dict::getDict('ptStyle', 'kmGhs')], null, '*', null, true);
  203. if (!empty($j)) {
  204. foreach ($j as $je) {
  205. $currentAdminId = $je->id ?? 0;
  206. ShopAdminClass::deleteByCondition(['adminId' => $currentAdminId]);
  207. $je->delete();
  208. }
  209. }
  210. }
  211. }
  212. }
  213. //花材和分类,零售和批发都有,单独拎出来
  214. ItemClass::updateByCondition(['shopId' => $pfShopId], ['mainId' => $mainId]);
  215. ItemClassClass::updateByCondition(['shopId' => $pfShopId], ['mainId' => $mainId]);
  216. self::setCommon($pfShopId, $mainId);
  217. self::setGhs($pfShopId, $mainId);
  218. }
  219. }
  220. //零售
  221. $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], 'default DESC', '*', null, true);
  222. if (!empty($lsShopList)) {
  223. foreach ($lsShopList as $lsShop) {
  224. $main = MainClass::add(['id' => null], true);
  225. $mainId = $main->id ?? 0;
  226. if (empty($mainId)) {
  227. echo "mainId没有生成 \n";
  228. exit();
  229. }
  230. $lsShop->mainId = $mainId;
  231. $lsShop->save();
  232. $lsShopId = $lsShop->id ?? 0;
  233. $lsSjId = $lsShop->sjId ?? 0;
  234. //将shop资产信息迁移到main
  235. self::migration($main, $lsShop);
  236. $staffList = ShopAdminClass::getAllByCondition(['shopId' => $lsShopId], null, '*');
  237. if (!empty($staffList)) {
  238. foreach ($staffList as $staff) {
  239. $adminId = $staff['adminId'] ?? 0;
  240. $admin = AdminClass::getById($adminId, true);
  241. if (!empty($admin)) {
  242. if (empty($admin->currentShopId)) {
  243. $admin->currentShopId = $lsShopId;
  244. $admin->save();
  245. }
  246. }
  247. }
  248. }
  249. //花材和分类,零售和批发都有,单独拎出来
  250. ItemClass::updateByCondition(['shopId' => $lsShopId], ['mainId' => $mainId]);
  251. ItemClassClass::updateByCondition(['shopId' => $lsShopId], ['mainId' => $mainId]);
  252. self::setCommon($lsShopId, $mainId);
  253. self::setHd($lsSjId, $lsShopId, $mainId);
  254. }
  255. }
  256. self::migrationDel();
  257. }
  258. public static function setCommon($shopId, $mainId)
  259. {
  260. ShopAdminClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  261. CashClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  262. AdminRoleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  263. CheckOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  264. StatPdAddClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  265. StatPdAddMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  266. StatPdSubClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  267. StatPdSubMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  268. }
  269. public static function setGhs($shopId, $mainId)
  270. {
  271. StatSaleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  272. StatSaleMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  273. StatUserClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  274. StatUserMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  275. StatVisitClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  276. StatVisitMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  277. StatOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  278. StatOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  279. PtYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  280. ShopYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  281. RechargeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  282. StatYjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  283. StatYjMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  284. StatOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  285. StatOrderMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  286. StatOrderCountClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  287. RefundOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  288. //采购统计
  289. StatCgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  290. StatCgMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  291. StatCgGhsClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  292. StatCgGhsMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  293. CustomClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  294. StatStockOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  295. StatStockOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  296. StatStockInClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  297. StatStockInMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  298. StatRefundClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  299. StatRefundMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  300. CgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  301. XjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  302. //报损中央化
  303. StockWastageOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  304. $wastageList = StockWastageOrderClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  305. if (!empty($wastageList)) {
  306. foreach ($wastageList as $wastage) {
  307. $wastageOrderSn = $wastage->orderSn ?? 0;
  308. StockWastageOrderItemClass::updateByCondition(['orderSn' => $wastageOrderSn], ['mainId' => $mainId]);
  309. }
  310. }
  311. }
  312. public static function setHd($sjId, $shopId, $mainId)
  313. {
  314. GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  315. GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  316. CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  317. GoodsSettingClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  318. FestRiseClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  319. GhsClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  320. }
  321. public static function migration($main, $shop)
  322. {
  323. //shop数据迁移到main,保存之后请在migrationDel()增加对应字段!!!!!!
  324. $main->balance = $shop->balance ?? 0;
  325. $main->freezeBalance = $shop->freezeBalance ?? 0;
  326. $main->txBalance = $shop->txBalance ?? 0;
  327. $main->fixBalance = $shop->fixBalance ?? 0;
  328. $main->totalRecharge = $shop->totalRecharge ?? 0;
  329. $main->totalIncome = $shop->totalIncome ?? 0;
  330. $main->totalExpend = $shop->totalExpend ?? 0;
  331. $main->totalPurchase = $shop->totalPurchase ?? 0;
  332. $main->totalItem = $shop->totalItem ?? 0;
  333. $main->totalSale = $shop->totalSale ?? 0;
  334. $main->totalStockIn = $shop->totalStockIn ?? 0;
  335. $main->totalStockOut = $shop->totalStockOut ?? 0;
  336. $main->totalRefund = $shop->totalRefund ?? 0;
  337. $main->totalWast = $shop->totalWast ?? 0;
  338. $main->totalPdSub = $shop->totalPdSub ?? 0;
  339. $main->totalPdAdd = $shop->totalPdAdd ?? 0;
  340. $main->totalPurchaseOrder = $shop->totalPurchaseOrder ?? 0;
  341. $main->totalUser = $shop->totalUser ?? 0;
  342. $main->totalVisit = $shop->totalVisit ?? 0;
  343. $main->totalView = $shop->totalView ?? 0;
  344. $main->cashName = $shop->cashName ?? '';
  345. $main->cashAccount = $shop->cashAccount ?? '';
  346. $main->cashBank = $shop->cashBank ?? '';
  347. $main->cgUnPay = $shop->cgUnPay ?? 0;
  348. $main->cgUnSend = $shop->cgUnSend ?? 0;
  349. $main->cgSending = $shop->cgSending ?? 0;
  350. $main->cgFinish = $shop->cgFinish ?? 0;
  351. $main->cgCancel = $shop->cgCancel ?? 0;
  352. $main->mayGatheringNum = $shop->mayGatheringNum ?? 0;
  353. $main->mayGathering = $shop->mayGathering ?? 0;
  354. $main->mayPay = $shop->mayPay ?? 0;
  355. $main->mayPayNum = $shop->mayPayNum ?? 0;
  356. $main->totalOrder = $shop->totalOrder ?? 0;
  357. $main->totalOrderNum = $shop->totalOrderNum ?? 0;
  358. $main->finishOrder = $shop->finishOrder ?? 0;
  359. $main->unPayOrder = $shop->unPayOrder ?? 0;
  360. $main->unSendOrder = $shop->unSendOrder ?? 0;
  361. $main->sendingOrder = $shop->sendingOrder ?? 0;
  362. $main->cancelOrder = $shop->cancelOrder ?? 0;
  363. $main->save();
  364. }
  365. //迁移完成之后删除xhShop对应字段
  366. public static function migrationDel()
  367. {
  368. $sql = "ALTER TABLE `xhShop` DROP COLUMN `balance`;";
  369. Yii::$app->db->createCommand($sql)->execute();
  370. $sql = "ALTER TABLE `xhShop` DROP COLUMN `freezeBalance`;";
  371. Yii::$app->db->createCommand($sql)->execute();
  372. $sql = "ALTER TABLE `xhShop` DROP COLUMN `txBalance`;";
  373. Yii::$app->db->createCommand($sql)->execute();
  374. $sql = "ALTER TABLE `xhShop` DROP COLUMN `fixBalance`;";
  375. Yii::$app->db->createCommand($sql)->execute();
  376. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRecharge`;";
  377. Yii::$app->db->createCommand($sql)->execute();
  378. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalIncome`;";
  379. Yii::$app->db->createCommand($sql)->execute();
  380. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalExpend`;";
  381. Yii::$app->db->createCommand($sql)->execute();
  382. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchase`;";
  383. Yii::$app->db->createCommand($sql)->execute();
  384. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalItem`;";
  385. Yii::$app->db->createCommand($sql)->execute();
  386. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalSale`;";
  387. Yii::$app->db->createCommand($sql)->execute();
  388. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockIn`;";
  389. Yii::$app->db->createCommand($sql)->execute();
  390. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockOut`;";
  391. Yii::$app->db->createCommand($sql)->execute();
  392. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRefund`;";
  393. Yii::$app->db->createCommand($sql)->execute();
  394. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalWast`;";
  395. Yii::$app->db->createCommand($sql)->execute();
  396. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdSub`;";
  397. Yii::$app->db->createCommand($sql)->execute();
  398. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdAdd`;";
  399. Yii::$app->db->createCommand($sql)->execute();
  400. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchaseOrder`;";
  401. Yii::$app->db->createCommand($sql)->execute();
  402. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalUser`;";
  403. Yii::$app->db->createCommand($sql)->execute();
  404. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalVisit`;";
  405. Yii::$app->db->createCommand($sql)->execute();
  406. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalView`;";
  407. Yii::$app->db->createCommand($sql)->execute();
  408. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashName`;";
  409. Yii::$app->db->createCommand($sql)->execute();
  410. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashAccount`;";
  411. Yii::$app->db->createCommand($sql)->execute();
  412. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashBank`;";
  413. Yii::$app->db->createCommand($sql)->execute();
  414. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnPay`;";
  415. Yii::$app->db->createCommand($sql)->execute();
  416. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnSend`;";
  417. Yii::$app->db->createCommand($sql)->execute();
  418. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgSending`;";
  419. Yii::$app->db->createCommand($sql)->execute();
  420. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgFinish`;";
  421. Yii::$app->db->createCommand($sql)->execute();
  422. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgCancel`;";
  423. Yii::$app->db->createCommand($sql)->execute();
  424. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGathering`;";
  425. Yii::$app->db->createCommand($sql)->execute();
  426. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGatheringNum`;";
  427. Yii::$app->db->createCommand($sql)->execute();
  428. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPay`;";
  429. Yii::$app->db->createCommand($sql)->execute();
  430. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPayNum`;";
  431. Yii::$app->db->createCommand($sql)->execute();
  432. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrder`;";
  433. Yii::$app->db->createCommand($sql)->execute();
  434. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrderNum`;";
  435. Yii::$app->db->createCommand($sql)->execute();
  436. $sql = "ALTER TABLE `xhShop` DROP COLUMN `finishOrder`;";
  437. Yii::$app->db->createCommand($sql)->execute();
  438. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unPayOrder`;";
  439. Yii::$app->db->createCommand($sql)->execute();
  440. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unSendOrder`;";
  441. Yii::$app->db->createCommand($sql)->execute();
  442. $sql = "ALTER TABLE `xhShop` DROP COLUMN `sendingOrder`;";
  443. Yii::$app->db->createCommand($sql)->execute();
  444. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cancelOrder`;";
  445. Yii::$app->db->createCommand($sql)->execute();
  446. }
  447. }