|
@@ -3,8 +3,12 @@
|
|
namespace app\common\controller;
|
|
namespace app\common\controller;
|
|
|
|
|
|
use app\BaseController;
|
|
use app\BaseController;
|
|
|
|
+use app\common\api\ChuanglanSmsApi;
|
|
use app\common\model\MessageRecord;
|
|
use app\common\model\MessageRecord;
|
|
use think\Facade\Cache;
|
|
use think\Facade\Cache;
|
|
|
|
+use app\common\validate\Enterprise;
|
|
|
|
+use think\exception\ValidateException;
|
|
|
|
+use think\facade\Request;
|
|
|
|
|
|
class Auth extends BaseController
|
|
class Auth extends BaseController
|
|
{
|
|
{
|
|
@@ -12,11 +16,42 @@ class Auth extends BaseController
|
|
public function register(){
|
|
public function register(){
|
|
$msg = "";
|
|
$msg = "";
|
|
if($this->request->isPost()){
|
|
if($this->request->isPost()){
|
|
|
|
+ $source = intval($this->request['source']);
|
|
|
|
+ try {
|
|
|
|
+ $result = validate(Enterprise::class)->batch(true)->scene('add')->check(Request::post());
|
|
|
|
+ } catch (ValidateException $e){
|
|
|
|
+ dd($e->getError());
|
|
|
|
+ }
|
|
|
|
+ dd($result);
|
|
|
|
+ $username = \StrUtil::getRequestDecodeParam($this->request,'username');
|
|
|
|
+ $password = \StrUtil::getRequestDecodeParam($this->request,'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']);
|
|
|
|
+ $talentType = \StrUtil::getRequestDecodeParam($this->request,'talentType');
|
|
|
|
+ $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');
|
|
|
|
|
|
}
|
|
}
|
|
return view("", ["msg" => $msg]);
|
|
return view("", ["msg" => $msg]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function enterpriseRegister()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
public function verificationCode()
|
|
public function verificationCode()
|
|
{
|
|
{
|
|
$phone = $this->request["phone"];
|
|
$phone = $this->request["phone"];
|
|
@@ -49,6 +84,35 @@ class Auth extends BaseController
|
|
|
|
|
|
$template = "【晋江市人才服务平台】尊敬的用户,您的短信验证码为{$code},5分钟内有效。若非本人操作请忽略。";
|
|
$template = "【晋江市人才服务平台】尊敬的用户,您的短信验证码为{$code},5分钟内有效。若非本人操作请忽略。";
|
|
|
|
|
|
|
|
+ $smsapi = new ChuanglanSmsApi();
|
|
|
|
+
|
|
|
|
+ $result = $smsapi->sendSMS($phone,$template);
|
|
|
|
|
|
|
|
+ $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);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|