|
|
@@ -141,16 +141,17 @@ class User extends Api
|
|
|
try {
|
|
|
$param = $this->request->post();
|
|
|
$validate = \think\Loader::validate('User');
|
|
|
+
|
|
|
if(!$validate->scene(key($param))->check($param) || count($param) > 2 || empty($param)) $this->error(__("Invalid parameters"));
|
|
|
|
|
|
//手机号修改
|
|
|
- if(isset($param['phone']) && UserInfoLogic::checkUserByInfo('phone', $this->auth->id) == false) $this->error(__("手机号已存在"));
|
|
|
+ if(isset($param['phone']) && UserInfoLogic::checkUserByInfo('phone', $this->auth->id, $param['phone']) == false) $this->error(__("手机号已存在"));
|
|
|
|
|
|
- //地址时候去重
|
|
|
- if(!$param['area_code'] && isset($param['address']) && UserInfoLogic::checkUserByInfo('address', $this->auth->id) == false) $this->error(__("钱包地址已存在不能修改"));
|
|
|
+ //地址时候去重 area_code
|
|
|
+ if(isset($param['address']) && UserInfoLogic::checkUserByInfo('address', $this->auth->id, $param['address']) == false) $this->error(__("钱包地址已存在不能修改"));
|
|
|
|
|
|
- if(!empty($param['area_code']) && !empty($param['address'])){
|
|
|
- $resp = $userArea::setUserAddress($this->auth->id, $param['area_code'], $param['address']);
|
|
|
+ if(isset($param['area_code']) && isset($param['area_name'])){
|
|
|
+ $resp = $userArea::setUserAddress($this->auth->id, $param['area_code'], $param['area_name']);
|
|
|
}else{
|
|
|
|
|
|
$resp = $userModel::where('id', $this->auth->id)->update($param);
|