接口优化

This commit is contained in:
彭桃 2023-01-31 10:29:46 +08:00
parent 13fb77f8dd
commit 432e5b2568

View File

@ -7,7 +7,6 @@ use app\api\middleware\Auth;
use think\Exception; use think\Exception;
use think\facade\Db; use think\facade\Db;
use think\exception\ValidateException; use think\exception\ValidateException;
use app\common\model\User;
/** /**
@ -1212,7 +1211,7 @@ class Maintainentry extends BaseController
$this->apiError('录入出错,请联系系统管理员'); $this->apiError('录入出错,请联系系统管理员');
} }
// 判断手机号是否已经注册 // 判断手机号是否已经注册
$is_mobile = User::getByMobile($post['phone']); $is_mobile = Db::table('fa_user')->where('mobile',$post['phone'])->find();
if ($is_mobile) { if ($is_mobile) {
$this->apiError('手机号已被使用'); $this->apiError('手机号已被使用');
} }
@ -1266,7 +1265,7 @@ class Maintainentry extends BaseController
'updatetime' => $time 'updatetime' => $time
]; ];
//写入用户表 //写入用户表
$userid = User::strict(false)->insertGetId($params); $userid = Db::table('fa_user')->strict(false)->insertGetId($params);
// 写入商城关系表 // 写入商城关系表
$nk_user['n_user_id'] = $userid; $nk_user['n_user_id'] = $userid;
@ -1507,7 +1506,7 @@ class Maintainentry extends BaseController
$this->apiError('录入出错,请联系系统管理员'); $this->apiError('录入出错,请联系系统管理员');
} }
// 判断手机号是否已经注册 // 判断手机号是否已经注册
$is_mobile = User::getByMobile($post['phone']); $is_mobile = Db::table('fa_user')->where('mobile',$post['phone'])->find();
if ($is_mobile) { if ($is_mobile) {
$this->apiError('手机号已被使用'); $this->apiError('手机号已被使用');
} }
@ -1561,7 +1560,7 @@ class Maintainentry extends BaseController
'updatetime' => $time 'updatetime' => $time
]; ];
//写入用户表 //写入用户表
$userid = User::strict(false)->insertGetId($params); $userid = Db::table('fa_user')->strict(false)->insertGetId($params);
// 写入商城关系表 // 写入商城关系表
$nk_user['n_user_id'] = $userid; $nk_user['n_user_id'] = $userid;
@ -1784,7 +1783,7 @@ class Maintainentry extends BaseController
// } // }
// 判断手机号是否已经注册 // 判断手机号是否已经注册
$is_mobile = User::getByMobile($phone); $is_mobile = Db::table('fa_user')->where('mobile',$phone)->find();
if ($is_mobile) { if ($is_mobile) {
$this->apiError('手机号已被使用'); $this->apiError('手机号已被使用');
} }