Api.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. <?php
  2. namespace app\common\controller;
  3. use app\BaseController;
  4. use app\common\api\EnterpriseApi;
  5. use app\common\middleware\Auth;
  6. use app\common\model\TalentChecklog;
  7. use app\common\validate\Enterprise;
  8. use think\exception\ValidateException;
  9. use think\facade\Db;
  10. use app\enterprise\api\TalentApi;
  11. use app\common\api\TalentLogApi;
  12. use app\common\api\DictApi;
  13. use app\common\model\CurrentcyFileType;
  14. use app\common\model\TalentCommonFile;
  15. use app\common\api\UploadApi;
  16. use app\common\api\TalentConditionApi;
  17. use app\common\api\CompanyApi;
  18. use app\common\api\TalentState;
  19. /**
  20. * 需要权限的公共方法放这
  21. * Description of Tool
  22. *
  23. * @author sgq
  24. */
  25. class Api extends BaseController {
  26. protected $middleware = [Auth::class];
  27. protected $user;
  28. public function __construct(\think\App $app) {
  29. parent::__construct($app);
  30. $this->user = session("user");
  31. }
  32. public function findIdentifyConditionByLevel() {
  33. $params = $this->request->param();
  34. $id = $params["id"];
  35. if ($this->user["usertype"] == 2) {
  36. $type = $this->user["type"];
  37. } else {
  38. $talentInfo = TalentApi::getOne($id);
  39. $enterprise = \app\common\model\Enterprise::findOrEmpty($talentInfo["enterprise_id"]);
  40. $type = $enterprise["type"];
  41. }
  42. $list = TalentConditionApi::getList($params["level"], $type, $params["cat"]);
  43. return json($list, 200);
  44. }
  45. public function getTalentCondtionUploadFile() {
  46. $param = $this->request->param();
  47. $id = $param["mainId"];
  48. $order = $param["order"];
  49. $project = $param["project"];
  50. $type = $param["type"];
  51. $talent_condition = $param["talent_condition"];
  52. $condition_info = Db::table("new_talent_condition")->findOrEmpty($talent_condition);
  53. if (!$condition_info["bindFileTypes"])
  54. return json(["rows" => null]);
  55. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  56. $rows = Db::table("new_common_filetype")->where($whr)->order("sn " . $order)->select()->toArray();
  57. if ($id) {
  58. foreach ($rows as $key => $row) {
  59. $where = [];
  60. $where[] = ["mainId", "=", $id];
  61. $where[] = ["typeId", "=", $row["id"]];
  62. $files = Db::table("new_talent_file")->where($where)->field("id,typeId,orignName,url")->order("sn asc")->select()->toArray();
  63. foreach ($files as &$file) {
  64. $file["url"] = "/storage/" . $file["url"];
  65. }
  66. $rows[$key]["files"] = $files;
  67. }
  68. }
  69. return json(["rows" => $rows]);
  70. }
  71. public function getCheckLog() {
  72. $params = $this->request->param();
  73. $mainId = $params["mainId"];
  74. $type = $params["type"];
  75. /* $talentInfo = TalentApi::getOne($mainId);
  76. $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
  77. $needDeptVerify = false;
  78. if ($condition["companyIds"] && $talentInfo["pass_dept_check"] != 1)
  79. $needDeptVerify = true; */
  80. $list = TalentLogApi::getList($type, $mainId);
  81. $new_list = [];
  82. foreach ($list as $key => $item) {
  83. switch ($item['category']) {
  84. case 'enterprise_change':
  85. switch ($item['step']) {
  86. case 100:
  87. $new_item["stepName"] = "<span class='label'>用户操作</span>";
  88. break;
  89. case 101:
  90. $new_item["stepName"] = "<span class='label label-primary'>审核</span>";
  91. break;
  92. case 102:
  93. $new_item["stepName"] = "<span class='label label-danger'>设置冻结</span>";
  94. break;
  95. case 103:
  96. $new_item["stepName"] = "<span class='label label-info'>重置密码</span>";
  97. break;
  98. }
  99. switch ($item['state']) {
  100. case 1:
  101. $new_item["stateName"] = "<span class='label label-success'>待提交</span>";
  102. break;
  103. case 2:
  104. $new_item["stateName"] = "<span class='label label-success'>待审核</span>";
  105. break;
  106. case 3:
  107. $new_item["stateName"] = "<span class='label label-danger'>审核驳回</span>";
  108. break;
  109. case 4:
  110. $new_item["stateName"] = "<span class='label label-primary'>审核通过</span>";
  111. break;
  112. case 5:
  113. $new_item["stateName"] = "<span class='label label-warm'>重新提交</span>";
  114. break;
  115. }
  116. $new_item["stateChange"] = $item['stateChange'];
  117. break;
  118. default:
  119. $new_item["stepName"] = DictApi::getCheckLogStepName($item["state"], $item["step"]);
  120. if (in_array($item["state"], [TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  121. $new_item["stateName"] = '<span class="label label-danger">审核不通过</span>';
  122. } else if (in_array($item["state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  123. if ($item["step"] == 3) {
  124. if ($item["new_state"] == TalentState::SCND_SUBMIT) {
  125. $new_item["stateName"] = '<span class="label label-danger">审核驳回</span>';
  126. } else if ($item["new_state"] == TalentState::DEPT_VERIFY_PASS) {
  127. $new_item["stateName"] = '<span class="label label-primary">审核通过</span>';
  128. } else {
  129. $new_item["stateName"] = '<span class="label label-success">待审核</span>';
  130. }
  131. } else {
  132. $new_item["stateName"] = '<span class="label label-primary">审核通过</span>';
  133. }
  134. } else if (in_array($item["state"], [4, 8, 10, 12])) {
  135. $new_item["stateName"] = '<span class="label label-danger">审核驳回</span>';
  136. } else if (in_array($item["state"], [TalentState::ZX_PASS, TalentState::ANNOUNCED, TalentState::ANNOUNCED_REVERIFY_PASS, TalentState::PUBLISH_PASS, TalentState::CERTIFICATED])) {
  137. $new_item["stateName"] = '<span class="label label-primary">审核通过</span>';
  138. } else {
  139. $new_item["stateName"] = '<span class="label label-success">待审核</span>';
  140. }
  141. if ($item["step"] == 3) {
  142. $company = CompanyApi::getOne($item["companyId"]);
  143. if ($item["active"] == 0) {
  144. $new_item["stateChange"] = str_replace("部门", '"' . $company["name"] . '"', DictApi::getTalentInfoStateName($item["state"], $item["step"]));
  145. } else {
  146. $new_item["stateChange"] = sprintf("%s -> %s", str_replace("部门", '"' . $company["name"] . '"', DictApi::getTalentInfoStateName($item["state"], $item["step"])), DictApi::getTalentInfoStateName($item["new_state"], $item["step"]));
  147. }
  148. } else {
  149. if ($item["last_state"] && $item["new_state"]) {
  150. $new_item["stateChange"] = sprintf("%s -> %s", DictApi::getTalentInfoStateName($item["last_state"], $list[$key + 1]["step"]), DictApi::getTalentInfoStateName($item["new_state"], $list[$key - 1]["step"], $item["last_state"]));
  151. } else {
  152. $new_item["stateChange"] = "";
  153. }
  154. }
  155. break;
  156. }
  157. $new_item["description"] = $item["description"];
  158. $new_item["createUser"] = $item["updateUser"] ?: $item["createUser"];
  159. $new_item["createTime"] = $item["updateTime"] ?: $item["createTime"];
  160. $new_list[] = $new_item;
  161. }
  162. return json(["rows" => $new_list]);
  163. }
  164. public function findCommonFileType() {
  165. $param = $this->request->param();
  166. $id = $param["mainId"];
  167. $order = $param["order"];
  168. $project = $param["project"];
  169. $type = $param["type"];
  170. $checkState = $param["checkState"];
  171. $talent_condition = $param["talent_condition"];
  172. if (in_array($checkState, [-1, 0, 1, 2])) {
  173. $where[] = ["step", "=", 1]; //只查找人才第一步所需文件
  174. } else {
  175. $where[] = ["isConditionFile", "<>", 1]; //排除人才条件上传文件
  176. }
  177. $where[] = ["project", "=", $project];
  178. $where[] = ["type", "=", $type];
  179. if ($talent_condition) {
  180. $condition_info = Db::table("new_talent_condition")->findOrEmpty($talent_condition);
  181. if ($condition_info["bindFileTypes"]) {
  182. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  183. }
  184. }
  185. if ($whr) {
  186. $rows = Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn " . $order)->select()->toArray();
  187. } else {
  188. $rows = Db::table("new_common_filetype")->where($where)->order("sn " . $order)->select()->toArray();
  189. }
  190. if ($id) {
  191. foreach ($rows as $key => $row) {
  192. $where = [];
  193. $where[] = ["mainId", "=", $id];
  194. $where[] = ["typeId", "=", $row["id"]];
  195. $files = Db::table("new_talent_file")->where($where)->field("id,typeId,orignName,url")->order("sn asc")->select()->toArray();
  196. foreach ($files as &$file) {
  197. $file["url"] = "/storage/" . $file["url"];
  198. }
  199. $rows[$key]["files"] = $files;
  200. }
  201. }
  202. return json(["rows" => $rows]);
  203. }
  204. public function listTalentFile() {
  205. $param = $this->request->param();
  206. $mainId = $param["mainId"];
  207. $typeId = $param["fileTypeId"];
  208. $where = [["mainId", "=", $mainId], ["typeId", "=", $typeId]];
  209. $list = Db::table("new_talent_file")->where($where)->select()->toArray();
  210. foreach ($list as $key => $item) {
  211. $list[$key]["url"] = "/storage/" . $item["url"]; //获取系统配置无效,暂时这样
  212. }
  213. return json($list);
  214. }
  215. public function addTalentFile() {
  216. $backName = $this->request->param("backName");
  217. $fileId = $this->request->param("fileId");
  218. $mainId = $this->request->param("mainId");
  219. $fileTypeId = $this->request->param("fileTypeId");
  220. $index = $this->request->param("index");
  221. $type = $this->request->param("type");
  222. $upload = new \app\common\api\UploadApi();
  223. $file = $this->request->file("fileUrl");
  224. if (!TalentApi::checkIsEditable($mainId)) {
  225. $res = ["msg" => "当前状态不能修改附件", "obj" => $index];
  226. echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
  227. exit();
  228. }
  229. $mime = $file->getMime();
  230. switch ($mime) {
  231. case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"://xlsx
  232. case "application/pdf"://pdf
  233. case "application/vnd.ms-excel"://xls
  234. $filestd = $upload->uploadOne($file, "file", "talent_files");
  235. break;
  236. case "image/jpg":
  237. case "image/jpeg":
  238. case "image/png":
  239. case "image/gif":
  240. $filestd = $upload->uploadOne($file, "image", "talent_files");
  241. break;
  242. default:
  243. $res = ["msg" => "不支持的附件类型", "obj" => $index];
  244. echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
  245. exit();
  246. break;
  247. }
  248. $change = false;
  249. if ($fileId) {
  250. if (!$this->chkIsFileOwner($mainId, $type)) {
  251. $res = ["msg" => "删除失败", "obj" => $index];
  252. echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
  253. exit();
  254. }
  255. $old = Db::table("new_talent_file")->findOrEmpty($fileId);
  256. $old_filepath = "storage/" . $old["url"];
  257. if (file_exists($old_filepath))
  258. unlink($old_filepath);
  259. $data["id"] = $fileId;
  260. $change = true;
  261. }
  262. $data["mainId"] = $mainId;
  263. $data["type"] = $type;
  264. $data["typeId"] = $fileTypeId;
  265. $data["orignName"] = $file->getOriginalName();
  266. $data["url"] = $filestd->filepath;
  267. $data["sn"] = $index;
  268. $data["createTime"] = time();
  269. if ($fileId) {
  270. Db::table("new_talent_file")->save($data);
  271. } else {
  272. $fileId = Db::table("new_talent_file")->insertGetId($data);
  273. }
  274. TalentLogApi::write($type, $mainId, 0, sprintf("%s附件,附件名为:%s", $change ? "修改" : "添加", $data["orignName"]), 1, $fileTypeId, $fileId);
  275. $res = ["code" => 200, "msg" => "上传附件成功", "obj" => $index, "info" => "/storage/" . $filestd->filepath, "typeId" => $fileTypeId, "id" => $fileId, "orignName" => $data["orignName"]];
  276. echo sprintf("<script>parent.%s(%s);</script>", $backName, json_encode($res));
  277. }
  278. public function deleteFile() {
  279. $param = $this->request->param();
  280. $where = [["id", "=", $param["id"]]];
  281. $file = Db::table("new_talent_file")->where($where)->findOrEmpty();
  282. if (!TalentApi::checkIsEditable($file["mainId"]))
  283. return json(["msg" => "当前状态不能删除"]);
  284. if ($this->chkIsFileOwner($file["mainId"], $file["type"])) {
  285. $filepath = "storage/" . $file["url"];
  286. if (file_exists($filepath)) {
  287. unlink($filepath);
  288. }
  289. Db::table("new_talent_file")->delete($file["id"]);
  290. TalentLogApi::write($file["type"], $file["mainId"], 0, sprintf("删除附件,附件名为:%s", $file["orignName"]), 1, $file["typeId"], $param["id"]);
  291. return json(["code" => 200, "msg" => "删除成功"]);
  292. }
  293. return json(["msg" => "不能删除"]);
  294. }
  295. /**
  296. * 下载文件
  297. */
  298. public function downloadFile() {
  299. $param = $this->request->param();
  300. $type = $param["type"];
  301. $id = $param["id"];
  302. $where = [];
  303. $where[] = ["id", "=", $id];
  304. $where[] = ["type", "=", $type];
  305. $fileinfo = Db::table("new_talent_file")->where($where)->findOrEmpty();
  306. $filename = $fileinfo["orignName"];
  307. $filepath = "storage/" . $fileinfo["url"]; // 下载文件名
  308. if (!file_exists($filepath)) {
  309. header('HTTP/1.1 404 NOT FOUND');
  310. } else {
  311. $file = fopen($filepath, "rb");
  312. Header("Content-type: application/octet-stream");
  313. Header("Accept-Ranges: bytes");
  314. Header("Accept-Length: " . filesize($filepath));
  315. Header("Content-Disposition: attachment; filename=" . $filename);
  316. echo fread($file, filesize($filepath));
  317. fclose($file);
  318. exit();
  319. }
  320. }
  321. /**
  322. * 打包下载人才申请附件
  323. */
  324. public function downloadZip() {
  325. $param = $this->request->param();
  326. $type = $param["type"];
  327. $id = $param["id"];
  328. $where = [];
  329. $where[] = ["mainId", "=", $id];
  330. $where[] = ["type", "=", $type];
  331. $files = Db::table("new_talent_file")->where($where)->select()->toArray();
  332. if (!$files)
  333. die("没有附件不能打包下载");
  334. $talent_info = \app\enterprise\model\Talent::findOrEmpty($id);
  335. $enterprise_info = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
  336. $zip_filename = sprintf("%s(%s)人才申报材料.zip", $talent_info["name"], $enterprise_info["name"]);
  337. $tmp_path = "storage/temp/";
  338. $tmp_file_path = $tmp_path . $zip_filename;
  339. if (!file_exists($tmp_path)) {
  340. mkdir($tmp_path);
  341. }
  342. $zip = new \ZipArchive();
  343. if (!$zip->open($tmp_file_path, \ZipArchive::CREATE | \ZipArchive::OVERWRITE)) {
  344. header('HTTP/1.1 404 NOT FOUND');
  345. }
  346. foreach ($files as $file) {
  347. $filepath = "storage/" . $file["url"];
  348. $filename = $file["orignName"];
  349. $zip->addFile($filepath, $filename);
  350. }
  351. $zip->close();
  352. if (file_exists($tmp_file_path)) {
  353. header("Cache-Control: public");
  354. header("Content-Description: File Transfer");
  355. header('Content-disposition: attachment; filename=' . $zip_filename); //文件名
  356. header("Content-Type: application/octet-stream;charset=utf-8"); //zip格式的
  357. header("Content-Transfer-Encoding: binary"); //告诉浏览器,这是二进制文件
  358. header('Content-Length: ' . filesize($tmp_file_path)); //告诉浏览器,文件大小
  359. @readfile($tmp_file_path);
  360. }
  361. //删除临时文件
  362. @unlink($tmp_file_path);
  363. }
  364. private function chkIsFileOwner($mainId, $type) {
  365. if (!$mainId)
  366. return true;
  367. switch ($type) {
  368. case 1:
  369. if ($this->user["usertype"] == 2) {
  370. $user_id = $this->user["uid"];
  371. $talent_info = Db::table("new_talent_info")->findOrEmpty($mainId);
  372. if ($user_id == $talent_info["enterprise_id"])
  373. return true;
  374. }
  375. break;
  376. }
  377. return false;
  378. }
  379. public function getCompanyKvs() {
  380. $companys = \app\common\model\Company::field("name,id")->select();
  381. return json($companys);
  382. }
  383. public function getLayerCatsByLayer() {
  384. $lv = $this->request->param("level");
  385. return json(DictApi::getLayerCatsByLayer($lv));
  386. }
  387. /**
  388. * 通过人才类别查找人才认定第二步骤支持的所有文件类型
  389. * 默认人才认定第二步骤,当前只有人才认定分了两步,所以此方法目前默认参数高度匹配人才认定第二阶段附件的查找
  390. */
  391. public function getConditionFileTypesByType() {
  392. $params = $this->request->param();
  393. $type = $params["type"]; //人才类型不默认,需要传
  394. $declare_type = $params["project"] ?: 1; //默认人才认定
  395. $active = $params["active"] ?: 1; //默认查找启用的附件
  396. $where[] = ["type", "=", $type];
  397. $where[] = ["project", "=", $declare_type];
  398. $where[] = ["active", "=", $active];
  399. $where[] = ["isConditionFile", "=", 1];
  400. $list = Db::table("new_common_filetype")->where($where)->order("sn " . $order)->select()->toArray();
  401. return json($list);
  402. }
  403. public function listCurrencyFileType() {
  404. $where = [
  405. 'type' => $this->request['type'],
  406. 'active' => 1
  407. ];
  408. $rows = CurrentcyFileType::where($where)->select();
  409. return json(["rows" => $rows, 'total' => count($rows)]);
  410. }
  411. public function listTalentCommonFile() {
  412. $where = [];
  413. if (\StrUtil::isNotEmpAndNull($this->request['mainId'])) {
  414. $where[] = ['mainId', '=', $this->request['mainId']];
  415. }
  416. if (\StrUtil::isNotEmpAndNull($this->request['typeId'])) {
  417. $where[] = ['typeId', '=', $this->request['typeId']];
  418. }
  419. $res = TalentCommonFile::where($where)->order('sn')->select();
  420. if ($res) {
  421. foreach ($res as $k => &$v) {
  422. $v['url'] = "/storage/" . $v['url'];
  423. }
  424. }
  425. return json($res);
  426. }
  427. public function addTalentCommonFile() {
  428. $backName = \StrUtil::getRequestDecodeParam($this->request, 'backName');
  429. $id = \StrUtil::getRequestDecodeParam($this->request, "fileId");
  430. $mainId = \StrUtil::getRequestDecodeParam($this->request, "mainId");
  431. $typeId = \StrUtil::getRequestDecodeParam($this->request, "typeId");
  432. $index = \StrUtil::getRequestDecodeParam($this->request, "index");
  433. if ($backName == "EpChangeEdit.callBack") {
  434. $type = 1;
  435. $error = "文件格式不正确,只能上传图片";
  436. } else {
  437. $type = 4;
  438. $error = "文件格式不正确,只能上传pdf和图片";
  439. }
  440. $uploadapi = new UploadApi();
  441. $file_check_res = $uploadapi->uploadOne($this->request->file('fileUrl'), 'system');
  442. if ($file_check_res->code == 500) {
  443. return \StrUtil::back($file_check_res, "Register.epCallBack");
  444. }
  445. $file_data = [
  446. 'id' => getStringId(),
  447. 'mainId' => $mainId,
  448. 'typeId' => $typeId,
  449. 'orignName' => $this->request->file('fileUrl')->getOriginalName(),
  450. 'url' => $file_check_res->filepath
  451. ];
  452. if (\StrUtil::isEmpOrNull($id)) {
  453. $tc = TalentCommonFile::where('mainId', $mainId)->where('typeId', $typeId)->order('sn', 'desc')->findOrEmpty();
  454. if ($tc) {
  455. $file_data['sn'] = $tc['sn'] + 1;
  456. } else {
  457. $file_data['sn'] = 1;
  458. }
  459. $file_data['createTime'] = date("Y-m-d H:i:s");
  460. TalentCommonFile::create($file_data);
  461. $response_object = new \StdClass();
  462. $response_object->code = 200;
  463. $response_object->msg = "附件上传成功!";
  464. $response_object->obj = $index;
  465. return \StrUtil::back($response_object, $backName);
  466. } else {
  467. $tf = TalentCommonFile::findOrEmpty($id);
  468. $tf->originalName = $file_data['orignName'];
  469. $tf->updateTime = date("Y-m-d H:i:s");
  470. $tf->url = $file_check_res->filepath;
  471. $tf->save();
  472. $response_object = new \StdClass();
  473. $response_object->code = 200;
  474. $response_object->msg = "附件修改成功!";
  475. $response_object->obj = $index;
  476. return \StrUtil::back($response_object, $backName);
  477. }
  478. }
  479. public function changePwd() {
  480. $password = \StrUtil::getRequestDecodeParam($this->request, 'password');
  481. $newPassword = \StrUtil::getRequestDecodeParam($this->request, 'newPassword');
  482. //数据校验(原密码与新密码不能为空)
  483. if (\StrUtil::isEmpOrNull($password)) {
  484. return json(['code' => 500, 'msg' => "请填写原密码!"]);
  485. }
  486. if (\StrUtil::isEmpOrNull($newPassword)) {
  487. return json(['code' => 500, 'msg' => "请填写新密码!"]);
  488. }
  489. try {
  490. validate(Enterprise::class)->batch(true)->scene('changePwd')->check(['password' => $password, 'password' => $newPassword]);
  491. $ep = EnterpriseApi::getOne(session("user")['uid']);
  492. if (!$ep) {
  493. return json(['code' => 500, 'msg' => "请刷新页面后重试!"]);
  494. }
  495. if ($ep->password != hash('md5', $password)) {
  496. return json(['code' => 500, 'msg' => "旧密码不正确!"]);
  497. }
  498. $ep->password = hash('md5', $newPassword);
  499. $ep->updateUser = session("user")['uid'];
  500. $ep->updateTime = date("Y-m-d H:i:s");
  501. $ep->save();
  502. TalentChecklog::create([
  503. 'id' => getStringId(),
  504. 'category' => 'enterprise_change',
  505. 'mainId' => $ep->id,
  506. 'type' => 10,
  507. 'typeField' => null,
  508. 'active' => 1,
  509. 'state' => 1,
  510. 'step' => 100,
  511. 'stateChange' => null,
  512. 'description' => '用户修改密码',
  513. 'createTime' => date("Y-m-d H:i:s", time()),
  514. 'createUser' => '用户'
  515. ]);
  516. return json(['code' => 200, 'msg' => "修改成功!"]);
  517. } catch (ValidateException $e) {
  518. $error = $e->getError();
  519. return json(['code' => 500, 'msg' => array_pop($error)]);
  520. }
  521. }
  522. }