Talent.php 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. <?php
  2. namespace app\enterprise\controller;
  3. use app\enterprise\common\EnterpriseController;
  4. use app\enterprise\api\TalentApi;
  5. use app\enterprise\model\Talent as TalentModel;
  6. use think\facade\Db;
  7. use app\common\api\EnterpriseApi;
  8. use app\common\api\DictApi;
  9. use app\common\api\TalentLogApi;
  10. use app\common\api\TalentState;
  11. use think\exception\ValidateException;
  12. use app\enterprise\validate\TalentInfo;
  13. // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
  14. /**
  15. * Description of Talent
  16. *
  17. * @author sgq
  18. */
  19. class Talent extends EnterpriseController {
  20. public function index() {
  21. $isMix = $this->request->param("isMix");
  22. $tpl = "";
  23. if ($isMix == 1) {
  24. $tpl = "newIndex";
  25. }
  26. return view($tpl);
  27. }
  28. public function list() {
  29. $step = 2;
  30. $res = TalentApi::getList($this->request, $step);
  31. return json($res);
  32. }
  33. public function zrIndex() {
  34. return view();
  35. }
  36. /**
  37. * 新人才申报企业端统一申报入口,混合基础信息及人才信息
  38. */
  39. public function apply(\think\Request $request) {
  40. $type = $this->user["type"];
  41. $tpl = "";
  42. switch ($type) {
  43. case 1:
  44. $tpl = "apply"; //晋江人才
  45. break;
  46. case 2:
  47. $tpl = "ic_apply"; //集成电路
  48. break;
  49. }
  50. $param = $request->param();
  51. $id = isset($param["id"]) ? $param["id"] : 0;
  52. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  53. if ($info["isImport"]) {
  54. //$tpl = "no_file_apply"; //晋江人才
  55. }
  56. $ep = EnterpriseApi::getOne($this->user["uid"]);
  57. if (!chkEnterpriseFull($ep))
  58. return;
  59. $tagList = DictApi::selectByParentCode('enterprise_tag');
  60. $streetList = DictApi::selectByParentCode('street');
  61. $industryFieldNew = DictApi::selectByParentCode('industry_field');
  62. $ep->enterpristTagName = $tagList[$ep->enterpriseTag];
  63. $ep->streetName = $streetList[$ep->street];
  64. $ep->industryFieldNewName = $industryFieldNew[$ep->industryFieldNew];
  65. if ($info) {
  66. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  67. }
  68. if ($info && in_array($info["checkState"], [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::REVERIFY_PASS, TalentState::REVERIFY_FAIL])) {
  69. return $this->view($request);
  70. exit();
  71. }
  72. if ($request->isPost()) {
  73. $checkState = $info["checkState"] ?: 0;
  74. if ($checkState == TalentState::SCND_SAVE || $checkState == 0) {
  75. switch ($type) {
  76. case 1:
  77. $this->mixSave($info, $request, TalentState::SCND_SAVE);
  78. exit();
  79. break;
  80. case 2:
  81. $this->icSave($info, $request, TalentState::SCND_SAVE);
  82. exit();
  83. break;
  84. }
  85. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  86. $res = ["msg" => "审核失败,不能再保存"];
  87. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  88. exit;
  89. }
  90. $res = ["msg" => "已提交审核,请耐心等待"];
  91. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  92. exit;
  93. }
  94. $checkState = $info["checkState"] ?: 0;
  95. $batch = \app\common\api\BatchApi::getValidBatch(\app\common\state\ProjectState::TALENT, $this->user["type"]);
  96. $info["enterprise"] = $ep;
  97. $info["talent_type_list"] = DictApi::findChildDictByCode("talent_type");
  98. if ($info["talent_condition"]) {
  99. $info["isSalary"] = \app\common\api\TalentConditionApi::getOne($info["talent_condition"])["isSalary"] ?: 0;
  100. }
  101. return view($tpl, ["year" => $batch["batch"], "checkState" => $checkState, "row" => $info]);
  102. }
  103. /**
  104. * 旧第二步
  105. * @param \think\Request $request
  106. * @return type
  107. */
  108. public function second(\think\Request $request) {
  109. if ($this->user["type"] != 1)
  110. return "此入口仅供晋江市人才申报,晋江集成电路人才请使用新统一申报入口";
  111. $params = $request->param();
  112. $id = $params["id"];
  113. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  114. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  115. if ($request->isPost()) {
  116. if (!$info || $info["enterprise_id"] != $this->user["uid"]) {
  117. $res = ["msg" => "没有对应的人才认定申报信息"];
  118. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  119. exit;
  120. }
  121. $checkState = $info["checkState"];
  122. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_REVERIFY_PASS) {
  123. $this->save($info, $request, TalentState::SCND_SAVE);
  124. exit();
  125. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  126. $res = ["msg" => "审核失败,不能再保存"];
  127. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  128. exit;
  129. }
  130. $res = ["msg" => "已提交审核,请耐心等待"];
  131. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  132. exit;
  133. }
  134. $enterprise_info = \app\common\model\Enterprise::find($this->user["uid"]);
  135. $info["enterprise"] = $enterprise_info;
  136. $batch = \app\common\api\BatchApi::getValidBatch(1, $enterprise_info["type"]);
  137. return view("second", ["year" => $info["apply_year"] ?: $batch["batch"], "row" => $info]);
  138. }
  139. public function view(\think\Request $request) {
  140. switch ($this->user["type"]) {
  141. case 1:
  142. $tpl = "view"; //晋江人才
  143. break;
  144. case 2:
  145. $tpl = "ic_view"; //集成电路
  146. break;
  147. }
  148. $id = $request->param("id");
  149. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  150. if ($info["isImport"]) {
  151. //$tpl = "no_file_view";
  152. }
  153. return view($tpl, ["row" => $info]);
  154. }
  155. /**
  156. * 提交表单(旧第二步)
  157. */
  158. public function submit() {
  159. $params = $this->request->param();
  160. $id = $params["id"];
  161. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  162. $res = ["msg" => "没有对应的人才认定申报信息"];
  163. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  164. exit;
  165. }
  166. if ($info) {
  167. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  168. }
  169. $checkState = $info["checkState"];
  170. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_REVERIFY_PASS) {
  171. $field_dict = \app\common\api\DictApi::getTalentFields(2);
  172. $no_empty = ["talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
  173. "bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
  174. $where = [];
  175. $where[] = ["rel", "=", "study_abroad"];
  176. $where[] = ["step", "=", 2];
  177. $where[] = ["project", "=", 1];
  178. $where[] = ["active", "=", 1];
  179. $where[] = ["delete", "=", 0];
  180. $where[] = ["type", "=", $this->user["type"]];
  181. $where[] = ["isConditionFile", "<>", 1];
  182. $abroad_files = Db::table("new_common_filetype")->where($where)->select()->toArray(); //留学的附件
  183. $abroad_file_ids = null;
  184. if ($abroad_files)
  185. $abroad_file_ids = array_column($abroad_files, "id");
  186. if ($params["study_abroad"] == 1) {
  187. $no_empty[] = "abroad_school";
  188. $no_empty[] = "abroad_major";
  189. }
  190. if (in_array($params["source"], [1, 3])) {
  191. $no_empty[] = "source_batch";
  192. $no_empty[] = "fujian_highcert_pubtime";
  193. $no_empty[] = "fujian_highcert_exptime";
  194. if ($params["source"] == 3) {
  195. $no_empty[] = "source_city";
  196. }
  197. }
  198. if (in_array($params["source"], [2, 4])) {
  199. $no_empty[] = "source_batch";
  200. $no_empty[] = "quanzhou_highcert_pubtime";
  201. $no_empty[] = "quanzhou_highcert_exptime";
  202. if ($params["source"] == 4) {
  203. $no_empty[] = "source_county";
  204. }
  205. }
  206. $condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
  207. if ($condition_info["isSalary"] == 1) {
  208. $no_empty[] = "annual_salary";
  209. }
  210. $no_empty = array_filter($no_empty);
  211. $return = [];
  212. foreach ($no_empty as $key) {
  213. if (!$params[$key]) {
  214. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  215. }
  216. }
  217. if (count($return) > 0) {
  218. $res = ["msg" => implode("<br>", $return)];
  219. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  220. exit;
  221. }
  222. if ($condition_info["bindFileTypes"] && $info["source"] == 5) {
  223. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  224. $whr[] = ["must", "=", 1];
  225. }
  226. $where = [];
  227. $where[] = ["step", "=", 2];
  228. $where[] = ["project", "=", 1];
  229. $where[] = ["type", "=", $this->user["type"]];
  230. $where[] = ["must", "=", 1];
  231. $where[] = ["active", "=", 1];
  232. $where[] = ["delete", "=", 0];
  233. $where[] = ["isConditionFile", "<>", 1];
  234. if ($whr) {
  235. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  236. } else {
  237. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  238. }
  239. $ft_ids = array_column($filetypes, "id");
  240. if ($params["study_abroad"] == 1) {
  241. //选中留学,如果存在留学附件变成必传
  242. $ft_ids = array_unique(array_merge($ft_ids, (array) $abroad_file_ids));
  243. } else {
  244. //没选中,留学附件就算设成必传也不用验证
  245. $ft_ids = array_diff($ft_ids, (array) $abroad_file_ids);
  246. }
  247. $whr = [];
  248. $whr[] = ["typeId", "in", $ft_ids];
  249. $whr[] = ["mainId", "=", $id];
  250. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
  251. $upload_type_counts = count($distinct_filetypes);
  252. if ($upload_type_counts != count($ft_ids)) {
  253. $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
  254. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  255. exit;
  256. }
  257. $this->save($info, $this->request, TalentState::SCND_SUBMIT);
  258. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  259. $res = ["msg" => "审核失败,不能再提交审核"];
  260. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  261. exit;
  262. }
  263. $res = ["msg" => "已提交审核,请耐心等待"];
  264. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  265. exit;
  266. }
  267. public function submitToCheck() {
  268. switch ($this->user["type"]) {
  269. case 1:
  270. return $this->submitToCheck_JJRC();
  271. case 2:
  272. return $this->submitToCheck_IC();
  273. }
  274. }
  275. /**
  276. * 提交表单(新:混合基础信息人才申报信息)晋江人才
  277. */
  278. private function submitToCheck_JJRC() {
  279. $params = $this->request->param();
  280. $id = $params["id"];
  281. $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
  282. if ($info) {
  283. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  284. }
  285. $checkState = $info["checkState"];
  286. if ($checkState == TalentState::SCND_SAVE || !$id) {
  287. $field_dict = \app\common\api\DictApi::getTalentFields(4, $info["isImport"]);
  288. $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type", "experience", "education",
  289. "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
  290. "bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
  291. $where = [];
  292. $where[] = ["rel", "=", "study_abroad"];
  293. $where[] = ["project", "=", 1];
  294. $where[] = ["active", "=", 1];
  295. $where[] = ["delete", "=", 0];
  296. $where[] = ["type", "=", $this->user["type"]];
  297. $where[] = ["isConditionFile", "<>", 1];
  298. $abroad_files = Db::table("new_common_filetype")->where($where)->select()->toArray(); //留学的附件
  299. $abroad_file_ids = null;
  300. if ($abroad_files)
  301. $abroad_file_ids = array_column($abroad_files, "id");
  302. if (in_array($params["talent_type"], [1, 2])) {
  303. $no_empty[] = "tax_insurance_month";
  304. $no_empty[] = "labor_contract_rangetime";
  305. }
  306. if ($params["talent_type"] == 3) {
  307. $no_empty[] = "pre_import_type";
  308. }
  309. if ($params["study_abroad"] == 1) {
  310. $no_empty[] = "abroad_school";
  311. $no_empty[] = "abroad_major";
  312. }
  313. if (in_array($params["source"], [1, 3])) {
  314. //$no_empty[] = "source_batch";
  315. //$no_empty[] = "fujian_highcert_pubtime";
  316. //$no_empty[] = "fujian_highcert_exptime";
  317. if ($params["source"] == 3) {
  318. $no_empty[] = "source_city";
  319. }
  320. }
  321. if (in_array($params["source"], [2, 4])) {
  322. //$no_empty[] = "source_batch";
  323. //$no_empty[] = "quanzhou_highcert_pubtime";
  324. //$no_empty[] = "quanzhou_highcert_exptime";
  325. if ($params["source"] == 4) {
  326. $no_empty[] = "source_county";
  327. }
  328. }
  329. $condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
  330. if ($condition_info["isSalary"] == 1) {
  331. $no_empty[] = "annual_salary";
  332. }
  333. $no_empty = array_filter($no_empty);
  334. $return = [];
  335. foreach ($no_empty as $key) {
  336. if (!$params[$key]) {
  337. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  338. }
  339. }
  340. if (count($return) > 0) {
  341. $res = ["msg" => implode("<br>", $return)];
  342. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  343. exit;
  344. }
  345. $isMatchZhiren = $info["isImport"] && $params["isMatchZhiren"] == 1 ? true : false;
  346. if ($condition_info["bindFileTypes"] && $info["source"] == 5 && !$isMatchZhiren) {
  347. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  348. $whr[] = ["must", "=", 1];
  349. }
  350. $where = [];
  351. $where[] = ["project", "=", 1];
  352. $where[] = ["type", "=", $this->user["type"]];
  353. $where[] = ["must", "=", 1];
  354. $where[] = ["active", "=", 1];
  355. $where[] = ["delete", "=", 0];
  356. $where[] = ["isConditionFile", "<>", 1];
  357. if ($whr) {
  358. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  359. } else {
  360. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  361. }
  362. $age = 0;
  363. if ($params["birthday"]) {
  364. $birthday = $params["birthday"];
  365. $birthdayYear = substr($birthday, 0, 4);
  366. $currentYear = date("Y");
  367. $age = $currentYear - $birthdayYear;
  368. }
  369. $ft_ids = [];
  370. $deletes = [];
  371. foreach ($filetypes as $ft) {
  372. if ($ft["option"]) {
  373. if ($ft["rel"] == "birthday") {
  374. if ($age < $ft["option"]) {
  375. $deletes[] = $ft["id"];
  376. continue;
  377. }
  378. } else {
  379. $selectVal = $params[$ft["rel"]];
  380. $conditions = array_filter(explode(",", $ft["option"]));
  381. if (!in_array($selectVal, $conditions)) {
  382. $deletes[] = $ft["id"];
  383. continue;
  384. }
  385. }
  386. }
  387. $ft_ids[] = $ft["id"];
  388. }
  389. if ($params["study_abroad"] == 1) {
  390. //选中留学,如果存在留学附件变成必传
  391. $ft_ids = array_unique(array_merge($ft_ids, (array) $abroad_file_ids));
  392. } else {
  393. //没选中,留学附件就算设成必传也不用验证
  394. $ft_ids = array_diff($ft_ids, (array) $abroad_file_ids);
  395. }
  396. $whr = [];
  397. if ($id) {
  398. $whr[] = ["mainId", "=", $id];
  399. } else {
  400. if ($params["uploadFiles"])
  401. $whr[] = ["id", "in", $params["uploadFiles"]];
  402. }
  403. $whr[] = ["typeId", "in", $ft_ids];
  404. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
  405. $upload_type_counts = count($distinct_filetypes);
  406. if ($upload_type_counts != count($ft_ids)) {
  407. $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
  408. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  409. exit;
  410. }
  411. return $this->mixSave($info, $this->request, TalentState::SCND_SUBMIT);
  412. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  413. $res = ["msg" => "审核失败,不能再提交审核"];
  414. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  415. exit;
  416. }
  417. $res = ["msg" => "已提交审核,请耐心等待"];
  418. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  419. exit;
  420. }
  421. /**
  422. * 提交表单(新:混合基础信息人才申报信息)晋江电路
  423. */
  424. private function submitToCheck_IC() {
  425. $params = $this->request->param();
  426. $id = $params["id"];
  427. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  428. return json(["msg" => "没有对应的人才认定申报信息"]);
  429. }
  430. if ($info) {
  431. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  432. }
  433. $checkState = $info["checkState"];
  434. if ($checkState == TalentState::SCND_SAVE) {
  435. $field_dict = \app\common\api\DictApi::getTalentFields_IC();
  436. $no_empty = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "break_faith",
  437. "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad", "position", "cur_entry_time", "labor_contract_rangetime",
  438. "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime",
  439. "bank", "bank_branch_name", "bank_account", "experience", "education"];
  440. $no_empty = array_filter($no_empty);
  441. $return = [];
  442. foreach ($no_empty as $key) {
  443. if (!$info[$key]) {
  444. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  445. }
  446. }
  447. if (count($return) > 0) {
  448. return json(["msg" => implode("<br>", $return)]);
  449. }
  450. $where = [];
  451. $where[] = ["project", "=", 1];
  452. $where[] = ["type", "=", $this->user["type"]];
  453. $where[] = ["must", "=", 1];
  454. $where[] = ["active", "=", 1];
  455. $where[] = ["delete", "=", 0];
  456. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  457. $ft_ids = array_column($filetypes, "id");
  458. $whr = [];
  459. $whr[] = ["typeId", "in", $ft_ids];
  460. $whr[] = ["mainId", "=", $id];
  461. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
  462. $upload_type_counts = count($distinct_filetypes);
  463. if ($upload_type_counts != count($ft_ids)) {
  464. return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
  465. }
  466. return $this->icSave($info, $this->request, TalentState::SCND_SUBMIT);
  467. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  468. return json(["msg" => "审核失败,不能再提交审核", "code" => 500]);
  469. }
  470. return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
  471. }
  472. /**
  473. * 保存表单(旧第二步)
  474. * @param type $info talent_info
  475. * @param type $param request->param();
  476. */
  477. private function save($info, \think\Request $request, $checkState) {
  478. try {
  479. $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
  480. if (!$batch) {
  481. throw new ValidateException("不在人才认定申报申请时间内");
  482. }
  483. $param = $request->param();
  484. validate(TalentInfo::class)->check($param);
  485. $data["apply_year"] = $batch["batch"];
  486. $all_valid_keys = ["applay_year", "import_way", "cur_entry_time", "position",
  487. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  488. "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  489. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  490. foreach ($all_valid_keys as $key) {
  491. $data[$key] = trim($param[$key]);
  492. }
  493. if ($data["study_abroad"] == 1) {
  494. $data["abroad_school"] = $param["abroad_school"];
  495. $data["abroad_major"] = $param["abroad_major"];
  496. } else {
  497. $data["abroad_school"] = null;
  498. $data["abroad_major"] = null;
  499. }
  500. switch ($data["source"]) {
  501. case 1:
  502. $data["source_batch"] = $param["source_batch"];
  503. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  504. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  505. $data["source_city"] = null;
  506. break;
  507. case 2:
  508. $data["source_batch"] = $param["source_batch"];
  509. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  510. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  511. $data["source_county"] = null;
  512. break;
  513. case 3:
  514. $data["source_batch"] = $param["source_batch"];
  515. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  516. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  517. $data["source_city"] = $param["source_city"];
  518. break;
  519. case 4:
  520. $data["source_batch"] = $param["source_batch"];
  521. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  522. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  523. $data["source_county"] = $param["source_county"];
  524. break;
  525. }
  526. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  527. if ($condition_info["isSalary"] == 1) {
  528. $data["annual_salary"] = $param["annual_salary"];
  529. } else {
  530. $data["annual_salary"] = null;
  531. }
  532. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  533. //真实状态8是驳回,需要判断什么字段可以提交
  534. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  535. $tmp_data = $data;
  536. $data = [];
  537. foreach ($modify_fields as $field) {
  538. $data[$field] = $tmp_data[$field];
  539. }
  540. }
  541. $data["checkState"] = $checkState;
  542. $data["id"] = $info["id"];
  543. $success_msg = "提交成功";
  544. $error_msg = "提交失败";
  545. if ($checkState == TalentState::SCND_SAVE) {
  546. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  547. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  548. TalentLogApi::write(1, $data["id"], $checkState, "保存认定材料未提交", 1);
  549. }
  550. TalentModel::update($data);
  551. } else if ($checkState == TalentState::SCND_SUBMIT) {
  552. $success_msg = "提交成功";
  553. $error_msg = "提交失败";
  554. $data["new_submit_time"] = date("Y-m-d H:i:s");
  555. TalentModel::update($data);
  556. TalentLogApi::write(1, $info["id"], $checkState, "确认提交审核", 1);
  557. } else {
  558. throw new ValidateException($error_msg);
  559. }
  560. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $info["id"], "checkState" => $checkState]];
  561. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  562. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  563. exit();
  564. } catch (ValidateException $e) {
  565. $res = ["msg" => $e->getMessage()];
  566. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  567. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  568. exit();
  569. }
  570. }
  571. /**
  572. * 保存表单(新:混合基础信息人才申报信息)
  573. * @param type $info talent_info
  574. * @param type $param request->param();
  575. */
  576. private function mixSave($info, \think\Request $request, $checkState) {
  577. try {
  578. $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
  579. if (!$batch) {
  580. throw new ValidateException("不在人才认定申报申请时间内");
  581. }
  582. $param = $request->param();
  583. validate(TalentInfo::class)->check($param);
  584. $id = $param["id"];
  585. if ($id) {
  586. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  587. throw new ValidateException("没有对应的人才认定申报信息");
  588. }
  589. }
  590. $files = $param["uploadFiles"];
  591. $data["headimgurl"] = $info["headimgurl"];
  592. if ($request->file()) {
  593. $headimg = $request->file("photo");
  594. $upload = new \app\common\api\UploadApi();
  595. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  596. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  597. $width = imagesx($file);
  598. $height = imagesy($file);
  599. //免冠二寸照长宽413:579
  600. if ($width * 579 != $height * 413) {
  601. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  602. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  603. }
  604. if ($info && $info["headimgurl"]) {
  605. //如果新照片符合像素要求,则删除旧照片
  606. $old_head_url = "storage/" . $info["headimgurl"];
  607. if (file_exists($old_head_url))
  608. @unlink($old_head_url);
  609. }
  610. $data["headimgurl"] = $result->filepath;
  611. }
  612. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  613. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  614. $where = [];
  615. $where[] = ["project", "=", 1];
  616. $where[] = ["type", "=", $this->user["type"]];
  617. $where[] = ["must", "=", 1];
  618. $where[] = ["active", "=", 1];
  619. $where[] = ["delete", "=", 0];
  620. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  621. $age = 0;
  622. if ($param["birthday"]) {
  623. $birthday = $param["birthday"];
  624. $birthdayYear = substr($birthday, 0, 4);
  625. $currentYear = date("Y");
  626. $age = $currentYear - $birthdayYear;
  627. }
  628. $ft_ids = [];
  629. $deletes = [];
  630. foreach ($filetypes as $ft) {
  631. if ($ft["option"]) {
  632. if ($ft["rel"] == "birthday") {
  633. if ($age < $ft["option"]) {
  634. $deletes[] = $ft["id"];
  635. continue;
  636. }
  637. } else {
  638. $selectVal = $param[$ft["rel"]];
  639. $conditions = array_filter(explode(",", $ft["option"]));
  640. if (!in_array($selectVal, $conditions)) {
  641. $deletes[] = $ft["id"];
  642. continue;
  643. }
  644. }
  645. }
  646. $ft_ids[] = $ft["id"];
  647. }
  648. $data["apply_year"] = $batch["batch"];
  649. $data["isMatchZhiren"] = $param["isMatchZhiren"] ?: 0;
  650. $all_valid_keys = ["talent_type", "name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education",
  651. "import_way", "cur_entry_time", "position",
  652. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  653. "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  654. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  655. foreach ($all_valid_keys as $key) {
  656. $data[$key] = trim($param[$key]);
  657. }
  658. if (in_array($data["talent_type"], [1, 2])) {
  659. $data["tax_insurance_month"] = $param["tax_insurance_month"];
  660. $data["labor_contract_rangetime"] = $param["labor_contract_rangetime"];
  661. $data["salary_pay_way"] = $param["salary_pay_way"];
  662. $data["salary_pay_month"] = $param["salary_pay_month"];
  663. $data["fst_work_time"] = $param["fst_work_time"];
  664. $data['pre_import_type'] = null;
  665. } else {
  666. $data["tax_insurance_month"] = null;
  667. $data["labor_contract_rangetime"] = null;
  668. $data["salary_pay_way"] = null;
  669. $data["salary_pay_month"] = null;
  670. $data["fst_work_time"] = null;
  671. $data['pre_import_type'] = $param["pre_import_type"];
  672. }
  673. if ($data["study_abroad"] == 1) {
  674. $data["abroad_school"] = $param["abroad_school"];
  675. $data["abroad_major"] = $param["abroad_major"];
  676. } else {
  677. $data["abroad_school"] = null;
  678. $data["abroad_major"] = null;
  679. }
  680. switch ($data["source"]) {
  681. case 1:
  682. $data["source_batch"] = $param["source_batch"];
  683. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  684. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  685. $data["source_city"] = null;
  686. break;
  687. case 2:
  688. $data["source_batch"] = $param["source_batch"];
  689. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  690. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  691. $data["source_county"] = null;
  692. break;
  693. case 3:
  694. $data["source_batch"] = $param["source_batch"];
  695. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  696. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  697. $data["source_city"] = $param["source_city"];
  698. break;
  699. case 4:
  700. $data["source_batch"] = $param["source_batch"];
  701. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  702. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  703. $data["source_county"] = $param["source_county"];
  704. break;
  705. }
  706. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  707. if ($condition_info["isSalary"] == 1) {
  708. $data["annual_salary"] = $param["annual_salary"];
  709. } else {
  710. $data["annual_salary"] = null;
  711. }
  712. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  713. //真实状态11是驳回,需要判断什么字段可以提交
  714. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  715. $tmp_data = $data;
  716. $data = [];
  717. foreach ($modify_fields as $field) {
  718. $data[$field] = $tmp_data[$field];
  719. }
  720. }
  721. $data["checkState"] = $checkState;
  722. $data["id"] = $id;
  723. $success_msg = "提交成功";
  724. $error_msg = "提交失败";
  725. if ($checkState == TalentState::SCND_SAVE) {
  726. $success_msg = "保存成功";
  727. if ($data["id"]) {
  728. //编辑
  729. TalentModel::update($data);
  730. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  731. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  732. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  733. } else {
  734. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  735. }
  736. } else {
  737. //新增
  738. $data["enterprise_id"] = $this->user["uid"];
  739. $id = TalentModel::insertGetId($data);
  740. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  741. $whr = [];
  742. $whr[] = ["fileId", "in", $files];
  743. $upd_checklog["mainId"] = $id;
  744. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  745. }
  746. } else if ($checkState == TalentState::SCND_SUBMIT) {
  747. if (!$info["first_submit_time"]) {
  748. $data["first_submit_time"] = date("Y-m-d H:i:s");
  749. } else {
  750. $data["new_submit_time"] = date("Y-m-d H:i:s");
  751. }
  752. if ($data["id"]) {
  753. TalentModel::update($data);
  754. } else {
  755. //新增
  756. $data["enterprise_id"] = $this->user["uid"];
  757. $id = TalentModel::insertGetId($data);
  758. $whr = [];
  759. $whr[] = ["fileId", "in", $files];
  760. $upd_checklog["mainId"] = $id;
  761. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  762. }
  763. TalentLogApi::write(1, $id, $checkState, "确认提交审核", 1);
  764. } else {
  765. throw new ValidateException($error_msg);
  766. }
  767. if ($id) {
  768. if ($deletes) {
  769. //删除多余的附件,一般是选择人才类型留下来的
  770. $whr = [];
  771. $whr[] = ["typeId", "in", $deletes];
  772. $whr[] = ["id", "in", $files];
  773. $_wait_del_files = Db::table("new_talent_file")->where($whr)->select()->toArray();
  774. $_logfileIds[] = [];
  775. foreach ($_wait_del_files as $_del_file) {
  776. $_logfileIds[] = $_del_file["id"];
  777. @unlink("storage/" . $_del_file["url"]);
  778. }
  779. Db::table("new_talent_file")->where($whr)->delete();
  780. if ($_logfileIds) {
  781. $whr = [];
  782. $whr[] = ["fileId", "in", $_logfileIds];
  783. $_upd_checklog["description"] = "删除附件";
  784. $_upd_checklog["updateUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"] ?: $this->user["rolename"]);
  785. $_upd_checklog["updateTime"] = date("Y-m-d H:i:s");
  786. Db::table("new_talent_checklog")->where($whr)->save($_upd_checklog);
  787. }
  788. }
  789. $whr = [];
  790. $whr[] = ["id", "in", $files];
  791. Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
  792. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  793. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  794. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  795. exit();
  796. } else {
  797. throw new ValidateException($error_msg);
  798. }
  799. } catch (ValidateException $e) {
  800. $res = ["msg" => $e->getMessage()];
  801. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  802. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  803. exit();
  804. }
  805. }
  806. private function icSave($info, \think\Request $request, $checkState) {
  807. try {
  808. $batch = \app\common\api\BatchApi::getValidBatch(1, $this->user["type"]);
  809. if (!$batch) {
  810. throw new ValidateException("不在人才认定申报申请时间内");
  811. }
  812. $param = $request->param();
  813. validate(TalentInfo::class)->check($param);
  814. $id = $param["id"];
  815. if ($id) {
  816. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  817. throw new ValidateException("没有对应的人才认定申报信息");
  818. }
  819. }
  820. $files = $param["uploadFiles"];
  821. $data["headimgurl"] = $info["headimgurl"];
  822. if ($request->file()) {
  823. $headimg = $request->file("photo");
  824. $upload = new \app\common\api\UploadApi();
  825. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  826. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  827. $width = imagesx($file);
  828. $height = imagesy($file);
  829. //免冠二寸照长宽413:579
  830. if ($width * 579 != $height * 413) {
  831. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  832. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  833. }
  834. if ($info && $info["headimgurl"]) {
  835. //如果新照片符合像素要求,则删除旧照片
  836. $old_head_url = "storage/" . $info["headimgurl"];
  837. if (file_exists($old_head_url))
  838. @unlink($old_head_url);
  839. }
  840. $data["headimgurl"] = $result->filepath;
  841. }
  842. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  843. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  844. $data["apply_year"] = $batch["batch"];
  845. $all_valid_keys = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education", "break_faith",
  846. "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad",
  847. "position", "cur_entry_time", "labor_contract_rangetime",
  848. "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime", "title", "pro_qua",
  849. "bank", "bank_branch_name", "bank_account", "description"];
  850. foreach ($all_valid_keys as $key) {
  851. $value = trim($param[$key]);
  852. if ($value) {
  853. $data[$key] = $value;
  854. }
  855. }
  856. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  857. //真实状态11是驳回,需要判断什么字段可以提交
  858. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  859. $tmp_data = $data;
  860. $data = [];
  861. foreach ($modify_fields as $field) {
  862. $data[$field] = $tmp_data[$field];
  863. }
  864. }
  865. $data["checkState"] = $checkState;
  866. $data["id"] = $id;
  867. $success_msg = "提交成功";
  868. $error_msg = "提交失败";
  869. if ($checkState == TalentState::SCND_SAVE) {
  870. $success_msg = "保存成功";
  871. if ($data["id"]) {
  872. //编辑
  873. TalentModel::update($data);
  874. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  875. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  876. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  877. } else {
  878. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  879. }
  880. } else {
  881. //新增
  882. $data["enterprise_id"] = $this->user["uid"];
  883. $id = TalentModel::insertGetId($data);
  884. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  885. $whr = [];
  886. $whr[] = ["fileId", "in", $files];
  887. $upd_checklog["mainId"] = $id;
  888. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  889. }
  890. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  891. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  892. exit();
  893. } else if ($checkState == TalentState::SCND_SUBMIT) {
  894. $data["new_submit_time"] = date("Y-m-d H:i:s");
  895. TalentModel::update($data);
  896. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  897. return json(["msg" => $success_msg, "code" => 200]);
  898. } else {
  899. throw new ValidateException($error_msg);
  900. }
  901. } catch (ValidateException $e) {
  902. if ($checkState == TalentState::SCND_SAVE) {
  903. $res = ["msg" => $e->getMessage()];
  904. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  905. exit();
  906. } else {
  907. return json(["msg" => $e->getMessage()]);
  908. }
  909. }
  910. }
  911. public function delete() {
  912. $id = $this->request->param("talentInfoId");
  913. $info = Talent::chkIsOwner($id, $this->user["uid"]);
  914. if (!$info) {
  915. return json(["msg" => "操作失败"]);
  916. }
  917. $checkState = $info["checkState"];
  918. if (in_array($checkState, [0, 1])) {
  919. $log = TalentLogApi::getLastLog($id, 1);
  920. if ($log["state"] > 1) {
  921. //有提交审核记录
  922. return json(["msg" => "该申报已提交审核,无法删除"]);
  923. }
  924. }
  925. $data["id"] = $id;
  926. $data["delete"] = 1;
  927. TalentModel::update($data);
  928. return json(["msg" => "删除成功"]);
  929. }
  930. public function mixDelete() {
  931. $id = $this->request->param("talentInfoId");
  932. $info = Talent::chkIsOwner($id, $this->user["uid"]);
  933. if (!$info) {
  934. return json(["msg" => "操作失败"]);
  935. }
  936. $checkState = $info["checkState"];
  937. if (in_array($checkState, [0, TalentState::SCND_SAVE])) {
  938. $log = TalentLogApi::getLastLog($id, 1);
  939. if ($log["state"] > 1) {
  940. //有提交审核记录
  941. return json(["msg" => "该申报已提交审核,无法删除"]);
  942. }
  943. }
  944. $data["id"] = $id;
  945. $data["delete"] = 1;
  946. TalentModel::update($data);
  947. return json(["msg" => "删除成功"]);
  948. }
  949. }