feat(UserLogic): 优化用户地址查询逻辑
This commit is contained in:
parent
0942299f55
commit
75c6e3b05a
@ -84,28 +84,22 @@ class UserLogic extends BaseLogic
|
|||||||
self::setError('请设置村参数');
|
self::setError('请设置村参数');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->column('id');
|
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'])->find();
|
||||||
if($arr){
|
if ($arr) {
|
||||||
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->find();
|
|
||||||
if($find){
|
|
||||||
self::setError('该区域已有村长请重新选择');
|
self::setError('该区域已有村长请重新选择');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}elseif($user_ship==3){
|
}elseif($user_ship==3){
|
||||||
if(!isset($params['brigade'])){
|
if(!isset($params['brigade'])){
|
||||||
self::setError('请设置队参数');
|
self::setError('请设置队参数');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$arr=User::where('user_ship',$user_ship)->column('id');
|
$arr=User::where('user_ship',$user_ship)->alias('user')->join('user_address address','user.id=address.uid and village='.$params['village'] .' and brigade='.$params['brigade'])->find();
|
||||||
if($arr){
|
if($arr){
|
||||||
$find=UserAddress::where('uid','in',$arr)->where('village',$params['village'])->where('brigade',$params['brigade'])->find();
|
|
||||||
if($find){
|
|
||||||
self::setError('该区域已有队长请重新选择');
|
self::setError('该区域已有队长请重新选择');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static function StoreAdd(array $params)
|
public static function StoreAdd(array $params)
|
||||||
|
@ -66,8 +66,8 @@ class StoreController extends BaseApiController
|
|||||||
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
|
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
|
||||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||||
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
|
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
|
||||||
$code = $this->request->post('code','');//验证码
|
// $code = $this->request->post('code','');//验证码
|
||||||
$phone = $params['mobile'];
|
// $phone = $params['mobile'];
|
||||||
// if($code && $phone){
|
// if($code && $phone){
|
||||||
// $remark = $phone.'_reporting';
|
// $remark = $phone.'_reporting';
|
||||||
// $codeCache = Cache::get($remark);
|
// $codeCache = Cache::get($remark);
|
||||||
@ -84,12 +84,18 @@ 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;
|
||||||
|
if(isset($params['user_ship']) && in_array($params['user_ship'],[2,3])){
|
||||||
|
UserUserLogic::checkAddress($params);
|
||||||
|
if(UserUserLogic::hasError()){
|
||||||
|
return $this->fail(UserUserLogic::getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
$find=UserUserLogic::StoreAdd($params);
|
$find=UserUserLogic::StoreAdd($params);
|
||||||
if(UserUserLogic::hasError()){
|
if(UserUserLogic::hasError()){
|
||||||
return $this->fail(UserUserLogic::getError());
|
return $this->fail(UserUserLogic::getError());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(isset($params['type']) && $params['type'] != 2){
|
if($find['user_ship']!=$params['user_ship'] && in_array($params['user_ship'],[2,3])){
|
||||||
UserUserLogic::checkAddress($params);
|
UserUserLogic::checkAddress($params);
|
||||||
if(UserUserLogic::hasError()){
|
if(UserUserLogic::hasError()){
|
||||||
return $this->fail(UserUserLogic::getError());
|
return $this->fail(UserUserLogic::getError());
|
||||||
@ -130,6 +136,7 @@ class StoreController extends BaseApiController
|
|||||||
'recharge_type'=>'INDUSTRYMEMBERS',
|
'recharge_type'=>'INDUSTRYMEMBERS',
|
||||||
'user_ship'=>$params['user_ship']??0,
|
'user_ship'=>$params['user_ship']??0,
|
||||||
];
|
];
|
||||||
|
d(123123);
|
||||||
$order = UserRecharge::create($data);
|
$order = UserRecharge::create($data);
|
||||||
|
|
||||||
$order['pay_price']=$order['price'];
|
$order['pay_price']=$order['price'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user