EnterpriseChangeRecord.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\ChuanglanSmsApi;
  5. use app\common\api\CompanyApi;
  6. use app\common\api\DictApi;
  7. use app\common\api\EnterpriseApi;
  8. use app\common\api\TalentState;
  9. use app\common\model\CurrentcyFileType;
  10. use app\common\model\MessageRecord;
  11. use app\common\model\TalentChecklog;
  12. use app\common\model\TalentCommonFile;
  13. class EnterpriseChangeRecord extends AdminController {
  14. private $compatible_time = "2022-10-15 23:59:59";
  15. public function gotoEnterpriseChangeRecordPage() {
  16. $talentTypeList = DictApi::findChildDictByCode("enterprise_tag");
  17. $industryFieldNewList = DictApi::findChildDictByCode("industry_field");
  18. $streetList = DictApi::findChildDictByCode("street");
  19. return view("", ['enterprise_tag' => $talentTypeList, 'industryFieldNew' => $industryFieldNewList, 'street' => $streetList]);
  20. }
  21. public function findEnterpriseChangeRecordByPage() {
  22. $res = EnterpriseApi::getRecordList($this->request);
  23. return json($res);
  24. }
  25. public function gotoEnterpriseChangeDetailPage() {
  26. $id = trim($this->request['id']);
  27. if (!$id) {
  28. return json(["msg" => 'ID不能为空!']);
  29. }
  30. $ecr = EnterpriseApi::getOneRecord($id);
  31. $ep = EnterpriseApi::getOne($ecr['mainId']);
  32. if (\StrUtil::isNotEmpAndNull($ecr['oldStreet']) || \StrUtil::isNotEmpAndNull($ecr['newStreet'])) {
  33. $streetList = DictApi::selectByParentCode("street");
  34. if (\StrUtil::isNotEmpAndNull($ecr['oldStreet'])) {
  35. $ecr['oldStreetName'] = $streetList[$ecr['oldStreet']];
  36. }
  37. if (\StrUtil::isNotEmpAndNull($ecr['newStreet'])) {
  38. $ecr['newStreetName'] = $streetList[$ecr['newStreet']];
  39. }
  40. }
  41. switch ($ecr['checkState']) {
  42. case 1:
  43. $ecr['checkStateName'] = '保存未提交';
  44. break;
  45. case 2:
  46. $ecr['checkStateName'] = '待审核';
  47. break;
  48. case 3:
  49. $ecr['checkStateName'] = '审核驳回';
  50. break;
  51. case 4:
  52. $ecr['checkStateName'] = '审核通过';
  53. break;
  54. case 5:
  55. $ecr['checkStateName'] = '重新提交';
  56. break;
  57. default:
  58. $ecr['checkStateName'] = '';
  59. break;
  60. }
  61. /* $where = [];
  62. $where[] = ['tcf.mainId', '=', $id];
  63. $files = TalentCommonFile::alias("tcf")->field("tcf.*,cft.api")->leftJoin("new_currency_filetype cft", "cft.id=tcf.typeId")->where($where)->select();
  64. $_files = [];
  65. foreach ($files as $k => $v) {
  66. $extension = pathinfo($v["url"])["extension"];
  67. if (in_array($extension, ["jpeg", "jpg", "png", "gif"])) {
  68. $v["is_img"] = 1;
  69. } else {
  70. $v["is_img"] = 0;
  71. }
  72. $v['url'] = getStoragePath($v['url']);
  73. $_files[$v["api"]][] = $v;
  74. } */
  75. $time = $this->compatible_time;
  76. //营业执照
  77. if (!$ecr["oldImgurl"]) {
  78. $ecr["oldImgurl"] = $ep["imgurl"];
  79. }
  80. if ($ecr["oldImgurl"]) {
  81. $pathinfo = pathinfo($ecr["oldImgurl"]);
  82. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  83. $ecr["oldImgurl_is_img"] = 1;
  84. }
  85. }
  86. if (!$ecr["newImgurl"]) {
  87. //兼容旧filetype
  88. if (strtotime($ecr["createTime"]) < strtotime($time)) {
  89. $where = [];
  90. $where[] = ["mainId", "=", $id];
  91. $where[] = ["api", "=", "businessLicense"];
  92. $where[] = ["active", "=", 1];
  93. $_uploadFile = TalentCommonFile::alias("tcf")->leftJoin("new_currency_filetype ft", "ft.id=tcf.typeId")->where($where)->order("tcf.createTime desc")->find();
  94. if ($_uploadFile) {
  95. $ecr["newImgurl"] = $_uploadFile["url"];
  96. } else {
  97. $ecr["newImgurl"] = $ep["imgurl"];
  98. }
  99. }
  100. }
  101. if ($ecr["newImgurl"]) {
  102. $pathinfo = pathinfo($ecr["newImgurl"]);
  103. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  104. $ecr["newImgurl_is_img"] = 1;
  105. }
  106. }
  107. //备案表
  108. if (!$ecr["oldBeian"]) {
  109. $ecr["oldBeian"] = $ep["beian"];
  110. }
  111. if ($ecr["oldBeian"]) {
  112. $pathinfo = pathinfo($ecr["oldBeian"]);
  113. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  114. $ecr["oldBeian_is_img"] = 1;
  115. }
  116. }
  117. if (!$ecr["newBeian"]) {
  118. //兼容旧filetype
  119. if (strtotime($ecr["createTime"]) < strtotime($time)) {
  120. $where = [];
  121. $where[] = ["mainId", "=", $id];
  122. $where[] = ["api", "=", "businessBeian"];
  123. $where[] = ["active", "=", 1];
  124. $_uploadFile = TalentCommonFile::alias("tcf")->leftJoin("new_currency_filetype ft", "ft.id=tcf.typeId")->where($where)->order("tcf.createTime desc")->find();
  125. if ($_uploadFile) {
  126. $ecr["newBeian"] = $_uploadFile["url"];
  127. } else {
  128. $ecr["newBeian"] = $ep["beian"];
  129. }
  130. }
  131. }
  132. if ($ecr["newBeian"]) {
  133. $pathinfo = pathinfo($ecr["newBeian"]);
  134. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  135. $ecr["newBeian_is_img"] = 1;
  136. }
  137. }
  138. //行业领域
  139. if (!$ecr["oldDomainImg"]) {
  140. $ecr["oldDomainImg"] = $ep["domainImg"];
  141. }
  142. if ($ecr["oldDomainImg"]) {
  143. $pathinfo = pathinfo($ecr["oldDomainImg"]);
  144. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  145. $ecr["oldDomainImg_is_img"] = 1;
  146. }
  147. }
  148. if (!$ecr["newDomainImg"]) {
  149. //兼容旧filetype
  150. if (strtotime($ecr["createTime"]) < strtotime($time)) {
  151. $where = [];
  152. $where[] = ["mainId", "=", $id];
  153. $where[] = ["api", "=", "businessDomain"];
  154. $where[] = ["active", "=", 1];
  155. $_uploadFile = TalentCommonFile::alias("tcf")->leftJoin("new_currency_filetype ft", "ft.id=tcf.typeId")->where($where)->order("tcf.createTime desc")->find();
  156. if ($_uploadFile) {
  157. $ecr["newDomainImg"] = $_uploadFile["url"];
  158. } else {
  159. $ecr["newDomainImg"] = $ep["domainImg"];
  160. }
  161. }
  162. }
  163. if ($ecr["newDomainImg"]) {
  164. $pathinfo = pathinfo($ecr["newDomainImg"]);
  165. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  166. $ecr["newDomainImg_is_img"] = 1;
  167. }
  168. }
  169. //个别企业类型需要上传附件
  170. if ($ecr["oldTypeImg"]) {
  171. $pathinfo = pathinfo($ecr["oldTypeImg"]);
  172. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  173. $ecr["oldTypeImg_is_img"] = 1;
  174. }
  175. }
  176. if ($ecr["newTypeImg"]) {
  177. $pathinfo = pathinfo($ecr["newTypeImg"]);
  178. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  179. $ecr["newTypeImg_is_img"] = 1;
  180. }
  181. }
  182. //开户许可证
  183. if (!$ecr["oldBankImg"]) {
  184. $ecr["oldBankImg"] = $ep["bankImg"];
  185. }
  186. if ($ecr["oldBankImg"]) {
  187. $pathinfo = pathinfo($ecr["oldBankImg"]);
  188. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  189. $ecr["oldBankImg_is_img"] = 1;
  190. }
  191. }
  192. if (!$ecr["newBankImg"]) {
  193. //兼容旧filetype
  194. if (strtotime($ecr["createTime"]) < strtotime($time)) {
  195. $where = [];
  196. $where[] = ["mainId", "=", $id];
  197. $where[] = ["api", "=", "businessBank"];
  198. $where[] = ["active", "=", 1];
  199. $_uploadFile = TalentCommonFile::alias("tcf")->leftJoin("new_currency_filetype ft", "ft.id=tcf.typeId")->where($where)->order("tcf.createTime desc")->find();
  200. if ($_uploadFile) {
  201. $ecr["newBankImg"] = $_uploadFile["url"];
  202. } else {
  203. $ecr["newBankImg"] = $ep["bankImg"];
  204. }
  205. }
  206. }
  207. if ($ecr["newBankImg"]) {
  208. $pathinfo = pathinfo($ecr["newBankImg"]);
  209. if (in_array($pathinfo["extension"], ["jpeg", "jpg", "png", "gif"])) {
  210. $ecr["newBankImg_is_img"] = 1;
  211. }
  212. }
  213. $ecr["special"] = $ep->special;
  214. switch ($ep->special) {
  215. case 0:
  216. if (\StrUtil::isNotEmpAndNull($ecr['oldAgencyType']) || \StrUtil::isNotEmpAndNull($ecr['newAgencyType'])) {
  217. $agencyTypeList = DictApi::selectByParentCode("agency_type");
  218. if (\StrUtil::isNotEmpAndNull($ecr['oldAgencyType'])) {
  219. $ecr['oldAgencyTypeName'] = $agencyTypeList[$ecr['oldAgencyType']];
  220. }
  221. if (\StrUtil::isNotEmpAndNull($ecr['newAgencyType'])) {
  222. $ecr['newAgencyTypeName'] = $agencyTypeList[$ecr['newAgencyType']];
  223. }
  224. }
  225. if (\StrUtil::isNotEmpAndNull($ecr['oldEnterpriseTag']) || \StrUtil::isNotEmpAndNull($ecr['newEnterpriseTag'])) {
  226. $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
  227. if (\StrUtil::isNotEmpAndNull($ecr['oldEnterpriseTag'])) {
  228. $ecr['oldEnterpriseTagName'] = $talentTypeList[$ecr['oldEnterpriseTag']];
  229. }
  230. if (\StrUtil::isNotEmpAndNull($ecr['newEnterpriseTag'])) {
  231. $ecr['newEnterpriseTagName'] = $talentTypeList[$ecr['newEnterpriseTag']];
  232. }
  233. }
  234. if (\StrUtil::isNotEmpAndNull($ecr['oldIndustryFieldNew']) || \StrUtil::isNotEmpAndNull($ecr['newIndustryFieldNew'])) {
  235. $industryFieldNewList = DictApi::selectByParentCode("industry_field");
  236. if (\StrUtil::isNotEmpAndNull($ecr['oldIndustryFieldNew'])) {
  237. $ecr['oldIndustryFieldNewName'] = $industryFieldNewList[$ecr['oldIndustryFieldNew']];
  238. }
  239. if (\StrUtil::isNotEmpAndNull($ecr['newIndustryFieldNew'])) {
  240. $ecr['newIndustryFieldNewName'] = $industryFieldNewList[$ecr['newIndustryFieldNew']];
  241. }
  242. }
  243. if (\StrUtil::isNotEmpAndNull($ecr['oldIndustryFieldOld'])) {
  244. $industry = DictApi::findDictByCode($ecr['oldIndustryFieldOld']);
  245. $ecr['oldIndustryFieldOldName'] = $industry['name'];
  246. }
  247. if (\StrUtil::isNotEmpAndNull($ecr['newIndustryFieldOld'])) {
  248. $industry = DictApi::findDictByCode($ecr['newIndustryFieldOld']);
  249. $ecr['newIndustryFieldOldName'] = $industry['name'];
  250. }
  251. if (\StrUtil::isNotEmpAndNull($ecr['oldEnterpriseType'])) {
  252. $industry = DictApi::findDictByCode($ecr['oldEnterpriseType']);
  253. $ecr['oldEnterpriseTypeName'] = $industry['name'];
  254. }
  255. if (\StrUtil::isNotEmpAndNull($ecr['newEnterpriseType'])) {
  256. $industry = DictApi::findDictByCode($ecr['newEnterpriseType']);
  257. $ecr['newEnterpriseTypeName'] = $industry['name'];
  258. }
  259. return view("", ['ecr' => $ecr]);
  260. break;
  261. case 1:
  262. return view("", ['ecr' => $ecr]);
  263. break;
  264. default:
  265. break;
  266. }
  267. }
  268. public function gotoEnterpriseChangeExaminePage() {
  269. $id = trim($this->request['id']);
  270. if (!$id) {
  271. return json(["msg" => 'ID不能为空!']);
  272. }
  273. $ecr = EnterpriseApi::getOneRecord($id);
  274. $ep = EnterpriseApi::getOne($ecr['mainId']);
  275. if ($ep->special == 0) {
  276. if ($ep->type == 1) {
  277. $fields = ["Name" => "企业名称", "IdCard" => "统一社会信用代码", "Legal" => "法人代表", "Address" => "企业地址", "Street" => "所属街道", "Ephone" => "企业电话", "BankCard" => "企业银行账号", "Bank" => "企业开户银行", "BankNetwork" => "企业开户银行网点",
  278. "AgencyType" => "机构类型", "IndustryFieldNew" => "产业领域", "IndustryFieldOld" => "行业领域", "EnterpriseTag" => "企业标签", "EnterpriseType" => "企业类型",
  279. "AgentName" => "人才联络员姓名", "AgentPhone" => "人才联络员电话", "AgentEmail" => "人才联络员邮箱"];
  280. $files = ["newImgurl" => "企业营业执照", "newBankImg" => "开户许可证", "newDomainImg" => "行业领域佐证材料", "newBeian" => "人才联络员信息备案表", "newTypeImg" => "规上、高新技术、专精特新企业上传材料"];
  281. } else {
  282. $fields = ["Name" => "企业名称", "IdCard" => "统一社会信用代码", "Legal" => "法人代表", "Address" => "企业地址", "Street" => "所属街道", "Ephone" => "企业电话", "BankCard" => "企业银行账号", "Bank" => "企业开户银行", "BankNetwork" => "企业开户银行网点",
  283. "AgentName" => "人才联络员姓名", "AgentPhone" => "人才联络员电话", "AgentEmail" => "人才联络员邮箱"];
  284. $files = ["newImgurl" => "企业营业执照", "newBankImg" => "开户许可证", "newBeian" => "人才联络员备案表"];
  285. }
  286. } else {
  287. $fields = ["Name" => "单位名称", "IdCard" => "统一社会信用代码", "Legal" => "法人代表", "Address" => "单位地址", "Street" => "所属街道", "Ephone" => "单位电话", "BankCard" => "单位银行账号", "Bank" => "单位开户银行", "BankNetwork" => "单位开户银行网点",
  288. "AgentName" => "人才联络员姓名", "AgentPhone" => "人才联络员电话", "AgentEmail" => "人才联络员邮箱"];
  289. $files = ["newImgurl" => "法人证或批文", "newBankImg" => "开户许可证", "newBeian" => "人才联络员备案表"];
  290. }
  291. $modify_fields = [];
  292. foreach ($fields as $key => $value) {
  293. $oldFieldName = "old" . $key;
  294. $newFieldName = "new" . $key;
  295. //if ($ecr[$oldFieldName] != $ecr[$newFieldName]) {
  296. $modify_fields[$newFieldName] = ["field" => $newFieldName, "name" => $value, "checked" => false];
  297. //}
  298. }
  299. if ($ecr["modify_fields"]) {
  300. $_modify_fields = explode(",", $ecr["modify_fields"]);
  301. foreach ($_modify_fields as $_field) {
  302. if ($modify_fields[$_field]) {
  303. $modify_fields[$_field]["checked"] = true;
  304. } else {
  305. $modify_fields[$_field] = ["field" => $_field, "name" => $fields[substr($_field, 3)], "checked" => true];
  306. }
  307. }
  308. }
  309. /* $currencyType = $ep["special"] == 0 ? "enterpriseChange" : "governmentChange";
  310. $where = [];
  311. $where[] = ["type", "=", $currencyType];
  312. $where[] = ["active", "=", 1];
  313. $fileTypes = \app\admin\model\CurrencyFiletype::where($where)->order("sn asc")->column("name", "id");
  314. $where = [];
  315. $where[] = ['mainId', '=', $id];
  316. $uploadTypeIds = TalentCommonFile::distinct(true)->field("typeId")->where($where)->column("typeId"); */
  317. $oldtypes = ["1161965644164075522" => "newImgurl", "1518753449987148467" => "newImgurl", "1518328155588131269" => "newBankImg", "1518926324960220206" => "newBankImg",
  318. "1518941016720463523" => "newDomainImg", "1519109971871948101" => "newBeian", "1519185486755815382" => "newBeian"];
  319. $modify_files = [];
  320. foreach ($files as $key => $value) {
  321. $modify_files[$key] = ["field" => $key, "name" => $value, "checked" => false];
  322. }
  323. if ($ecr["modify_files"]) {
  324. $_modify_files = explode(",", $ecr["modify_files"]);
  325. foreach ($_modify_files as $_file) {
  326. if ($modify_files[$_file]) {
  327. $modify_files[$_file]["checked"] = true;
  328. } else {
  329. if (strtotime($ecr["createTime"]) < strtotime($this->compatible_time)) {
  330. //兼容旧的typeid
  331. $_file = $oldtypes[$_file];
  332. }
  333. $modify_files[$_file] = ["field" => $_file, "name" => $files[$_file], "checked" => true];
  334. }
  335. }
  336. }
  337. return view("", ['ecr' => $ecr, 'fields' => $modify_fields, "files" => $modify_files]);
  338. }
  339. public function doExamine() {
  340. $id = trim($this->request['id']);
  341. if (!$id) {
  342. return json(["msg" => 'ID不能为空!', 'code' => 500]);
  343. }
  344. $ecr = EnterpriseApi::getOneRecord($id);
  345. if (!$ecr) {
  346. return json(["msg" => '原始数据不存在!', 'code' => 500]);
  347. }
  348. $checkState = trim($this->request['checkState']);
  349. $files = $this->request["files"];
  350. $fields = $this->request["fields"];
  351. if ($checkState == null || ($checkState != 4 && $checkState != 3)) {
  352. return json(["msg" => '请选择审核状态!', 'code' => 500]);
  353. }
  354. $checkMsg = trim($this->request['checkMsg']);
  355. //如果审核状态为 审核驳回, 需要填写审核意见
  356. if ($checkState == 3 && \StrUtil::isEmpOrNull($checkMsg)) {
  357. return json(["msg" => '审核驳回时,需要填写审核意见!', 'code' => 500]);
  358. }
  359. if ($checkState == 3 && !$files && !$fields) {
  360. return json(["msg" => '审核驳回时,需要选择可修改的字段或者附件!', 'code' => 500]);
  361. }
  362. if (\StrUtil::isNotEmpAndNull($checkMsg) && strlen($checkMsg) > 200) {
  363. return json(["msg" => '审核意见最多200个字符!', 'code' => 500]);
  364. }
  365. if ($ecr['checkState'] != 2 && $ecr['checkState'] != 3 && $ecr['checkState'] != 5) {
  366. return json(["msg" => '不在审核范围内!', 'code' => 500]);
  367. }
  368. //如果为审核驳回,更新表中的审核状态 和 审核意见, 直接返回结果
  369. if ($checkState == 3) {
  370. $ecr->checkState = 3;
  371. $ecr->checkMsg = $checkMsg;
  372. $ecr->updateUser = session('user')['uid'];
  373. $ecr->updateTime = date("Y-m-d H:i:s");
  374. $ecr->modify_fields = $fields ? implode(",", $fields) : null;
  375. $ecr->modify_files = $files ? implode(",", $files) : null;
  376. $ecr->save();
  377. //发送短信
  378. $record_data = [
  379. 'id' => getStringId(),
  380. 'bizId' => getStringId(),
  381. 'userId' => $ecr['mainId'],
  382. 'type' => 2,
  383. 'smsType' => 2,
  384. 'name' => $ecr['newName'],
  385. 'phone' => $ecr['newAgentPhone'],
  386. 'templateCode' => "【晋江市人才服务平台】您好!您提交申请的优秀人才{$checkMsg}因信息填写错误或上传不完整已被退回,请及时登录申报系统查看审核意见并重新提交。",
  387. 'params' => '机构信息变更',
  388. 'state' => 1,
  389. 'sendingDate' => date("Y-m-d H:i:s", time()),
  390. 'createTime' => date("Y-m-d H:i:s", time())
  391. ];
  392. $smsapi = new ChuanglanSmsApi();
  393. $result = $smsapi->sendSMS($ecr['newAgentPhone'], $record_data['templateCode']);
  394. MessageRecord::create($record_data);
  395. $company = CompanyApi::getOne(session('user')['companyId']);
  396. TalentChecklog::create([
  397. 'id' => getStringId(),
  398. 'category' => 'enterprise_change',
  399. 'mainId' => $ecr['id'],
  400. 'type' => 10,
  401. 'typeField' => null,
  402. 'active' => 1,
  403. 'state' => 3,
  404. 'step' => 101,
  405. 'stateChange' => "<span class='label label-info'>审核驳回</span>",
  406. 'description' => $checkMsg,
  407. 'createTime' => date("Y-m-d H:i:s", time()),
  408. 'createUser' => session('user')['name'] . "({$company['name']})"
  409. ]);
  410. return json(["msg" => '操作成功!', "code" => 200]);
  411. } else {
  412. $ecr->checkState = 4;
  413. $ecr->checkMsg = $checkMsg;
  414. $ecr->updateUser = session('user')['uid'];
  415. $ecr->updateTime = date("Y-m-d H:i:s");
  416. $ecr->modify_fields = null;
  417. $ecr->modify_files = null;
  418. $ecr->save();
  419. $ep = EnterpriseApi::getOne($ecr['mainId']);
  420. $ep->name = $ecr['newName'];
  421. $ep->idCard = $ecr['newIdCard'];
  422. $ep->enterpriseTag = $ecr['newEnterpriseTag'];
  423. $ep->street = $ecr['newStreet'];
  424. $ep->address = $ecr['newAddress'];
  425. $ep->legal = $ecr['newLegal'];
  426. $ep->ephone = $ecr['newEphone'];
  427. $ep->agentName = $ecr['newAgentName'];
  428. $ep->agentEmail = $ecr['newAgentEmail'];
  429. $ep->agentPhone = $ecr['newAgentPhone'];
  430. $ep->industryFieldNew = $ecr['newIndustryFieldNew'];
  431. $ep->industryFieldOld = $ecr['newIndustryFieldOld'];
  432. $ep->enterpriseType = $ecr['newEnterpriseType'];
  433. $ep->bankCard = $ecr['newBankCard'];
  434. $ep->bankNetwork = $ecr['newBankNetwork'];
  435. $ep->bank = $ecr['newBank'];
  436. $ep->updateUser = session('user')['uid'];
  437. $ep->updateTime = date("Y-m-d H:i:s");
  438. $ep->imgurl = $ecr['newImgurl'] ?: $ep->imgurl;
  439. $ep->bankImg = $ecr['newBankImg'] ?: $ep->bankImg;
  440. $ep->domainImg = $ecr['newDomainImg'] ?: $ep->domainImg;
  441. $ep->typeImg = $ecr['newTypeImg'];
  442. $ep->beian = $ecr['newBeian'] ?: $ep->beian;
  443. //查询此次上传的文件
  444. /* $list = TalentCommonFile::where('mainId', $ecr['id'])->select()->toArray();
  445. if (count($list) > 0) {
  446. foreach ($list as $k => $v) {
  447. $fileInfo = CurrentcyFileType::where('id', $v['typeId'])->select()->toArray();
  448. if (count($fileInfo) > 0) {
  449. foreach ($fileInfo as $item) {
  450. switch ($item['api']) {
  451. case 'businessLicense':
  452. $ep->imgurl = $v['url'];
  453. break;
  454. case 'businessBank':
  455. $ep->bankImg = $v['url'];
  456. break;
  457. case 'businessDomain':
  458. $ep->domainImg = $v['url'];
  459. break;
  460. case 'businessBeian':
  461. $ep->beian = $v['url'];
  462. break;
  463. }
  464. }
  465. }
  466. }
  467. } */
  468. //同步人才库与津贴库 TODO
  469. $ep->save();
  470. //发送短信
  471. $record_data = [
  472. 'id' => getStringId(),
  473. 'bizId' => getStringId(),
  474. 'userId' => $ecr['mainId'],
  475. 'type' => 2,
  476. 'smsType' => 2,
  477. 'name' => $ecr['newName'],
  478. 'phone' => $ecr['newAgentPhone'],
  479. 'templateCode' => "【晋江市人才服务平台】您好!您提交申请的优秀人才{$checkMsg}已审核通过,可登录申报系统做相关事宜申报。",
  480. 'params' => '机构信息变更',
  481. 'state' => 1,
  482. 'sendingDate' => date("Y-m-d H:i:s", time()),
  483. 'createTime' => date("Y-m-d H:i:s", time())
  484. ];
  485. $smsapi = new ChuanglanSmsApi();
  486. $result = $smsapi->sendSMS($ecr['newAgentPhone'], $record_data['templateCode']);
  487. MessageRecord::create($record_data);
  488. $company = CompanyApi::getOne(session('user')['companyId']);
  489. TalentChecklog::create([
  490. 'id' => getStringId(),
  491. 'category' => 'enterprise_change',
  492. 'mainId' => $ecr['id'],
  493. 'type' => 10,
  494. 'typeField' => null,
  495. 'active' => 1,
  496. 'state' => 4,
  497. 'step' => 101,
  498. 'stateChange' => "<span class='label label-info'>审核通过</span>",
  499. 'description' => $checkMsg,
  500. 'createTime' => date("Y-m-d H:i:s", time()),
  501. 'createUser' => session('user')['name'] . "({$company['name']})"
  502. ]);
  503. return json(["msg" => '操作成功!', "code" => 200]);
  504. }
  505. }
  506. }