From 5d3c49f1972f643f3fa106395fbe221a32e9c7d9 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 22 Jun 2019 10:19:56 +0800 Subject: [PATCH] fix user homepage info api --- app/decorators/user_decorator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 0ee9a4b43..a0f9f7fdd 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -39,19 +39,19 @@ module UserDecorator apply = ApplyAction.order(created_at: :desc).find_by(user_id: id, container_type: 'TrialAuthorization') - apply && !apply.status.zero? + apply.present? && !apply.status.zero? end # 是否已经签到 def attendance_signed? attendance = Attendance.find_by(user_id: id) - attendance && Util.days_between(Time.zone.now, attendance.created_at).zero? + attendance.present? && Util.days_between(Time.zone.now, attendance.created_at).zero? end # 明日签到金币 def tomorrow_attendance_gold - Attendance.find_by(user_id: id)&.next_gold + Attendance.find_by(user_id: id)&.next_gold || 50 end # ----------- 账号管理 -------------