ShopController.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace console\controllers;
  3. use biz\ghs\classes\GhsClass;
  4. use biz\shop\classes\ShopClass;
  5. use bizGhs\custom\classes\CustomClass;
  6. use bizGhs\order\classes\OrderClass;
  7. use yii\console\Controller;
  8. use Yii;
  9. class ShopController extends Controller
  10. {
  11. public function actionOrder()
  12. {
  13. $orderList = OrderClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  14. if (!empty($orderList)) {
  15. foreach ($orderList as $order) {
  16. $payTime = $order->payTime ?? '';
  17. if (!empty($payTime) && $payTime != '0000-00-00 00:00:00') {
  18. $addTime = $order->addTime ?? '';
  19. if ($payTime > $addTime) {
  20. echo "id:{$order->id} {$payTime} {$addTime}\n";
  21. }
  22. }
  23. }
  24. }
  25. }
  26. public function actionCustom()
  27. {
  28. $custom = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  29. if (empty($custom)) {
  30. echo '空';
  31. return false;
  32. }
  33. foreach ($custom as $item) {
  34. $shopId = $item->shopId ?? 0;
  35. $shop = ShopClass::getById($shopId, true);
  36. if ($shop->mainId != $item->mainId) {
  37. echo "客户id:{$item->id} {$shop->mainId} {$item->mainId}\n";
  38. if (!empty($shop->mainId)) {
  39. $item->mainId = $shop->mainId;
  40. $item->save();
  41. }
  42. }
  43. $ownShopId = $item->ownShopId ?? 0;
  44. $ownShop = ShopClass::getById($ownShopId, true);
  45. if ($ownShop->mainId != $item->ownMainId) {
  46. echo "客户own {$item->id} {$item->ownMainId} {$ownShop->mainId}\n";
  47. if (!empty($ownShop->mainId)) {
  48. $item->ownMainId = $ownShop->mainId;
  49. $item->save();
  50. }
  51. }
  52. }
  53. }
  54. public function actionGhs()
  55. {
  56. $ghs = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true);
  57. if (empty($ghs)) {
  58. echo '空';
  59. return false;
  60. }
  61. foreach ($ghs as $item) {
  62. $shopId = $item->shopId ?? 0;
  63. $mainId = $item->mainId ?? 0;
  64. $shop = ShopClass::getById($shopId, true);
  65. if ($shop->mainId != $mainId) {
  66. echo "ghs {$item->id} {$mainId} {$shop->mainId} \n";
  67. }
  68. $ownShopId = $item->ownShopId ?? 0;
  69. $ownMainId = $item->ownMainId ?? 0;
  70. $ownShop = ShopClass::getById($ownShopId, true);
  71. if ($ownShop->mainId != $ownMainId) {
  72. echo "ghs own {$item->id} {$ownMainId} {$ownShop->mainId} \n";
  73. if (!empty($ownShop->mainId)) {
  74. $item->ownMainId = $ownShop->mainId;
  75. $item->save();
  76. }
  77. }
  78. }
  79. }
  80. }