IndexController.php
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace App\Http\Controllers;
use App\Http\Services\IndexService;
use App\Http\Services\MessageService;
use App\Model\IntracodeModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class IndexController extends Controller
{
public function Entrance(Request $request, $id = 'index')
{
if ($request->path() == '/') {
$path = 'web/index';
} else {
$path = $request->path();
}
$this->data = [
'menus' => $request->menus,
'header' => $request->user->header,
'username' => $request->user->email,
'user_email' => $request->user->email,
'uri' => '/' . $path,
'id' => $id
];
$userId = $request->user->userId;
$canAudit = perm($userId, 'AuditSupplier');
$this->data['canAudit'] = $canAudit;
//把是否是领导查看放到模板,用来区分部门老大能干的权限
$leaderView = perm($userId, 'LeaderView');
$this->data['leaderView'] = $leaderView;
return $this->$id($request);
}
public function __call($method, $parameters)
{
return $this->errhtml('Not', '没有这个页面');
}
//操作日志列表
public function Index($request)
{
$service = new IndexService();
try {
$statistics = $service->getDailySupplierAddStatistics();
$this->data['dates'] = array_values(array_column($statistics['all'], 'date'));
$this->data['all_increase_statistics'] = array_values(array_column($statistics['all'], 'count'));
$this->data['user_increase_statistics'] = array_values(array_column($statistics['user'], 'count'));
$intraCodeModel = new IntracodeModel();
$userCodes = $intraCodeModel->getSampleEncode();
$this->data['user'] = $userCodes;
$this->data['purchase_users'] = [];
foreach ($userCodes as $userId => $code) {
$this->data['purchase_users'][] = [
'name' => $code,
'value' => $userId,
];
}
} catch (\Exception $exception) {
}
return $this->view('首页');
}
}