liyaozhi
2025-10-28 1320688354fd168c51cf2e05f29a2253f4ed9c00
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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() ?: '注册失败');
    }
 
}