fix: some detail for messages
This commit is contained in:
parent
a8c75f3b20
commit
91676492ab
|
@ -26,11 +26,11 @@ POST accounts/remote_register
|
|||
*示例*
|
||||
```bash
|
||||
curl -X POST \
|
||||
-d "email=2456233122@qq.com" \
|
||||
-d "password=djs_D_00001" \
|
||||
-d "username=16895620" \
|
||||
-d "email=yystopf@163.com" \
|
||||
-d "password=a19960425" \
|
||||
-d "username=yystopf" \
|
||||
-d "platform=forge" \
|
||||
http://localhost:3000/api/accounts/remote_register | jq
|
||||
http://120.132.31.109:8080/api/accounts/remote_register | jq
|
||||
```
|
||||
*请求参数说明:*
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class Users::MessagesController < Users::BaseController
|
|||
case params[:type]
|
||||
when 'atme'
|
||||
Notice::Write::CreateAtmeForm.new(atme_params).validate!
|
||||
result = Notice::Write::CreateService.call(@receivers.pluck(:id), '发送了一个@我消息', base_url, "IssueAtme", 2)
|
||||
result = Notice::Write::CreateService.call(@receivers.pluck(:id), '发送了一个@我消息', base_url, "IssueAtme", 2, {}, current_user.id)
|
||||
return render_error if result.nil?
|
||||
end
|
||||
render_ok
|
||||
|
@ -27,7 +27,7 @@ class Users::MessagesController < Users::BaseController
|
|||
|
||||
def delete
|
||||
return render_forbidden unless %w(atme).include?(params[:type])
|
||||
result = Notice::Write::DeleteService.call(params[:ids], observed_user.id)
|
||||
result = Notice::Write::DeleteService.call(params[:ids], observed_user.id, message_type)
|
||||
return render_error if result.nil?
|
||||
|
||||
render_ok
|
||||
|
@ -38,7 +38,7 @@ class Users::MessagesController < Users::BaseController
|
|||
|
||||
def read
|
||||
return render_forbidden unless %w(notification atme).include?(params[:type])
|
||||
result = Notice::Write::ChangeStatusService.call(params[:ids], observed_user.id)
|
||||
result = Notice::Write::ChangeStatusService.call(params[:ids], observed_user.id, message_type)
|
||||
if result.nil?
|
||||
render_error
|
||||
else
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
class Notice::Write::ChangeStatusService < Notice::Write::ClientService
|
||||
attr_accessor :notification_ids, :receiver, :status
|
||||
attr_accessor :notification_ids, :receiver, :type, :status
|
||||
|
||||
def initialize(notification_ids, receiver, status=2)
|
||||
def initialize(notification_ids, receiver, type=-1, status=2)
|
||||
@notification_ids = notification_ids
|
||||
@receiver = receiver
|
||||
@type = type
|
||||
@status = status
|
||||
end
|
||||
|
||||
|
@ -22,6 +23,7 @@ class Notice::Write::ChangeStatusService < Notice::Write::ClientService
|
|||
Hash.new.merge(data: {
|
||||
notificationIds: request_notification_ids,
|
||||
receiver: receiver,
|
||||
type: type,
|
||||
status: status
|
||||
}.stringify_keys)
|
||||
end
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
class Notice::Write::DeleteService < Notice::Write::ClientService
|
||||
attr_accessor :notification_ids, :receiver
|
||||
attr_accessor :notification_ids, :receiver, :type
|
||||
|
||||
def initialize(notification_ids, receiver)
|
||||
def initialize(notification_ids, receiver, type=-1)
|
||||
@notification_ids = notification_ids
|
||||
@receiver = receiver
|
||||
@type = type
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -20,7 +21,8 @@ class Notice::Write::DeleteService < Notice::Write::ClientService
|
|||
def request_params
|
||||
Hash.new.merge(data: {
|
||||
notificationIds: request_notification_ids,
|
||||
receiver: receiver
|
||||
receiver: receiver,
|
||||
type: type
|
||||
}.stringify_keys)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue