<?php
|
|
namespace app\api\controller\user;
|
|
use app\api\controller\Controller;
|
|
/**
|
* 手动注册 by yj
|
*/
|
class Register extends Controller
|
{
|
/**
|
* 提交注册
|
*/
|
public function register()
|
{
|
$model = $this->getUser();
|
if($this->request->isGet()){
|
$userInfo = [
|
'real_name' => $model['real_name'],
|
'mobile' => $model['mobile']
|
];
|
$is_register = false;
|
if(!empty($model['real_name']) && !empty($model['mobile'])){
|
$is_register = true;
|
}
|
return $this->renderSuccess('',compact('userInfo','is_register'));
|
}
|
// 保存记录
|
if ($model->saveRegister($this->postData())) {
|
return $this->renderSuccess('注册成功');
|
}
|
return $this->renderError($model->getError() ?: '注册失败');
|
}
|
|
}
|