System.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. /**
  63. * 导入旧的电路人才到新库
  64. *
  65. -1 复核不通过 173
  66. 1 待提交 4
  67. 7 待初审 22
  68. 10 初审驳回 44
  69. 20 复审驳回 1
  70. 25 初审通过 71
  71. 35 复核通过,待核查征信 1281
  72. * isPublic 5:待发证 6:已发证
  73. * active 1:在职 2:离职
  74. * isEffect 1:有效 4:失效 其它:已过期
  75. * 需要增加字段
  76. * cur_quit_time离职时间
  77. * active在职状态
  78. * identifyMonth认证月份
  79. * identifyExpireTime
  80. * oldId 旧id
  81. */
  82. public function import_old_jcdl() {
  83. $where = [];
  84. $where[] = ["type", "=", 2];
  85. $list = Db::table("un_talent_info")->where($where)->select();
  86. $count = session("oldJcjlTalentInfoToNewTable");
  87. $count += count($list);
  88. session("oldJcjlTalentInfoToNewTable", $count);
  89. foreach ($list as $item) {
  90. queue("app\job\Worker", ["type" => 99, "talent_info" => $item]);
  91. }
  92. echo "加入队列成功";
  93. }
  94. }