FengR 9 сар өмнө
parent
commit
0be05e0606

+ 2 - 0
app/JsonRpc/NewsService.php

@@ -435,6 +435,8 @@ class NewsService implements NewsServiceInterface
         },
         },
         'websiteCategory' => function ($query) {
         'websiteCategory' => function ($query) {
           $query->select('website_id', 'category_id', 'alias');
           $query->select('website_id', 'category_id', 'alias');
+        },'user' => function ($query) {
+          $query->select('id', 'nickname');
         }
         }
       ])
       ])
       // 构建where条件
       // 构建where条件

+ 7 - 0
app/Model/Article.php

@@ -35,6 +35,13 @@ class Article extends Model
     public function aricleIgnore()
     public function aricleIgnore()
     {
     {
         return $this->belongsTo(ArticleIgnore::class, 'id', 'article_id');
         return $this->belongsTo(ArticleIgnore::class, 'id', 'article_id');
+    }
+     /**
+     * 定义与分类的一对一关系
+     */
+    public function user()
+    {
+        return $this->hasOne(User::class, 'id', 'admin_user_id');
     }
     }
     /**
     /**
      * The attributes that are mass assignable.
      * The attributes that are mass assignable.