核销数量接口
This commit is contained in:
parent
5b9c50b689
commit
f012cbc04c
@ -33,6 +33,7 @@ class OrderController extends BaseApiController
|
|||||||
ApiDoc\url('/api/order/order/write_list'),
|
ApiDoc\url('/api/order/order/write_list'),
|
||||||
ApiDoc\Method('POST'),
|
ApiDoc\Method('POST'),
|
||||||
ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"),
|
ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"),
|
||||||
|
ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||||
ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"),
|
||||||
ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"),
|
||||||
ApiDoc\NotHeaders(),
|
ApiDoc\NotHeaders(),
|
||||||
@ -56,6 +57,24 @@ class OrderController extends BaseApiController
|
|||||||
return $this->success('ok',$res);
|
return $this->success('ok',$res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[
|
||||||
|
ApiDoc\Title('核销数量'),
|
||||||
|
ApiDoc\url('/api/order/order/write_count'),
|
||||||
|
ApiDoc\Method('POST'),
|
||||||
|
ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"),
|
||||||
|
ApiDoc\NotHeaders(),
|
||||||
|
ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"),
|
||||||
|
ApiDoc\ResponseSuccess("data", type: "array"),
|
||||||
|
]
|
||||||
|
public function write_count()
|
||||||
|
{
|
||||||
|
$info = $this->userInfo;
|
||||||
|
$params = $this->request->post();
|
||||||
|
$res = OrderLogic::write_count($info,$params);
|
||||||
|
return $this->success('ok',$res);
|
||||||
|
}
|
||||||
|
|
||||||
#[
|
#[
|
||||||
ApiDoc\Title('订单校验'),
|
ApiDoc\Title('订单校验'),
|
||||||
ApiDoc\url('/api/order/order/checkOrder'),
|
ApiDoc\url('/api/order/order/checkOrder'),
|
||||||
|
@ -442,6 +442,46 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function write_count($info,$params)
|
||||||
|
{
|
||||||
|
$store_id = SystemStoreStaff::where('phone',$info['mobile'])->value('store_id');
|
||||||
|
if(empty($store_id)){
|
||||||
|
throw new \Exception('该用户未绑定店铺请查看');
|
||||||
|
}
|
||||||
|
$query = StoreOrderCartInfo::alias('o')
|
||||||
|
->leftJoin('store_branch_product p','p.id = o.product_id')
|
||||||
|
->leftJoin('store_order s','s.id = o.oid')
|
||||||
|
->field('o.oid,p.store_name,s.order_id')
|
||||||
|
->where('o.store_id',$store_id);
|
||||||
|
|
||||||
|
if(isset($params['name']) && $params['name']){
|
||||||
|
if($params['name'] && preg_match('/[\x{4e00}-\x{9fff}]+/u', $params['name'])==1){
|
||||||
|
$query->where('p.store_name','like','%'.$params['name'].'%');
|
||||||
|
}else{
|
||||||
|
$query->where('s.order_id',$params['name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$product = $query->select();
|
||||||
|
if(empty($product)){
|
||||||
|
return [
|
||||||
|
'no_send'=>0,
|
||||||
|
'send'=>0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$oids = array_column($product->toArray(), 'oid');
|
||||||
|
$uniqueOids = array_unique($oids);
|
||||||
|
$no_send = StoreOrder::whereIn('id',$uniqueOids)
|
||||||
|
->where('status',1)->count();
|
||||||
|
$send = StoreOrder::whereIn('id',$uniqueOids)
|
||||||
|
->where('status',2)->count();
|
||||||
|
return [
|
||||||
|
'no_send'=>$no_send,
|
||||||
|
'send'=>$send
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function write_list($info,$status,$params)
|
public static function write_list($info,$status,$params)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -463,7 +503,6 @@ class OrderLogic extends BaseLogic
|
|||||||
}else{
|
}else{
|
||||||
$query->where('s.order_id',$params['name']);
|
$query->where('s.order_id',$params['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$product = $query->select();
|
$product = $query->select();
|
||||||
if(empty($product)){
|
if(empty($product)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user