123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace app\enterprise\controller;
- use app\enterprise\common\EnterpriseController;
- use app\common\state\CommonConst;
- use app\common\api\BatchApi;
- use app\common\api\TalentAllowanceApi;
- use app\common\api\EnterpriseApi;
- use app\common\state\ProjectState;
- /**
- * Description of TalentAllowance
- *
- * @author sgq
- */
- class TalentAllowance extends EnterpriseController {
- public function index() {
- $tpl = "";
- switch ($this->user["type"]) {
- case CommonConst::ENTERPRISE_JC:
- $tpl = "indexIC";
- break;
- }
- return view($tpl, ['type' => $this->user["type"]]);
- }
- public function list() {
- $res = EnterpriseLaApi::getList($this->request);
- return json($res);
- }
- /**
- * 申请
- */
- public function apply(\think\Request $request) {
- $type = $this->user["type"];
- $param = $request->param();
- $id = isset($param["id"]) ? $param["id"] : 0;
- $info = TalentAllowanceApi::getInfoById($id);
- $ep = EnterpriseApi::getOne($this->user["uid"]);
- if (!chkEnterpriseFull($ep))
- return;
- /* if ($info && !in_array($info["checkState"], [LaState::LA_SAVE, LaState::LA_FIRST_REJECT])) {
- return view("", ["row" => $info, "enterprise" => $ep, "hand" => "select"]);
- } */
- if ($request->isPost()) {
- return $this->save($info, $request);
- }
- $hand = $info ? "update" : "add";
- $batch = $info["year"] ?: BatchApi::getValidBatch(ProjectState::LIVINGALLOWANCE, $this->user["type"])["batch"];
- return view("", ["year" => $batch, "row" => $info, "enterprise" => $ep, "hand" => $hand]);
- }
- public function detail(\think\Request $request) {
- $param = $request->param();
- $id = $param["id"];
- $info = CommonLaApi::getInfoById($id);
- $ep = EnterpriseApi::getOne($this->user["uid"]);
- if (!chkEnterpriseFull($ep))
- return;
- return view("apply", ["row" => $info, "enterprise" => $ep, "hand" => "select"]);
- }
- }
|