diff --git a/app/common/controller/MessageNoticeController.php b/app/common/controller/MessageNoticeController.php index 1ed13cd..9ffe4ad 100644 --- a/app/common/controller/MessageNoticeController.php +++ b/app/common/controller/MessageNoticeController.php @@ -4,6 +4,8 @@ namespace app\common\controller; use app\common\controller\BaseController; use app\common\model\Post; use app\common\model\PostMedia; +use app\common\model\User; +use app\common\service\OssService; use app\common\traits\crud\CrudControllerTrait; use app\common\service\MessageNoticeService; use support\Request; @@ -54,6 +56,14 @@ class MessageNoticeController extends BaseController $data['post'] = Post::where('id', $data['post_id'])->first(); $data['post']['media'] = PostMedia::where('post_id', $data['post_id'])->get(); } + if (isset($data['sender_user_id'])){ + $ossservice = new OssService(); + $data['sender_user'] = User::where('id', $data['sender_user_id'])->select(['name', 'avatar', 'openid'])->first(); + + if(!str_contains($data['sender_user']['avatar'], 'http') && !empty($data['sender_user']['avatar'])){ + $data['sender_user']['avatar_pull'] = $ossservice->generatePrivateUrl($data['sender_user']['avatar']); + } + } return $data; } } \ No newline at end of file