System.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use think\facade\Db;
  5. /**
  6. * Description of System
  7. *
  8. * @author sgq
  9. */
  10. class System extends AdminController {
  11. /**
  12. * 生成缓存
  13. * @return type
  14. */
  15. public function cache() {
  16. $step = $this->request->param("step");
  17. if ($step) {
  18. $cache_kvs = [
  19. ["func" => "\app\common\model\Company::cache", "stepName" => "部门"],
  20. ["func" => "\app\common\model\IntegralProject::cache", "stepName" => "积分项目"],
  21. ["func" => "\app\common\model\IntegralItem::cache", "stepName" => "积分标准"]
  22. ];
  23. $cache = $cache_kvs[$step - 1];
  24. if ($cache) {
  25. $time1 = microtime(true);
  26. $cache["func"]();
  27. $time2 = microtime(true);
  28. $runtime = round($time2 - $time1, 2);
  29. $step++;
  30. echo '<script>window.parent.setText("<span class=\"highlight\">' . $cache["stepName"] . '</span>缓存成功![用时 ' . $runtime . 's]");</script>';
  31. echo '<script>window.location.href="/admin/system/cache/step/' . $step . '";</script>';
  32. } else {
  33. echo '<script>window.parent.setText("缓存创建结束!");</script>';
  34. }
  35. } else {
  36. return view();
  37. }
  38. }
  39. /**
  40. * 恢复自动审核失败
  41. */
  42. public function recovery() {
  43. $batch = 2022; //得更改批次
  44. $type = 1; //人才类型 1:晋江人才 2:电路人才
  45. $where = [];
  46. $where[] = ["ti.apply_year", "=", $batch];
  47. $where[] = ["ti.checkState", "=", \app\common\api\TalentState::FST_VERIFY_FAIL];
  48. $where[] = ["e.type", "=", $type];
  49. $where[] = ["tl.createUser", "=", "系统"];
  50. $where[] = ["tl.state", "=", \app\common\api\TalentState::FST_VERIFY_FAIL];
  51. $list = \app\enterprise\model\Talent::alias("ti")
  52. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  53. ->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")
  54. ->where($where)
  55. ->field("ti.*,e.type as enterpriseType")
  56. ->select()->toArray();
  57. if ($list) {
  58. foreach ($list as $ti) {
  59. queue("app\job\Talent", ["type" => 3, "talentInfo" => $ti]);
  60. }
  61. }
  62. }
  63. /**
  64. * 导入旧的电路人才到新库
  65. *
  66. -1 复核不通过 173
  67. 1 待提交 4
  68. 7 待初审 22
  69. 10 初审驳回 44
  70. 20 复审驳回 1
  71. 25 初审通过 71
  72. 35 复核通过,待核查征信 1281
  73. * isPublic 5:待发证 6:已发证
  74. * active 1:在职 2:离职
  75. * isEffect 1:有效 4:失效 其它:已过期
  76. * 需要增加字段
  77. * cur_quit_time离职时间
  78. * active在职状态
  79. * identifyMonth认证月份
  80. * identifyExpireTime
  81. * oldId 旧id
  82. */
  83. public function import_old_jcdl() {
  84. $where = [];
  85. $where[] = ["type", "=", 2];
  86. $where[] = ["name", "=", "杨忠宪"];
  87. $list = Db::table("un_talent_info")->where($where)->select();
  88. $count = session("oldJcjlTalentInfoToNewTable");
  89. $count += count($list);
  90. session("oldJcjlTalentInfoToNewTable", $count);
  91. foreach ($list as $item) {
  92. queue("app\job\Worker", ["type" => 99, "talent_info" => $item]);
  93. }
  94. echo "加入队列成功";
  95. }
  96. }