正在显示
1 个修改的文件
包含
27 行增加
和
0 行删除
@@ -88,6 +88,8 @@ class LeaveController extends RestBaseController | @@ -88,6 +88,8 @@ class LeaveController extends RestBaseController | ||
88 | } elseif ($this->userId && $this->userType == 3) {//信贷员 | 88 | } elseif ($this->userId && $this->userType == 3) {//信贷员 |
89 | $condition['l.to_uid|l.from_uid'] = $this->userId; | 89 | $condition['l.to_uid|l.from_uid'] = $this->userId; |
90 | $field = 'l.id,l.to_uid,from.avatar,from.user_nickname name,content,l.create_time'; | 90 | $field = 'l.id,l.to_uid,from.avatar,from.user_nickname name,content,l.create_time'; |
91 | + //将该业务员的 留言都改为已读状态 | ||
92 | + Db::name('leave')->where(['to_uid|from_uid' => $this->userId])->update(['is_read' => 1]); | ||
91 | } | 93 | } |
92 | $result = Db::name('leave') | 94 | $result = Db::name('leave') |
93 | ->alias('l') | 95 | ->alias('l') |
@@ -108,6 +110,31 @@ class LeaveController extends RestBaseController | @@ -108,6 +110,31 @@ class LeaveController extends RestBaseController | ||
108 | $result[$k]['create_time'] = date('Y-m-d',strtotime($v['create_time'])); | 110 | $result[$k]['create_time'] = date('Y-m-d',strtotime($v['create_time'])); |
109 | } | 111 | } |
110 | } | 112 | } |
113 | + | ||
111 | $this->success('获取成功',$result); | 114 | $this->success('获取成功',$result); |
112 | } | 115 | } |
116 | + | ||
117 | + /** | ||
118 | + * @title 留言板(是否有红点) | ||
119 | + * @description 位置:名片详情 | ||
120 | + * @url /wxapp/leave/getUnread | ||
121 | + * @method POST | ||
122 | + * | ||
123 | + * @header name:XX-Token type:string require:1 default:abc other: desc:登录标识 | ||
124 | + * @header name:XX-Device-Type type:string require:0 default:wxapp other: desc:设备类型 | ||
125 | + * | ||
126 | + * @return is_unread:1未读 0已读 | ||
127 | + */ | ||
128 | + public function getUnread() { | ||
129 | + $condition['parent_id'] = 0; | ||
130 | + $condition['is_read'] = 0; | ||
131 | + $condition['to_uid|from_uid'] = $this->userId; | ||
132 | + $result = Db::name('leave')->where($condition)->field('is_read')->find(); | ||
133 | + if($result) { | ||
134 | + $is_unread = 1; | ||
135 | + } else { | ||
136 | + $is_unread = 0; | ||
137 | + } | ||
138 | + $this->success('获取成功',['is_unread',$is_unread]); | ||
139 | + } | ||
113 | } | 140 | } |
-
请 注册 或 登录 后发表评论