InstallController.class.php
1.31 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
<?php
/**
* 套件应用安装初始化数据
*/
namespace Rpc\Controller\Common;
use Common\Service\DictService;
use Common\Service\TeacherService;
class InstallController extends AbstractController
{
public function index()
{
$dictServ = new DictService();
$dict_count = $dictServ->count_by_conds(['key' => DictService::TEACHER_TITLE]);
if ($dict_count == 0) {
$titles = ['金牌讲师', '银牌讲师', '铜牌讲师'];
foreach ($titles as $title) {
$dictServ->insert([
'key' => DictService::TEACHER_TITLE,
'value' => $title,
]);
}
}
$teacherServ = new TeacherService();
$teacher_count = $teacherServ->count();
if ($teacher_count == 0) {
$teacher = [
'teacher_type' => 2,
'teacher_name' => '员圈小助手',
'face_url' => 'https://st.vchangyi.com/yuanquan/course/image08.png',
'title_id' => 0,
'tags' => '员工赋能 人资专家 培训小能手',
'source' => '员圈',
'remark' => '<img src="https://st.vchangyi.com/yuanquan/course/image09.png" />',
];
$teacherServ->insert($teacher);
}
}
}