LsCustomController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace console\controllers;
  3. use bizHd\custom\classes\CustomClass;
  4. use bizHd\custom\classes\HdClass;
  5. use bizHd\custom\models\Custom;
  6. use bizHd\shop\models\Shop;
  7. use yii\console\Controller;
  8. use Yii;
  9. class LsCustomController extends Controller
  10. {
  11. public function actionIndex()
  12. {
  13. //先确认所有客户的欠款总数跟账单总和能不能对应上 ssh 20250620
  14. //批发不需要这一步
  15. //零售要去数据库确认这一步
  16. }
  17. public function actionMigrate()
  18. {
  19. $query = new \yii\db\Query();
  20. $query->from(Shop::tableName());
  21. $query->where(['ptStyle' => 1]);
  22. $query->orderBy('addTime ASC');
  23. foreach ($query->batch(20) as $shopList) {
  24. foreach ($shopList as $shop) {
  25. $shopId = $shop['id']??0;
  26. $query = new \yii\db\Query();
  27. $query->from(Custom::tableName());
  28. $query->where(['shopId' => $shopId]);
  29. $query->orderBy('addTime ASC');
  30. foreach ($query->batch(50) as $customList) {
  31. foreach ($customList as $custom) {
  32. }
  33. }
  34. }
  35. }
  36. }
  37. }