|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace app\controllers; |
|
6
|
|
|
|
|
7
|
|
|
use Yii; |
|
8
|
|
|
use yii\rest\Controller; |
|
9
|
|
|
|
|
10
|
|
|
class SiteController extends Controller |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @return string |
|
14
|
|
|
*/ |
|
15
|
|
|
public function actionIndex() |
|
16
|
|
|
{ |
|
17
|
|
|
return 'hello yii'; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @return string |
|
22
|
|
|
*/ |
|
23
|
|
|
public function actionHealthCheck() |
|
24
|
|
|
{ |
|
25
|
|
|
return 'OK'; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @return array |
|
30
|
|
|
*/ |
|
31
|
|
|
public function actionError(): array |
|
32
|
|
|
{ |
|
33
|
|
|
$exception = Yii::$app->errorHandler->exception; |
|
34
|
|
|
if ($exception !== null) { |
|
35
|
|
|
Yii::error([ |
|
36
|
|
|
'request_id' => Yii::$app->requestId->id, |
|
37
|
|
|
'exception' => $exception->getMessage(), |
|
38
|
|
|
'line' => $exception->getLine(), |
|
39
|
|
|
'file' => $exception->getFile(), |
|
40
|
|
|
], 'response_data_error'); |
|
41
|
|
|
|
|
42
|
|
|
return ['code' => $exception->getCode(), 'message' => $exception->getMessage()]; |
|
43
|
|
|
} |
|
44
|
|
|
return []; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
public function actionIcons() |
|
49
|
|
|
{ |
|
50
|
|
|
return [ |
|
51
|
|
|
'food', |
|
52
|
|
|
'home', |
|
53
|
|
|
'bus', |
|
54
|
|
|
'game', |
|
55
|
|
|
'medicine-chest', |
|
56
|
|
|
'clothes', |
|
57
|
|
|
'education', |
|
58
|
|
|
'investment', |
|
59
|
|
|
'baby', |
|
60
|
|
|
'expenses', |
|
61
|
|
|
'work', |
|
62
|
|
|
'income', |
|
63
|
|
|
'transfer', |
|
64
|
|
|
'adjust', |
|
65
|
|
|
]; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function actionData() |
|
69
|
|
|
{ |
|
70
|
|
|
return [ |
|
71
|
|
|
'app' => [ |
|
72
|
|
|
'name' => Yii::$app->name, |
|
73
|
|
|
'description' => params('seoDescription'), |
|
74
|
|
|
'keywords' => params('seoKeywords'), |
|
75
|
|
|
'google_analytics' => params('googleAnalyticsAU'), |
|
76
|
|
|
'telegram_bot_name' => params('telegramBotName') |
|
77
|
|
|
], |
|
78
|
|
|
'menu' => [ |
|
79
|
|
|
[ |
|
80
|
|
|
'text' => 'Main', |
|
81
|
|
|
'group' => false, |
|
82
|
|
|
'children' => [ |
|
83
|
|
|
[ |
|
84
|
|
|
'text' => '仪表盘', |
|
85
|
|
|
'link' => '/dashboard', |
|
86
|
|
|
'icon' => 'anticon-dashboard', |
|
87
|
|
|
], |
|
88
|
|
|
[ |
|
89
|
|
|
'text' => '账户', |
|
90
|
|
|
'link' => '/account/index', |
|
91
|
|
|
'icon' => 'anticon-account-book', |
|
92
|
|
|
], |
|
93
|
|
|
[ |
|
94
|
|
|
'text' => '记录', |
|
95
|
|
|
'link' => '/record/index', |
|
96
|
|
|
'icon' => 'anticon-database', |
|
97
|
|
|
], |
|
98
|
|
|
[ |
|
99
|
|
|
'text' => '定时', |
|
100
|
|
|
'link' => '/recurrence/index', |
|
101
|
|
|
'icon' => 'anticon-field-time', |
|
102
|
|
|
], |
|
103
|
|
|
[ |
|
104
|
|
|
'text' => '分析', |
|
105
|
|
|
'link' => '/analysis/index', |
|
106
|
|
|
'icon' => 'anticon-area-chart', |
|
107
|
|
|
], |
|
108
|
|
|
[ |
|
109
|
|
|
'text' => '设置', |
|
110
|
|
|
'icon' => 'anticon-setting', |
|
111
|
|
|
'children' => [ |
|
112
|
|
|
[ |
|
113
|
|
|
'text' => '个人设置', |
|
114
|
|
|
'link' => '/settings/personal', |
|
115
|
|
|
'icon' => 'anticon-user', |
|
116
|
|
|
], |
|
117
|
|
|
[ |
|
118
|
|
|
'text' => '分类设置', |
|
119
|
|
|
'link' => '/settings/categories', |
|
120
|
|
|
'icon' => 'anticon-appstore', |
|
121
|
|
|
], |
|
122
|
|
|
[ |
|
123
|
|
|
'text' => '标签设置', |
|
124
|
|
|
'link' => '/settings/tags', |
|
125
|
|
|
'icon' => 'anticon-appstore', |
|
126
|
|
|
], |
|
127
|
|
|
[ |
|
128
|
|
|
'text' => '规则设置', |
|
129
|
|
|
'link' => '/settings/rules', |
|
130
|
|
|
'icon' => 'anticon-group', |
|
131
|
|
|
] |
|
132
|
|
|
] |
|
133
|
|
|
], |
|
134
|
|
|
] |
|
135
|
|
|
] |
|
136
|
|
|
] |
|
137
|
|
|
]; |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|