File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
packages/slimkit-plus-feed/src/API2 Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 27
27
28
28
class Comment implements ResourceInterface
29
29
{
30
+ /**
31
+ * The comment resource.
32
+ * @var \Zhiyi\Plus\Models\Comment
33
+ */
30
34
protected $ comment ;
35
+
36
+ /**
37
+ * The sender
38
+ * @var \Zhiyi\Plus\Models\User
39
+ */
31
40
protected $ sender ;
32
41
42
+ /**
43
+ * Create the resource.
44
+ * @param \Zhiyi\Plus\Models\Comment $comment
45
+ * @param \Zhiyi\Plus\Models\User $sender
46
+ */
33
47
public function __construct (CommentModel $ comment , UserModel $ sender )
34
48
{
35
49
$ this ->comment = $ comment ;
36
50
$ this ->sender = $ sender ;
37
51
}
38
52
53
+ /**
54
+ * Get the resourceable type.
55
+ * @return string
56
+ */
39
57
public function type (): string
40
58
{
41
59
$ alise = ModelTypes::$ types [CommentModel::class] ?? null ;
@@ -47,11 +65,19 @@ public function type(): string
47
65
return $ alise ;
48
66
}
49
67
68
+ /**
69
+ * Get the resourceable id.
70
+ * @return int
71
+ */
50
72
public function id (): int
51
73
{
52
74
return $ this ->comment ->id ;
53
75
}
54
76
77
+ /**
78
+ * Get the resourceable push message.
79
+ * @return string
80
+ */
55
81
public function message (): string
56
82
{
57
83
return sprintf ('%s在评论中@了你 ' , $ this ->sender ->name );
Original file line number Diff line number Diff line change 25
25
use Zhiyi \Plus \Services \Push ;
26
26
use Zhiyi \Plus \Http \Controllers \Controller ;
27
27
use Zhiyi \Plus \Models \Comment as CommentModel ;
28
+ use Zhiyi \Plus \AtMessage \AtMessageHelperTrait ;
28
29
use Zhiyi \Plus \Models \UserCount as UserCountModel ;
29
30
use Zhiyi \Plus \Packages \Currency \Processes \User as UserProcess ;
30
31
use Zhiyi \Component \ZhiyiPlus \PlusComponentFeed \Models \FeedPinned ;
34
35
35
36
class FeedCommentController extends Controller
36
37
{
38
+ use AtMessageHelperTrait;
39
+
37
40
/**
38
41
* List comments of the feed.
39
42
*
@@ -217,6 +220,9 @@ public function store(
217
220
}
218
221
$ comment ->load ('user ' );
219
222
223
+ // 发送 at 数据
224
+ $ this ->sendAtMessage ($ comment ->body , $ user , $ comment );
225
+
220
226
return $ response ->json ([
221
227
'message ' => '操作成功 ' ,
222
228
'comment ' => $ comment ,
You can’t perform that action at this time.
0 commit comments