fix: some detail for messages
This commit is contained in:
parent
a8c75f3b20
commit
91676492ab
|
@ -26,11 +26,11 @@ POST accounts/remote_register
|
||||||
*示例*
|
*示例*
|
||||||
```bash
|
```bash
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-d "email=2456233122@qq.com" \
|
-d "email=yystopf@163.com" \
|
||||||
-d "password=djs_D_00001" \
|
-d "password=a19960425" \
|
||||||
-d "username=16895620" \
|
-d "username=yystopf" \
|
||||||
-d "platform=forge" \
|
-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]
|
case params[:type]
|
||||||
when 'atme'
|
when 'atme'
|
||||||
Notice::Write::CreateAtmeForm.new(atme_params).validate!
|
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?
|
return render_error if result.nil?
|
||||||
end
|
end
|
||||||
render_ok
|
render_ok
|
||||||
|
@ -27,7 +27,7 @@ class Users::MessagesController < Users::BaseController
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
return render_forbidden unless %w(atme).include?(params[:type])
|
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?
|
return render_error if result.nil?
|
||||||
|
|
||||||
render_ok
|
render_ok
|
||||||
|
@ -38,7 +38,7 @@ class Users::MessagesController < Users::BaseController
|
||||||
|
|
||||||
def read
|
def read
|
||||||
return render_forbidden unless %w(notification atme).include?(params[:type])
|
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?
|
if result.nil?
|
||||||
render_error
|
render_error
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class Notice::Write::ChangeStatusService < Notice::Write::ClientService
|
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
|
@notification_ids = notification_ids
|
||||||
@receiver = receiver
|
@receiver = receiver
|
||||||
|
@type = type
|
||||||
@status = status
|
@status = status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ class Notice::Write::ChangeStatusService < Notice::Write::ClientService
|
||||||
Hash.new.merge(data: {
|
Hash.new.merge(data: {
|
||||||
notificationIds: request_notification_ids,
|
notificationIds: request_notification_ids,
|
||||||
receiver: receiver,
|
receiver: receiver,
|
||||||
|
type: type,
|
||||||
status: status
|
status: status
|
||||||
}.stringify_keys)
|
}.stringify_keys)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
class Notice::Write::DeleteService < Notice::Write::ClientService
|
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
|
@notification_ids = notification_ids
|
||||||
@receiver = receiver
|
@receiver = receiver
|
||||||
|
@type = type
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
@ -20,7 +21,8 @@ class Notice::Write::DeleteService < Notice::Write::ClientService
|
||||||
def request_params
|
def request_params
|
||||||
Hash.new.merge(data: {
|
Hash.new.merge(data: {
|
||||||
notificationIds: request_notification_ids,
|
notificationIds: request_notification_ids,
|
||||||
receiver: receiver
|
receiver: receiver,
|
||||||
|
type: type
|
||||||
}.stringify_keys)
|
}.stringify_keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue