| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace plugin\admin\app\controller;
- use Illuminate\Support\Arr;
- use plugin\admin\app\model\Statistics;
- use plugin\admin\app\model\UserCark;
- use support\Db;
- use support\Request;
- use support\Response;
- use plugin\admin\app\model\ArticleType;
- use plugin\admin\app\controller\Crud;
- use support\exception\BusinessException;
- /**
- * 文章分类
- */
- class StatisticsController extends Crud
- {
- /**
- * @var Statistics
- */
- protected $model = null;
- /**
- * 构造函数
- * @return void
- */
- public function __construct()
- {
- $this->model = new Statistics;
- }
- /**
- * 浏览
- * @return Response
- */
- public function index(): Response
- {
- return view('statistics/index');
- }
- /**
- * 插入
- * @param Request $request
- * @return Response
- * @throws BusinessException
- */
- public function insert(Request $request): Response
- {
- if ($request->method() === 'POST') {
- return parent::insert($request);
- }
- return view('statistics/insert');
- }
- /**
- * 更新
- * @param Request $request
- * @return Response
- * @throws BusinessException
- */
- public function update(Request $request): Response
- {
- if ($request->method() === 'POST') {
- return parent::update($request);
- }
- return view('statistics/update');
- }
- /**查询收银余额
- * @param Request $request
- * @return Response
- */
- public function select(Request $request): Response
- {
- $param = $request->all();
- $data = Statistics::query()->orderByDesc('id');
- $data = $data->paginate(Arr::get($param, 'limit', 10))
- ->toArray();
- $arr = [];
- foreach ($data['data'] as $k => $v) {
- $arr[] = [
- 'id' => $v['id'],
- 'open' => $v['open'],
- 'close' => $v['close'],
- 'up' => $v['up'],
- 'lower' => $v['lower'],
- 'created_at' => $v['created_at'],
- 'updated_at' => $v['updated_at'],
- ];
- }
- return json(['code' => 0, 'data' => $arr, 'msg' => 'ok', 'count' => $data['total']]);
- }
- }
|