From 57737ff15d7bd698fb77b57a03490c1658a69dc3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 10 Aug 2016 16:08:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/course.rb | 9 ++++ app/api/mobile/entities/project.rb | 10 +++++ app/controllers/members_controller.rb | 8 +++- app/controllers/users_controller.rb | 33 +++++++++++--- app/services/courses_service.rb | 41 ++++++++++++++++- app/services/projects_service.rb | 26 +++++++++++ app/services/syllabuses_service.rb | 2 +- app/services/wechat_service.rb | 36 ++++++++++++++- config/wechat.yml.template | 2 + config/wechat.yml.test | 2 + public/assets/wechat/activities.html | 44 +++++++------------ public/assets/wechat/blog_detail.html | 6 +-- public/assets/wechat/course_discussion.html | 6 +-- public/assets/wechat/course_notice.html | 4 +- public/assets/wechat/homework_detail.html | 6 +-- public/assets/wechat/issue_detail.html | 4 +- public/assets/wechat/jour_message_detail.html | 6 +-- public/assets/wechat/login_tip.html | 0 public/assets/wechat/project.html | 8 ++-- public/assets/wechat/project_discussion.html | 6 +-- public/assets/wechat/reg.html | 5 ++- .../wechat/controllers/review_class_member.js | 7 ++- .../controllers/review_project_member.js | 7 ++- .../wechat/directives/form_validate.js | 14 ++++++ public/javascripts/wechat/others/factory.js | 12 +++++ 25 files changed, 236 insertions(+), 68 deletions(-) create mode 100644 public/assets/wechat/login_tip.html diff --git a/app/api/mobile/entities/course.rb b/app/api/mobile/entities/course.rb index 925c4d7a7..fc78cc14e 100644 --- a/app/api/mobile/entities/course.rb +++ b/app/api/mobile/entities/course.rb @@ -76,6 +76,15 @@ module Mobile end can_setting end + expose :is_member, if: lambda { |instance, options| options[:user] } do |instance, options| + current_user = options[:user] + if instance[:course] + course = instance[:course] + else + course = instance + end + current_user.member_of_course?(course) + end expose :teacher, using: Mobile::Entities::User do |c, opt| if c.is_a? ::Course c.teacher diff --git a/app/api/mobile/entities/project.rb b/app/api/mobile/entities/project.rb index 073f7cd0f..8da151b42 100644 --- a/app/api/mobile/entities/project.rb +++ b/app/api/mobile/entities/project.rb @@ -23,6 +23,16 @@ module Mobile current_user.id == instance.user_id end + expose :is_member, if: lambda { |instance, options| options[:user] } do |instance, options| + current_user = options[:user] + if instance[:project] + project = instance[:project] + else + project = instance + end + current_user.member_of?(project) + end + expose :member_count, if: lambda { |instance, options| options[:user] } do |instance, options| instance.members.count diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index f14416442..d661350c6 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -84,7 +84,8 @@ class MembersController < ApplicationController # 添加成功后,申请人收到消息 AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id , :status => 6, :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id) - + ps = ProjectsService.new + ps.send_wechat_join_project_notice user,project,ap_role,0 # 添加成功后,批准人收到消息 # AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id , # :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) @@ -114,6 +115,11 @@ class MembersController < ApplicationController @applied_message = AppliedMessage.find(params[:applied_message_id]) # AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5, # :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id) + ps = ProjectsService.new + user = User.find(@applied_message.applied_user_id) + ap_role = applied_project.try(:role) + ps.send_wechat_join_project_notice user,project,ap_role,1 + applied_project.delete end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2f1d6a4db..f721f6b8a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -352,14 +352,14 @@ class UsersController < ApplicationController def dealwith_apply_request @msg = CourseMessage.find(params[:msg_id]) #CourseMessage content存的是role 7教辅 9 教师 + apply_user = User.find(@msg.course_message_id) + ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色 + integer_ids = [] + ids.each do |role_id| + integer_ids << role_id.to_i + end case params[:agree] when 'Y' - apply_user = User.find(@msg.course_message_id) - ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色 - integer_ids = [] - ids.each do |role_id| - integer_ids << role_id.to_i - end if apply_user.member_of_course?(Course.find(@msg.course_id)) #将角色改为老师或者教辅 member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0] @@ -382,11 +382,32 @@ class UsersController < ApplicationController Course.find(@msg.course_id).members << members CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1) @msg.update_attributes(:status=>1,:viewed=>1) + + if integer_ids.include?(9) + cs = CoursesService.new + c = Course.find(@msg.course_id) + cs.send_wechat_join_class_notice apply_user,c,9,0 + else + cs = CoursesService.new + c = Course.find(@msg.course_id) + cs.send_wechat_join_class_notice apply_user,c,7,0 + end end when 'N' CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2) @msg.update_attributes(:status=>2,:viewed=>1) + + if integer_ids.include?(9) + cs = CoursesService.new + c = Course.find(@msg.course_id) + cs.send_wechat_join_class_notice apply_user,c,9,1 + else + cs = CoursesService.new + c = Course.find(@msg.course_id) + cs.send_wechat_join_class_notice apply_user,c,7,1 + end + end respond_to do |format| format.js diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 73ca91590..81fe9c5f4 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -108,14 +108,14 @@ class CoursesService end #双重身份 学生列表中不显示 - unless (params[:role] == '2' && role_ids.length >= 2) + # unless (params[:role] == '2' && role_ids.length >= 2) users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender, :work_unit => work_unit, :mail => m.user.mail, :location => location, role_name: m.roles.first.name, name: m.user.show_name, roles_id: role_ids.include?(7) ? 7 : (role_ids.include?(9) ? 9 : 10 ), :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname} - end + # end end users @@ -223,16 +223,20 @@ class CoursesService end if integer_ids.include?(9) message = "您已同意教师"+apply_user.show_name+",加入班级" + send_wechat_join_class_notice apply_user,c,9,0 else message = "您已同意助教"+apply_user.show_name+",加入班级" + send_wechat_join_class_notice apply_user,c,7,0 end else CourseMessage.create(:user_id => apply_user.id, :course_id => c.id, :viewed => false,:content=> messages.content,:course_message_id=>current_user.id,:course_message_type=>'CourseRequestDealResult',:status=>2) messages.update_attributes(:status=>2,:viewed=>1) if integer_ids.include?(9) message = "您已拒绝教师"+apply_user.show_name+",加入班级" + send_wechat_join_class_notice apply_user,c,9,1 else message = "您已拒绝助教"+apply_user.show_name+",加入班级" + send_wechat_join_class_notice apply_user,c,7,1 end end status = 0 @@ -528,6 +532,37 @@ class CoursesService {:state => @state,:course => course} end + #加入班级结果 + def send_wechat_join_class_notice user,course,role_id,result + 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 + if role_id == 10 && result == 0 + title = "恭喜您加入班级成功。" + ws.join_class_notice user.id, "class", course.id,title, course.syllabus.name,course.name,course.teacher.show_name, "点击查看班级详情。" + else + + role_name = role_id == 7 ? "助教" : "教师" + result_name = result == 0 ? "通过" : "被拒绝" + content = "您以"+role_name+"身份加入班级的申请已"+result_name+"。" + + if result == 0 + title = "恭喜您加入班级成功。" + remark = "点击查看班级详情。" + uid = 0 + type = "class" + else + title = "很遗憾您未能成功加入班级。" + remark = "点击查看申请详情。" + uid = user.id + type = "review_class_member" + end + ws = WechatService.new + ws.class_notice user.id, type, course.id, title, course.name, user.show_name, format_time(Time.now), content, remark,uid + end + end + end + #多个角色加入课程 def join_course_roles params,current_user course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code] @@ -587,6 +622,7 @@ class CoursesService course.members << members StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) @state = 0 + send_wechat_join_class_notice current_user,course,10,0 else is_stu = false if role_ids.include?("10") @@ -595,6 +631,7 @@ class CoursesService course.members << members StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id) is_stu = true + send_wechat_join_class_notice current_user,course,10,0 end #如果已经发送过消息了,那么就要给个提示 if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{current_user.id} and course_id = #{course.id} and status = 0").count != 0 diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb index 4de9143bf..2b72fed69 100644 --- a/app/services/projects_service.rb +++ b/app/services/projects_service.rb @@ -117,6 +117,27 @@ class ProjectsService ] end + #加入项目结果 + def send_wechat_join_project_notice user,project,role_id,result + count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count + if count == 0 + result_name = result == 0 ? "已同意" : "已拒绝" + if result == 0 + title = "恭喜您加入项目成功。" + remark = "点击查看项目详情。" + uid = 0 + type = "project" + else + title = "很遗憾您未能成功加入项目。" + remark = "点击查看申请详情。" + uid = user.id + type = "review_project_member" + end + ws = WechatService.new + ws.join_project_notice user.id, "project", project.id,title, project.name,result_name, remark,uid + end + end + def join_project params,current_user status = -1 project = Project.find_by_invite_code(params[:invite_code]) if params[:invite_code] @@ -146,6 +167,7 @@ class ProjectsService project.project_infos << project_info status = 0 + send_wechat_join_project_notice current_user,project,5,0 else if !AppliedProject.where(:project_id => project.id, :user_id => current_user.id).first.nil? status = 8 @@ -271,6 +293,8 @@ class ProjectsService message = "您已同意"+rolename+user.show_name+",加入项目" + send_wechat_join_project_notice user,project,ap_role,0 + else #拒绝 AppliedMessage.create(:user_id => user.id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4, @@ -280,6 +304,8 @@ class ProjectsService applied_project.delete message = "您已拒绝"+rolename+user.show_name+",加入项目" + + send_wechat_join_project_notice user,project,ap_role,1 end status = 0 diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index fcb70653b..9ca7457a0 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -72,7 +72,7 @@ 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, 0, "点击查看班级详情。" + ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 1, "点击查看班级详情。" end end diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index 9a6351391..4b120eaa0 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -111,11 +111,15 @@ class WechatService end end - def two_keys_template(openid, template_id, type, id, first, key1, key2, remark="") + def two_keys_template(openid, template_id, type, id, first, key1, key2, remark="",uid) + tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}" + if uid && uid != 0 + tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s + end data = { touser:openid, template_id:template_id, - url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}",#/assets/wechat/app.html#/#{type}/#{id} + url:tmpurl,#/assets/wechat/app.html#/#{type}/#{id} topcolor:"#FF0000", data:{ first: { @@ -292,6 +296,19 @@ class WechatService end end + def join_class_notice(user_id, type, id, first, key1, key2, key3,remark="") + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = three_keys_template uw.openid,Wechat.config.join_class_notice, type, id, first, key1, key2, key3, remark + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[join_class__notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + end + def create_class_notice(user_id, type, id, first, key1, key2, key3, remark="") uw = UserWechat.where(user_id: user_id).first unless uw.nil? @@ -383,4 +400,19 @@ class WechatService end end + def join_project_notice(user_id, type, id, first, key1, key2,remark="",uid=0) + uw = UserWechat.where(user_id: user_id).first + unless uw.nil? + data = two_keys_template uw.openid,Wechat.config.join_project_notice, type, id, first, key1, key2,remark,uid + begin + req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data) + rescue Exception => e + Rails.logger.error "[join_project_notice] ===> #{e}" + end + Rails.logger.info "send over. #{req}" + end + + + end + end \ No newline at end of file diff --git a/config/wechat.yml.template b/config/wechat.yml.template index 68e6ed62e..f55640d97 100644 --- a/config/wechat.yml.template +++ b/config/wechat.yml.template @@ -23,6 +23,8 @@ default: &default create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw" create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs" project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E" + join_class_notice: "0V2vhhp5co7drgoyqn3WXUUTQ9xwYrnVcMma7ika6o0" + join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg" production: <<: *default diff --git a/config/wechat.yml.test b/config/wechat.yml.test index 8dbd9850f..a49282c1a 100644 --- a/config/wechat.yml.test +++ b/config/wechat.yml.test @@ -23,6 +23,8 @@ default: &default create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I" create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig" project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc" + join_class__notice: "umHZyT8n6KPf3emf4sTJ66I8OB_TJTzjYhxDbJUgUis" + join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M" production: <<: *default diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index fbdfb1152..a4aa9a4c7 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -26,8 +26,7 @@
@@ -64,8 +63,7 @@
@@ -100,8 +98,7 @@
@@ -136,7 +133,7 @@
- +
@@ -153,8 +150,7 @@
@@ -192,8 +188,7 @@
@@ -226,7 +221,7 @@
- +
@@ -243,8 +238,7 @@
@@ -280,8 +274,7 @@
@@ -326,8 +319,7 @@
@@ -364,8 +356,7 @@
@@ -400,8 +391,7 @@
@@ -436,7 +426,7 @@
- +
@@ -460,8 +450,7 @@
@@ -499,8 +488,7 @@
@@ -533,7 +521,7 @@
- +
diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index ee9e968d2..7df2cb237 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -8,7 +8,7 @@
@@ -38,7 +38,7 @@
{{journal.lasted_comment}}
@@ -48,7 +48,7 @@
点击展开更多楼层
{{reply_bottom.lasted_comment}}
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 9ef7bc429..a59294791 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -8,7 +8,7 @@
@@ -36,7 +36,7 @@
{{journal.lasted_comment}}
@@ -47,7 +47,7 @@
点击展开更多楼层
{{reply_bottom.lasted_comment}}
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index b2771100b..73f6bcfb0 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -7,7 +7,7 @@
@@ -35,7 +35,7 @@
{{comments.created_on}}
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 599774dfc..43d120950 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -7,7 +7,7 @@
@@ -40,7 +40,7 @@
{{journal.lasted_comment}}
@@ -51,7 +51,7 @@
点击展开更多楼层
{{reply_bottom.lasted_comment}}
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 852103b81..927de8432 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -8,7 +8,7 @@
@@ -41,7 +41,7 @@
{{journal.created_on}}
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html index 78760da71..1c004aa59 100644 --- a/public/assets/wechat/jour_message_detail.html +++ b/public/assets/wechat/jour_message_detail.html @@ -7,7 +7,7 @@
@@ -36,7 +36,7 @@
{{journal.lasted_comment}}
@@ -46,7 +46,7 @@
点击展开更多楼层
{{reply_bottom.lasted_comment}}
diff --git a/public/assets/wechat/login_tip.html b/public/assets/wechat/login_tip.html new file mode 100644 index 000000000..e69de29bb diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html index f6fcb4b49..3af3ce9c6 100644 --- a/public/assets/wechat/project.html +++ b/public/assets/wechat/project.html @@ -15,8 +15,7 @@
@@ -54,8 +53,7 @@
@@ -88,7 +86,7 @@
- +
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index cc3d4b1c8..0db2393ad 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -7,7 +7,7 @@
@@ -37,7 +37,7 @@
{{journal.lasted_comment}}
@@ -47,7 +47,7 @@
点击展开更多楼层
{{reply_bottom.lasted_comment}}
diff --git a/public/assets/wechat/reg.html b/public/assets/wechat/reg.html index 26a17931f..71b05a399 100644 --- a/public/assets/wechat/reg.html +++ b/public/assets/wechat/reg.html @@ -27,9 +27,10 @@
diff --git a/public/javascripts/wechat/controllers/review_class_member.js b/public/javascripts/wechat/controllers/review_class_member.js index d7f63a9bf..5bf8a36fd 100644 --- a/public/javascripts/wechat/controllers/review_class_member.js +++ b/public/javascripts/wechat/controllers/review_class_member.js @@ -80,6 +80,11 @@ app.controller('ReviewClassMemberController', ['$scope', '$http', 'auth', 'confi }; vm.goClassMemberList = function(){ - $location.path("/class").search({id: course_id,tag: 1}); + if(vm.current_course.is_member){ + $location.path("/class").search({id: course_id,tag: 1}); + } + else{ + $location.path("/class_list"); + } }; }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/review_project_member.js b/public/javascripts/wechat/controllers/review_project_member.js index e74cf0286..2254a8340 100644 --- a/public/javascripts/wechat/controllers/review_project_member.js +++ b/public/javascripts/wechat/controllers/review_project_member.js @@ -92,6 +92,11 @@ app.controller('ReviewProjectMemberController', ['$scope', '$http', 'auth', 'con rms.save("review_master_members",[]); rms.save("review_develop_members",[]); rms.save("tab_num",null); - $location.path("/project").search({id: project_id,tag: 1}); + if(vm.current_project.is_member){ + $location.path("/project").search({id: project_id,tag: 1}); + } + else{ + $location.path("/project_list") + } }; }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/form_validate.js b/public/javascripts/wechat/directives/form_validate.js index 553560c56..7b5657428 100644 --- a/public/javascripts/wechat/directives/form_validate.js +++ b/public/javascripts/wechat/directives/form_validate.js @@ -7,4 +7,18 @@ app.directive('pwdconfirm', function(){ } } } +}); + +app.directive('unconfirm', function(){ + return { + require: 'ngModel', + link: function(scope, elm, attrs, ctrl){ + ctrl.$validators.unconfirm = function(modelValue, viewValue) { + if(viewValue == ""){ + return true; + } + return (/^[a-zA-Z\d]\w{0,23}[a-zA-Z\d]{0,1}$/.test(viewValue)); + } + } + } }); \ No newline at end of file diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index ad42eb27c..7acea6938 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -95,6 +95,18 @@ app.factory('rms', function(){ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){ var addCommonReply = function(id, type, data, cb){ + //先判断有没有绑定 + $http.post( + '/wechat/is_bind', + {} ///不用传code了,都由服务器来处理 + ).then(function(response){ + console.log(response.data); + if(response.data.status != 0){ + $location.path("/login_tip"); + } + }); + + if(!data.comment || data.comment.length<=0){ return;