|
@@ -73,4 +73,30 @@ class NoticeService extends BaseService
|
|
|
|
|
|
|
|
return $datas;
|
|
return $datas;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取详情
|
|
|
|
|
+ * @param $id
|
|
|
|
|
+ * @return array|mixed
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getInfo($id)
|
|
|
|
|
+ {
|
|
|
|
|
+ $cacheKey = "caches:notices:info_{$id}";
|
|
|
|
|
+ $info = RedisService::get($cacheKey);
|
|
|
|
|
+ if($info){
|
|
|
|
|
+ return $info;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $info = $this->model->where(['id'=> $id,'status'=>1,'mark'=>1])
|
|
|
|
|
+ ->select(['id','title','author','content','create_time','type'])
|
|
|
|
|
+ ->first();
|
|
|
|
|
+ $info = $info? $info->toArray() : [];
|
|
|
|
|
+ if($info){
|
|
|
|
|
+ $info['create_time'] = $info['create_time']? datetime($info['create_time'],'Y-m-d') : '';
|
|
|
|
|
+ $info['content'] = get_format_content($info['content']);
|
|
|
|
|
+ RedisService::set($cacheKey, $info, rand(5,10));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $info;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|