IntegralVerify.php 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\ChuanglanSmsApi;
  5. use app\common\api\TalentLogApi;
  6. use app\common\model\MessageRecord;
  7. use app\common\api\DictApi;
  8. use app\common\api\EnterpriseApi;
  9. use think\facade\Db;
  10. use app\admin\model\User;
  11. use app\common\api\MenuApi;
  12. use app\admin\model\SysRelation;
  13. use app\common\api\CompanyApi;
  14. use app\common\api\IntegralRecordApi;
  15. use app\common\state\ProjectState;
  16. use app\common\state\IntegralState;
  17. use app\common\model\IntegralRecord;
  18. use app\common\model\IntegralDetail;
  19. /**
  20. * Description of Talent
  21. *
  22. * @author sgq
  23. */
  24. class IntegralVerify extends AdminController {
  25. public function fst_verify() {
  26. $enterprises = EnterpriseApi::getSimpleList();
  27. return view("", ["enterprises" => $enterprises]);
  28. }
  29. public function re_verify() {
  30. $enterprises = EnterpriseApi::getSimpleList();
  31. return view("", ["enterprises" => $enterprises]);
  32. }
  33. public function list() {
  34. $res = IntegralRecordApi::getListByProcess($this->request->param());
  35. return json($res);
  36. }
  37. public function detail() {
  38. $request = $this->request;
  39. $params = $request->param();
  40. $id = $params["id"];
  41. $row = IntegralRecordApi::getOne($id);
  42. foreach ($row["items"] as $key => $item) {
  43. $redis = \app\common\Redis::instance(\think\facade\Config::get("cache.stores.redis.select"));
  44. $integralItem = json_decode($redis->hGet("IntegralItem", $item["item_id"]), true);
  45. $integralProject = json_decode($redis->hGet("IntegralProject", $integralItem["projectId"]), true);
  46. $row["items"][$key]["itemName"] = $integralItem["name"];
  47. $row["items"][$key]["unit"] = $integralItem["unit"];
  48. $row["items"][$key]["projectName"] = $integralProject["name"];
  49. $row["items"][$key]["projectType"] = $integralProject["projectType"];
  50. }
  51. return view("", ["row" => $row]);
  52. }
  53. public function cancel_verify() {
  54. $params = $this->request->param();
  55. $ids = $params["ids"];
  56. $msg = $params["msg"];
  57. if ($msg == "") {
  58. return json(["msg" => "请填写审核不通过的原因"]);
  59. }
  60. $ids_arr = array_filter(explode(",", $ids));
  61. $counts = 0;
  62. foreach ($ids_arr as $id) {
  63. $record = IntegralRecordApi::getOne($id);
  64. $data["id"] = $id;
  65. if ($record["checkState"] == IntegralState::SUBMIT) {
  66. $data["checkState"] = IntegralState::VERIFY_FAIL;
  67. TalentLogApi::write(ProjectState::INTEGRAL, $id, IntegralState::VERIFY_FAIL, $msg, 1);
  68. IntegralRecord::update($data);
  69. $counts++;
  70. } else if ($record["checkState"] == IntegralState::VERIFY_PASS) {
  71. $data["checkState"] = IntegralState::REVERIFY_FAIL;
  72. TalentLogApi::write(ProjectState::INTEGRAL, $id, IntegralState::REVERIFY_FAIL, $msg, 1);
  73. IntegralRecord::update($data);
  74. $counts++;
  75. } else {
  76. return json(["msg" => "不在审核范围"]);
  77. }
  78. }
  79. return json(["code" => 200, sprintf("%d个申请已审核失败", $counts)]);
  80. }
  81. /**
  82. * 预备积分库
  83. */
  84. public function pre_list() {
  85. if ($this->user["type"] == 1) {
  86. $message = [
  87. "typeName" => "晋江市现代产业体系人才积分评定", "address" => "聚才网/人才晋江微信公众号", "dep" => "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心",
  88. "phone" => "0595-85633128", "email" => "jjrc85661234@163.com"
  89. ];
  90. } else {
  91. $message = [
  92. "typeName" => "晋江市集成电路产业优秀人才积分评定", "address" => "福建(晋江)集成电路产业园官方网站及微信公众号", "dep" => "集成电路产业园区",
  93. "phone" => "0595-82250007、0595-82250001", "email" => "jjjcdr@163.com"
  94. ];
  95. }
  96. $enterprises = EnterpriseApi::getSimpleList();
  97. return view("", ["message" => $message, "enterprises" => $enterprises]);
  98. }
  99. /**
  100. * 人才积分库
  101. */
  102. public function library() {
  103. $enterprises = EnterpriseApi::getSimpleList();
  104. return view("", ["enterprises" => $enterprises]);
  105. }
  106. public function selectNeedCheckData() {
  107. $params = $this->request->param();
  108. return json(["code" => 200, "obj" => IntegralRecordApi::getPublicList($params)]);
  109. }
  110. /**
  111. * 预备人才库-核查征信
  112. */
  113. public function prepareHczx() {
  114. $ids = $this->request->param("ids");
  115. $ids_arr = array_filter(explode(",", $ids));
  116. if (!$ids_arr) {
  117. $res = ["code" => 500, "msg" => "没有选择导出的名单"];
  118. echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
  119. }
  120. $where[] = ["ir.id", "in", $ids_arr];
  121. $list = IntegralRecord::alias("ir")->leftJoin("un_enterprise e", "e.id=ir.enterprise_id")->field("ir.name,ir.card_type,ir.card_number,e.name as enterpriseName,e.description")->where($where)->select();
  122. if (!$list) {
  123. $res = ["code" => 500, "msg" => "没有可以导出的内容"];
  124. echo sprintf("<script>IntegralInfo.callBack(%s);</script>", json_encode($res));
  125. }
  126. $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
  127. $rows = [];
  128. $i = 1;
  129. $card_types = DictApi::selectByParentCode("card_type");
  130. foreach ($list as $item) {
  131. $row = [
  132. $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
  133. ];
  134. $rows[] = $row;
  135. $i++;
  136. }
  137. $filename = "积分申报核查征信名单导出";
  138. if ($rows) {
  139. export($columns, $rows, $filename);
  140. exit();
  141. }
  142. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  143. }
  144. /**
  145. * 预备人才库-征信通过
  146. */
  147. public function hczxPass() {
  148. $params = $this->request->param();
  149. $ids = $params["ids"];
  150. $ids = array_filter(explode(",", $ids));
  151. $msg = "征信通过";
  152. $state = IntegralState::ZX_PASS; //征信通过
  153. $total = count($ids);
  154. $error = 0;
  155. $success = 0;
  156. foreach ($ids as $id) {
  157. $record = IntegralRecordApi::getOne($id);
  158. if ($record["checkState"] != IntegralState::REVERIFY_PASS) {
  159. $error++;
  160. continue;
  161. }
  162. if (IntegralRecordApi::setPublic($id, $state, $msg)) {
  163. $success++;
  164. } else {
  165. $error++;
  166. }
  167. }
  168. return json(["code" => 200, "msg" => sprintf("核查征信完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  169. }
  170. /**
  171. * 预备人才库-征信失信
  172. */
  173. public function hczxReject() {
  174. $params = $this->request->param();
  175. $id = $params["id"];
  176. $msg = $params["outMsg"];
  177. if (!$msg)
  178. return json(["msg" => "请填写审核意见"]);
  179. $msg = "征信失信:" . $msg;
  180. $state = IntegralState::ZX_FAIL; //征信不通过
  181. $record = IntegralRecordApi::getOne($id);
  182. if ($record["checkState"] != IntegralState::REVERIFY_PASS) {
  183. return json(["msg" => "当前记录不是待核查征信状态,无法核查"]);
  184. }
  185. if (IntegralRecordApi::setPublic($id, $state, $msg)) {
  186. return json(["code" => 200, "msg" => "已设置征信失信"]);
  187. }
  188. return json(["msg" => "设置征信失信失败"]);
  189. }
  190. /**
  191. * 预备人才库-公示预览
  192. */
  193. public function publicExportBefore() {
  194. $params = $this->request->param();
  195. $ids_arr = array_filter(explode(",", $params["ids"]));
  196. $columns = ["序号", "批次", "姓名", "证件类型", "证件号码", "工作单位", "申请积分项目", "拟认定获得积分", "审核状态", "备注"];
  197. if ($ids_arr) {
  198. $where[] = ["ir.id", "in", $ids_arr];
  199. $list = IntegralRecord::alias("ir")->where($where)
  200. ->leftJoin("sys_batch b", "b.id=ir.batch_id")
  201. ->leftJoin("un_enterprise e", "e.id=ir.enterprise_id")
  202. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=20 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ir.id")
  203. ->field("ir.*,e.name as enterpriseName,b.batch as apply_year,tl.state as real_state,tl.last_state,tl.description")->order("createTime asc")->select();
  204. $rows = [];
  205. $i = 1;
  206. $card_types = DictApi::selectByParentCode("card_type");
  207. foreach ($list as $item) {
  208. $tmp_items = [];
  209. $total_points = 0;
  210. foreach ($item["detail"] as $_item) {
  211. $integral_item_info = getCacheById("IntegralItem", $_item["item_id"]);
  212. $tmp_items[] = sprintf("%s(%s%s)+%d积分", $integral_item_info["name"], $_item["amount"], $integral_item_info["unit"], $_item["point"]);
  213. $total_points += $_item["point"];
  214. }
  215. $row = [
  216. $i, $item["apply_year"], $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], implode(";", $tmp_items), $total_points, $item["checkState"] == IntegralState::ZX_PASS ? "审核通过" : "审核不通过", $item["description"]
  217. ];
  218. $rows[] = $row;
  219. $i++;
  220. }
  221. }
  222. if ($rows) {
  223. $filename = "积分申报公示预览导出";
  224. export($columns, $rows, $filename);
  225. exit();
  226. }
  227. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  228. }
  229. /**
  230. * 预备人才库-公示导出
  231. */
  232. public function publicExport() {
  233. $params = $this->request->param();
  234. $columns = ["序号", "批次", "姓名", "证件类型", "证件号码", "工作单位", "申请积分项目", "拟认定获得积分", "审核状态", "备注"];
  235. $startTime = $params["startTime"];
  236. $endTime = $params["endTime"];
  237. if (!strtotime($startTime) || !strtotime($endTime))
  238. return json(["msg" => "时间格式错误"]);
  239. $where[] = ["ir.checkState", "=", IntegralState::ANNOUNCED];
  240. $where[] = ["publicBatch", "between", [$startTime, $endTime]];
  241. $list = IntegralRecord::alias("ir")->where($where)
  242. ->leftJoin("sys_batch b", "b.id=ir.batch_id")
  243. ->leftJoin("un_enterprise e", "e.id=ir.enterprise_id")
  244. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=20 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ir.id")
  245. ->field("ir.*,e.name as enterpriseName,b.batch as apply_year,tl.state as real_state,tl.last_state,tl.description")->order("createTime asc")->select();
  246. $rows = [];
  247. $i = 1;
  248. $card_types = DictApi::selectByParentCode("card_type");
  249. foreach ($list as $item) {
  250. $tmp_items = [];
  251. $total_points = 0;
  252. foreach ($item["detail"] as $_item) {
  253. $integral_item_info = getCacheById("IntegralItem", $_item["item_id"]);
  254. $tmp_items[] = sprintf("%s(%s%s)+%d积分", $integral_item_info["name"], $_item["amount"], $integral_item_info["unit"], $_item["point"]);
  255. $total_points += $_item["point"];
  256. }
  257. $row = [
  258. $i, $item["apply_year"], $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], implode(";", $tmp_items), $total_points, $item["checkState"] == IntegralState::ANNOUNCED ? "审核通过" : "审核不通过", $item["description"]
  259. ];
  260. $rows[] = $row;
  261. $i++;
  262. }
  263. if ($rows) {
  264. $filename = "积分申报公示导出";
  265. export($columns, $rows, $filename);
  266. exit();
  267. }
  268. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  269. }
  270. /**
  271. * 预备人才库-公示
  272. */
  273. public function preparePublic() {
  274. $params = $this->request->param();
  275. $ids = $params["ids"];
  276. $publicBatch = $params["batch"];
  277. if (!$publicBatch || strlen($publicBatch) != 6 || !is_numeric($publicBatch))
  278. return json(["msg" => "公示批次错误"]);
  279. $isMessage = $params["isMessage"] == 1 ? true : false;
  280. if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
  281. return json(["msg" => "短信参数不能为空"]);
  282. }
  283. $ids = array_filter(explode(",", $ids));
  284. $msg = "已公示";
  285. $state = IntegralState::ANNOUNCED; //公示
  286. $total = count($ids);
  287. $error = 0;
  288. $success = 0;
  289. $phones = [];
  290. foreach ($ids as $id) {
  291. $record = IntegralRecordApi::getOne($id);
  292. if ($record["checkState"] != IntegralState::ZX_PASS) {
  293. $error++;
  294. continue;
  295. }
  296. if (IntegralRecordApi::setPublic($id, $state, $msg, $publicBatch)) {
  297. $success++;
  298. $phones[] = $record["enterprise"]->agentPhone;
  299. } else {
  300. $error++;
  301. }
  302. }
  303. $phones = array_unique(array_filter($phones));
  304. if ($isMessage && $phones) {
  305. $sms = new \app\common\api\ChuanglanSmsApi();
  306. $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
  307. $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
  308. while ($phone = array_shift($phones)) {
  309. $result = $sms->sendSMS($phone, $tpl_content);
  310. $result = json_decode($result, true);
  311. $recordId = getStringId();
  312. $record_data = [
  313. 'id' => $recordId,
  314. 'bizId' => $result["msgId"],
  315. 'type' => 2,
  316. 'smsType' => 1,
  317. 'phone' => $phone,
  318. 'params' => '公示',
  319. 'templateCode' => $tpl_content,
  320. 'state' => $result['code'] == 0 ? 2 : 3,
  321. 'sendingDate' => date("Y-m-d H:i:s", time()),
  322. 'createTime' => date("Y-m-d H:i:s", time()),
  323. 'msg' => $result['errorMsg']
  324. ];
  325. MessageRecord::create($record_data);
  326. }
  327. }
  328. return json(["code" => 200, "msg" => sprintf("公示完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  329. }
  330. /**
  331. * 预备人才库-公示再审核
  332. */
  333. public function prepareCheck() {
  334. $params = $this->request->param();
  335. $id = $params["id"];
  336. $checkState = $params["checkState"];
  337. $msg = $params["checkMsg"];
  338. if (!$msg)
  339. return json(["msg" => "请填写审核意见"]);
  340. if ($checkState == 1) {
  341. $msg = "公示再审核通过:" . $msg;
  342. $state = IntegralState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  343. } else {
  344. $msg = "公示再审核不通过:" . $msg;
  345. $state = IntegralState::ANNOUNCED_REVERIFY_FAIL; //公示再审核不通过
  346. }
  347. $record = IntegralRecordApi::getOne($id);
  348. if ($record["checkState"] != IntegralState::ANNOUNCED) {
  349. return json(["msg" => "当前记录不是公示状态,无法审核"]);
  350. }
  351. if (IntegralRecordApi::setPublic($id, $state, $msg)) {
  352. return json(["code" => 200, "msg" => "公示再审核完成"]);
  353. }
  354. return json(["msg" => "公示再审核失败"]);
  355. }
  356. /**
  357. * 预备人才库-公示通过(批量)
  358. */
  359. public function publicPass() {
  360. $params = $this->request->param();
  361. $ids = $params["ids"];
  362. $ids = array_filter(explode(",", $ids));
  363. $msg = "公示再审核批量通过";
  364. $state = IntegralState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  365. $total = count($ids);
  366. $error = 0;
  367. $success = 0;
  368. foreach ($ids as $id) {
  369. $record = IntegralRecordApi::getOne($id);
  370. if ($record["checkState"] != IntegralState::ANNOUNCED) {
  371. $error++;
  372. continue;
  373. }
  374. if (IntegralRecordApi::setPublic($id, $state, $msg)) {
  375. $success++;
  376. } else {
  377. $error++;
  378. }
  379. }
  380. return json(["code" => 200, "msg" => sprintf("公示再审核完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  381. }
  382. /**
  383. * 预备人才库-公布预览
  384. */
  385. public function publishExportBefore() {
  386. $params = $this->request->param();
  387. $ids = $params["ids"];
  388. $ids = array_filter(explode(",", $ids));
  389. if ($ids) {
  390. $where[] = ["ir.id", "in", $ids];
  391. $list = IntegralRecord::alias("ir")->where($where)
  392. ->leftJoin("sys_batch b", "b.id=ir.batch_id")
  393. ->leftJoin("un_enterprise e", "e.id=ir.enterprise_id")
  394. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=20 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ir.id")
  395. ->field("ir.*,e.name as enterpriseName,b.batch as apply_year,tl.state as real_state,tl.last_state,tl.description")->order("createTime asc")->select();
  396. $rows = [];
  397. $i = 1;
  398. $card_types = DictApi::selectByParentCode("card_type");
  399. foreach ($list as $item) {
  400. $tmp_items = [];
  401. $total_points = 0;
  402. foreach ($item["detail"] as $_item) {
  403. $integral_item_info = getCacheById("IntegralItem", $_item["item_id"]);
  404. $tmp_items[] = sprintf("%s(%s%s)+%d积分", $integral_item_info["name"], $_item["amount"], $integral_item_info["unit"], $_item["point"]);
  405. $total_points += $_item["point"];
  406. }
  407. $row = [
  408. $i, $item["apply_year"], $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], implode(";", $tmp_items), $total_points, $item["checkState"] == IntegralState::ANNOUNCED_REVERIFY_PASS ? "审核通过" : "审核不通过", $item["description"]
  409. ];
  410. $rows[] = $row;
  411. $i++;
  412. }
  413. }
  414. $columns = ["序号", "批次", "姓名", "证件类型", "证件号码", "工作单位", "申请积分项目", "拟认定获得积分", "审核状态", "备注"];
  415. $filename = "积分申报" . date("Ym") . "公布预览名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  416. if ($rows) {
  417. export($columns, $rows, $filename);
  418. exit();
  419. }
  420. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  421. }
  422. /**
  423. * 预备人才库-公布导出
  424. */
  425. public function publishExport() {
  426. $params = $this->request->param();
  427. $startTime = $params["startTime"];
  428. $endTime = $params["endTime"];
  429. if (!strtotime($startTime) || !strtotime($endTime))
  430. return json(["msg" => "时间格式错误"]);
  431. $where[] = ["ir.checkState", "=", IntegralState::PUBLISH_PASS];
  432. $where[] = ["ir.getTime", "between", [$startTime, $endTime]];
  433. $list = IntegralRecord::alias("ir")->where($where)
  434. ->leftJoin("sys_batch b", "b.id=ir.batch_id")
  435. ->leftJoin("un_enterprise e", "e.id=ir.enterprise_id")
  436. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=20 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ir.id")
  437. ->field("ir.*,e.name as enterpriseName,b.batch as apply_year,tl.state as real_state,tl.last_state,tl.description")->order("createTime asc")->select();
  438. $rows = [];
  439. $i = 1;
  440. $card_types = DictApi::selectByParentCode("card_type");
  441. foreach ($list as $item) {
  442. $tmp_items = [];
  443. $total_points = 0;
  444. foreach ($item["detail"] as $_item) {
  445. $integral_item_info = getCacheById("IntegralItem", $_item["item_id"]);
  446. $tmp_items[] = sprintf("%s(%s%s)+%d积分", $integral_item_info["name"], $_item["amount"], $integral_item_info["unit"], $_item["point"]);
  447. $total_points += $_item["point"];
  448. }
  449. $row = [
  450. $i, $item["apply_year"], $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], implode(";", $tmp_items), $total_points, $item["checkState"] == IntegralState::PUBLISH_PASS ? "审核通过" : "审核不通过", $item["description"]
  451. ];
  452. $rows[] = $row;
  453. $i++;
  454. }
  455. $columns = ["序号", "批次", "姓名", "证件类型", "证件号码", "工作单位", "申请积分项目", "拟认定获得积分", "审核状态", "备注"];
  456. $filename = "积分申报" . date("Ym") . "公布名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  457. if ($rows) {
  458. export($columns, $rows, $filename);
  459. exit();
  460. }
  461. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  462. }
  463. /**
  464. * 预备人才库-公布
  465. */
  466. public function publish() {
  467. $params = $this->request->param();
  468. $id = $params["id"];
  469. $msg = $params["checkMsg"];
  470. $checkState = $params["checkState"];
  471. $batch = $params["batch"];
  472. if ($checkState == 1) {
  473. $state = IntegralState::PUBLISH_PASS;
  474. $msg = "公布审核通过:" . $msg;
  475. } else {
  476. $state = IntegralState::PUBLISH_FAIL;
  477. $msg = "公布审核不通过:" . $msg;
  478. }
  479. if (!$batch || !strtotime($batch))
  480. return json(["msg" => "公布批次时间错误"]);
  481. if (!$msg)
  482. return json(["msg" => "请填写审核意见"]);
  483. $state = IntegralState::PUBLISH_PASS; //公示再审核通过
  484. $batch = $params["batch"];
  485. if (!strtotime($batch))
  486. return json(["msg" => "公布批次时间错误"]);
  487. $record = IntegralRecordApi::getOne($id);
  488. if ($record["checkState"] != IntegralState::ANNOUNCED_REVERIFY_PASS) {
  489. return json(["msg" => "当前记录不是公示再审核通过状态,无法审核"]);
  490. }
  491. if (IntegralRecordApi::setPublic($id, $state, $msg, $batch)) {
  492. return json(["code" => 200, "msg" => "公布审核完成"]);
  493. }
  494. return json(["msg" => "公布审核失败"]);
  495. }
  496. /**
  497. * 预备人才库-批量公布通过
  498. */
  499. public function preparePublish() {
  500. $params = $this->request->param();
  501. $ids = $params["ids"];
  502. $ids = array_filter(explode(",", $ids));
  503. $msg = "批量公布";
  504. $state = IntegralState::PUBLISH_PASS; //公示再审核通过
  505. $batch = $params["batch"];
  506. if (!strtotime($batch))
  507. return json(["msg" => "公布批次时间错误"]);
  508. $total = count($ids);
  509. $error = 0;
  510. $success = 0;
  511. foreach ($ids as $id) {
  512. $record = IntegralRecordApi::getOne($id);
  513. if ($record["checkState"] != IntegralState::ANNOUNCED_REVERIFY_PASS) {
  514. $error++;
  515. continue;
  516. }
  517. if (IntegralRecordApi::setPublic($id, $state, $msg, $batch)) {
  518. $success++;
  519. } else {
  520. $error++;
  521. }
  522. }
  523. return json(["code" => 200, "msg" => sprintf("公布完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  524. }
  525. /**
  526. * 预备人才库-批量发放人才码
  527. */
  528. public function prepareCertification() {
  529. $lockFile = fopen("send_certificate.lock", "a");
  530. if (flock($lockFile, LOCK_EX | LOCK_NB)) {//文件锁(独占)
  531. $params = $this->request->param();
  532. $ids = array_filter(explode(",", $params["ids"]));
  533. Db::startTrans();
  534. $user = $this->user;
  535. try {
  536. $record_list = IntegralRecordApi::getListByIds($ids);
  537. $year = date("Y");
  538. foreach ($record_list as $record) {
  539. if ($record["checkState"] != IntegralState::PUBLISH_PASS) {
  540. Db::rollback();
  541. return json(["msg" => "只能对公布通过的对象发放积分,请核查待发放积分名单后再重新发放积分"]);
  542. }
  543. $data["id"] = $record["id"];
  544. $data["checkState"] = IntegralState::SUCCESS;
  545. $data["isPublic"] = 5;
  546. Db::table("new_integral_record")->update($data);
  547. //写入日志
  548. $log["last_state"] = IntegralState::PUBLISH_PASS;
  549. $log["id"] = getStringId();
  550. $log["state"] = $log["new_state"] = IntegralState::SUCCESS;
  551. $log["type"] = ProjectState::INTEGRAL;
  552. $log["mainId"] = $record["id"];
  553. $log["companyId"] = $user["companyId"];
  554. $log["active"] = 1;
  555. $log["description"] = "积分申报成功";
  556. $log["createUser"] = sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]);
  557. $log["createTime"] = date("Y-m-d H:i:s");
  558. Db::table("new_talent_checklog")->insert($log);
  559. }
  560. Db::commit();
  561. return json(["code" => 200, "msg" => "发放积分成功"]);
  562. } catch (\Exception $e) {
  563. Db::rollback();
  564. return json(["msg" => "发放积分失败:" . $e->getMessage()]);
  565. }
  566. flock($lockFile, LOCK_UN);
  567. } else {
  568. return json(["msg" => "同一时间只能有一个管理员进行发放积分操作"]);
  569. }
  570. }
  571. /**
  572. * 预备人才库-撤销公布
  573. */
  574. public function pre_cancel_publish() {
  575. }
  576. /**
  577. * 初审-提交未保存
  578. * @param \think\Request $request
  579. * @param type $record
  580. * @return type json
  581. */
  582. private function fstCheck(\think\Request $request, $record) {
  583. $params = $request->param();
  584. if ($params["checkState"] == 1) {
  585. //审核成功,并取消设置越过部门并审
  586. $log_checkState = $checkState = IntegralState::VERIFY_PASS; //初审成功
  587. } else if ($params["checkState"] == 2) {
  588. //审核驳回并记录需要修改的字段和上传文件
  589. $checkState = IntegralState::SAVE; //退回材料编辑状态
  590. $log_checkState = IntegralState::VERIFY_REJECT; //日志记录拒绝状态
  591. } else {
  592. $checkState = IntegralState::VERIFY_FAIL;
  593. }
  594. $log = TalentLogApi::getLastLog($record["id"], ProjectState::INTEGRAL);
  595. if (!$log)
  596. return json(["msg" => "日志数据异常,保存失败"]);
  597. if ($log["active"] == 0) {
  598. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  599. } else {
  600. TalentLogApi::write(ProjectState::INTEGRAL, $record["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  601. }
  602. $data["id"] = $record["id"];
  603. $data["modify_files"] = $params["files"];
  604. $data["modify_fields"] = $params["fields"];
  605. IntegralRecord::update($data);
  606. return json(["code" => 200, "msg" => "保存成功"]);
  607. }
  608. /**
  609. * 初审-提交审核
  610. * @param type $record
  611. * @return type json
  612. */
  613. private function fstSubmitCheck($record) {
  614. $log = TalentLogApi::getLastLog($record["id"], ProjectState::INTEGRAL);
  615. if (!$log || $log["active"] == 1)
  616. return json(["msg" => "请先保存审核状态,再提交审核"]);
  617. if ($log["new_state"] == IntegralState::VERIFY_PASS) {
  618. $data["modify_files"] = null;
  619. $data["modify_fields"] = null;
  620. }
  621. $data["id"] = $record["id"];
  622. $data["checkState"] = $log["new_state"];
  623. IntegralRecord::update($data);
  624. TalentLogApi::setActive($log["id"], 1);
  625. $userIds = [];
  626. if (in_array($log["state"], [IntegralState::VERIFY_PASS])) {
  627. //初审成功需要发送短信给复核部门,复核的其它状态发送通知给用户,调用此方法的还有基础审核的每个状态都要发送通知给用户
  628. //从复核权限,逆推复核人员
  629. $codes = ["integralVerify_reCheck"];
  630. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  631. $where = [];
  632. $where[] = ["menuid", "in", $menuIds];
  633. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  634. $where = [];
  635. $where[] = ["status", "=", 1];
  636. $where[] = ["type", "=", $this->user["type"]];
  637. $where[] = ["roleid", "<>", 1];
  638. $regstr = ",(" . implode("|", $roleIds) . "),";
  639. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  640. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  641. }
  642. $this->sendMsgByState($record, $log["state"], $userIds);
  643. return json(["code" => 200, "msg" => "审核成功"]);
  644. }
  645. /**
  646. * 复审-提交未保存
  647. * @param \think\Request $request
  648. * @param type $record
  649. * @param type json
  650. */
  651. private function reCheck(\think\Request $request, $record) {
  652. $params = $request->param();
  653. $data["modify_files"] = null;
  654. $data["modify_fields"] = null;
  655. $totalPoints = 0;
  656. if ($params["checkState"] == 1) {
  657. //审核成功
  658. $log_checkState = $checkState = IntegralState::REVERIFY_PASS; //复核成功
  659. foreach ($record->detail as $item) {
  660. $result = IntegralRecordApi::calIntegral($record["enterprise_id"], $record["card_type"], $record["card_number"], $item["item_id"], $item["amount"]);
  661. $totalPoints += $result->points;
  662. $iData["id"] = $item["id"];
  663. $iData["point"] = $result->points;
  664. IntegralDetail::update($iData);
  665. }
  666. $data["totalPoints"] = $totalPoints;
  667. } else if ($params["checkState"] == 2) {
  668. //审核驳回并记录需要修改的字段和上传文件
  669. $checkState = IntegralState::SUBMIT; //退回待初审
  670. $log_checkState = IntegralState::REVERIFY_REJECT; //日志记录拒绝状态
  671. $data["modify_files"] = $params["files"];
  672. $data["modify_fields"] = $params["fields"];
  673. } else {
  674. $log_checkState = $checkState = IntegralState::REVERIFY_FAIL; //审核失败
  675. }
  676. $log = TalentLogApi::getLastLog($record["id"], ProjectState::INTEGRAL);
  677. if (!$log)
  678. return json(["msg" => "日志数据异常,保存失败"]);
  679. if ($log["active"] == 0) {
  680. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  681. } else {
  682. TalentLogApi::write(ProjectState::INTEGRAL, $record["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  683. }
  684. $data["id"] = $record["id"];
  685. IntegralRecord::update($data);
  686. return json(["code" => 200, "msg" => "保存成功"]);
  687. }
  688. /**
  689. * 复审-提交审核
  690. * @param type $record
  691. * @return type json
  692. */
  693. private function reSubmitCheck($record) {
  694. $log = TalentLogApi::getLastLog($record["id"], ProjectState::INTEGRAL);
  695. if (!$log || $log["active"] == 1)
  696. return json(["msg" => "请先保存审核状态,再提交审核"]);
  697. $data["id"] = $record["id"];
  698. $data["checkState"] = $log["new_state"];
  699. IntegralRecord::update($data);
  700. TalentLogApi::setActive($log["id"], 1);
  701. $userIds = [];
  702. if (in_array($log["state"], [IntegralState::REVERIFY_PASS, IntegralState::REVERIFY_REJECT])) {
  703. //复核成功需要发送短信给征信部门,复核的其它状态发送通知给用户,调用此方法的还有基础审核的每个状态都要发送通知给用户
  704. //从征信审核权限,逆推征信部门
  705. if ($data["checkState"] == IntegralState::REVERIFY_PASS) {
  706. $codes = ["integralVerify_hczxReject", "integralVerify_firstCheck_hczxPass"];
  707. } else {
  708. $codes = ["integralVerify_firstCheck"];
  709. }
  710. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  711. $where = [];
  712. $where[] = ["menuid", "in", $menuIds];
  713. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  714. $where = [];
  715. $where[] = ["status", "=", 1];
  716. $where[] = ["type", "=", $this->user["type"]];
  717. $where[] = ["roleid", "<>", 1];
  718. $regstr = ",(" . implode("|", $roleIds) . "),";
  719. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  720. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  721. }
  722. $this->sendMsgByState($record, $log["state"], $userIds);
  723. return json(["code" => 200, "msg" => "审核成功"]);
  724. }
  725. private function sendMsgByState($record, $state, $userIds = []) {
  726. $phones = [];
  727. $template = "";
  728. $type = 0;
  729. $processName = "";
  730. $userId = 0;
  731. $name = null;
  732. switch ($state) {
  733. case IntegralState::VERIFY_PASS://初审通过发送短信通知并审部门
  734. $type = 1;
  735. $processName = "积分申报-初级审核";
  736. $template = "【晋江市人才服务平台】您的部门有新的积分申报需要审批,请及时登录审批系统处理。";
  737. break;
  738. case IntegralState::VERIFY_REJECT; //初审驳回发送短信通知用户
  739. $type = 2;
  740. $processName = "积分申报-初级审核";
  741. $template = "【晋江市人才服务平台】尊敬的用户,您提交的积分申报审核驳回,原因是:{$log['description']},请及时登录申报系统修改并重新提交。";
  742. break;
  743. case IntegralState::VERIFY_FAIL://初审不通过发送短信通知用户
  744. $type = 2;
  745. $processName = "积分申报-初级审核";
  746. $template = "【晋江市人才服务平台】尊敬的用户,您提交的积分申报审核不通过,原因是:{$log['description']}。";
  747. break;
  748. case IntegralState::REVERIFY_PASS://复核通过发短信通知征信部门
  749. $type = 1;
  750. $processName = "积分申报-复审";
  751. $template = "【晋江市人才服务平台】有新的积分申报通过复审进入征信阶段,请及时登录审批系统处理。";
  752. break;
  753. case IntegralState::REVERIFY_REJECT://复核驳回发短信通知初审部门
  754. $type = 1;
  755. $processName = "积分申报-复审";
  756. $template = "【晋江市人才服务平台】有积分申报在复审阶段被驳回,原因是:{$log['description']},请及时登录审批系统处理。";
  757. break;
  758. case IntegralState::REVERIFY_FAIL://并审驳回发送短信通知初审部门
  759. $type = 2;
  760. $processName = "积分申报-复审";
  761. $template = "【晋江市人才服务平台】尊敬的用户,您提交的积分申报审核不通过,原因是:{$log['description']}。";
  762. break;
  763. }
  764. if ($type == 1) {
  765. $where = [];
  766. $where[] = ["id", "in", $userIds];
  767. $phones = User::where($where)->column("phone");
  768. $phones = array_unique(array_filter($phones));
  769. }
  770. if ($type == 2) {
  771. $ep = EnterpriseApi::getOne($record['enterprise_id']);
  772. $phones[] = $ep->agentPhone;
  773. $userId = $ep->id;
  774. $name = $ep->name;
  775. }
  776. if ($phones && $template) {
  777. while ($phone = array_shift($phones)) {
  778. $smsapi = new ChuanglanSmsApi();
  779. $result = $smsapi->sendSMS($phone, $template);
  780. $result = json_decode($result, true);
  781. $id = getStringId();
  782. $record_data = [
  783. 'id' => $id,
  784. 'userId' => $userId,
  785. 'bizId' => $result["msgId"],
  786. 'type' => $type,
  787. 'smsType' => 2,
  788. 'name' => $name,
  789. 'phone' => $phone,
  790. 'params' => $processName,
  791. 'templateCode' => $template,
  792. 'state' => $result['code'] == 0 ? 2 : 3,
  793. 'sendingDate' => date("Y-m-d H:i:s", time()),
  794. 'createTime' => date("Y-m-d H:i:s", time()),
  795. 'msg' => $result['errorMsg']
  796. ];
  797. MessageRecord::create($record_data);
  798. }
  799. }
  800. }
  801. public function check() {
  802. //公共调度方法
  803. $request = $this->request;
  804. $params = $request->param();
  805. $check = $params["checkState"];
  806. $check_msg = trim($params["checkMsg"]);
  807. $files = $params["files"];
  808. $fields = $params["fields"];
  809. $id = $params["id"];
  810. $record = IntegralRecordApi::getOne($id);
  811. $checkState = $record["checkState"];
  812. if (!$record) {
  813. return json(["msg" => "数据错误"]);
  814. }
  815. if (!$check) {
  816. return json(["msg" => "请选择审核状态"]);
  817. }
  818. if (!$check_msg) {
  819. return json(["msg" => "请填写审核说明"]);
  820. }
  821. if ($check == 2 && !$files && $fields) {
  822. return json(["msg" => "请选择可修改的字段或项目"]);
  823. }
  824. if ($checkState == IntegralState::SUBMIT) {
  825. return $this->fstCheck($request, $record);
  826. } else if ($checkState == IntegralState::VERIFY_PASS) {
  827. return $this->reCheck($request, $record);
  828. } else {
  829. return json(["msg" => "不在审核范围内,保存失败"]);
  830. }
  831. }
  832. public function submitCheck() {
  833. //公共调度方法
  834. $id = $this->request->param("id");
  835. $record = IntegralRecordApi::getOne($id);
  836. $checkState = $record["checkState"];
  837. if (!$record) {
  838. return json(["msg" => "数据错误"]);
  839. }
  840. if ($checkState == IntegralState::SUBMIT) {
  841. return $this->fstSubmitCheck($record);
  842. } else if ($checkState == IntegralState::VERIFY_PASS) {
  843. return $this->reSubmitCheck($record);
  844. } else {
  845. return json(["msg" => "不在审核范围内,审核失败"]);
  846. }
  847. }
  848. public function validateIsCheck() {
  849. $params = $this->request->param();
  850. $id = $params["id"];
  851. $record = IntegralRecordApi::getOne($id);
  852. $enterprise = \app\common\model\Enterprise::findOrEmpty($record["enterprise_id"]);
  853. if ($record) {
  854. $items = $record["detail"]->toArray(); //项目明细
  855. $checkState = $record["checkState"];
  856. if (in_array($checkState, [IntegralState::SUBMIT, IntegralState::VERIFY_PASS])) {
  857. $fields = DictApi::getIntegralFields();
  858. $field_tmp = [];
  859. foreach ($fields as $key => $field) {
  860. $field_tmp[] = ["key" => $key, "value" => $field];
  861. }
  862. $record["files"] = $record["modify_files"];
  863. $record["fields"] = array_filter(explode(",", $record["modify_fields"]));
  864. return json(["code" => 200, "obj" => ["record" => $record, "fieldList" => $field_tmp]]);
  865. } else {
  866. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  867. }
  868. }
  869. }
  870. public function findFieldsAndFiles() {
  871. $id = $this->request["id"];
  872. $record = IntegralRecordApi::getOne($id);
  873. $lastLog = TalentLogApi::getLastLog($id, ProjectState::INTEGRAL);
  874. $responseObj = new \stdClass();
  875. if ($record["checkState"] == IntegralState::SAVE && $lastLog["state"] == IntegralState::VERIFY_REJECT) {
  876. $items = $record["detail"]->toArray(); //项目明细
  877. $checkState = $record["checkState"];
  878. $fields = DictApi::getIntegralFields();
  879. $field_tmp = [];
  880. foreach ($fields as $key => $field) {
  881. $field_tmp[] = ["key" => $key, "value" => $field];
  882. }
  883. $record["files"] = $record["modify_files"];
  884. $record["fields"] = array_filter(explode(",", $record["modify_fields"]));
  885. return json(["code" => 200, "obj" => ["record" => $record, "fieldList" => $field_tmp]]);
  886. $responseObj->code = 200;
  887. $responseObj->id = $id;
  888. $responseObj->obj = ["record" => $record, "fieldList" => $field_tmp];
  889. } else {
  890. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  891. }
  892. return json($responseObj);
  893. }
  894. public function updateFieldsAndFiles() {
  895. $id = $this->request["id"];
  896. $fields = array_filter(explode(",", $this->request["fields"]));
  897. $files = array_filter(explode(",", $this->request["files"]));
  898. $record = IntegralRecordApi::getOne($id);
  899. $lastLog = TalentLogApi::getLastLog($id, ProjectState::INTEGRAL);
  900. $responseObj = new \stdClass();
  901. if ($record["checkState"] == IntegralState::SAVE && $lastLog["state"] == IntegralState::VERIFY_REJECT) {
  902. if (!$fields && !$files) {
  903. $responseObj->msg = "请选择可修改的字段或附件!";
  904. return json($responseObj);
  905. }
  906. try {
  907. $data["id"] = $id;
  908. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  909. $data["modify_files"] = $files ? implode(",", $files) : null;
  910. IntegralRecord::update($data);
  911. $responseObj->code = 200;
  912. $responseObj->msg = "驳回字段修改成功";
  913. return json($responseObj);
  914. } catch (\think\db\exception\DbException $e) {
  915. $responseObj->msg = $e->getMessage();
  916. return json($responseObj);
  917. }
  918. } else {
  919. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  920. return json($responseObj);
  921. }
  922. }
  923. public function fstVerifyListExport() {
  924. $this->commonExport(1);
  925. }
  926. public function reVerifyListExport() {
  927. $this->commonExport(2);
  928. }
  929. public function preListExport() {
  930. $this->commonExport(3);
  931. }
  932. private function commonExport($process) {
  933. $params = $this->request->param();
  934. $fields = $params["export"];
  935. if (!$fields)
  936. return json(["msg" => "请选择要导出的数据"]);
  937. $names = DictApi::getIntegralFields();
  938. $names["enterpriseName"] = "单位名称";
  939. $names["street"] = "所属镇街";
  940. $names["project"] = "申报项目";
  941. $names["checkState"] = "审核状态";
  942. $names["checkMsg"] = "审核意见";
  943. $names["year"] = "申报年度";
  944. $list = IntegralRecordApi::getExportDatas($process, $fields);
  945. foreach ($fields as $field) {
  946. $columns[] = $names[$field];
  947. }
  948. $datas = [];
  949. for ($i = 0; $i < count($list); $i++) {
  950. $data = [];
  951. for ($n = 0; $n < count($fields); $n++) {
  952. $data[] = $list[$i][$fields[$n]];
  953. }
  954. $datas[] = $data;
  955. }
  956. if ($datas) {
  957. export($columns, $datas);
  958. exit();
  959. }
  960. echo "<script>parent.layer.alert('没有可以导出的数据');window.history.go(-1);</script>";
  961. }
  962. public function getPhones() {
  963. $list = VerifyApi::getListByProcess($this->request->param("process"));
  964. $result = [];
  965. if ($list) {
  966. foreach ($list as $item) {
  967. if ($item["phone"] && $item["name"]) {
  968. $result[] = sprintf("%s:%s", $item["name"], $item["phone"]);
  969. }
  970. }
  971. }
  972. return json(["code" => 200, "obj" => implode(";", $result)]);
  973. }
  974. public function getEnterprisePhones() {
  975. $list = VerifyApi::getListByProcess($this->request->param("process"));
  976. $result = [];
  977. if ($list) {
  978. foreach ($list as $item) {
  979. if ($item["agentName"] && $item["agentPhone"]) {
  980. $result[] = sprintf("%s:%s", $item["agentName"], $item["agentPhone"]);
  981. }
  982. }
  983. }
  984. return json(["code" => 200, "obj" => implode(";", $result)]);
  985. }
  986. }