<?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); } } }