瀏覽代碼

wesmiler 报恩寺项目提交

wesmiler 4 年之前
父節點
當前提交
cf54ef6ced
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      app/Services/ArticleService.php

+ 6 - 0
app/Services/ArticleService.php

@@ -12,6 +12,7 @@
 namespace App\Services;
 
 use App\Models\ArticleModel;
+use App\Models\MemberModel;
 
 /**
  * 文章管理-服务类
@@ -207,6 +208,11 @@ class ArticleService extends BaseService
             $info['thumb'] = $info['thumb']? get_image_url($info['thumb']) : '';
             $info['publish_at'] = $info['publish_at']? $info['publish_at'] : datetime( $info['create_time'],'Y-m-d H:i:s');
 
+            $info['author'] = '报恩寺';
+            if($info['user_id']){
+                $author = MemberModel::where(['id'=> $info['user_id']])->value('nickname');
+                $info['author'] = $author? $author : '报恩寺';
+            }
         }
         return $info;
     }