pull/1/head
ztt 1 year ago
parent 47365d35a6
commit 7de68fab79
  1. 2
      app/api/controller/StoreKeeper.php
  2. 43
      app/store/model/Order.php

@ -193,7 +193,7 @@ class StoreKeeper extends Controller
return $this->renderSuccess(compact('list'));
} else {
$model = new OrderModel;
$list = $model->getList($params);
$list = $model->getNewList($params);
return $this->renderSuccess(compact('dataType', 'list'));
}

@ -59,6 +59,49 @@ class Order extends OrderModel
* @return mixed
*/
public function getList(array $param = [])
{
// 检索查询条件
$filter = $this->getQueryFilter($param);
$filterOr = [];
if (!empty($param['searchValue']) && $param['searchType'] == 'all') {
// $filterOr = [
// ['order.order_no', 'like', "%{$param['searchValue']}%"],
// ['user.nick_name', 'like', "%{$param['searchValue']}%"],
// ['address.name', 'like', "%{$param['searchValue']}%"],
// ['address.phone', 'like', "%{$param['searchValue']}%"],
// ];
$filterOr = [
['order.order_no|user.nick_name|address.name|address.phone', 'like', "%{$param['searchValue']}%"]
];
}
// 设置订单类型条件
$dataTypeFilter = $this->getFilterDataType($param['dataType']);
// 获取数据列表
$query = $this->with(['goods.image', 'user.avatar', 'address'])
->alias('order')
->field('order.*')
->leftJoin('user', 'user.user_id = order.user_id')
->leftJoin('order_address address', 'address.order_id = order.order_id')
->where($dataTypeFilter)
->where($filter)
->where('order.is_delete', '=', 0);
if (!empty($filterOr)) {
// $query = $query->whereOr($filterOr);
$query = $query->where($filterOr);
}
$list = $query->order(['order.create_time' => 'desc'])
->paginate(10);
return $list;
}
/**
* 订单列表 (API调用)
* @param array $param
* @return mixed
*/
public function getNewList(array $param = [])
{
// 检索查询条件
$filter = $this->getQueryFilter($param);

Loading…
Cancel
Save