VerifyApi.php 25 KB

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