TeacherService.class.php
1.66 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
<?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');
}
}