InitController.php 25 KB

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