Enterprise.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\admin\model\ApiData;
  5. use app\common\api\ChuanglanSmsApi;
  6. use app\common\api\DictApi;
  7. use app\common\api\EnterpriseApi;
  8. use app\common\model\MessageRecord;
  9. use app\common\model\TalentChecklog;
  10. use app\common\api\TalentState;
  11. use app\common\api\CompanyApi;
  12. use think\facade\Db;
  13. use app\admin\api\RsApi;
  14. /**
  15. * 企业审核
  16. * checkState 1:用户提交 [2:审核驳回 3:审核通过] 4:重新提交 [5:初审驳回 6:初审通过]
  17. */
  18. class Enterprise extends AdminController {
  19. public function gotoEnterprisePage() {
  20. return view("", []);
  21. }
  22. public function findEnterpriseByPage() {
  23. $res = EnterpriseApi::getList($this->request);
  24. return json($res);
  25. }
  26. public function gotoEnterpriseDetailPage() {
  27. $id = trim($this->request['id']);
  28. $ep = EnterpriseApi::getOne($id);
  29. $check_info = ApiData::where('action','=','register_check')->where('uid','=',$ep['idCard'])->where('status','=',1)->find();
  30. $force = intval($this->request['force'],0);
  31. if($force || !$check_info || !$check_info['status']){
  32. $rsapi = new RsApi();
  33. switch ($ep['special']){
  34. case 0:
  35. $ep['rs'] = $rsapi->I040102($ep['idCard']);
  36. break;
  37. case 1:
  38. $ep['rs'] = $rsapi->I080101($ep['idCard']);
  39. break;
  40. case 2:
  41. $ep['rs'] = $rsapi->I030501($ep['name'], $ep['idCard']);
  42. break;
  43. }
  44. ApiData::where('action','=','register_check')->where('uid','=',$ep['idCard'])->where('status','=',1)->update(['status' => 0,'updateTime' => time()]);
  45. $api_model_data = [
  46. 'uid' => $ep['idCard'],
  47. 'action' => 'register_check',
  48. 'content' => serialize($ep['rs']),
  49. 'createTime' => time()
  50. ];
  51. ApiData::create($api_model_data);
  52. }else{
  53. $ep['rs'] = unserialize($check_info['content']);
  54. }
  55. if (!$ep) {
  56. return "无此企业";
  57. }
  58. //--------设置 审核状态---------------------------------------------------
  59. switch ($ep['checkState']) {
  60. case 1:
  61. $ep['checkStateName'] = "待审核";
  62. break;
  63. case 2:
  64. $ep['checkStateName'] = "审核驳回";
  65. break;
  66. case 3:
  67. $ep['checkStateName'] = "审核通过";
  68. break;
  69. case 4:
  70. $ep['checkStateName'] = "重新提交";
  71. break;
  72. case 5:
  73. $ep['checkStateName'] = "初审驳回";
  74. break;
  75. case 6:
  76. $ep['checkStateName'] = "初审通过";
  77. break;
  78. }
  79. //-------设置账号状态----------------------------------------------------
  80. switch ($ep['active']) {
  81. case 1:
  82. $ep['activeName'] = "账号有效";
  83. break;
  84. case 2:
  85. $ep['activeName'] = "冻结/拉黑";
  86. break;
  87. }
  88. //---------设置 街道-----------------------------------------------------
  89. if (\StrUtil::isNotEmpAndNull($ep['street'])) {
  90. $street_info = DictApi::findByParentCodeAndCode('street', $ep['street']);
  91. if ($street_info != null) {
  92. $ep['streetName'] = $street_info['name'];
  93. }
  94. }
  95. if (\StrUtil::isNotEmpAndNull($ep['agencyType'])) {
  96. $agencyType = DictApi::findByParentCodeAndCode('agency_type', $ep['agencyType']);
  97. $ep["agencyTypeName"] = $agencyType["name"];
  98. }
  99. //---------设置产业领域 --------------------------------------------------
  100. if (\StrUtil::isNotEmpAndNull($ep['industryFieldNew'])) {
  101. $industryFieldNew = DictApi::findByParentCodeAndCode('industry_field', $ep['industryFieldNew']);
  102. if ($industryFieldNew != null) {
  103. $ep['industryFieldNewName'] = $industryFieldNew['name'];
  104. }
  105. }
  106. //---------设置行业领域 --------------------------------------------------
  107. if (\StrUtil::isNotEmpAndNull($ep['industryFieldOld'])) {
  108. $industryFieldOld = DictApi::findByParentCodeAndCode($ep['industryFieldNew'] . "_field", $ep['industryFieldOld']);
  109. if ($industryFieldOld != null) {
  110. $ep['industryFieldOldName'] = $industryFieldOld['name'];
  111. }
  112. }
  113. //---------设置单位标签 --------------------------------------------------
  114. if (\StrUtil::isNotEmpAndNull($ep['enterpriseTag'])) {
  115. $enterpriseTag = DictApi::findByParentCodeAndCode("enterprise_tag", $ep['enterpriseTag']);
  116. if ($enterpriseTag != null) {
  117. $ep['enterpriseTagName'] = $enterpriseTag['name'];
  118. }
  119. }
  120. //---------设置机构标签 --------------------------------------------------
  121. if (\StrUtil::isNotEmpAndNull($ep['organizationTag'])) {
  122. $organizationTag = DictApi::findByParentCodeAndCode("organization_tag", $ep['organizationTag']);
  123. if ($organizationTag != null) {
  124. $ep['organizationTagName'] = $organizationTag['name'];
  125. }
  126. }
  127. //---------设置事业单位标签 --------------------------------------------------
  128. if (\StrUtil::isNotEmpAndNull($ep['institutionTag'])) {
  129. $institutionTag = DictApi::findByParentCodeAndCode("institution_tag", $ep['institutionTag']);
  130. if ($institutionTag != null) {
  131. $ep['institutionTagName'] = $institutionTag['name'];
  132. }
  133. }
  134. //---------设置单位类型 --------------------------------------------------
  135. if (\StrUtil::isNotEmpAndNull($ep['enterpriseType'])) {
  136. $enterpriseType = DictApi::findByParentCodeAndCode("enterprise_type", $ep['enterpriseType']);
  137. if ($enterpriseType != null) {
  138. $ep['enterpriseTypeName'] = $enterpriseType['name'];
  139. }
  140. }
  141. $imgurl_info = pathinfo($ep['imgurl']);
  142. if (in_array($imgurl_info['extension'], ["jpeg", "jpg", "png", "gif"])) {
  143. $ep['imgurl_is_img'] = 1;
  144. } else {
  145. $ep['imgurl_is_img'] = 0;
  146. }
  147. $bankImg_info = pathinfo($ep['bankImg']);
  148. if (in_array($bankImg_info['extension'], ["jpeg", "jpg", "png", "gif"])) {
  149. $ep['bankImg_is_img'] = 1;
  150. } else {
  151. $ep['bankImg_is_img'] = 0;
  152. }
  153. $domainImg_info = pathinfo($ep['domainImg']);
  154. if (in_array($domainImg_info['extension'], ["jpeg", "jpg", "png", "gif"])) {
  155. $ep['domainImg_is_img'] = 1;
  156. } else {
  157. $ep['domainImg_is_img'] = 0;
  158. }
  159. $typeImg_info = pathinfo($ep['typeImg']);
  160. if (in_array($typeImg_info['extension'], ["jpeg", "jpg", "png", "gif"])) {
  161. $ep['typeImg_is_img'] = 1;
  162. } else {
  163. $ep['typeImg_is_img'] = 0;
  164. }
  165. $beian_info = pathinfo($ep['beian']);
  166. if (in_array($beian_info['extension'], ["jpeg", "jpg", "png", "gif"])) {
  167. $ep['beian_is_img'] = 1;
  168. } else {
  169. $ep['beian_is_img'] = 0;
  170. }
  171. return view("", ['ep' => $ep]);
  172. }
  173. public function gotoExaminePage() {
  174. $id = trim($this->request['id']);
  175. $ep = EnterpriseApi::getOne($id);
  176. $lastLog = \app\common\api\TalentLogApi::getLastLog($id, 10);
  177. if ($lastLog["active"] == 0) {
  178. $ep["checkState"] = $lastLog["state"];
  179. $ep["checkMsg"] = $lastLog["description"];
  180. }
  181. if (!$ep) {
  182. return "无此企业";
  183. }
  184. //---------设置产业领域 --------------------------------------------------
  185. if (\StrUtil::isNotEmpAndNull($ep['industryFieldNew'])) {
  186. $industryFieldNew = DictApi::findByParentCodeAndCode('industry_field', $ep['industryFieldNew']);
  187. if ($industryFieldNew != null) {
  188. $ep['industryFieldNewName'] = $industryFieldNew['name'];
  189. }
  190. }
  191. if ($ep->special == 0) {
  192. $fields = ["name" => "企业名称", "idCard" => "统一社会信用代码", "legal" => "法人代表", "address" => "企业地址", "street" => "所属街道", "ephone" => "企业电话", "bankCard" => "企业银行账号", "bank" => "企业开户银行", "bankNetwork" => "企业开户银行网点",
  193. "agencyType" => "机构类型", "industryFieldNew" => "产业领域", "industryFieldOld" => "行业领域", "enterpriseTag" => "企业标签", "enterpriseType" => "企业类型",
  194. "agentName" => "人才联络员姓名", "agentPhone" => "人才联络员电话", "agentEmail" => "人才联络员邮箱"];
  195. $files = ["imgurl" => "企业营业执照", "bankImg" => "开户许可证/基本存款账户信息", "domainImg" => "行业领域佐证材料", "beian" => "人才联络员信息备案表", "typeImg" => "规上、高新技术、专精特新企业上传材料"];
  196. } else {
  197. $fields = ["name" => "单位名称", "idCard" => "统一社会信用代码", "legal" => "法人代表", "address" => "单位地址", "street" => "所属街道", "ephone" => "单位电话", "bankCard" => "单位银行账号", "bank" => "单位开户银行", "bankNetwork" => "单位开户银行网点",
  198. "agentName" => "人才联络员姓名", "agentPhone" => "人才联络员电话", "agentEmail" => "人才联络员邮箱"];
  199. if ($ep->special == 1) {
  200. $fields["institutionTag"] = "单位标签";
  201. }
  202. if ($ep->special == 3) {
  203. $fields["organizationTag"] = "机构标签";
  204. }
  205. $files = ["imgurl" => "法人证或批文", "bankImg" => "开户许可证/基本存款账户信息", "beian" => "人才联络员备案表"];
  206. }
  207. $modify_fields = [];
  208. $modify_files = [];
  209. $_modify_fields = explode(",", $ep["modify_fields"]);
  210. foreach ($fields as $key => $value) {
  211. $checked = in_array($key, $_modify_fields);
  212. $modify_fields[$key] = ["field" => $key, "name" => $value, "checked" => $checked];
  213. }
  214. $_modify_files = explode(",", $ep["modify_files"]);
  215. foreach ($files as $key => $value) {
  216. $checked = in_array($key, $_modify_files);
  217. $modify_files[$key] = ["field" => $key, "name" => $value, "checked" => $checked];
  218. }
  219. return view("", ['ep' => $ep, 'checkUser' => session('user')['name'], 'fields' => $modify_fields, "files" => $modify_files]);
  220. }
  221. public function doExamine() {
  222. $id = trim($this->request['id']);
  223. $doSubmit = $this->request["submit"] == 1 ? true : false;
  224. if (!$id) {
  225. return json(["msg" => 'ID不能为空!']);
  226. }
  227. $ep = EnterpriseApi::getOne($id);
  228. if (!$ep) {
  229. return json(["msg" => '无此企业!']);
  230. }
  231. $oriCheckState = $ep["checkState"];
  232. if ($oriCheckState == 6 && !EnterpriseApi::chkUserInSuperusers()) {
  233. return json(["msg" => "已经流转到审核,不在审核范围内"]);
  234. }
  235. if (!in_array($ep["checkState"], [1, 4, 6]))
  236. return json(["msg" => "不在审核范围内"]);
  237. $checkState = $this->request['checkState'];
  238. if ($checkState == null || ($checkState != 2 && $checkState != 3)) {
  239. return json(["msg" => '请选择审核状态!']);
  240. }
  241. $checkMsg = $this->request['checkMsg'];
  242. $fields = $this->request['fields'];
  243. $files = $this->request['files'];
  244. if ($checkState == 2) {
  245. if (\StrUtil::isEmpOrNull($checkMsg)) {
  246. return json(["msg" => '请填写审核意见!']);
  247. }
  248. if (strlen($checkMsg) > 1000) {
  249. return json(["msg" => '审核意见最多1000个字符!']);
  250. }
  251. if (!$fields && !$files) {
  252. return json(["msg" => '请选择驳回修改的字段或者附件!']);
  253. }
  254. }
  255. try {
  256. $lastLog = \app\common\api\TalentLogApi::getLastLog($id, 10);
  257. $companyName = session('user')["companyName"] ?: session('user')["rolename"];
  258. if ($checkState == 3) {
  259. $fields = null;
  260. $files = null;
  261. }
  262. if ($oriCheckState == 6 || $ep["type"] == 2) {
  263. $newCheckState = $checkState;
  264. } else {
  265. $newCheckState = $checkState == 3 ? 6 : 5;
  266. }
  267. if ($doSubmit) {
  268. $checkData = [
  269. 'id' => $id,
  270. 'checkState' => $newCheckState,
  271. 'checkMsg' => $checkMsg,
  272. 'modify_fields' => $fields ? implode(",", $fields) : null,
  273. 'modify_files' => $files ? implode(",", $files) : null,
  274. 'checkUser' => session('user')['name'],
  275. 'updateUser' => session('user')['uid'],
  276. 'updateTime' => date("Y-m-d H:i:s")
  277. ];
  278. $res = EnterpriseApi::updateById($checkData);
  279. //短信入库数据
  280. $record_data = [
  281. 'id' => getStringId(),
  282. 'bizId' => getStringId(),
  283. 'userId' => $id,
  284. 'type' => 2,
  285. 'smsType' => 2,
  286. 'name' => $ep['name'],
  287. 'phone' => $ep['agentPhone'],
  288. 'params' => '机构注册信息',
  289. 'state' => 1,
  290. 'sendingDate' => date("Y-m-d H:i:s", time()),
  291. 'createTime' => date("Y-m-d H:i:s", time())
  292. ];
  293. if ($checkState == 2) {
  294. $record_data['templateCode'] = "【晋江市人才服务平台】您好!您提交的晋江市现代产业体系人才机构注册信息因信息填写错误或上传不完整已被退回,请及时登录“晋江市人才综合服务申报平台”根据审核意见修改并重新提交。退订回复TD。";
  295. }
  296. if ($newCheckState == 3) {
  297. $record_data['templateCode'] = "【晋江市人才服务平台】您好!您提交的晋江市现代产业体系人才机构注册信息已审核通过,可登录“晋江市人才综合服务申报平台”做相关事宜申报。退订回复TD。";
  298. }
  299. if ($newCheckState == 3 || $checkState == 2) {
  300. $smsapi = new ChuanglanSmsApi();
  301. $result = $smsapi->sendSMS($ep['agentPhone'], $record_data['templateCode']);
  302. MessageRecord::create($record_data);
  303. }
  304. if ($lastLog["active"] === 0) {
  305. TalentChecklog::update([
  306. 'id' => $lastLog["id"],
  307. 'active' => 1,
  308. 'state' => $newCheckState,
  309. 'step' => 101,
  310. 'stateChange' => TalentState::stateEnum($newCheckState),
  311. 'description' => $checkMsg,
  312. 'updateTime' => date("Y-m-d H:i:s", time()),
  313. 'updateUser' => session('user')['name'] . "({$companyName})"
  314. ]);
  315. } else {
  316. TalentChecklog::create([
  317. 'id' => getStringId(),
  318. 'mainId' => $id,
  319. 'type' => 10,
  320. 'typeField' => null,
  321. 'active' => 1,
  322. 'state' => $newCheckState,
  323. 'step' => 101,
  324. 'stateChange' => TalentState::stateEnum($newCheckState),
  325. 'description' => $checkMsg,
  326. 'createTime' => date("Y-m-d H:i:s", time()),
  327. 'createUser' => session('user')['name'] . "({$companyName})"
  328. ]);
  329. }
  330. return json(["msg" => '操作成功!', "code" => 200]);
  331. } else {
  332. $checkData = [
  333. 'id' => $id,
  334. 'modify_fields' => $fields ? implode(",", $fields) : null,
  335. 'modify_files' => $files ? implode(",", $files) : null,
  336. 'checkUser' => session('user')['name'],
  337. 'updateUser' => session('user')['uid'],
  338. 'updateTime' => date("Y-m-d H:i:s")
  339. ];
  340. $res = EnterpriseApi::updateById($checkData);
  341. if ($lastLog["active"] === 0) {
  342. TalentChecklog::update([
  343. 'id' => $lastLog["id"],
  344. 'state' => $newCheckState,
  345. 'step' => 101,
  346. 'stateChange' => TalentState::stateEnum($newCheckState),
  347. 'description' => $checkMsg,
  348. 'updateTime' => date("Y-m-d H:i:s", time()),
  349. 'updateUser' => session('user')['name'] . "({$companyName})"
  350. ]);
  351. } else {
  352. TalentChecklog::create([
  353. 'id' => getStringId(),
  354. 'mainId' => $id,
  355. 'type' => 10,
  356. 'typeField' => null,
  357. 'active' => 0,
  358. 'state' => $newCheckState,
  359. 'step' => 101,
  360. 'stateChange' => TalentState::stateEnum($checkState),
  361. 'description' => $checkMsg,
  362. 'createTime' => date("Y-m-d H:i:s", time()),
  363. 'createUser' => session('user')['name'] . "({$companyName})"
  364. ]);
  365. }
  366. return json(["msg" => '保存成功!', "code" => 200]);
  367. }
  368. } catch (\Exception $e) {
  369. return json(["msg" => $e->getMessage()]);
  370. }
  371. }
  372. public function delEnterprise() {
  373. if (!$id = trim($this->request['id'])) {
  374. return json(["msg" => 'ID不能为空!', "code" => 500]);
  375. }
  376. $ep = EnterpriseApi::getOne($id);
  377. if (!$ep || $ep->delete == 1)
  378. return json(["msg" => '要删除的数据不存在!', "code" => 500]);
  379. $ep->delete = 1;
  380. $ep->deleteUser = session('user')['uid'] . "";
  381. $ep->deleteTime = date('Y-m-d H:i:s');
  382. try {
  383. $ep->save();
  384. return json(["msg" => '操作成功!', "code" => 200]);
  385. } catch (\Exception $e) {
  386. return json(["msg" => $e->getMessage()]);
  387. }
  388. }
  389. public function GotoActivePage() {
  390. $id = trim($this->request['id']);
  391. $ep = EnterpriseApi::getOne($id);
  392. return view("", ['ep' => $ep]);
  393. }
  394. public function setActive() {
  395. if (!$id = trim($this->request['id'])) {
  396. return json(["msg" => 'ID不能为空!', "code" => 500]);
  397. }
  398. $ep = EnterpriseApi::getOne($id);
  399. $active = $this->request['active'];
  400. if ($ep['active'] == null || ($ep['active'] != 1 && $ep['active'] != 2)) {
  401. return json(["msg" => '状态有误!', "code" => 500]);
  402. }
  403. if ($ep['active'] == 2) {
  404. $msg = trim($this->request['activeMsg']);
  405. if (empty($msg)) {
  406. return json(["msg" => '请填写拉黑/冻结原因!', "code" => 500]);
  407. }
  408. if (strlen($msg) > 100) {
  409. return json(["msg" => '拉黑/冻结原因 最多100个字符!', "code" => 500]);
  410. }
  411. }
  412. $company = CompanyApi::getOne(session('user')['companyId']);
  413. $ep->active = $active;
  414. $ep->activeMsg = $msg;
  415. $ep->updateUser = session('user')['uid'] . "";
  416. $ep->updateTime = date('y-m-d H:i:s');
  417. try {
  418. $ep->save();
  419. //添加日志
  420. TalentChecklog::create([
  421. 'id' => getStringId(),
  422. 'mainId' => $ep['id'],
  423. 'type' => 10,
  424. 'typeField' => null,
  425. 'active' => 1,
  426. 'state' => TalentState::RCRD_BASEIC_FROZEN,
  427. 'step' => 102,
  428. 'stateChange' => TalentState::stateEnum(10),
  429. 'description' => $msg,
  430. 'createTime' => date("Y-m-d H:i:s", time()),
  431. 'createUser' => session('user')['name'] . "({$company['name']})"
  432. ]);
  433. return json(["msg" => '操作成功!', "code" => 200]);
  434. } catch (\Exception $e) {
  435. return json(["msg" => $e->getMessage()]);
  436. }
  437. }
  438. public function resetPassword() {
  439. if (!$id = trim($this->request['id'])) {
  440. return json(["msg" => 'ID不能为空!', "code" => 500]);
  441. }
  442. $ep = EnterpriseApi::getOne($id);
  443. if (!$ep) {
  444. return json(["msg" => '找不到该用户!', "code" => 500]);
  445. }
  446. $ep->password = hash("md5", 'JJrc@123'); //默认密码
  447. $ep->updateUser = session('user')['uid'] . "";
  448. $ep->updateTime = date("Y-m-d H:i:s");
  449. $ep->save();
  450. $company = CompanyApi::getOne(session('user')['companyId']);
  451. TalentChecklog::create([
  452. 'id' => getStringId(),
  453. 'mainId' => $ep['id'],
  454. 'type' => 10,
  455. 'typeField' => null,
  456. 'active' => 1,
  457. 'state' => null,
  458. 'step' => 103,
  459. 'stateChange' => '重置密码',
  460. 'description' => '重置密码',
  461. 'createTime' => date("Y-m-d H:i:s", time()),
  462. 'createUser' => session('user')['name'] . "({$company['name']})"
  463. ]);
  464. return json(["msg" => '重置密码成功!', "code" => 200]);
  465. }
  466. public function export() {
  467. $res = EnterpriseApi::getList($this->request, true);
  468. $rows = $res["rows"];
  469. $columns = ["单位名称", " 统一社会信用代码", "产业领域", "单位标签", " 所属街道", "单位地址", " 法人代表", " 单位电话", "人才联络员", "人才联络员电话", "人才联络员邮箱", "审核状态", "账号状态", "注册时间", "备注"];
  470. $exportDatas = [];
  471. if ($res["rows"]) {
  472. $stateMaps = [1 => "未审核", 2 => "审核驳回", 3 => "审核通过", 4 => "重新提交", 5 => "初审驳回", 6 => "初审通过"];
  473. $activeMaps = [1 => "账号有效", 2 => "拉黑/冻结"];
  474. foreach ($rows as $row) {
  475. $exportDatas[] = [
  476. $row['name'],
  477. $row['idCard'],
  478. $row['industryFieldNewName'],
  479. $row['enterpriseTagName'],
  480. $row['streetName'],
  481. $row['address'],
  482. $row['legal'],
  483. $row['ephone'],
  484. $row['agentName'],
  485. $row['agentPhone'],
  486. $row['agentEmail'],
  487. $stateMaps[$row["checkState"]],
  488. $activeMaps[$row["active"]],
  489. $row['createTime'],
  490. $row['description']
  491. ];
  492. }
  493. export($columns, $exportDatas, "企业用户信息");
  494. exit();
  495. }
  496. return json(["msg" => "没有可以导出的内容"]);
  497. }
  498. public function findFieldsAndFiles() {
  499. $id = $this->request->param("id");
  500. $ep = EnterpriseApi::getOne($id);
  501. if ($ep->special == 0) {
  502. $fields = ["name" => "企业名称", "idCard" => "统一社会信用代码", "legal" => "法人代表", "address" => "企业地址", "street" => "所属街道", "ephone" => "企业电话", "bankCard" => "企业银行账号", "bank" => "企业开户银行", "bankNetwork" => "企业开户银行网点",
  503. "agencyType" => "机构类型", "industryFieldNew" => "产业领域", "industryFieldOld" => "行业领域", "enterpriseTag" => "企业标签", "enterpriseType" => "企业类型",
  504. "agentName" => "人才联络员姓名", "agentPhone" => "人才联络员电话", "agentEmail" => "人才联络员邮箱"];
  505. $files = ["imgurl" => "企业营业执照", "bankImg" => "开户许可证/基本存款账户信息", "domainImg" => "行业领域佐证材料", "beian" => "人才联络员信息备案表", "typeImg" => "规上、高新技术、专精特新企业上传材料"];
  506. } else {
  507. $fields = ["name" => "单位名称", "idCard" => "统一社会信用代码", "legal" => "法人代表", "address" => "单位地址", "street" => "所属街道", "ephone" => "单位电话", "bankCard" => "单位银行账号", "bank" => "单位开户银行", "bankNetwork" => "单位开户银行网点",
  508. "agentName" => "人才联络员姓名", "agentPhone" => "人才联络员电话", "agentEmail" => "人才联络员邮箱"];
  509. if ($ep->special == 1) {
  510. $fields["institutionTag"] = "单位标签";
  511. }
  512. if ($ep->special == 3) {
  513. $fields["organizationTag"] = "机构标签";
  514. }
  515. $files = ["imgurl" => "法人证或批文", "bankImg" => "开户许可证/基本存款账户信息", "beian" => "人才联络员备案表"];
  516. }
  517. $modify_fields = [];
  518. $modify_files = [];
  519. $_modify_fields = explode(",", $ep["modify_fields"]);
  520. foreach ($fields as $key => $value) {
  521. $checked = in_array($key, $_modify_fields);
  522. $modify_fields[$key] = ["field" => $key, "name" => $value, "checked" => $checked];
  523. }
  524. $_modify_files = explode(",", $ep["modify_files"]);
  525. foreach ($files as $key => $value) {
  526. $checked = in_array($key, $_modify_files);
  527. $modify_files[$key] = ["field" => $key, "name" => $value, "checked" => $checked];
  528. }
  529. return json(["code" => 200, "files" => $modify_files, "fields" => $modify_fields]);
  530. }
  531. public function updateFieldsAndFiles() {
  532. try {
  533. $params = $this->request->param();
  534. $id = $params["id"];
  535. $ep = EnterpriseApi::getOne($id);
  536. if (!$ep) {
  537. throw new \think\Exception("没有对应的企业信息");
  538. }
  539. if (!in_array($ep["checkState"], [2, 5])) {
  540. throw new \think\Exception("不是驳回状态,不能修改驳回字段!");
  541. }
  542. if ($ep["checkState"] == 2 && !EnterpriseApi::chkUserInSuperusers()) {
  543. throw new \think\Exception("已经流转到审核,不在审核范围内");
  544. }
  545. $fields = array_filter(explode(",", $params["fields"]));
  546. $files = array_filter(explode(",", $params["files"]));
  547. if (!$fields && !$files)
  548. throw new \think\Exception("请选择要驳回的字段或附件!");
  549. $data["id"] = $id;
  550. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  551. $data["modify_files"] = $files ? implode(",", $files) : null;
  552. $data["updateTime"] = date("Y-m-d H:i:s");
  553. $data["updateUser"] = session("user")["uid"];
  554. if (EnterpriseApi::updateById($data)) {
  555. return json(["code" => 200, "msg" => "修改成功!"]);
  556. }
  557. } catch (\think\Exception $e) {
  558. return json(["msg" => $e->getMessage()]);
  559. }
  560. }
  561. }