add: notice message skeletal code

This commit is contained in:
2021-09-09 16:32:13 +08:00
parent 8c60ce1d76
commit 86d634d94f
43 changed files with 1696 additions and 236 deletions
+2 -1
View File
@@ -21,4 +21,5 @@ json.province @user.province
json.city @user.city
json.custom_department @user.custom_department
json.description @user.description
json.(@user, :show_email, :show_department, :show_location)
json.(@user, :show_email, :show_department, :show_location)
json.message_unread_total 5
@@ -0,0 +1,22 @@
json.id message["id"]
# json.receiver do
# json.partial! '/users/user_simple', locals: {user: current_user}
# end
json.status message["status"]
json.content message["content"]
json.notification_url message["notification_url"]
json.source message["source"]
case message["type"]
when 1
json.type "notification"
when 2
json.type "atme"
json.sender do
sender = User.find_by_id(message["sender"])
if sender.present?
json.partial! '/users/user_simple', locals: {user: sender}
else
json.nil
end
end
end
@@ -0,0 +1,7 @@
json.total_count @data["records_count"]
json.type %w(notification atme).include?(params[:type]) ? params[:type] : ""
json.unread_notification @data["unread_notification"]
json.unread_atme @data["unread_atme"]
json.messages @data["records"].each do |message|
json.partial! "message", message: message.stringify_keys
end