|
|
@ -6,7 +6,6 @@ use App\Models\LanzuOrderGoods as Model; |
|
|
use Dcat\Admin\Grid\Model as GridModel; |
|
|
use Dcat\Admin\Grid\Model as GridModel; |
|
|
use Dcat\Admin\Repositories\EloquentRepository; |
|
|
use Dcat\Admin\Repositories\EloquentRepository; |
|
|
use Illuminate\Support\Facades\DB; |
|
|
use Illuminate\Support\Facades\DB; |
|
|
use App\Admin\Controllers\v3\GoodsActivityController; |
|
|
|
|
|
|
|
|
|
|
|
class GoodsActivityReport extends EloquentRepository |
|
|
class GoodsActivityReport extends EloquentRepository |
|
|
{ |
|
|
{ |
|
|
@ -27,6 +26,16 @@ class GoodsActivityReport extends EloquentRepository |
|
|
$currentPage = $model->getCurrentPage(); |
|
|
$currentPage = $model->getCurrentPage(); |
|
|
// 获取每页显示行数
|
|
|
// 获取每页显示行数
|
|
|
$perPage = $model->getPerPage(); |
|
|
$perPage = $model->getPerPage(); |
|
|
|
|
|
$list = $this->getData($perPage); |
|
|
|
|
|
|
|
|
|
|
|
return $model->makePaginator( |
|
|
|
|
|
$list['total'] ?? 0,$list['data'] ?? [] |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getData($perPage = 10) |
|
|
|
|
|
{ |
|
|
// 获取筛选参数
|
|
|
// 获取筛选参数
|
|
|
$name = request()->input('name', ''); |
|
|
$name = request()->input('name', ''); |
|
|
$marketId = request()->input('market_id'); |
|
|
$marketId = request()->input('market_id'); |
|
|
@ -40,8 +49,7 @@ class GoodsActivityReport extends EloquentRepository |
|
|
->join('lanzu_order_main','lanzu_order.order_main_id','=','lanzu_order_main.global_order_id') |
|
|
->join('lanzu_order_main','lanzu_order.order_main_id','=','lanzu_order_main.global_order_id') |
|
|
->where('lanzu_order_goods.activity_type',2) |
|
|
->where('lanzu_order_goods.activity_type',2) |
|
|
->where('lanzu_order_goods.status',1) |
|
|
->where('lanzu_order_goods.status',1) |
|
|
->whereIn('lanzu_order_main.state',[4,5,10,11]) |
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
->whereIn('lanzu_order_main.state',[4,5,10,11]); |
|
|
|
|
|
|
|
|
if($name){ |
|
|
if($name){ |
|
|
$orderGoodsActivity->where('lanzu_order_goods.name','like',"%$name%"); |
|
|
$orderGoodsActivity->where('lanzu_order_goods.name','like',"%$name%"); |
|
|
@ -77,11 +85,6 @@ class GoodsActivityReport extends EloquentRepository |
|
|
// }
|
|
|
// }
|
|
|
$list = $orderGoodsActivity->orderBy('total','desc')->groupBy('goods_id','lanzu_order_goods.name','cover_img','market_id','store_id')->paginate($perPage); |
|
|
$list = $orderGoodsActivity->orderBy('total','desc')->groupBy('goods_id','lanzu_order_goods.name','cover_img','market_id','store_id')->paginate($perPage); |
|
|
$list = $list->toArray(); |
|
|
$list = $list->toArray(); |
|
|
$this->data = $list['data'] ?? []; |
|
|
|
|
|
|
|
|
|
|
|
return $model->makePaginator( |
|
|
|
|
|
$list['total'] ?? 0,$list['data'] ?? [] |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $list; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |