2023-05-10 13:38:51 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace app\controller\admin\user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\repositories\store\ExcelRepository;
|
|
|
|
|
use crmeb\basic\BaseController;
|
|
|
|
|
use app\common\repositories\user\UserBillRepository;
|
|
|
|
|
use crmeb\services\ExcelService;
|
|
|
|
|
use think\App;
|
2023-10-08 15:23:44 +08:00
|
|
|
|
use think\facade\Db;
|
2023-05-10 13:38:51 +08:00
|
|
|
|
|
|
|
|
|
class UserBill extends BaseController
|
|
|
|
|
{
|
|
|
|
|
protected $repository;
|
|
|
|
|
|
|
|
|
|
public function __construct(App $app, UserBillRepository $repository)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct($app);
|
|
|
|
|
$this->repository = $repository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getList()
|
|
|
|
|
{
|
|
|
|
|
[$page, $limit] = $this->getPage();
|
|
|
|
|
$where = $this->request->params(['keyword', 'date', 'type']);
|
|
|
|
|
return app('json')->success($this->repository->getList($where, $page, $limit));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function type()
|
|
|
|
|
{
|
|
|
|
|
return app('json')->success($this->repository->type());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function export()
|
|
|
|
|
{
|
|
|
|
|
$where = $this->request->params(['keyword', 'date', 'type']);
|
|
|
|
|
[$page, $limit] = $this->getPage();
|
|
|
|
|
$data = app()->make(ExcelService::class)->bill($where,$page,$limit);
|
|
|
|
|
return app('json')->success($data);
|
|
|
|
|
}
|
2023-10-08 15:23:44 +08:00
|
|
|
|
|
|
|
|
|
public function deposit(){
|
|
|
|
|
$where = $this->request->params(['keyword', 'date']);
|
|
|
|
|
// ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
|
|
|
|
// getModelTime($query, $where['date'], 'create_time');
|
|
|
|
|
// })
|
|
|
|
|
// ->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
|
|
|
|
|
// $query->whereLike('a.uid|b.nickname|a.title', "%{$where['keyword']}%");
|
|
|
|
|
// })
|
|
|
|
|
// whereTime('birthday', 'between', ['1970-10-1', '2000-10-1'])
|
|
|
|
|
|
|
|
|
|
[$page, $limit] = $this->getPage();
|
|
|
|
|
$query= Db::name('margin_order')->where('paid',1);
|
|
|
|
|
// if(isset($where['date']))
|
|
|
|
|
|
|
|
|
|
$list=$query->withAttr('mer_name',function($value,$data){
|
|
|
|
|
return Db::name('merchant')->where('mer_id',$data['mer_id'])->value('mer_name');
|
|
|
|
|
})
|
|
|
|
|
->withAttr('nickname',function($value,$data){
|
|
|
|
|
return Db::name('user')->where('uid',$data['uid'])->value('nickname');
|
|
|
|
|
})
|
|
|
|
|
->page($page, $limit)->order('order_id', 'desc')->select()->toArray();
|
|
|
|
|
return app('json')->success($list);
|
|
|
|
|
}
|
2023-05-10 13:38:51 +08:00
|
|
|
|
}
|