GhsInitController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * User: admin
  4. * Date Time: 2021/4/7 21:29
  5. */
  6. namespace console\controllers;
  7. use biz\item\classes\PtItemClass;
  8. use bizGhs\item\classes\ItemClass;
  9. use bizGhs\item\classes\ItemClassClass;
  10. use bizGhs\product\classes\ProductClass;
  11. use common\services\xhItemService;
  12. use yii\console\Controller;
  13. class GhsInitController extends Controller
  14. {
  15. public function actionInit()
  16. {
  17. }
  18. //清空某个商户的product
  19. public function actionClearItem($sjId)
  20. {
  21. }
  22. public function actionPtUnit()
  23. {
  24. $res = ProductClass::getAllList("*","");
  25. foreach ($res as $v){
  26. $id = $v['id'];
  27. $obigU = $v['bigUnit'];
  28. $oSmallU = $v['smallUnit'];
  29. $bigUname = xhItemService::getUnitName($obigU);
  30. $smallUName = xhItemService::getUnitName($oSmallU);
  31. $data = [
  32. 'bigUnitId'=>$obigU,
  33. 'smallUnitId'=>$oSmallU,
  34. 'bigUnit'=>$bigUname,
  35. 'smallUnit'=>$smallUName,
  36. ];
  37. ProductClass::updateById($id,$data);
  38. }
  39. echo "done";
  40. }
  41. }