request->isPost()){ $source = intval($this->request['source']); $response_object = new \StdClass(); $special = \StrUtil::getRequestDecodeParam($this->request,'special'); $data = [ 'username' => \StrUtil::getRequestDecodeParam($this->request,'username'), 'password' => \StrUtil::getRequestDecodeParam($this->request,'password'), 're_password' => \StrUtil::getRequestDecodeParam($this->request,'re_password'), 'name' => \StrUtil::getRequestDecodeParam($this->request,'name'), 'idCard' => \StrUtil::getRequestDecodeParam($this->request,'idCard'), 'agentName' => \StrUtil::getRequestDecodeParam($this->request,'agentName'), 'agentPhone' => \StrUtil::getRequestDecodeParam($this->request,'agentPhone'), 'verificationCode' => \StrUtil::getRequestDecodeParam($this->request,'verificationCode'), 'legal' => \StrUtil::getRequestDecodeParam($this->request,'legal'), 'street' => \StrUtil::getRequestDecodeParam($this->request,'street'), 'address' => \StrUtil::getRequestDecodeParam($this->request,'address'), 'type' => intval($this->request['type']), 'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseTag'), 'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseType'), 'agentEmail' => \StrUtil::getRequestDecodeParam($this->request,'agentEmail'), 'ephone' => \StrUtil::getRequestDecodeParam($this->request,'ephone'), 'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldNew'), 'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldOld'), 'bankCard' => \StrUtil::getRequestDecodeParam($this->request,'bankCard'), 'bank' => \StrUtil::getRequestDecodeParam($this->request,'bank'), 'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request,'bankNetwork') ]; try { if($special == 'qiye'){ if($data['type'] == 1){ validate(Enterprise::class)->batch(true)->scene('add')->check($data); }else{ validate(Enterprise::class)->batch(true)->scene('jc_add')->check($data); } $data['special'] = 0; }else{ $data['type'] = 1; validate(Enterprise::class)->batch(true)->scene('sy_add')->check($data); $data['special'] = 1; } //检验验证码 $codeResult = MessageRecord::where('smsType',1)->where('phone',$data['agentPhone'])->order('createTime','desc')->find(); if(!$codeResult){ $response_object->code = 500; $response_object->msg = '请先发送验证码'; return \StrUtil::back($response_object,"Register.epCallBack"); } if(time() - strtotime($codeResult['createTime']) > 300){ $response_object->code = 500; $response_object->msg = '验证码过期,请重新发送'; return \StrUtil::back($response_object,"Register.epCallBack"); } $uploadapi = new UploadApi(); $files = $this->request->file(); //检验附件 营业执照 if(array_key_exists('imgurl',$files)){ $upload_result = $uploadapi->uploadOne($this->request->file('imgurl'),'image'); if($upload_result->code == 500){ return \StrUtil::back($upload_result,"Register.epCallBack"); } $imgurl = $upload_result->filepath; }else{ $imgurl = ''; } //检验附件 开户许可证 if(array_key_exists('bankImg',$files)){ $upload_result1 = $uploadapi->uploadOne($this->request->file('bankImg'),'image'); if($upload_result->code == 500){ return \StrUtil::back($upload_result1,"Register.epCallBack"); } $bankImg = $upload_result1->filepath; }else{ $bankImg = ''; } //检验附件 行业领域佐证材料 if(array_key_exists('domainImg',$files)){ $upload_result2 = $uploadapi->uploadOne($this->request->file('domainImg'),'image'); if($upload_result2->code == 500){ return \StrUtil::back($upload_result2,"Register.epCallBack"); } $domainImg = $upload_result2->filepath; }else{ $domainImg = ''; } //检验附件 人才联络员备案表 if(array_key_exists('beian',$files)){ $upload_result3 = $uploadapi->uploadOne($this->request->file('beian'),'system'); if($upload_result->code == 500){ return \StrUtil::back($upload_result3,"Register.epCallBack"); } $beian = $upload_result3->filepath; }else{ $beian = ''; } $data['id'] = getStringId(); $data['password'] = hash('md5',$data['password']); $data['source'] = $source; $data['imgurl'] = $imgurl; $data['bankImg'] = $bankImg; $data['domainImg'] = $domainImg; $data['beian'] = $beian; $data['createTime'] = date("Y-m-d H:i:s",time()); $data['updateTime'] = date("Y-m-d H:i:s",time()); $data['active'] = 1; $data['checkState'] = 1; \app\common\model\Enterprise::create($data); TalentChecklog::create([ 'id' => getStringId(), 'mainId' => $data['id'], 'type' => 10, 'typeField' => null, 'active' => 1, 'state' => 1, 'step' => 100, 'stateChange' => '用户提交', 'description' => '用户注册', 'createTime' => date("Y-m-d H:i:s",time()), 'createUser' => '用户' ]); $response_object->code = 200; $response_object->msg = '注册成功'; return \StrUtil::back($response_object,"Register.epCallBack"); } catch (ValidateException $e){ $error = $e->getError(); $response_object->code = 500; $response_object->msg = array_pop($error); return \StrUtil::back($response_object,"Register.epCallBack"); } } return view("", ["msg" => $msg]); } public function enterprise_edit() { $temp = session('temp'); if(empty($temp)){ return redirect("/"); } $ep = EnterpriseApi::getOne(session('temp')['uid']); if($this->request->isPost()){ $response_object = new \StdClass(); $data = [ 'name' => \StrUtil::getRequestDecodeParam($this->request,'name'),//单位名称 'idCard' => \StrUtil::getRequestDecodeParam($this->request,'idCard'),//统一社会信用代码 'agentName' => \StrUtil::getRequestDecodeParam($this->request,'agentName'),//人才联络员 'legal' => \StrUtil::getRequestDecodeParam($this->request,'legal'),//法人 'street' => \StrUtil::getRequestDecodeParam($this->request,'street'),//镇街 'address' => \StrUtil::getRequestDecodeParam($this->request,'address'),//地址 'type' => intval($this->request['type']), 'enterpriseTag' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseTag'),//单位标签 'enterpriseType' => \StrUtil::getRequestDecodeParam($this->request,'enterpriseType'),//单位类型 'agentEmail' => \StrUtil::getRequestDecodeParam($this->request,'agentEmail'),//邮箱 'ephone' => \StrUtil::getRequestDecodeParam($this->request,'ephone'),//单位电话 'industryFieldNew' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldNew'),//产业领域 'industryFieldOld' => \StrUtil::getRequestDecodeParam($this->request,'industryFieldOld'),//行业领域 'bankCard' => \StrUtil::getRequestDecodeParam($this->request,'bankCard'),//银行 'bank' => \StrUtil::getRequestDecodeParam($this->request,'bank'),//开户行 'bankNetwork' => \StrUtil::getRequestDecodeParam($this->request,'bankNetwork')//网点 ]; try { $data['id'] = $ep->id; validate(\app\common\validate\Enterprise::class)->batch(true)->scene('check_common')->check($data); $data['checkState'] = 1; $ep->update($data); $response_object->code = 200; $response_object->msg = '修改成功'; return \StrUtil::back($response_object,"Register.epCallBack"); }catch (ValidateException $e){ $error = $e->getError(); $response_object->code = 500; $response_object->msg = array_pop($error); return \StrUtil::back($response_object,"Register.epCallBack"); } } $msg = session('temp')['msg']; return view("",['msg' => $msg, 'ep' => $ep]); } public function verificationCode() { $phone = $this->request["phone"]; $type = $this->request["type"]; //校验手机号码是否为空 if(\StrUtil::isEmpOrNull($phone)) { return json(["msg" => "请填写手机号码!"],500); } if (\StrUtil::isEmpOrNull($type)) { return json(["msg" => "请填写手机号码!"],500); } //校验手机号码格式是否正确 if(\StrUtil::isMoblePhone($phone)) { return json(["msg" => "请填写正确的手机号码!"],500); } $record = Cache::get("verify_{$type}_{$phone}"); if($record){ $time = time(); if($time - $record <= 60){ return json(["msg" => "一分钟内请勿频繁发送短信!"],500); } } $code = ''; for ($i = 1;$i <= 6;$i++){ $code .= rand(0,9); } $code = 999999; $template = "【晋江市人才服务平台】尊敬的用户,您的短信验证码为{$code},5分钟内有效。若非本人操作请忽略。"; $smsapi = new ChuanglanSmsApi(); //$result = $smsapi->sendSMS($phone,$template); //测试 $result = [ 'code' => 0, 'errorMsg' => '' ]; //$result = json_decode($result,true); $id = getStringId(); $record_data = [ 'id' => $id, 'bizId' => $id, 'type' => 2, 'smsType' => 1, 'phone' => $phone, 'params' => $code, 'templateCode' => $template, 'state' => $result['code'] == 0 ? 2 : 3, 'sendingDate' => date("Y-m-d H:i:s",time()), 'createTime' => date("Y-m-d H:i:s",time()), 'msg' => $result['errorMsg'] ]; MessageRecord::create($record_data); if($result['code'] == 0){ Cache::set("verify_{$type}_{$phone}",time()); return json(["msg" => '验证码发送成功'],200); }else{ return json(["msg" => '验证码发送失败'],500); } } }