Batch.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\controller;
  3. use app\BaseController;
  4. use app\common\middleware\Auth;
  5. use app\common\api\BatchApi;
  6. use app\common\state\ProjectState;
  7. /**
  8. * Description of Batch
  9. *
  10. * @author sgq
  11. */
  12. class Batch extends BaseController {
  13. protected $middleware = [Auth::class];
  14. public function checkBatchValid() {
  15. $user = session("user");
  16. if ($this->request["id"] && $this->request["type"]) {
  17. $params = [];
  18. switch ($this->request["type"]) {
  19. case ProjectState::HOUSE:
  20. $info = \app\common\api\HouseApi::getInfoById($this->request["id"]);
  21. $params = ["type" => $this->request["type"], "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]];
  22. break;
  23. }
  24. return json(BatchApi::checkBatchValid($params, $user["type"]));
  25. }
  26. return json(BatchApi::checkBatchValid($this->request->param(), $user["type"]));
  27. }
  28. public function listBatchByType() {
  29. $projectType = $this->request["type"];
  30. $talentType = $this->request["source"];
  31. return json(BatchApi::getValidBatchs($projectType, $talentType));
  32. }
  33. }