xieruidong 2 yıl önce
ebeveyn
işleme
8148e688fa

+ 1 - 1
app/data/controller/api/Xw.php

@@ -93,8 +93,8 @@ class Xw extends Auth
     public function show(){
         $xw=DataXw::show()
             ->withCount(['comments','likes'])
-            ->append(['user'])
             ->where('id',input('id'))->findOrFail();
+        $xw->append(['user']);
         $this->success('',$xw);
     }
 }

+ 4 - 4
app/data/model/DataXw.php

@@ -32,12 +32,12 @@ class DataXw extends Model
     public function scopeShow(Query $query){
         $query->where('status',1);
     }
-    public function getUserAttribute(){
+    public function getUserAttr(){
         static $config;
-        is_null($config) && $config=sysconf('config_xw')?:[];
+        is_null($config) && $config=sysconf('config_xw.')?:[];
         return [
-            'avatar'=>$config['avatar'],
-            'username'=>$config['username'],
+            'avatar'=>$config['user_avatar']??request()->domain().('/static/images/16.jpg'),
+            'username'=>$config['username']??'官方账号',
         ];
     }
 }

BIN
public/static/images/16.jpg