InitController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. 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. $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  273. if (!empty($customList)) {
  274. foreach ($customList as $custom) {
  275. $shopId = $custom->shopId ?? 0;
  276. $mainId = $map[$shopId] ?? 0;
  277. $custom->mainId = $mainId;
  278. $ownShopId = $custom->ownShopId ?? 0;
  279. $ownMainId = $map[$ownShopId] ?? 0;
  280. $custom->ownMainId = $ownMainId;
  281. $custom->save();
  282. }
  283. }
  284. $ghsList = GhsClass::getByCondition(['id>' => 0], null, '*', null, true);
  285. foreach ($ghsList as $ghs) {
  286. $shopId = $ghs->shopId ?? 0;
  287. $mainId = $map[$shopId] ?? 0;
  288. $ghs->mainId = $mainId;
  289. $ownShopId = $ghs->ownShopId ?? 0;
  290. $ownMainId = $map[$ownShopId] ?? 0;
  291. $ghs->ownMainId = $ownMainId;
  292. $ghs->save();
  293. }
  294. }
  295. public static function setCommon($shopId, $mainId)
  296. {
  297. ShopAdminClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  298. CashClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  299. AdminRoleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  300. CheckOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  301. StatPdAddClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  302. StatPdAddMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  303. StatPdSubClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  304. StatPdSubMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  305. }
  306. public static function setGhs($shopId, $mainId)
  307. {
  308. StatSaleClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  309. StatSaleMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  310. StatUserClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  311. StatUserMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  312. StatVisitClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  313. StatVisitMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  314. StatOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  315. StatOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  316. PtYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  317. ShopYeChangeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  318. RechargeClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  319. StatYjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  320. StatYjMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  321. StatOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  322. StatOrderMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  323. StatOrderCountClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  324. RefundOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  325. //采购统计
  326. StatCgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  327. StatCgMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  328. StatCgGhsClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  329. StatCgGhsMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  330. CustomClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  331. StatStockOutClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  332. StatStockOutMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  333. StatStockInClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  334. StatStockInMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  335. StatRefundClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  336. StatRefundMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  337. CgClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  338. XjClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  339. //报损中央化
  340. StockWastageOrderClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
  341. $wastageList = StockWastageOrderClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  342. if (!empty($wastageList)) {
  343. foreach ($wastageList as $wastage) {
  344. $wastageOrderSn = $wastage->orderSn ?? 0;
  345. StockWastageOrderItemClass::updateByCondition(['orderSn' => $wastageOrderSn], ['mainId' => $mainId]);
  346. }
  347. }
  348. }
  349. public static function setHd($sjId, $shopId, $mainId)
  350. {
  351. GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  352. GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  353. CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  354. GoodsSettingClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  355. FestRiseClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
  356. GhsClass::updateByCondition(['ownShopId' => $shopId], ['ownMainId' => $mainId]);
  357. }
  358. public static function migration($main, $shop)
  359. {
  360. //shop数据迁移到main,保存之后请在migrationDel()增加对应字段!!!!!!
  361. $main->balance = $shop->balance ?? 0;
  362. $main->freezeBalance = $shop->freezeBalance ?? 0;
  363. $main->txBalance = $shop->txBalance ?? 0;
  364. $main->fixBalance = $shop->fixBalance ?? 0;
  365. $main->totalRecharge = $shop->totalRecharge ?? 0;
  366. $main->totalIncome = $shop->totalIncome ?? 0;
  367. $main->totalExpend = $shop->totalExpend ?? 0;
  368. $main->totalPurchase = $shop->totalPurchase ?? 0;
  369. $main->totalItem = $shop->totalItem ?? 0;
  370. $main->totalSale = $shop->totalSale ?? 0;
  371. $main->totalStockIn = $shop->totalStockIn ?? 0;
  372. $main->totalStockOut = $shop->totalStockOut ?? 0;
  373. $main->totalRefund = $shop->totalRefund ?? 0;
  374. $main->totalWast = $shop->totalWast ?? 0;
  375. $main->totalPdSub = $shop->totalPdSub ?? 0;
  376. $main->totalPdAdd = $shop->totalPdAdd ?? 0;
  377. $main->totalPurchaseOrder = $shop->totalPurchaseOrder ?? 0;
  378. $main->totalUser = $shop->totalUser ?? 0;
  379. $main->totalVisit = $shop->totalVisit ?? 0;
  380. $main->totalView = $shop->totalView ?? 0;
  381. $main->cashName = $shop->cashName ?? '';
  382. $main->cashAccount = $shop->cashAccount ?? '';
  383. $main->cashBank = $shop->cashBank ?? '';
  384. $main->cgUnPay = $shop->cgUnPay ?? 0;
  385. $main->cgUnSend = $shop->cgUnSend ?? 0;
  386. $main->cgSending = $shop->cgSending ?? 0;
  387. $main->cgFinish = $shop->cgFinish ?? 0;
  388. $main->cgCancel = $shop->cgCancel ?? 0;
  389. $main->mayGatheringNum = $shop->mayGatheringNum ?? 0;
  390. $main->mayGathering = $shop->mayGathering ?? 0;
  391. $main->mayPay = $shop->mayPay ?? 0;
  392. $main->mayPayNum = $shop->mayPayNum ?? 0;
  393. $main->totalOrder = $shop->totalOrder ?? 0;
  394. $main->totalOrderNum = $shop->totalOrderNum ?? 0;
  395. $main->finishOrder = $shop->finishOrder ?? 0;
  396. $main->unPayOrder = $shop->unPayOrder ?? 0;
  397. $main->unSendOrder = $shop->unSendOrder ?? 0;
  398. $main->sendingOrder = $shop->sendingOrder ?? 0;
  399. $main->cancelOrder = $shop->cancelOrder ?? 0;
  400. $main->save();
  401. }
  402. //迁移完成之后删除xhShop对应字段
  403. public static function migrationDel()
  404. {
  405. $sql = "ALTER TABLE `xhShop` DROP COLUMN `balance`;";
  406. Yii::$app->db->createCommand($sql)->execute();
  407. $sql = "ALTER TABLE `xhShop` DROP COLUMN `freezeBalance`;";
  408. Yii::$app->db->createCommand($sql)->execute();
  409. $sql = "ALTER TABLE `xhShop` DROP COLUMN `txBalance`;";
  410. Yii::$app->db->createCommand($sql)->execute();
  411. $sql = "ALTER TABLE `xhShop` DROP COLUMN `fixBalance`;";
  412. Yii::$app->db->createCommand($sql)->execute();
  413. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRecharge`;";
  414. Yii::$app->db->createCommand($sql)->execute();
  415. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalIncome`;";
  416. Yii::$app->db->createCommand($sql)->execute();
  417. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalExpend`;";
  418. Yii::$app->db->createCommand($sql)->execute();
  419. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchase`;";
  420. Yii::$app->db->createCommand($sql)->execute();
  421. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalItem`;";
  422. Yii::$app->db->createCommand($sql)->execute();
  423. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalSale`;";
  424. Yii::$app->db->createCommand($sql)->execute();
  425. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockIn`;";
  426. Yii::$app->db->createCommand($sql)->execute();
  427. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalStockOut`;";
  428. Yii::$app->db->createCommand($sql)->execute();
  429. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalRefund`;";
  430. Yii::$app->db->createCommand($sql)->execute();
  431. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalWast`;";
  432. Yii::$app->db->createCommand($sql)->execute();
  433. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdSub`;";
  434. Yii::$app->db->createCommand($sql)->execute();
  435. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPdAdd`;";
  436. Yii::$app->db->createCommand($sql)->execute();
  437. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalPurchaseOrder`;";
  438. Yii::$app->db->createCommand($sql)->execute();
  439. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalUser`;";
  440. Yii::$app->db->createCommand($sql)->execute();
  441. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalVisit`;";
  442. Yii::$app->db->createCommand($sql)->execute();
  443. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalView`;";
  444. Yii::$app->db->createCommand($sql)->execute();
  445. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashName`;";
  446. Yii::$app->db->createCommand($sql)->execute();
  447. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashAccount`;";
  448. Yii::$app->db->createCommand($sql)->execute();
  449. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cashBank`;";
  450. Yii::$app->db->createCommand($sql)->execute();
  451. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnPay`;";
  452. Yii::$app->db->createCommand($sql)->execute();
  453. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgUnSend`;";
  454. Yii::$app->db->createCommand($sql)->execute();
  455. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgSending`;";
  456. Yii::$app->db->createCommand($sql)->execute();
  457. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgFinish`;";
  458. Yii::$app->db->createCommand($sql)->execute();
  459. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cgCancel`;";
  460. Yii::$app->db->createCommand($sql)->execute();
  461. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGathering`;";
  462. Yii::$app->db->createCommand($sql)->execute();
  463. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayGatheringNum`;";
  464. Yii::$app->db->createCommand($sql)->execute();
  465. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPay`;";
  466. Yii::$app->db->createCommand($sql)->execute();
  467. $sql = "ALTER TABLE `xhShop` DROP COLUMN `mayPayNum`;";
  468. Yii::$app->db->createCommand($sql)->execute();
  469. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrder`;";
  470. Yii::$app->db->createCommand($sql)->execute();
  471. $sql = "ALTER TABLE `xhShop` DROP COLUMN `totalOrderNum`;";
  472. Yii::$app->db->createCommand($sql)->execute();
  473. $sql = "ALTER TABLE `xhShop` DROP COLUMN `finishOrder`;";
  474. Yii::$app->db->createCommand($sql)->execute();
  475. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unPayOrder`;";
  476. Yii::$app->db->createCommand($sql)->execute();
  477. $sql = "ALTER TABLE `xhShop` DROP COLUMN `unSendOrder`;";
  478. Yii::$app->db->createCommand($sql)->execute();
  479. $sql = "ALTER TABLE `xhShop` DROP COLUMN `sendingOrder`;";
  480. Yii::$app->db->createCommand($sql)->execute();
  481. $sql = "ALTER TABLE `xhShop` DROP COLUMN `cancelOrder`;";
  482. Yii::$app->db->createCommand($sql)->execute();
  483. }
  484. }