配送员逻辑调整
This commit is contained in:
parent
c8f1aab0f4
commit
25eb6ce7be
@ -119,14 +119,12 @@ class LogisticsLogic extends BaseLogic
|
|||||||
->where('order_id', $params['order_id'])->where('order_sn', $params['order_sn'])->find();
|
->where('order_id', $params['order_id'])->where('order_sn', $params['order_sn'])->find();
|
||||||
if(empty($order['user_address_code'])) return ['code'=>1, 'msg'=>'用户地址信息错误'];
|
if(empty($order['user_address_code'])) return ['code'=>1, 'msg'=>'用户地址信息错误'];
|
||||||
//匹配配送员
|
//匹配配送员
|
||||||
$arr = explode(',', $order['user_address_code']);
|
$courier = Courier::alias('u')
|
||||||
array_pop($arr);
|
->leftjoin('la_company c', 'c.id = u.company_id')
|
||||||
$addr = implode(',', $arr);
|
->where("CONCAT_WS(',',u.province,u.city,u.area,u.street,u.village,u.brigade) = '". $order['user_address_code']."'")
|
||||||
$courier = Courier::alias('c')
|
->where('u.is_contract', 1)
|
||||||
->leftjoin('la_admin_role r', 'r.admin_id = c.id')
|
->where('u.is_captain',1)
|
||||||
->where("CONCAT_WS(',',c.province,c.city,c.area,c.street,c.village) = '". $addr."'")
|
->value('c.user_id');
|
||||||
->where('r.role_id', 6)
|
|
||||||
->value('c.id');
|
|
||||||
//判断配送员是否存在
|
//判断配送员是否存在
|
||||||
if(!$courier) return ['code'=>0, 'msg'=>'暂无配送员'];
|
if(!$courier) return ['code'=>0, 'msg'=>'暂无配送员'];
|
||||||
//写入数据
|
//写入数据
|
||||||
|
@ -28,7 +28,7 @@ class Courier extends BaseModel
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $connection = 'mysql3';
|
protected $connection = 'mysql3';
|
||||||
protected $name = 'la_admin';
|
protected $name = 'la_user';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user