From 5c39b86f66863afb7b79016de18f6e44fec2c369 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 00:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=A7=8B=E7=9A=84=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E4=B9=9F=E5=8F=AF=E4=BB=A5=E6=88=AA=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/attendances_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/weapps/attendances_controller.rb b/app/controllers/weapps/attendances_controller.rb index 7da852393..ea2688cc5 100644 --- a/app/controllers/weapps/attendances_controller.rb +++ b/app/controllers/weapps/attendances_controller.rb @@ -130,8 +130,14 @@ class Weapps::AttendancesController < ApplicationController def end a_end_time = "#{@attendance.attendance_date} #{@attendance.end_time}".to_time - tip_exception("该签到已截止") unless @attendance.current_attendance? - @attendance.update!(end_time: Time.current) + tip_exception("该签到已截止") if a_end_time < Time.now + + a_start_time = "#{@attendance.attendance_date} #{@attendance.start_time}".to_time + if a_start_time > Time.now + @attendance.update!(end_time: Time.current, start_time: Time.current) + else + @attendance.update!(end_time: Time.current) + end render_ok end