VerifyApi.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <?php
  2. namespace app\common\api;
  3. use app\enterprise\model\Talent;
  4. use app\common\api\DictApi;
  5. use app\admin\model\Enterprise;
  6. use think\facade\Db;
  7. use app\common\model\TalentCondition;
  8. /**
  9. * Description of VerifyApi
  10. *
  11. * @author sgq
  12. */
  13. class VerifyApi {
  14. public static function getTalentInfoById($id) {
  15. $where = [];
  16. $where[] = ["id", "=", $id];
  17. $info = Talent::findOrEmpty($id)->toArray();
  18. if ($info) {
  19. if ($info["talent_type"]) {
  20. $info["talentTypeName"] = DictApi::selectByParentCode("talent_type")[$info["talent_type"]];
  21. }
  22. if ($info["nationality"]) {
  23. $info["nationalityName"] = DictApi::selectByParentCode("nationality")[$info["nationality"]];
  24. }
  25. if ($info["nation"]) {
  26. $info["nationName"] = DictApi::selectByParentCode("nation")[$info["nation"]];
  27. }
  28. if ($info["politics"]) {
  29. $info["politicsName"] = DictApi::selectByParentCode("politics")[$info["politics"]];
  30. }
  31. if ($info["province"]) {
  32. $info["provinceName"] = Db::table("un_common_location")->where("code", "=", $info["province"])->findOrEmpty()["name"];
  33. }
  34. if ($info["city"]) {
  35. $info["cityName"] = Db::table("un_common_location")->where("code", "=", $info["city"])->findOrEmpty()["name"];
  36. }
  37. if ($info["county"]) {
  38. $info["countyName"] = Db::table("un_common_location")->where("code", "=", $info["county"])->findOrEmpty()["name"];
  39. }
  40. $enterprise = Enterprise::findOrEmpty($info["enterprise_id"])->toArray();
  41. $info["enterpriseName"] = $enterprise["name"];
  42. $info["enterpriseTag"] = $enterprise["enterpriseTag"];
  43. if ($enterprise["street"]) {
  44. $info["street"] = $enterprise["street"];
  45. $info["streetName"] = DictApi::selectByParentCode("street")[$enterprise["street"]];
  46. }
  47. if ($enterprise["industryFieldNew"]) {
  48. $info["industryFieldName"] = DictApi::selectByParentCode("industry_field")[$enterprise["industryFieldNew"]];
  49. }
  50. if ($enterprise["enterpriseTag"]) {
  51. $info["enterpriseTagName"] = DictApi::selectByParentCode("enterprise_tag")[$enterprise["enterpriseTag"]];
  52. }
  53. if ($info["headimgurl"]) {
  54. $info["headimgurl"] = "/storage/" . $info["headimgurl"];
  55. }
  56. if ($info["talent_arrange"]) {
  57. $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talent_arrange"]];
  58. }
  59. if ($info["import_way"]) {
  60. $info["importWayName"] = DictApi::selectByParentCode("import_way")[$info["import_way"]];
  61. }
  62. if ($info["source"]) {
  63. $info["sourceName"] = DictApi::selectByParentCode("source")[$info["source"]];
  64. }
  65. if ($info["source_city"]) {
  66. $info["sourceCityName"] = Db::table("un_common_location")->where("code", "=", $info["source_city"])->findOrEmpty()["name"];
  67. }
  68. if ($info["source_county"]) {
  69. $info["sourceCountyName"] = Db::table("un_common_location")->where("code", "=", $info["source_county"])->findOrEmpty()["name"];
  70. }
  71. if ($info["highest_degree"]) {
  72. $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
  73. }
  74. if ($info["talent_condition"]) {
  75. $talent_condition = \app\common\model\TalentCondition::findOrEmpty($info["talent_condition"]);
  76. $info["talentConditionName"] = $talent_condition["name"];
  77. $info["talent_arrange_category"] = $talent_condition["talentLevelCat"];
  78. $info["talentArrangeCatName"] = DictApi::selectByParentCode("talent_condition_cats")[$talent_condition["talentLevelCat"]];
  79. }
  80. }
  81. return $info;
  82. }
  83. public static function getOne($id) {
  84. return Talent::findOrEmpty($id);
  85. }
  86. public static function getDeptList($params, $where = []) {
  87. $order = $params["order"] ?: "desc";
  88. $offset = $params["offset"] ?: 0;
  89. $limit = $params["limit"] ?: 10;
  90. $companyId = session("user")["companyId"];
  91. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  92. $count = Talent::alias("ti")
  93. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  94. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  95. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  96. ->where($where)
  97. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  98. $list = Talent::alias("ti")
  99. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  100. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  101. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  102. ->where($where)
  103. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  104. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")
  105. ->limit($offset, $limit)->order("ti.createTime " . $order)
  106. ->select()->toArray();
  107. foreach ($list as &$item) {
  108. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  109. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  110. $lastCheckLog = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  111. $item["deptCheckState"] = $lastCheckLog["new_state"];
  112. }unset($item);
  113. return ["total" => $count, "rows" => $list];
  114. }
  115. public static function getPublicList($params) {
  116. $order = $params["order"];
  117. $offset = $params["offset"];
  118. $limit = $params["limit"];
  119. $where = [];
  120. if ($params["name"]) {
  121. $where[] = ["ti.name", "like", "%" . $params["name"] . "%"];
  122. }
  123. if ($params["sex"]) {
  124. $where[] = ["ti.sex", "=", $params["sex"]];
  125. }
  126. if ($params["checkState"]) {
  127. $where[] = ["ti.checkState", "=", $params["checkState"]];
  128. }
  129. $type = $params["type"];
  130. switch ($type) {
  131. case 1:
  132. case 2:
  133. $where[] = ["ti.checkState", "=", TalentState::REVERIFY_PASS];
  134. break;
  135. case 3: //公示
  136. case 7: //公示预览
  137. $where[] = ["ti.checkState", "=", TalentState::ZX_PASS];
  138. break;
  139. case 4: //公示通过
  140. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED];
  141. break;
  142. case 5:
  143. case 8: //公布预览
  144. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED_REVERIFY_PASS];
  145. break;
  146. case 6:
  147. $where[] = ["ti.checkState", "=", TalentState::PUBLISH_PASS];
  148. break;
  149. }
  150. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  151. $count = Talent::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")->where($where)->count();
  152. $list = Talent::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  153. ->where($where)
  154. ->limit($offset, $limit)
  155. ->order("ti.createTime " . $order)->field("ti.*,e.name as enterpriseName,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  156. foreach ($list as &$item) {
  157. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  158. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  159. }unset($item);
  160. return ["total" => $count, "rows" => $list];
  161. }
  162. public static function getListByIds($ids) {
  163. $where[] = ["id", "in", $ids];
  164. return Talent::where($where)->select()->toArray();
  165. }
  166. public static function getList($params) {
  167. $where = [];
  168. $order = $params["order"] ?: "desc";
  169. $offset = $params["offset"] ?: 0;
  170. $limit = $params["limit"] ?: 10;
  171. unset($params["order"]);
  172. unset($params["limit"]);
  173. unset($params["offset"]);
  174. if ($params["name"]) {
  175. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  176. }
  177. if ($params["card_number"]) {
  178. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  179. }
  180. if ($params["sex"]) {
  181. $where[] = ["ti.sex", "=", $params["sex"]];
  182. }
  183. if ($params["nation"]) {
  184. $where[] = ["ti.nation", "=", $params["nation"]];
  185. }
  186. if ($params["apply_year"]) {
  187. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  188. }
  189. if ($params["phone"]) {
  190. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  191. }
  192. if ($params["email"]) {
  193. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  194. }
  195. if ($params["nationality"]) {
  196. $where[] = ["ti.nationality", "=", $params["nationality"]];
  197. }
  198. if ($params["province"]) {
  199. $where[] = ["ti.province", "=", $params["province"]];
  200. }
  201. if ($params["politics"]) {
  202. $where[] = ["ti.politics", "=", $params["politics"]];
  203. }
  204. if ($params["enterprise_id"]) {
  205. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  206. }
  207. if ($params["street"]) {
  208. $where[] = ["e.street", "=", $params["street"]];
  209. }
  210. if ($params["industry_field"]) {
  211. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  212. }
  213. if ($params["talent_type"]) {
  214. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  215. }
  216. if ($params["import_way"]) {
  217. $where[] = ["ti.import_way", "=", $params["import_way"]];
  218. }
  219. if ($params["highest_degree"]) {
  220. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  221. }
  222. if ($params["study_abroad"]) {
  223. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  224. }
  225. if ($params["source"]) {
  226. $where[] = ["ti.source", "=", $params["source"]];
  227. }
  228. if ($params["talent_arrange"]) {
  229. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  230. }
  231. $process = $params["process"];
  232. if ($process == 3) {
  233. switch ($params["checkState"]) {
  234. case 5:
  235. $_where = [];
  236. $_where[] = ["type", "=", 1];
  237. $_where[] = ["active", "=", 1];
  238. $_where[] = ["step", "=", 3];
  239. $_where[] = ["companyId", "=", session("user")["companyId"]];
  240. $mainIds = \app\common\model\TalentChecklog::where($_where)->group("mainId")->order("createTime desc")->column("mainId");
  241. if ($mainIds) {
  242. $where[] = ["ti.id", "in", $mainIds];
  243. } else {
  244. $where[] = ["ti.checkState", "=", 7];
  245. $where[] = ["ti.pass_dept_check", "=", 0];
  246. }
  247. break;
  248. default:
  249. $where[] = ["ti.checkState", "=", 7];
  250. $where[] = ["ti.pass_dept_check", "=", 0];
  251. break;
  252. }
  253. return self::getDeptList($params, $where);
  254. }
  255. if ($process == 4) {
  256. $whereRaw = sprintf("(ti.checkState in (11,12,13)) or (ti.checkState=9 and ti.pass_dept_check=0) or (ti.checkState=7 and ti.pass_dept_check=1) or (ti.checkState=7 and (tc.companyIds is null or tc.companyIds = ''))");
  257. switch ($params["checkState"]) {
  258. case 1:
  259. $where[] = ["ti.checkState", "in", [7, 9]];
  260. break;
  261. case -1:
  262. $where[] = ["ti.checkState", "=", 13];
  263. break;
  264. }
  265. $count = Talent::alias("ti")
  266. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  267. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  268. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  269. ->whereRaw($whereRaw)->where($where)->count();
  270. $list = Talent::alias("ti")
  271. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  272. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  273. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  274. ->whereRaw($whereRaw)
  275. ->where($where)
  276. ->limit($offset, $limit)
  277. ->order("ti.createTime " . $order)
  278. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")
  279. ->select()->toArray();
  280. } else {
  281. switch ($process) {
  282. case 1:
  283. $where[] = ["ti.checkState", "in", [2, -1]];
  284. break;
  285. case 2:
  286. switch ($params["checkState"]) {
  287. case 1://待审核
  288. $where[] = ["ti.checkState", "=", 6];
  289. $where[] = ["tl.state", "=", 6];
  290. break;
  291. case 2://驳回
  292. $where[] = ["ti.checkState", "=", 6];
  293. $where[] = ["tl.state", "in", [10, 12]];
  294. break;
  295. default:
  296. $where[] = ["ti.checkState", "in", [6, -2]];
  297. }
  298. break;
  299. case 5:
  300. if ($params["checkState"]) {
  301. $where[] = ["ti.checkState", "=", $params["checkState"]];
  302. }
  303. break;
  304. }
  305. $count = Talent::alias("ti")
  306. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  307. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  308. ->where($where)->count();
  309. $list = Talent::alias("ti")
  310. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  311. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  312. ->where($where)->limit($offset, $limit)->order("ti.createTime " . $order)->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  313. }
  314. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  315. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  316. foreach ($list as &$item) {
  317. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  318. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  319. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  320. $item["talentConditionName"] = TalentCondition::findOrEmpty($item["talent_condition"])["name"];
  321. //$last_log = TalentLogApi::getLastLog($item["id"], 1, 0, ["step", "=", null]);
  322. //$item["lastState"] = $last_log["last_state"];
  323. //$item["realState"] = $last_log["state"];
  324. }unset($item);
  325. return ["total" => $count, "rows" => $list];
  326. }
  327. public static function getExportDatas($process, $params) {
  328. $where[] = [];
  329. //特殊字段处理
  330. $fields = [];
  331. foreach ($params as $param) {
  332. if (!in_array($param, ["industryFieldNew", "enterpriseName", "enterpriseTag", "street", "talent_arrange_category", "checkMsg"])) {
  333. $fields[] = "ti." . $param;
  334. }
  335. }
  336. $fields[] = "e.name as enterpriseName";
  337. $fields[] = "e.industryFieldNew";
  338. $fields[] = "e.enterpriseTag";
  339. $fields[] = "e.street";
  340. $fields[] = "tc.talentLevelCat";
  341. $fields[] = "tl.description as checkMsg";
  342. $fields[] = "tc.name as talentConditionName";
  343. $fields[] = "tl.description as checkMsg";
  344. if (in_array("card_type", $params)) {
  345. $cardTypes = DictApi::selectByParentCode("card_type");
  346. }
  347. if (in_array("industryFieldNew", $params)) {
  348. $industry_fields = DictApi::selectByParentCode("industry_field");
  349. }
  350. if (in_array("enterpriseTag", $params)) {
  351. $enterpriseTags = DictApi::selectByParentCode("enterprise_tag");
  352. }
  353. if (in_array("street", $params)) {
  354. $streets = DictApi::selectByParentCode("street");
  355. }
  356. if (in_array("nation", $params)) {
  357. $nations = DictApi::selectByParentCode("nation");
  358. }
  359. if (in_array("nationality", $params)) {
  360. $nationalitys = DictApi::selectByParentCode("nationality");
  361. }
  362. if (in_array("politics", $params)) {
  363. $politics = DictApi::selectByParentCode("politics");
  364. }
  365. if (in_array("talent_type", $params)) {
  366. $talentTypes = DictApi::selectByParentCode("talent_type");
  367. }
  368. if (in_array("talent_arrange_category", $params)) {
  369. $talentArrangeCategories = DictApi::selectByParentCode("talent_condition_cats");
  370. }
  371. if (in_array("highest_degree", $params)) {
  372. $highest_degree = DictApi::selectByParentCode("highest_degree");
  373. }
  374. if (in_array("import_way", $params)) {
  375. $import_way = DictApi::selectByParentCode("import_way");
  376. }
  377. if (in_array("source", $params)) {
  378. $source = DictApi::selectByParentCode("source");
  379. }
  380. if (in_array("source_city", $params)) {
  381. $source_city = DictApi::selectByParentCode("source_city");
  382. }
  383. if (in_array("source_county", $params)) {
  384. $source_county = DictApi::selectByParentCode("source_county");
  385. }
  386. if (in_array("talent_arrange", $params)) {
  387. $talent_arrange = DictApi::selectByParentCode("talent_arrange");
  388. }
  389. $sex = [1 => "男", 2 => "女"];
  390. $pre_import_type = [1 => "意向合同", 2 => "创业企业名称预核准"];
  391. $study_abroad = [1 => "是", 2 => "否"];
  392. $where = [];
  393. switch ($process) {
  394. case 1:
  395. $where = "ti.checkState in (2,-1)";
  396. break;
  397. case 2:
  398. $where = "ti.checkState in (6,-2)";
  399. break;
  400. case 3:
  401. $companyId = session("user")["companyId"];
  402. $where = "ti.checkState = 7 and ti.pass_dept_check=0 and find_in_set({$companyId},tc.companyIds)";
  403. break;
  404. case 4:
  405. $where = sprintf("(ti.checkState in (11,12,13)) or (ti.checkState=9 and ti.pass_dept_check=0) or (ti.checkState=7 and ti.pass_dept_check=1) or (ti.checkState=7 and (tc.companyIds is null or tc.companyIds = ''))");
  406. break;
  407. case 5:
  408. $where = "ti.checkState >= 11";
  409. break;
  410. }
  411. $list = Talent::alias("ti")
  412. ->field($fields)
  413. ->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")
  414. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  415. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  416. ->whereRaw($where)
  417. ->select()->toArray();
  418. foreach ($list as &$item) {
  419. $item["card_type"] = $cardTypes[$item["card_type"]];
  420. $item["industryFieldNew"] = $industry_fields[$item["industryFieldNew"]];
  421. $item["enterpriseTag"] = $enterpriseTags[$item["enterpriseTag"]];
  422. $item["street"] = $streets[$item["street"]];
  423. $item["nation"] = $nations[$item["nation"]];
  424. $item["nationality"] = $nationalitys[$item["nationality"]];
  425. $item["politics"] = $politics[$item["politics"]];
  426. $item["talent_type"] = $talentTypes[$item["talent_type"]];
  427. $item["talent_arrange_category"] = $talentArrangeCategories[$item["talentLevelCat"]];
  428. $item["sex"] = $sex[$item["sex"]];
  429. $item["highest_degree"] = $highest_degree[$item["highest_degree"]];
  430. $item["import_way"] = $import_way[$item["import_way"]];
  431. $item["pre_import_type"] = $pre_import_type[$item["pre_import_type"]];
  432. $item["study_abroad"] = $study_abroad[$item["study_abroad"]];
  433. $item["source"] = $source[$item["source"]];
  434. $item["talent_arrange"] = $talent_arrange[$item["talent_arrange"]];
  435. $item["talent_condition"] = $item["talentConditionName"];
  436. if (in_array("source_city", $params)) {
  437. $item["source_city"] = Db::table("un_common_location")->where("code", "=", $item["source_city"])->findOrEmpty()["name"];
  438. }
  439. if (in_array("source_county", $params)) {
  440. $item["source_county"] = Db::table("un_common_location")->where("code", "=", $item["source_county"])->findOrEmpty()["name"];
  441. }
  442. if (in_array("province", $params)) {
  443. $item["province"] = Db::table("un_common_location")->where("code", "=", $item["province"])->findOrEmpty()["name"];
  444. }
  445. if (in_array("city", $params)) {
  446. $item["city"] = Db::table("un_common_location")->where("code", "=", $item["city"])->findOrEmpty()["name"];
  447. }
  448. if (in_array("county", $params)) {
  449. $item["county"] = Db::table("un_common_location")->where("code", "=", $item["county"])->findOrEmpty()["name"];
  450. }
  451. $item["checkState"] = TalentState::getStateName($item["checkState"]);
  452. }unset($item);
  453. return $list;
  454. }
  455. public static function getListByProcess($process) {
  456. switch ($process) {
  457. case 1:
  458. $where[] = ["ti.checkState", "in", [2, -1]];
  459. break;
  460. case 2:
  461. $where[] = ["ti.checkState", "in", [6, -2]];
  462. break;
  463. default:
  464. return null;
  465. }
  466. return Talent::alias("ti")->leftJoin("new_enterprise e", "e.id=ti.enterprise_id")->where($where)->field("ti.*,e.agentName,e.agentPhone")->select()->toArray();
  467. }
  468. public static function setPublic($mainId, $state, $msg, $batch = null, $type = 1) {
  469. $data["id"] = $mainId;
  470. $data["checkState"] = $state;
  471. switch ($state) {
  472. case TalentState::ZX_PASS:
  473. case TalentState::ZX_FAIL:
  474. $data["isPublic"] = 2;
  475. break;
  476. case TalentState::ANNOUNCED:
  477. $data["isPublic"] = 3;
  478. $data["publicBatch"] = $batch;
  479. break;
  480. case TalentState::ANNOUNCED_REVERIFY_PASS:
  481. case TalentState::ANNOUNCED_REVERIFY_FAIL:
  482. $data["isPublic"] = 3;
  483. break;
  484. case TalentState::PUBLISH_PASS:
  485. $data["isPublic"] = 4;
  486. $data["certificateGetTime"] = $batch;
  487. $data["certificateExpireTime"] = date("Y-m-d", strtotime(sprintf("%s +6 years", $batch)));
  488. break;
  489. case TalentState::PUBLISH_FAIL:
  490. $data["isPublic"] = 4;
  491. break;
  492. }
  493. if (Talent::update($data)) {
  494. TalentLogApi::write($type, $mainId, $state, $msg, 1);
  495. return true;
  496. }
  497. return false;
  498. }
  499. }