add create_at and update_at to temp commits

This commit is contained in:
alan snape 2016-12-30 07:20:15 +00:00
parent 17c2072661
commit ffe9ad4ed3
3 changed files with 18 additions and 0 deletions

View File

@ -59,12 +59,14 @@ class MissionsController < ApplicationController
#Todo
id = params[:id]
body = request.body.read
now = Datetime.now
mission = Mission.find(id)
mission.name = body[:name]
mission.content = body[:content]
mission.priority = body[:priority]
mission.status = body[:status]
mission.deadline = body[:deadline]
mission.updated_at = now
mission.save!
pid = mission.project_id
Mission_user.destory_all(:mission_id => id)
@ -78,6 +80,8 @@ class MissionsController < ApplicationController
note.project_id = pid
note.user_id = uid
note.category = 3
note.created_at = now
note.updated_at = now
note.content = "任务信息发生了变化"
note.save!
end
@ -93,6 +97,9 @@ class MissionsController < ApplicationController
put.content = body[:content]
put.mission_id = body[:mission_id]
put.user_id = session[:user_id]
now = Datetime.now
put.created_at = now
put.updated_at = now
put.save!
render :json => {:code => 0}
end

View File

@ -37,6 +37,9 @@ class ProjectsController < ApplicationController
project = Project.new()
project.content = body[:content]
project.name = body[:name]
now = Datetime.now
project.created_at = now
project.updated_at = now
project.save!
render :json => {:code => 0}
end
@ -58,6 +61,9 @@ class ProjectsController < ApplicationController
note.category = 2
note.content = User.find(uid).name + "邀请您进入项目" +
Project.find(pid).name
now = Datetime.now
note.created_at = now
note.updated_at = now
note.save!
render :json => {:code => 0}
end

View File

@ -9,10 +9,13 @@ class SharesController < ApplicationController
body = request.body.read
uid = session[:user_id].to_i
pid = body[:project_id].to_i
now = Datetime.now
put = Share.new()
put.content = body[:content]
put.project_id = pid
put.user_id = uid
put.created_at = now
put.updated_at = now
put.save!
content = User.find(uid).name + "分享了一些事"
Project_user.where(:project_id => pid).each do |tuid|
@ -21,6 +24,8 @@ class SharesController < ApplicationController
note.project_id = pid
note.category = 1
note.content = content
note.created_at = now
note.updated_at = now
note.save!
end
render :json => {:code => 0}