<?php /** * Created by PhpStorm. * User: liyifei2012it * Date: 18/3/26 * Time: 16:59 */ namespace Common\Service; use Common\Common\Msg; use Common\Model\TeacherModel; class TeacherService extends AbstractService { // 构造方法 public function __construct() { $this->_d = new TeacherModel(); parent::__construct(); } /** * 发送讲师通知 * @author zhonglei * @param array $teacher 讲师数据 * @return void */ public function sendTeacherNotice($teacher) { $url = oaUrl('Frontend/Index/Teacher/Index'); $time = rgmdate(MILLI_TIME, 'Y-m-d H:i'); $desc = "指定时间:{$time}"; if ($teacher['title_id'] > 0) { $dictServ = new DictService(); $dict = $dictServ->get($teacher['title_id']); if (!empty($dict)) { $title = $dict['value']; $desc .= "\n头衔:{$title}"; } } $msg_data = [ [ 'title' => '【讲师通知】您已经被指定为企业内部讲师', 'description' => $desc, 'url' => $url, ] ]; $msgServ = &Msg::instance(); $msgServ->sendNews($teacher['uid'], null, null, $msg_data); } /** * 获取讲师头像Url * @author zhonglei * @param array $teacher 讲师数据 * @return string */ public static function getFaceUrl($teacher = []) { if (\is_array($teacher) && isset($teacher['face_url']) && !empty($teacher['face_url'])) { return $teacher['face_url']; } return cfg('USER_FACE_URL'); } }