InitController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. //初始化 ./yii init/main
  125. public function actionMain()
  126. {
  127. //基地批发商
  128. $jdShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'kmGhs')], 'default DESC', '*', null, true);
  129. if (!empty($jdShopList)) {
  130. foreach ($jdShopList as $jdShop) {
  131. $main = MainClass::add(['id' => null], true);
  132. $mainId = $main->id ?? 0;
  133. if (empty($mainId)) {
  134. echo "mainId没有生成 \n";
  135. exit();
  136. }
  137. $jdShop->mainId = $mainId;
  138. $jdShop->save();
  139. }
  140. }
  141. //批发商
  142. $pfShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'ghs')], 'default DESC', '*', null, true);
  143. if (!empty($pfShopList)) {
  144. foreach ($pfShopList as $pfShop) {
  145. $pfShopId = $pfShop->id ?? 0;
  146. $main = MainClass::add(['id' => null], true);
  147. $mainId = $main->id ?? 0;
  148. if (empty($mainId)) {
  149. echo "mainId没有生成 \n";
  150. exit();
  151. }
  152. $pfShop->mainId = $mainId;
  153. $pfShop->save();
  154. //将shop资产信息迁移到main
  155. self::migration($main, $pfShop);
  156. //员工数据迁移到currentGhsShopId,删除零售和基地供应商的管理员信息
  157. $staffList = ShopAdminClass::getAllByCondition(['shopId' => $pfShopId], null, '*');
  158. if (!empty($staffList)) {
  159. foreach ($staffList as $staff) {
  160. $pfAdminId = $staff['adminId'] ?? 0;
  161. $pfAdmin = AdminClass::getById($pfAdminId, true);
  162. if (!empty($pfAdmin)) {
  163. if (empty($pfAdmin->currentGhsShopId)) {
  164. $pfAdmin->currentGhsShopId = $pfShopId;
  165. $pfAdmin->ghsMiniOpenId = $pfAdmin->miniOpenId ?? '';
  166. $pfAdmin->miniOpenId = '';
  167. $pfAdmin->save();
  168. }
  169. } else {
  170. echo "没有找到shopId:{$pfShopId}批发店的员工\n";
  171. }
  172. $staffMobile = $staff['mobile'] ?? '';
  173. if (!empty($staffMobile)) {
  174. $h = AdminClass::getAllByCondition(['mobile' => $staffMobile, 'style' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
  175. if (!empty($h)) {
  176. foreach ($h as $he) {
  177. $currentAdminId = $he->id ?? 0;
  178. ShopAdminClass::deleteByCondition(['adminId' => $currentAdminId]);
  179. $he->delete();
  180. }
  181. }
  182. $j = AdminClass::getAllByCondition(['mobile' => $staffMobile, 'style' => dict::getDict('ptStyle', 'kmGhs')], null, '*', null, true);
  183. if (!empty($j)) {
  184. foreach ($j as $je) {
  185. $currentAdminId = $je->id ?? 0;
  186. ShopAdminClass::deleteByCondition(['adminId' => $currentAdminId]);
  187. $je->delete();
  188. }
  189. }
  190. }
  191. }
  192. }
  193. //花材和分类,零售和批发都有,单独拎出来
  194. ItemClass::updateByCondition(['shopId' => $pfShopId], ['mainId' => $mainId]);
  195. ItemClassClass::updateByCondition(['shopId' => $pfShopId], ['mainId' => $mainId]);
  196. self::setCommon($pfShopId, $mainId);
  197. self::setGhs($pfShopId, $mainId);
  198. }
  199. }
  200. //零售
  201. $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], 'default DESC', '*', null, true);
  202. if (!empty($lsShopList)) {
  203. foreach ($lsShopList as $lsShop) {
  204. $main = MainClass::add(['id' => null], true);
  205. $mainId = $main->id ?? 0;
  206. if (empty($mainId)) {
  207. echo "mainId没有生成 \n";
  208. exit();
  209. }
  210. $lsShop->mainId = $mainId;
  211. $lsShop->save();
  212. $lsShopId = $lsShop->id ?? 0;
  213. $lsSjId = $lsShop->sjId ?? 0;
  214. //将shop资产信息迁移到main
  215. self::migration($main, $lsShop);
  216. $staffList = ShopAdminClass::getAllByCondition(['shopId' => $lsShopId], null, '*');
  217. if (!empty($staffList)) {
  218. foreach ($staffList as $staff) {
  219. $adminId = $staff['adminId'] ?? 0;
  220. $admin = AdminClass::getById($adminId, true);
  221. if (!empty($admin)) {
  222. if (empty($admin->currentShopId)) {
  223. $admin->currentShopId = $lsShopId;
  224. $admin->save();
  225. }
  226. }
  227. }
  228. }
  229. //花材和分类,零售和批发都有,单独拎出来
  230. ItemClass::updateByCondition(['shopId' => $lsShopId], ['mainId' => $mainId]);
  231. ItemClassClass::updateByCondition(['shopId' => $lsShopId], ['mainId' => $mainId]);
  232. self::setCommon($lsShopId, $mainId);
  233. self::setHd($lsSjId, $lsShopId, $mainId);
  234. }
  235. }
  236. //清除零售商城相关的数据
  237. $sql = "TRUNCATE xhUser;TRUNCATE xhCustom;truncate xhUserAsset;";
  238. Yii::$app->db->createCommand($sql)->execute();
  239. $sql = "UPDATE xhOrder SET customId=0,customName='',alipayId=0;";
  240. Yii::$app->db->createCommand($sql)->execute();
  241. //补已经存在花店的默认客户
  242. $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
  243. if (!empty($lsShopList)) {
  244. foreach ($lsShopList as $lsShop) {
  245. $mobile = $lsShop->mobile ?? 0;
  246. if (empty($mobile)) {
  247. continue;
  248. }
  249. $user = UserClass::replaceUser(['mobile' => $mobile]);
  250. $custom = \bizHd\custom\classes\CustomClass::replaceCustom($lsShop, $user);
  251. $customId = $custom->id ?? 0;
  252. $lsShop->defaultCustomId = $customId;
  253. $lsShop->save();
  254. }
  255. }
  256. self::migrationDel();
  257. //客户和供应商的中央化
  258. self::ghsCustomMain();
  259. }
  260. //客户和供应商的中央化 ssh 20220506
  261. public static function ghsCustomMain()
  262. {
  263. $map = [];
  264. $allShop = ShopClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  265. if (!empty($allShop)) {
  266. foreach ($allShop as $single) {
  267. $mainId = $single->mainId ?? 0;
  268. $shopId = $single->id ?? 0;
  269. $map[$shopId] = $mainId;
  270. }
  271. }
  272. print_r($map);
  273. $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  274. if (!empty($customList)) {
  275. foreach ($customList as $custom) {
  276. $shopId = $custom->shopId ?? 0;
  277. $mainId = $map[$shopId] ?? 0;
  278. $custom->mainId = $mainId;
  279. $ownShopId = $custom->ownShopId ?? 0;
  280. $ownMainId = $map[$ownShopId] ?? 0;
  281. $custom->ownMainId = $ownMainId;
  282. $custom->save();
  283. }
  284. }
  285. $ghsList = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  286. foreach ($ghsList as $ghs) {
  287. $shopId = $ghs->shopId ?? 0;
  288. $mainId = $map[$shopId] ?? 0;
  289. $ghs->mainId = $mainId;
  290. $ownShopId = $ghs->ownShopId ?? 0;
  291. $ownMainId = $map[$ownShopId] ?? 0;
  292. $ghs->ownMainId = $ownMainId;
  293. $ghs->save();
  294. }
  295. }
  296. public static function setCommon($shopId, $mainId)
  297. {
  298. ShopAdminClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  299. CashClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  300. AdminRoleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  301. CheckOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  302. StatPdAddClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  303. StatPdAddMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  304. StatPdSubClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  305. StatPdSubMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  306. }
  307. public static function setGhs($shopId, $mainId)
  308. {
  309. StatSaleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  310. StatSaleMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  311. StatUserClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  312. StatUserMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  313. StatVisitClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  314. StatVisitMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  315. StatOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  316. StatOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  317. PtYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  318. ShopYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  319. RechargeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  320. StatYjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  321. StatYjMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  322. StatOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  323. StatOrderMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  324. StatOrderCountClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  325. RefundOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  326. //采购统计
  327. StatCgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  328. StatCgMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  329. StatCgGhsClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  330. StatCgGhsMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  331. CustomClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  332. StatStockOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  333. StatStockOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  334. StatStockInClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  335. StatStockInMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  336. StatRefundClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  337. StatRefundMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  338. CgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  339. XjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  340. //报损中央化
  341. StockWastageOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  342. $wastageList = StockWastageOrderClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  343. if (!empty($wastageList)) {
  344. foreach ($wastageList as $wastage) {
  345. $wastageOrderSn = $wastage->orderSn ?? 0;
  346. StockWastageOrderItemClass::updateByCondition(['orderSn' => $wastageOrderSn], ['mainId' => $mainId]);
  347. }
  348. }
  349. }
  350. public static function setHd($sjId, $shopId, $mainId)
  351. {
  352. GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  353. GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  354. CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  355. GoodsSettingClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  356. FestRiseClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  357. GhsClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  358. }
  359. public static function migration($main, $shop)
  360. {
  361. //shop数据迁移到main,保存之后请在migrationDel()增加对应字段!!!!!!
  362. $main->balance = $shop->balance ?? 0;
  363. $main->freezeBalance = $shop->freezeBalance ?? 0;
  364. $main->txBalance = $shop->txBalance ?? 0;
  365. $main->fixBalance = $shop->fixBalance ?? 0;
  366. $main->totalRecharge = $shop->totalRecharge ?? 0;
  367. $main->totalIncome = $shop->totalIncome ?? 0;
  368. $main->totalExpend = $shop->totalExpend ?? 0;
  369. $main->totalPurchase = $shop->totalPurchase ?? 0;
  370. $main->totalItem = $shop->totalItem ?? 0;
  371. $main->totalSale = $shop->totalSale ?? 0;
  372. $main->totalStockIn = $shop->totalStockIn ?? 0;
  373. $main->totalStockOut = $shop->totalStockOut ?? 0;
  374. $main->totalRefund = $shop->totalRefund ?? 0;
  375. $main->totalWast = $shop->totalWast ?? 0;
  376. $main->totalPdSub = $shop->totalPdSub ?? 0;
  377. $main->totalPdAdd = $shop->totalPdAdd ?? 0;
  378. $main->totalPurchaseOrder = $shop->totalPurchaseOrder ?? 0;
  379. $main->totalUser = $shop->totalUser ?? 0;
  380. $main->totalVisit = $shop->totalVisit ?? 0;
  381. $main->totalView = $shop->totalView ?? 0;
  382. $main->cashName = $shop->cashName ?? '';
  383. $main->cashAccount = $shop->cashAccount ?? '';
  384. $main->cashBank = $shop->cashBank ?? '';
  385. $main->cgUnPay = $shop->cgUnPay ?? 0;
  386. $main->cgUnSend = $shop->cgUnSend ?? 0;
  387. $main->cgSending = $shop->cgSending ?? 0;
  388. $main->cgFinish = $shop->cgFinish ?? 0;
  389. $main->cgCancel = $shop->cgCancel ?? 0;
  390. $main->mayGatheringNum = $shop->mayGatheringNum ?? 0;
  391. $main->mayGathering = $shop->mayGathering ?? 0;
  392. $main->mayPay = $shop->mayPay ?? 0;
  393. $main->mayPayNum = $shop->mayPayNum ?? 0;
  394. $main->totalOrder = $shop->totalOrder ?? 0;
  395. $main->totalOrderNum = $shop->totalOrderNum ?? 0;
  396. $main->finishOrder = $shop->finishOrder ?? 0;
  397. $main->unPayOrder = $shop->unPayOrder ?? 0;
  398. $main->unSendOrder = $shop->unSendOrder ?? 0;
  399. $main->sendingOrder = $shop->sendingOrder ?? 0;
  400. $main->cancelOrder = $shop->cancelOrder ?? 0;
  401. $main->save();
  402. }
  403. //迁移完成之后删除xhShop对应字段
  404. public static function migrationDel()
  405. {
  406. $sql = "ALTER TABLE `xhShop` DROP COLUMN `balance`;";
  407. Yii::$app->db->createCommand($sql)->execute();
  408. $sql = "ALTER TABLE `xhShop` DROP COLUMN `freezeBalance`;";
  409. Yii::$app->db->createCommand($sql)->execute();
  410. $sql = "ALTER TABLE `xhShop` DROP COLUMN `txBalance`;";
  411. Yii::$app->db->createCommand($sql)->execute();
  412. $sql = "ALTER TABLE `xhShop` DROP COLUMN `fixBalance`;";
  413. Yii::$app->db->createCommand($sql)->execute();
  414. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRecharge`;";
  415. Yii::$app->db->createCommand($sql)->execute();
  416. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalIncome`;";
  417. Yii::$app->db->createCommand($sql)->execute();
  418. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalExpend`;";
  419. Yii::$app->db->createCommand($sql)->execute();
  420. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchase`;";
  421. Yii::$app->db->createCommand($sql)->execute();
  422. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalItem`;";
  423. Yii::$app->db->createCommand($sql)->execute();
  424. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalSale`;";
  425. Yii::$app->db->createCommand($sql)->execute();
  426. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockIn`;";
  427. Yii::$app->db->createCommand($sql)->execute();
  428. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockOut`;";
  429. Yii::$app->db->createCommand($sql)->execute();
  430. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRefund`;";
  431. Yii::$app->db->createCommand($sql)->execute();
  432. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalWast`;";
  433. Yii::$app->db->createCommand($sql)->execute();
  434. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdSub`;";
  435. Yii::$app->db->createCommand($sql)->execute();
  436. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdAdd`;";
  437. Yii::$app->db->createCommand($sql)->execute();
  438. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchaseOrder`;";
  439. Yii::$app->db->createCommand($sql)->execute();
  440. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalUser`;";
  441. Yii::$app->db->createCommand($sql)->execute();
  442. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalVisit`;";
  443. Yii::$app->db->createCommand($sql)->execute();
  444. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalView`;";
  445. Yii::$app->db->createCommand($sql)->execute();
  446. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashName`;";
  447. Yii::$app->db->createCommand($sql)->execute();
  448. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashAccount`;";
  449. Yii::$app->db->createCommand($sql)->execute();
  450. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashBank`;";
  451. Yii::$app->db->createCommand($sql)->execute();
  452. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnPay`;";
  453. Yii::$app->db->createCommand($sql)->execute();
  454. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnSend`;";
  455. Yii::$app->db->createCommand($sql)->execute();
  456. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgSending`;";
  457. Yii::$app->db->createCommand($sql)->execute();
  458. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgFinish`;";
  459. Yii::$app->db->createCommand($sql)->execute();
  460. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgCancel`;";
  461. Yii::$app->db->createCommand($sql)->execute();
  462. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGathering`;";
  463. Yii::$app->db->createCommand($sql)->execute();
  464. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGatheringNum`;";
  465. Yii::$app->db->createCommand($sql)->execute();
  466. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPay`;";
  467. Yii::$app->db->createCommand($sql)->execute();
  468. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPayNum`;";
  469. Yii::$app->db->createCommand($sql)->execute();
  470. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrder`;";
  471. Yii::$app->db->createCommand($sql)->execute();
  472. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrderNum`;";
  473. Yii::$app->db->createCommand($sql)->execute();
  474. $sql = "ALTER TABLE `xhShop` DROP COLUMN `finishOrder`;";
  475. Yii::$app->db->createCommand($sql)->execute();
  476. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unPayOrder`;";
  477. Yii::$app->db->createCommand($sql)->execute();
  478. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unSendOrder`;";
  479. Yii::$app->db->createCommand($sql)->execute();
  480. $sql = "ALTER TABLE `xhShop` DROP COLUMN `sendingOrder`;";
  481. Yii::$app->db->createCommand($sql)->execute();
  482. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cancelOrder`;";
  483. Yii::$app->db->createCommand($sql)->execute();
  484. }
  485. }