CostChangeController.php 910 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace hd\controllers;
  3. use common\components\dateUtil;
  4. use common\components\util;
  5. use Yii;
  6. class CostChangeController extends BaseController
  7. {
  8. public function actionList()
  9. {
  10. $get = Yii::$app->request->get();
  11. $id = $get['id'] ?? 0;
  12. $product = ProductClass::getById($id, true);
  13. if ($product->mainId != $this->mainId) {
  14. util::fail('没有权限');
  15. }
  16. $where = ['itemId' => $id];
  17. $searchTime = $get['searchTime'] ?? '';
  18. if (!empty($searchTime)) {
  19. $startTime = $get['startTime'] ?? '';
  20. $endTime = $get['endTime'] ?? '';
  21. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  22. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  23. }
  24. $list = CostChangeClass::getChangeList($where);
  25. util::success($list);
  26. }
  27. }