InitController.php 25 KB

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