System.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. /**
  5. * Description of System
  6. *
  7. * @author sgq
  8. */
  9. class System extends AdminController {
  10. /**
  11. * 生成缓存
  12. * @return type
  13. */
  14. public function cache() {
  15. $step = $this->request->param("step");
  16. if ($step) {
  17. $cache_kvs = [
  18. ["func" => "\app\common\model\Company::cache", "stepName" => "部门"],
  19. ["func" => "\app\common\model\IntegralProject::cache", "stepName" => "积分项目"],
  20. ["func" => "\app\common\model\IntegralItem::cache", "stepName" => "积分标准"]
  21. ];
  22. $cache = $cache_kvs[$step - 1];
  23. if ($cache) {
  24. $time1 = microtime(true);
  25. $cache["func"]();
  26. $time2 = microtime(true);
  27. $runtime = round($time2 - $time1, 2);
  28. $step++;
  29. echo '<script>window.parent.setText("<span class=\"highlight\">' . $cache["stepName"] . '</span>缓存成功![用时 ' . $runtime . 's]");</script>';
  30. echo '<script>window.location.href="/admin/system/cache/step/' . $step . '";</script>';
  31. } else {
  32. echo '<script>window.parent.setText("缓存创建结束!");</script>';
  33. }
  34. } else {
  35. return view();
  36. }
  37. }
  38. /**
  39. * 恢复自动审核失败
  40. */
  41. public function recovery() {
  42. $batch = 2022; //得更改批次
  43. $type = 1; //人才类型 1:晋江人才 2:电路人才
  44. $where = [];
  45. $where[] = ["ti.apply_year", "=", $batch];
  46. $where[] = ["ti.checkState", "=", \app\common\api\TalentState::FST_VERIFY_FAIL];
  47. $where[] = ["e.type", "=", $type];
  48. $where[] = ["tl.createUser", "=", "系统"];
  49. $where[] = ["tl.state", "=", \app\common\api\TalentState::FST_VERIFY_FAIL];
  50. $list = \app\enterprise\model\Talent::alias("ti")
  51. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  52. ->leftJoin("(select mainId,last_state,new_state,state,createUser,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`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  53. ->where($where)
  54. ->field("ti.*,e.type as enterpriseType")
  55. ->select()->toArray();
  56. if ($list) {
  57. foreach ($list as $ti) {
  58. queue("app\job\Talent", ["type" => 3, "talentInfo" => $ti]);
  59. }
  60. }
  61. }
  62. }