diff --git a/app/api/mobile/apis/blog_comments.rb b/app/api/mobile/apis/blog_comments.rb index bb5758e71..39b6a486a 100644 --- a/app/api/mobile/apis/blog_comments.rb +++ b/app/api/mobile/apis/blog_comments.rb @@ -6,10 +6,17 @@ module Mobile resources :blog_comments do desc "get special topic" - get ':id' do + post ':id' do user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 + blog = BlogComment.find params[:id] - present :data, blog, with: Mobile::Entities::BlogComment,user: user + present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index caabad198..60e00280e 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -200,8 +200,13 @@ module Mobile # course = Course.find(params[:id]) cs = CoursesService.new course = cs.show_course(params,current_user) - present :data, course, with: Mobile::Entities::Course,user: current_user - { status: 0} + + if course[:course][:is_delete] == 1 + {status:-1, message: '该班级不存在或已被删除啦' } + else + present :data, course, with: Mobile::Entities::Course,user: current_user + present :status, 0 + end end end @@ -212,7 +217,7 @@ module Mobile get "homeworks/:id" do cs = CoursesService.new homeworks = cs.homework_list params,current_user - present :data, homeworks, with: Mobile::Entities::Homework + present :data, homeworks, with: Mobile::Entities::Homework,user: current_user present :status, 0 end @@ -259,7 +264,7 @@ module Mobile post ":course_id/attachments" do cs = CoursesService.new count = cs.course_attachments params - present :data, count, with: Mobile::Entities::Attachment + present :data, count, with: Mobile::Entities::Attachment,user: current_user present :status, 0 end @@ -392,8 +397,8 @@ module Mobile authenticate! course = Course.find(params[:course_id]) - exercises = course.exercises.where("exercise_status <> 1").order("created_at desc") - present :data,exercises,with:Mobile::Entities::Exercise + exercises = course.exercises.where("exercise_status <> 1").reorder("created_at desc") + present :data,exercises,with:Mobile::Entities::Exercise,user: current_user present :status,0 end diff --git a/app/api/mobile/apis/issues.rb b/app/api/mobile/apis/issues.rb index 4a6417cb4..36b558652 100644 --- a/app/api/mobile/apis/issues.rb +++ b/app/api/mobile/apis/issues.rb @@ -7,11 +7,17 @@ module Mobile include IssuesHelper desc "get special issuse" - get ':id' do + post ':id' do authenticate! user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 issue = Issue.find params[:id] - present :data, issue, with: Mobile::Entities::Issue,user: user + present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/apis/journal_for_messages.rb b/app/api/mobile/apis/journal_for_messages.rb index 5f2d01185..6ac484513 100644 --- a/app/api/mobile/apis/journal_for_messages.rb +++ b/app/api/mobile/apis/journal_for_messages.rb @@ -6,11 +6,18 @@ module Mobile resources :journal_for_messages do desc "get special journal" - get ':id' do + post ':id' do authenticate! user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 + jour = JournalsForMessage.find params[:id] - present :data, jour, with: Mobile::Entities::Jours,user: user + present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/apis/messages.rb b/app/api/mobile/apis/messages.rb index bab82de8d..ceda5058f 100644 --- a/app/api/mobile/apis/messages.rb +++ b/app/api/mobile/apis/messages.rb @@ -6,11 +6,17 @@ module Mobile resources :messages do desc "get special topic" - get ':id' do + post ':id' do authenticate! user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 message = Message.find params[:id] - present :data, message, with: Mobile::Entities::Message,user: user + present :data, message, with: Mobile::Entities::Message,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/apis/newss.rb b/app/api/mobile/apis/newss.rb index d42177783..6e012ca4b 100644 --- a/app/api/mobile/apis/newss.rb +++ b/app/api/mobile/apis/newss.rb @@ -6,11 +6,17 @@ module Mobile resources :newss do desc "get special news" - get ':id' do + post ':id' do authenticate! user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 news = News.find params[:id] - present :data, news, with: Mobile::Entities::News,user: user + present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb index d5823d5b4..ebfef7f2d 100644 --- a/app/api/mobile/apis/resources.rb +++ b/app/api/mobile/apis/resources.rb @@ -85,12 +85,26 @@ module Mobile requires :token, type: String requires :course_ids, type: Array[Integer] requires :send_id, type: Integer + requires :send_type, type: Integer end post 'send' do authenticate! rs = ResourcesService.new - ori, flag, save_message = rs.send_resource_to_course(current_user,params) + + ori = nil + flag = false + save_message = nil + + case params[:send_type] + when 1 + ori, flag, save_message = rs.send_resource_to_course(current_user,params) + when 2 + ori, flag, save_message = rs.send_homework_to_course(current_user,params) + when 3 + ori, flag, save_message = rs.send_exercise_to_course(current_user,params) + end + if flag present :status, 0 else diff --git a/app/api/mobile/apis/whomeworks.rb b/app/api/mobile/apis/whomeworks.rb index c8377aa0d..db1e7e269 100644 --- a/app/api/mobile/apis/whomeworks.rb +++ b/app/api/mobile/apis/whomeworks.rb @@ -6,11 +6,17 @@ module Mobile resources :whomeworks do desc "get one homework" - get ':id' do + post ':id' do authenticate! user = current_user + + #0一级回复的更多 1 二级回复的更多 + type = params[:type] || 0 + page = params[:page] || 0 homework = HomeworkCommon.find params[:id] - present :data, homework, with: Mobile::Entities::Whomework,user: user + present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page + present :type, type + present :page, page present :status, 0 end end diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 9e2a39a5a..2856354a1 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -25,10 +25,12 @@ module Mobile elsif ac.act_type == "News" ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage" - ac.nil? || ac.act.nil? ? 0 : ac.act.children.count + all_comments = [] + ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count elsif ac.act_type == "Issue" ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count end + when :subject if ac.act_type == "HomeworkCommon" ac.act.name unless ac.nil? || ac.act.nil? diff --git a/app/api/mobile/entities/attachment.rb b/app/api/mobile/entities/attachment.rb index 49cb6bd2b..028ad633d 100644 --- a/app/api/mobile/entities/attachment.rb +++ b/app/api/mobile/entities/attachment.rb @@ -3,6 +3,7 @@ module Mobile class Attachment < Grape::Entity include Redmine::I18n include ActionView::Helpers::NumberHelper + include ApplicationHelper def self.attachment_expose(field) expose field do |f,opt| if f.is_a?(Hash) && f.key?(field) @@ -22,6 +23,7 @@ module Mobile (number_to_human_size(f.filesize)).gsub("ytes", "").to_s when :coursename f.course.nil? ? "" : f.course.name + end end end @@ -36,6 +38,12 @@ module Mobile attachment_expose :file_dir attachment_expose :attafile_size attachment_expose :coursename #所属班级名 + expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options| + current_user = options[:user] + current_user_is_teacher = false + current_user_is_teacher = is_course_teacher(current_user,instance.course) + current_user_is_teacher + end end end end \ No newline at end of file diff --git a/app/api/mobile/entities/blog_comment.rb b/app/api/mobile/entities/blog_comment.rb index 67904d11e..3f58e901f 100644 --- a/app/api/mobile/entities/blog_comment.rb +++ b/app/api/mobile/entities/blog_comment.rb @@ -25,7 +25,9 @@ module Mobile when :act_id u.id when :comment_count - u.children.count + # u.children.count + all_comments = [] + get_all_children(all_comments, u).count end end end @@ -51,7 +53,18 @@ module Mobile blog_comment_expose :praise_count expose :blog_comment_children, using:Mobile::Entities::BlogComment do |c,opt| if c.is_a? (::BlogComment) - c.children.reverse + ##自己的父回复为空 才有子回复 + if !opt[:children] + if c.parent.nil? && opt[:type] == 0 + opt[:children] = true + all_comments = [] + tStart = opt[:page]*5 + tEnd = (opt[:page]+1)*5 - 1 + + all_comments = get_all_children(all_comments, c)[tStart..tEnd] + all_comments + end + end end end expose :has_praise, if: lambda { |instance, options| options[:user] } do |instance, options| @@ -61,6 +74,63 @@ module Mobile has_praise = obj.empty? ? false : true has_praise end + + expose :parents_count, if: lambda { |instance, options| options[:user] } do |instance, options| + parents_reply = [] + parents_reply = get_reply_parents_no_root(parents_reply, instance) + parents_reply.count + end + + expose :parents_reply_bottom, using:Mobile::Entities::BlogComment do |c,opt| + if c.is_a? (::BlogComment) + #取二级回复的底楼层 + parents_reply = [] + parents_reply = get_reply_parents_no_root(parents_reply, c) + if parents_reply.count > 0 && !opt[:bottom] + if opt[:type] == 1 + # opt[:bottom] = true + # parents_reply[opt[:page]..opt[:page]] + else + opt[:bottom] = true + parents_reply[0..0] + end + else + [] + end + end + end + + expose :parents_reply_top, using:Mobile::Entities::BlogComment do |c,opt| + if c.is_a? (::BlogComment) + #取二级回复的顶楼层 + parents_reply = [] + parents_reply = get_reply_parents_no_root(parents_reply, c) + if parents_reply.count > 0 && !opt[:top] + if opt[:type] == 1 + opt[:bottom] = true + tStart = (opt[:page]-1)*5+2 + tEnd = (opt[:page])*5+2 - 1 + + if tEnd >= parents_reply.count - 1 + tEnd = parents_reply.count - 2 + end + + if tStart <= parents_reply.count - 2 + parents_reply = parents_reply.reverse[tStart..tEnd] + parents_reply.reverse + else + [] + end + else + opt[:top] = true + parents_reply = parents_reply.reverse[0..1] + parents_reply.reverse + end + else + [] + end + end + end end end end \ No newline at end of file diff --git a/app/api/mobile/entities/exercise.rb b/app/api/mobile/entities/exercise.rb index 05066f8a4..ce6a2fb39 100644 --- a/app/api/mobile/entities/exercise.rb +++ b/app/api/mobile/entities/exercise.rb @@ -27,6 +27,14 @@ module Mobile expose :exercise_name expose :exercise_description exercise_expose :coursename #所属班级名 + + expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options| + current_user = options[:user] + current_user_is_teacher = false + current_user_is_teacher = is_course_teacher(current_user,instance.course) + current_user_is_teacher + end + end end end diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index 3f1631c96..a5b981c6d 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -98,6 +98,14 @@ module Mobile homework_expose :coursename #所属班级名 + expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options| + if instance[:current_user_is_teacher].nil? + current_user = options[:user] + current_user_is_teacher = false + current_user_is_teacher = is_course_teacher(current_user,instance.course) + current_user_is_teacher + end + end end end end \ No newline at end of file diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb index ef3d09450..b99ea03a5 100644 --- a/app/api/mobile/entities/issue.rb +++ b/app/api/mobile/entities/issue.rb @@ -23,7 +23,9 @@ module Mobile when :issue_status IssueStatus.find(issue.status_id).name when :journals_count - issue.journals.where("notes is not null and notes != ''").count + # issue.journals.where("notes is not null and notes != ''").count + all_comments = [] + get_all_children(all_comments, f).count when :project_name issue.project.name when :praise_count diff --git a/app/api/mobile/entities/jours.rb b/app/api/mobile/entities/jours.rb index 15e22174c..f98d7a9ed 100644 --- a/app/api/mobile/entities/jours.rb +++ b/app/api/mobile/entities/jours.rb @@ -18,7 +18,9 @@ module Mobile when :lasted_comment time_from_now f.created_on when :reply_count - f.children.count + # f.children.count + all_comments = [] + get_all_children(all_comments, f).count when :praise_count get_activity_praise_num(f) when :act_type diff --git a/app/api/mobile/entities/message.rb b/app/api/mobile/entities/message.rb index 051c92886..d58192378 100644 --- a/app/api/mobile/entities/message.rb +++ b/app/api/mobile/entities/message.rb @@ -30,6 +30,9 @@ module Mobile 'Message' when :act_id u.id + when :replies_count + all_comments = [] + get_all_children(all_comments, u).count end end end diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index 4f973d82e..ff1452b1c 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -24,6 +24,9 @@ module Mobile 'News' when :act_id f.id + when :comments_count + all_comments = [] + get_all_children(all_comments, f).count end end elsif f.is_a?(Hash) && !f.key?(field) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index ea305d967..6b1e3010d 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -78,12 +78,7 @@ class WechatsController < ActionController::Base end # When user view URL in the menu button on :view, with: 'http://wechat.somewhere.com/view_url' do |request, view| - uw = user_binded?(request[:FromUserName]) - unless uw - sendBind(request) - else - request.reply.text "#{request[:FromUserName]} view #{view}" - end + request.reply.text "#{request[:FromUserName]} view #{view}" end # When user sent the imsage @@ -147,6 +142,14 @@ class WechatsController < ActionController::Base default_msg(request) end + on :click, with: 'PROJECT' do |request, key| + request.reply.text "此功能正在开发中,很快就会上线,谢谢!" + end + + on :click, with: 'JOIN_PROJECT' do |request, key| + request.reply.text "此功能正在开发中,很快就会上线,谢谢!" + end + on :click, with: 'JOIN_CLASS' do |request, key| uw = user_binded?(request[:FromUserName]) unless uw @@ -218,8 +221,8 @@ class WechatsController < ActionController::Base raise CoursesService::JoinCourseError.message(status[:state]) end - news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!', - content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} } + news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!', + content: "课程名称:#{course.name}\n班级名称:#{course.name}\n任课老师:#{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} } return request.reply.news(news) do |article, n, index| # article is return object url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect" pic_url = "#{ROOT_URL}/images/wechat/class.jpg" @@ -274,7 +277,7 @@ class WechatsController < ActionController::Base user: user ) ws = WechatService.new - ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now)) + ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台!", user.login, format_time(Time.now)) render :json => {status:0, msg: "绑定成功"} rescue Exception=>e render :json => {status: -1, msg: e.message} diff --git a/app/helpers/wechats_helper.rb b/app/helpers/wechats_helper.rb new file mode 100644 index 000000000..5c6b3da8c --- /dev/null +++ b/app/helpers/wechats_helper.rb @@ -0,0 +1,20 @@ +#coding=utf-8 +# + +module WechatsHelper + def include_wechat_jsfile + if Rails.env.production? + javascript_include_tag '/javascripts/wechat/build/app.min.js' + else + wechat_path = File.join(Rails.root, "public", "javascripts", "wechat") + srcs = Rails.application.config.wechat_srcs + paths = [] + srcs.each do |src| + Dir.glob(wechat_path+ "/#{src}" ) do |path| + paths << path[File.join(Rails.root, "public").to_s.size, path.size] + end + end + javascript_include_tag *paths + end + end +end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 39c77de4b..ab4b65f5c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -335,6 +335,7 @@ class CoursesService 8, '您已经是该班级的教师了', 9, '您已经是该班级的教辅了', 10, '您已经是该班级的管理员了', + 11, '该班级不存在或已被删除啦', '未知错误,请稍后再试' ] end @@ -348,6 +349,8 @@ class CoursesService if course if course_endTime_timeout? course @state = 2 + elsif course[:is_delete] == 1 + @state = 11 else if current_user.member_of_course?(course) #如果已经是成员 member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0] @@ -392,7 +395,7 @@ class CoursesService def homework_list params,current_user course = Course.find(params[:id]) if course.is_public != 0 || current_user.member_of_course?(course) - bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC') + bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).reorder('created_at DESC') bids = bids.like(params[:name]) if params[:name].present? homeworks = [] bids.each do |bid| @@ -495,7 +498,7 @@ class CoursesService def course_attachments params result = [] course = Course.find(params[:course_id]) - attachments = course.attachments.where("is_publish = 1").order("created_on desc") + attachments = course.attachments.where("is_publish = 1").reorder("created_on desc") if !params[:name].nil? && params[:name] != "" attachments.each do |atta| result << atta if atta.filename.include?(params[:name]) @@ -632,7 +635,7 @@ class CoursesService :homework_submit_num => bid.student_works.count, :homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid), :student_evaluation_part => get_evaluation_part( bid ,3), - :ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?} + :ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?,:current_user_is_teacher => is_course_teacher} end diff --git a/app/services/resources_service.rb b/app/services/resources_service.rb index bc97437e4..b56da8ad3 100644 --- a/app/services/resources_service.rb +++ b/app/services/resources_service.rb @@ -49,6 +49,125 @@ class ResourcesService [@ori, @flag, @save_message] end + def send_homework_to_course user,params + homework = HomeworkCommon.find params[:send_id].to_i + @ori = homework + course_ids = params[:course_ids] + @flag = false + unless course_ids.nil? + course_ids.each do |course_id| + course = Course.find course_id.to_i + new_homework = HomeworkCommon.new + new_homework.name = homework.name + new_homework.user_id = user.id + new_homework.description = homework.description + new_homework.homework_type = homework.homework_type + new_homework.late_penalty = homework.late_penalty + new_homework.course_id = course.id + new_homework.teacher_priority = homework.teacher_priority + new_homework.anonymous_comment = homework.anonymous_comment + new_homework.quotes = 0 + new_homework.is_open = homework.is_open + homework.attachments.each do |attachment| + att = attachment.copy + att.container_id = nil + att.container_type = nil + att.copy_from = attachment.id + att.save + new_homework.attachments << att + end + homework_detail_manual = homework.homework_detail_manual + homework_detail_programing = homework.homework_detail_programing + homework_detail_group = homework.homework_detail_group + if homework_detail_manual + new_homework.homework_detail_manual = HomeworkDetailManual.new + new_homework_detail_manual = new_homework.homework_detail_manual + new_homework_detail_manual.ta_proportion = homework_detail_manual.ta_proportion + new_homework_detail_manual.comment_status = 0 + new_homework_detail_manual.evaluation_num = homework_detail_manual.evaluation_num + new_homework_detail_manual.absence_penalty = homework_detail_manual.absence_penalty + end + if homework_detail_programing + new_homework.homework_detail_programing = HomeworkDetailPrograming.new + new_homework.homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion + new_homework.homework_detail_programing.language = homework_detail_programing.language + homework.homework_tests.each_with_index do |homework_test| + new_homework.homework_tests << HomeworkTest.new( + input: homework_test.input, + output: homework_test.output + ) + end + end + + if homework_detail_group + new_homework.homework_detail_group = HomeworkDetailGroup.new + new_homework.homework_detail_group.min_num = homework_detail_group.min_num + new_homework.homework_detail_group.max_num = homework_detail_group.max_num + new_homework.homework_detail_group.base_on_project = homework_detail_group.base_on_project + end + if new_homework.save + new_homework_detail_manual.save if new_homework_detail_manual + new_homework.homework_detail_programing.save if new_homework.homework_detail_programing + new_homework.homework_detail_group.save if new_homework.homework_detail_group + @flag = true + else + @flag = false + @save_message = new_homework.errors.full_messages + break + end + homework.update_column(:quotes, homework.quotes+1) + end + end + [@ori, @flag, @save_message] + end + + def send_exercise_to_course user,params + # send_id = params[:send_id] + # @ori = Attachment.find_by_id(send_id) + # course_ids = params[:course_ids] + # @flag = false + # unless course_ids.nil? + # course_ids.each do |id| + # next if @ori.blank? + # @exist = false + # Course.find(id).attachments.each do |att| #如果课程中包含该资源 + # if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from + # att.created_on = Time.now + # att.save + # @exist = true + # @flag = true + # break + # end + # end + # next if @exist + # attach_copied_obj = @ori.copy + # attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联 + # attach_copied_obj.container = Course.find(id) + # attach_copied_obj.created_on = Time.now + # attach_copied_obj.author_id = user.id + # attach_copied_obj.is_public = 0 + # attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from + # if attach_copied_obj.attachtype == nil + # attach_copied_obj.attachtype = 4 + # end + # if attach_copied_obj.save + # # 更新引用次数 + # quotes = @ori.quotes.to_i + 1 + # @ori.update_attribute(:quotes, quotes) unless @ori.nil? + # @ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + # @flag = true + # else + # @flag = false + # @save_message = attach_copied_obj.errors.full_messages + # break + # end + # + # end + # end + + [@ori, @flag, @save_message] + end + # 我的资源-课件 已发布的 def all_course_attachments user diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index d5dec9f88..fcb70653b 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -71,8 +71,8 @@ class SyllabusesService count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count if count == 0 ws = WechatService.new - title = "恭喜您创建班级成功" - ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情" + title = "恭喜您创建班级成功。" + ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情。" end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 2da942ea6..7ac4e99d3 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -229,7 +229,7 @@ class WechatService color:"#707070" }, remark:{ - value:"绑定成功后可使用微信查看Trustie平台最新动态", + value:"绑定成功后可使用微信查看Trustie平台最新动态。", color:"#707070" } } diff --git a/app/views/account/about_us.html.erb b/app/views/account/about_us.html.erb index f990cd64c..a2b1c895b 100644 --- a/app/views/account/about_us.html.erb +++ b/app/views/account/about_us.html.erb @@ -1,4 +1,4 @@ -<%= stylesheet_link_tag 'new_user'%> +<%= stylesheet_link_tag 'css/public'%>