修复:总平台商品相关订单 不显示的问题
This commit is contained in:
parent
3e1eafbe90
commit
d607d3066d
|
|
@ -60,13 +60,24 @@ class StoreOrderDao extends BaseDao
|
|||
* @day 2020/6/16
|
||||
*/
|
||||
public function search(array $where, $sysDel = 0){
|
||||
$query = StoreOrder::hasWhere('merchant', function ($query) use ($where) {
|
||||
if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
$query = StoreOrder::alias('StoreOrder')
|
||||
->leftJoin('Merchant','Merchant.mer_id = StoreOrder.mer_id')
|
||||
->where(function($query){
|
||||
$query->where('Merchant.is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
})
|
||||
->when(isset($where['is_trader']) && $where['is_trader'] !== '', function ($query) use ($where) {
|
||||
$query->where('is_trader', $where['is_trader']);
|
||||
}
|
||||
$query->where('is_del',0);
|
||||
});
|
||||
// 存在商户id是否 判断商户id类型,显示对应的订单
|
||||
});
|
||||
|
||||
// $query = StoreOrder::hasWhere('merchant', function ($query) use ($where) {
|
||||
// if (isset($where['is_trader']) && $where['is_trader'] !== '') {
|
||||
// $query->where('is_trader', $where['is_trader'])->whereOr('StoreOrder.mer_id', 0);
|
||||
// }
|
||||
// $query->where(function($hasQuery){
|
||||
// $hasQuery->where('is_del',0)->whereOr('StoreOrder.mer_id', 0);
|
||||
// });
|
||||
// });
|
||||
// 存在商户id是否 判断商户id类型,显示对应的订单 30,31,32,33,34
|
||||
if(isset($where['mer_id']) && $where['mer_id'] !== ''){
|
||||
$merchantType = app()->make(MerchantRepository::class)
|
||||
->getSearch([])
|
||||
|
|
@ -75,13 +86,12 @@ class StoreOrderDao extends BaseDao
|
|||
// 供应商 仅显示酒道馆进货订单
|
||||
if($merchantType == 2) $where['activity_type'] = 35;
|
||||
}
|
||||
|
||||
$isWithGoods = $where['is_with_goods'] ?? 0;
|
||||
$activityType = $where['activity_type'] ?? 0;
|
||||
if($isWithGoods == 1 || $activityType == 35){
|
||||
$query->whereNotIn('StoreOrder.activity_type',[20,30]);
|
||||
}else{
|
||||
$query->whereNotIn('StoreOrder.activity_type',[20,30,35]);
|
||||
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34]);
|
||||
}else if($activityType == 0){
|
||||
$query->whereNotIn('StoreOrder.activity_type',[20,30,31,32,33,34,35]);
|
||||
}
|
||||
|
||||
$query->when(($sysDel !== null), function ($query) use ($sysDel) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class StoreOrder extends BaseModel
|
|||
|
||||
public function getOpenReceiptAttr()
|
||||
{
|
||||
return merchantConfig($this->mer_id,'mer_open_receipt') ?: 0;
|
||||
return merchantConfig((int)$this->mer_id,'mer_open_receipt') ?: 0;
|
||||
}
|
||||
|
||||
public function getOrderExtendAttr($val)
|
||||
|
|
|
|||
|
|
@ -1828,6 +1828,8 @@ class StoreOrderRepository extends BaseRepository
|
|||
public function getList(array $where, $page, $limit)
|
||||
{
|
||||
$query = $this->dao->search($where)->where('StoreOrder.is_del', 0);
|
||||
|
||||
// debug( $this->dao->search($where)->where('StoreOrder.is_del', 0)->fetchSql()->select());
|
||||
$count = $query->count();
|
||||
$list = $query->with([
|
||||
'orderProduct',
|
||||
|
|
|
|||
|
|
@ -180,8 +180,10 @@ class StoreOrder extends BaseController
|
|||
$where['with_goods_mer_id'] = is_array($agentInfo['mer_id_list']) ? $agentInfo['mer_id_list'] : [];
|
||||
$where['activity_type'] = 35;
|
||||
}
|
||||
// 获取订单
|
||||
$result = $this->repository->getList($where, $page, $limit);
|
||||
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue