From ffe9ad4ed30ccdcca0327048c2bcf9ddb65a8a08 Mon Sep 17 00:00:00 2001 From: alan snape Date: Fri, 30 Dec 2016 07:20:15 +0000 Subject: [PATCH] add create_at and update_at to temp commits --- app/controllers/missions_controller.rb | 7 +++++++ app/controllers/projects_controller.rb | 6 ++++++ app/controllers/shares_controller.rb | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/app/controllers/missions_controller.rb b/app/controllers/missions_controller.rb index 5df24ba..da3fa43 100644 --- a/app/controllers/missions_controller.rb +++ b/app/controllers/missions_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0609052..4501cf0 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb index eb9dfca..1825c57 100644 --- a/app/controllers/shares_controller.rb +++ b/app/controllers/shares_controller.rb @@ -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}