feat(UserLogic): 根据用户等级限制区域管理员添加
This commit is contained in:
parent
51948aaf35
commit
1639b54301
@ -77,6 +77,24 @@ class UserLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function StoreAdd(array $params)
|
public static function StoreAdd(array $params)
|
||||||
{
|
{
|
||||||
|
$user_ship=$params['user_ship']??0;
|
||||||
|
if($user_ship==2){
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
||||||
|
if($find){
|
||||||
|
self::setError('该区域又有村长请重新选择');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}elseif($user_ship==3){
|
||||||
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
|
if($arr){
|
||||||
|
$find=UserAddress::where('uid','in',$arr)->where('brigade',$params['brigade'])->find();
|
||||||
|
if($find){
|
||||||
|
self::setError('该区域已有对长请重新选择');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$passwordSalt = Config::get('project.unique_identification');
|
$passwordSalt = Config::get('project.unique_identification');
|
||||||
$password = create_password(123456, $passwordSalt);
|
$password = create_password(123456, $passwordSalt);
|
||||||
$defaultAvatar = config('project.default_image.admin_avatar');
|
$defaultAvatar = config('project.default_image.admin_avatar');
|
||||||
|
@ -83,15 +83,15 @@ class StoreController extends BaseApiController
|
|||||||
$find=User::where('account|mobile',$params['mobile'])->find();
|
$find=User::where('account|mobile',$params['mobile'])->find();
|
||||||
if(!$find){
|
if(!$find){
|
||||||
$params['create_uid']=$this->userId;
|
$params['create_uid']=$this->userId;
|
||||||
$find=UserUserLogic::StoreAdd($params);
|
UserUserLogic::StoreAdd($params);
|
||||||
|
if(UserUserLogic::hasError()){
|
||||||
|
return $this->fail(UserUserLogic::getError());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$find['real_name']=$params['real_name'];
|
$find['real_name']=$params['real_name'];
|
||||||
$find['label_id']=$params['label_id']??0;
|
$find['label_id']=$params['label_id']??0;
|
||||||
$find->save();
|
$find->save();
|
||||||
}
|
}
|
||||||
if($find === false){
|
|
||||||
return $this->fail(UserUserLogic::getError());
|
|
||||||
}
|
|
||||||
if($recharge_type!='INDUSTRYMEMBERS'){
|
if($recharge_type!='INDUSTRYMEMBERS'){
|
||||||
return $this->success('添加用户成功');
|
return $this->success('添加用户成功');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user