|
|
@@ -117,6 +117,31 @@ class ArticleService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取详情
|
|
|
+ * @param $id
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getDetail(){
|
|
|
+ $id = resuest()->get('id', 0);
|
|
|
+ if($id<=0){
|
|
|
+ return message(1006, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ $info = $this->model::from('article as a')
|
|
|
+ ->leftJoin('article_cates as c','c.id','=','a.cate_id')
|
|
|
+ ->where(['id'=> $id,'mark'=> 1,'status'=> 1])
|
|
|
+ ->select(['a.*','c.name as cate_name'])
|
|
|
+ ->first();
|
|
|
+ $info = $info? $info->toArray() :[];
|
|
|
+ if($info){
|
|
|
+ $info['thumb'] = $info['thumb']? get_image_url($info['thumb']) : '';
|
|
|
+ $info['create_time'] = $info['create_time']? datetime($info['create_time'], 'Y-m-d H:i:s') : '';
|
|
|
+ }
|
|
|
+
|
|
|
+ return message(1005, true, $info);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 访问量
|
|
|
* @return mixed
|
|
|
*/
|