93 lines
3.1 KiB
PHP
93 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace app\controller\api\dataview;
|
|
|
|
use app\common\repositories\BaseRepository;
|
|
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
|
use app\common\repositories\user\UserBillRepository;
|
|
use app\common\repositories\user\UserExtractRepository;
|
|
use crmeb\basic\BaseController;
|
|
use think\App;
|
|
use think\exception\ValidateException;
|
|
class Finance extends BaseController
|
|
{
|
|
/**
|
|
* @var repository
|
|
*/
|
|
protected $repository;
|
|
|
|
public $areaCode; // 区县地区码
|
|
|
|
public $streetCode; // 镇街道地区码
|
|
|
|
public function __construct(App $app, BaseRepository $repository)
|
|
{
|
|
parent::__construct($app);
|
|
$this->repository = $repository;
|
|
$this->areaCode = $this->request->param('areaCode', '');
|
|
$this->streetCode = $this->request->param('streetCode', '');
|
|
|
|
if ($this->areaCode == '' && $this->streetCode == '') {
|
|
throw new ValidateException('请选择地区');
|
|
}
|
|
}
|
|
|
|
// 提现记录
|
|
public function withdrawList(UserExtractRepository $repository)
|
|
{
|
|
[$page,$limit] = $this->getPage();
|
|
$where = $this->request->params(['status','keyword','date','extract_type']);
|
|
return app('json')->success($repository->getList($where,$page,$limit));
|
|
}
|
|
|
|
// 资金记录
|
|
public function billList(UserBillRepository $repository)
|
|
{
|
|
[$page, $limit] = $this->getPage();
|
|
$where = $this->request->params(['keyword', 'date', 'type']);
|
|
return app('json')->success($repository->getList($where, $page, $limit));
|
|
}
|
|
|
|
// 账单管理统计标题
|
|
public function financialRecordTitle(FinancialRecordRepository $repository)
|
|
{
|
|
$where = $this->request->params(['date']);
|
|
$where['is_mer'] = $this->request->merId() ?? 0 ;
|
|
if($where['is_mer'] == 0){
|
|
$data = $repository->getAdminTitle($where);
|
|
}else{
|
|
$data = $repository->getMerchantTitle($where);
|
|
}
|
|
return app('json')->success($data);
|
|
}
|
|
|
|
public function financialRecord(FinancialRecordRepository $repository)
|
|
{
|
|
[$page, $limit] = $this->getPage();
|
|
$where = $this->request->params([['type',1],'date']);
|
|
$where['is_mer'] = $this->request->merId() ?? 0 ;
|
|
try {
|
|
$merchant = $this->request->merchant();
|
|
}catch (\Exception $e){
|
|
$merchant = [];
|
|
}
|
|
$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);
|
|
}
|
|
} |