-
+
密码不能为空
From cb6a3e71619422f1d56e8bc3eeac702a85c13d5b Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Wed, 14 Sep 2016 10:26:18 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=85=AC=E4=BC=97?=
=?UTF-8?q?=E5=8F=B7=E7=95=99=E8=A8=80=E5=9B=9E=E5=A4=8D=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/wechats_controller.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb
index cd911bcd6..92864d490 100644
--- a/app/controllers/wechats_controller.rb
+++ b/app/controllers/wechats_controller.rb
@@ -8,13 +8,13 @@ class WechatsController < ActionController::Base
# default text responder when no other match
on :text do |request, content|
#邀请码
- if join_class_request(request)
- sendBindClass(request, {invite_code: content})
- elsif join_project_request(request)
- sendBindProject(request, {invite_code: content})
- else
+ # if join_class_request(request)
+ # sendBindClass(request, {invite_code: content})
+ # elsif join_project_request(request)
+ # sendBindProject(request, {invite_code: content})
+ # else
request.reply.text "您的意见已收到,非常感谢~ \n更多问题可以通过以下方式联系我们:\n官方QQ群:173184401\n我们会认真聆听您的意见和建议。"
- end
+ # end
end
# When receive 'help', will trigger this responder
From 154b77a3a7a016588c9c06ea21334e7ce88858ae Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Wed, 14 Sep 2016 15:10:24 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=8F=AD=E7=BA=A7?=
=?UTF-8?q?=E5=90=8D=E6=94=B9=E4=B8=BA=E8=AF=BE=E7=A8=8B=E5=90=8D=E3=80=82?=
=?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/mobile/entities/activity.rb | 7 +++++++
app/api/mobile/entities/course.rb | 1 +
app/controllers/news_controller.rb | 3 ++-
app/models/homework_common.rb | 3 ++-
app/services/courses_service.rb | 9 ++++++---
app/services/syllabuses_service.rb | 3 ++-
6 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb
index 9deeec58e..b36b8039b 100644
--- a/app/api/mobile/entities/activity.rb
+++ b/app/api/mobile/entities/activity.rb
@@ -73,6 +73,12 @@ module Mobile
elsif ac.container_type == "Blog"
"发表博客"
end
+ when :syllabus_title
+ if ac.container_type == "Course"
+ course = get_course(ac.container_id)
+ name = course.syllabus.nil? ? "":course.syllabus.title
+ name
+ end
when :course_project_id
if ac.container_type == "Course"
ac.container_id
@@ -145,6 +151,7 @@ module Mobile
act_expose :latest_update #最新更新时间
act_expose :course_project_id #课程/项目ID
act_expose :course_project_name #课程/项目名字
+ act_expose :syllabus_title #课程名字
act_expose :activity_type_name #课程问答区/项目缺陷等
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue"
diff --git a/app/api/mobile/entities/course.rb b/app/api/mobile/entities/course.rb
index fc78cc14e..30a5a6cc9 100644
--- a/app/api/mobile/entities/course.rb
+++ b/app/api/mobile/entities/course.rb
@@ -107,6 +107,7 @@ module Mobile
course_expose :current_user_is_member
course_expose :current_user_is_teacher
course_expose :work_unit
+ course_expose :syllabus_title
end
end
end
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 33ff2a248..660e4d76c 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -220,7 +220,8 @@ class NewsController < ApplicationController
if count == 0
ws = WechatService.new
content = @news.title
- ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", @news.course.name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情"
+ name = @news.course.syllabus.nil? ? @news.course.name : @news.course.syllabus.title+" • "+@news.course.name
+ ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情"
end
end
end
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index a901e6338..7a082cecf 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -77,7 +77,8 @@ class HomeworkCommon < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
- ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
+ name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+" • "+self.course.name
+ ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
# end
end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 24e15f369..5add9979d 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -332,7 +332,7 @@ class CoursesService
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
# raise '403'
# end
- {:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
+ {:course => course,:syllabus_title => course.syllabus.nil? ? "":course.syllabus.title ,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
end
#创建课程
@@ -554,8 +554,10 @@ class CoursesService
uid = user.id
type = "review_class_member"
end
+
+ name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
ws = WechatService.new
- ws.class_notice user.id, type, course.id, title, course.name, user.show_name, format_time(Time.now), content, remark,uid
+ ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid
end
end
@@ -650,8 +652,9 @@ class CoursesService
rolename = role_ids.include?("7") ? "助教" : "教师"
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
+ name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
ws = WechatService.new
- ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", course.name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
+ ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
end
end
#--------------------------------------------
diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb
index f12ae67cc..caf6e052e 100644
--- a/app/services/syllabuses_service.rb
+++ b/app/services/syllabuses_service.rb
@@ -69,7 +69,8 @@ class SyllabusesService
if count == 0
ws = WechatService.new
title = "恭喜您创建班级成功。"
- ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 1, "点击查看班级详情。"
+ name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
+ ws.create_class_notice user.id, "create_course_notice", course.id,title, name, user.show_name, 1, "点击查看班级详情。"
end
end