IntegralVerify.php 47 KB

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