| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- /**
- * ----------------------------------------------------------------------------
- * 行到水穷处,坐看云起时
- * 开发软件,找贵阳云起信息科技,官网地址:https://www.56q7.com/
- * ----------------------------------------------------------------------------
- * Author: 老成
- * email:85556713@qq.com
- */
- declare (strict_types = 1);
- namespace app\admin\controller;
- use app\common\model\Admin;
- use app\common\model\delivery\Text;
- use app\common\model\User;
- use app\common\model\StockDetail;
- use app\common\model\StockConfig;
- use app\common\library\Date;
- use app\common\controller\Backend;
- use think\annotation\route\Route;
- use think\facade\Db;
- /**
- * 控制台
- */
- class Dashboard extends Backend
- {
- public function _initialize()
- {
- parent::_initialize();
- }
- /**
- * 查看
- */
- #[Route('GET','dashboard/index')]
- public function index(StockConfig $stockConfig, StockDetail $stockDetail)
- {
- if($this->request->isAjax()){
- //模拟数据面板
- $panel=[
- rand(100,1000),
- rand(100,1000),
- rand(100,1000),
- rand(100,1000),
- ];
- $variety = [];
- $box = [];
- $material = [];
- $list = $stockConfig->where('status', $stockConfig::StatusNormal)->field('id,type_id,title')->orderRaw("field('variety_name','packing_box','material')")->select();
- foreach ($list as $item) {
- switch ($item['type_id']) {
- case $stockConfig::VarietyName:
- $variety[] = [
- 'name' => $item->title,
- 'num' => $stockDetail->where('key', $item['id'])->value('num')
- ];
- break;
- case $stockConfig::PackingBox:
- $box[] = [
- 'name' => $item->title,
- 'num' => $stockDetail->where('key', $item['id'])->value('num')
- ];
- break;
- case $stockConfig::Material:
- $material[] = [
- 'name' => $item->title,
- 'num' => $stockDetail->where('key', $item['id'])->value('num')
- ];
- break;
- }
- }
- $this->success('',compact('panel','variety','box','material'));
- }
- return $this->fetch();
- }
- #[Route('GET','dashboard/platform1')]
- public function platform1()
- {
- return $this->fetch();
- }
- #[Route('GET','dashboard/platform2')]
- public function platform2()
- {
- return $this->fetch();
- }
- }
|