feat(UserShipLogic): 添加用户船只逻辑,优化查询条件
This commit is contained in:
parent
ebde5684c0
commit
5101dd4e9c
@ -105,22 +105,33 @@ class UserShipLogic extends BaseLogic
|
|||||||
public static function user_ship($params){
|
public static function user_ship($params){
|
||||||
$user_ship=$params['user_ship']??0;
|
$user_ship=$params['user_ship']??0;
|
||||||
if($user_ship==2){
|
if($user_ship==2){
|
||||||
|
if(!isset($params['village'])){
|
||||||
|
self::setError('请设置村参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->column('id');
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
if($arr){
|
if($arr){
|
||||||
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
||||||
if($find){
|
if($find){
|
||||||
self::setError('该区域又有村长请重新选择');
|
self::setError('该区域又有村长请重新选择');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}elseif($user_ship==3){
|
}elseif($user_ship==3){
|
||||||
|
if(!isset($params['brigade'])){
|
||||||
|
self::setError('请设置队参数');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->column('id');
|
$arr=User::where('user_ship',$user_ship)->column('id');
|
||||||
if($arr){
|
if($arr){
|
||||||
$find=UserAddress::where('uid','in',$arr)->where('brigade',$params['brigade'])->find();
|
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->where('brigade',$params['brigade'])->find();
|
||||||
if($find){
|
if($find){
|
||||||
self::setError('该区域已有对长请重新选择');
|
self::setError('该区域已有队长请重新选择');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user