temp commit share controller
This commit is contained in:
parent
7d3b4fae28
commit
c946352470
|
@ -6,14 +6,33 @@ class SharesController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
#Todo
|
#Todo
|
||||||
|
body = request.body.read
|
||||||
|
put = Share.new()
|
||||||
|
put.content = body[:content]
|
||||||
|
put.project_id = body[:project_id]
|
||||||
|
put.user_id = session[:user_id]
|
||||||
|
put.save!
|
||||||
|
render :json => {:code => 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
#获取项目的分享列表
|
#获取项目的分享列表
|
||||||
|
|
||||||
def getShareList
|
def getShareList
|
||||||
#Todo
|
#Todo
|
||||||
|
pid = params[:project_id]
|
||||||
|
data = []
|
||||||
|
Share.where(:project_id => pid) do |i|
|
||||||
|
name = User.find(i.user_id).name
|
||||||
|
data += [{
|
||||||
|
:nickname => name,
|
||||||
|
:time => i.created_at,
|
||||||
|
:content => i.content
|
||||||
|
}]
|
||||||
|
end
|
||||||
|
render :json => {
|
||||||
|
:code => 0,
|
||||||
|
:data => data
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue