diff --git a/app/controller/api/dataview/Finance.php b/app/controller/api/dataview/Finance.php index 0ee6ae09..42532f4b 100644 --- a/app/controller/api/dataview/Finance.php +++ b/app/controller/api/dataview/Finance.php @@ -64,19 +64,30 @@ class Finance extends BaseController public function financialRecord(FinancialRecordRepository $repository) { [$page, $limit] = $this->getPage(); - $where = $this->request->params(['keyword', 'date', 'mer_id']); - $merId = $this->request->merId(); - if ($merId) { - $where['mer_id'] = $merId; - $where['financial_type'] = ['order', 'mer_accoubts', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon', - 'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund','commission_to_entry_merchant','commission_to_entry_merchant_refund' - ,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund']; - } else { - $where['financial_type'] = ['order', 'sys_accoubts', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon', - 'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund' - ,'commission_to_entry_merchant','commission_to_entry_merchant_refund' - ,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund']; + $where = $this->request->params([['type',1],'date']); + $where['is_mer'] = $this->request->merId() ?? 0 ; + try { + $merchant = $this->request->merchant(); + }catch (\Exception $e){ + $merchant = []; } - return app('json')->success($repository->getList($where, $page, $limit)); + $data = $repository->getAdminList($where,$page, $limit,$merchant); + return app('json')->success($data); + } + + public function financialDetail($type) + { + $repository = app()->make(FinancialRecordRepository::class); + $date = $this->request->param('date'); + $where['date'] = empty($date) ? date('Y-m-d',time()) : $date ; + $where['is_mer'] = $this->request->merId() ?? 0 ; + if($this->request->merId()){ + $merchant = $this->request->merchant(); + $data = $repository->merDetail($type,$where,$merchant); + }else{ + $data = $repository->adminDetail($type,$where); + } + + return app('json')->success($data); } } \ No newline at end of file diff --git a/route/api.php b/route/api.php index f7593047..8e0775c8 100644 --- a/route/api.php +++ b/route/api.php @@ -762,6 +762,7 @@ Route::group('api/', function () { Route::get('bill_list', 'Finance/billList'); Route::get('financial_record_title', 'Finance/financialRecordTitle'); Route::get('financial_record', 'Finance/financialRecord'); + Route::get('financial_detail/:type', 'Finance/financialDetail');