From 02a5e7752de3c712681d6c0ed548e880671fe677 Mon Sep 17 00:00:00 2001 From: txz Date: Fri, 8 Apr 2016 21:46:41 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/wechat/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index a8ba51662..d96164eb0 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,6 +1,6 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = 'http://wechat.trustie.net/api/v1/'; -var debug = true; //调试标志,如果在本地请置为true +var debug = false; //调试标志,如果在本地请置为true if(debug===true){ apiUrl = 'http://localhost:3000/api/v1/'; @@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; if(debug===true){ - _openid = "6"; + _openid = "2"; } var getOpenId = function() { From 930d95f8b56bd02ecf6f084cd91744b7c2794d1c Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 9 Apr 2016 13:29:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1234567 | 2 +- app/api/mobile/apis/activities.rb | 4 ++-- public/assets/wechat/activities.html | 2 +- public/javascripts/wechat/app.js | 26 ++++++++++---------------- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/1234567 b/1234567 index 4354b8b04..1aa01764f 100644 --- a/1234567 +++ b/1234567 @@ -1 +1 @@ -{"access_token":"t3XVpwqZbAO6-uRz_ltKUiplgHcYVstA0p43ECTHEjt0-FvVLU7VXzD7n6Z76PYFWHf8hvNHZtLNAUT-FlTl98wWLIK_lh9mhzHxS_x1iXCc0mC38RjxFzZ_NSeERW7dJZCfADAOEH","expires_in":7200,"got_token_at":1460105603} \ No newline at end of file +{"access_token":"G4QG7VJgF8Vmm71kLgC1XgHvyeXK-ZZrikaG7sPBrKuw6vgbYzV2FPYuNq3wNp7e-hsyfDI--rTlVspQXZk5bRK_CsZl8wWvuiPazV9mznGpOBGE5zVR8WOtvlqhylpHIMBdABABFU","expires_in":7200,"got_token_at":1460179500} \ No newline at end of file diff --git a/app/api/mobile/apis/activities.rb b/app/api/mobile/apis/activities.rb index 7d52da6a1..94ee14a56 100644 --- a/app/api/mobile/apis/activities.rb +++ b/app/api/mobile/apis/activities.rb @@ -33,8 +33,8 @@ module Mobile shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id) page = params[:page] ? params[:page] : 0 - user_project_ids = (user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" - user_course_ids = (user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" + user_project_ids = (user.projects.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.map{|project| project.id}-shield_project_ids).join(",") + ")" + user_course_ids = (user.courses.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.map{|course| course.id}-shield_course_ids).join(",") + ")" course_types = "('Message','News','HomeworkCommon','Poll','Course')" project_types = "('Message','Issue','ProjectCreateInfo')" principal_types = "JournalsForMessage" diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index b6315eb39..376fdcf6a 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -216,7 +216,7 @@
-
更多
+
更多
diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index a8ba51662..2520013d7 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,6 +1,6 @@ var app = angular.module('wechat', ['ngRoute','ngCookies']); var apiUrl = 'http://wechat.trustie.net/api/v1/'; -var debug = true; //调试标志,如果在本地请置为true +var debug = false; //调试标志,如果在本地请置为true if(debug===true){ apiUrl = 'http://localhost:3000/api/v1/'; @@ -77,7 +77,15 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ url: apiUrl+ "activities", data: {openid: auth.openid(), page: page} }).then(function successCallback(response) { - $scope.activities = $scope.activities.concat(response.data.data); + $scope.current_page = 0; + console.log($scope.current_page); + console.log(response.data.page); + if($scope.current_page < response.data.page) { + $scope.activities = $scope.activities.concat(response.data.data); + } else { + $scope.activities = response.data.data; + } + $scope.current_page = response.data.page $scope.all_count = response.data.all_count; $scope.count = response.data.count; console.log(response.data); @@ -97,12 +105,10 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ $scope.loadActData = loadActData; $scope.addPraise = function(act){ - console.log(act); common.addCommonPraise(act); }; $scope.decreasePraise = function(act){ - console.log(act); common.decreaseCommonPraise(act); }; @@ -110,7 +116,6 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ app.factory('common', function($http, auth, $routeParams){ var addCommonReply = function(id, type, data, cb){ - console.log(data.comment); if(!data.comment || data.comment.length<=0){ return; @@ -197,12 +202,10 @@ app.controller('IssueController', function($scope, $http, $routeParams, auth, co }; $scope.addPraise = function(act){ - console.log(act); common.addCommonPraise(act); }; $scope.decreasePraise = function(act){ - console.log(act); common.decreaseCommonPraise(act); }; }); @@ -229,12 +232,10 @@ app.controller('HomeworkController', function($scope, $http, $routeParams, auth, }; $scope.addPraise = function(act){ - console.log(act); common.addCommonPraise(act); }; $scope.decreasePraise = function(act){ - console.log(act); common.decreaseCommonPraise(act); }; }); @@ -261,12 +262,10 @@ app.controller('CourseNoticeController', function($scope, $http, $routeParams, a }; $scope.addPraise = function(act){ - console.log(act); common.addCommonPraise(act); }; $scope.decreasePraise = function(act){ - console.log(act); common.decreaseCommonPraise(act); }; }); @@ -293,12 +292,10 @@ app.controller('DiscussionController', function($scope, $http, $routeParams, aut }; $scope.addPraise = function(act){ - console.log(act); common.addCommonPraise(act); }; $scope.decreasePraise = function(act){ - console.log(act); common.decreaseCommonPraise(act); }; }); @@ -383,9 +380,6 @@ app.directive('textAutoHeight', function($timeout){ var e = element.parent().children().eq(4); var height = e[0].scrollHeight; var offsetHeight = e[0].offsetHeight; - console.log(height); - console.log(offsetHeight); - console.log(attr); if(height>90){ element.css('display', 'block'); element.on('click', function(){ From 3f365e75b58ffa6f5e982bccc0892f5065c30faf Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 9 Apr 2016 14:13:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 4 ++-- public/javascripts/wechat/app.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 7e8aa8b1a..5bfbfec01 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -741,7 +741,7 @@ class Mailer < ActionMailer::Base mail_wechat_message member.user_id, "oKzFCdk7bsIHnGbscA__N8LPQrBkUShvpjV3-kuwWDQ", "项目讨论区有新帖子发布了", message.subject, @author.try(:realname), format_time(message.created_on) end else - mail_wechat_message member.parent.author_id, "A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c", "您的帖子有新回复了", @author.try(:realname), format_time(message.created_on), message.content.html_safe + mail_wechat_message message.parent.author_id, "A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c", "您的帖子有新回复了", @author.try(:realname), format_time(message.created_on), message.content.html_safe end elsif message.course redmine_headers 'Course' => message.course.id, @@ -763,7 +763,7 @@ class Mailer < ActionMailer::Base mail_wechat_message member.user_id, "oKzFCdk7bsIHnGbscA__N8LPQrBkUShvpjV3-kuwWDQ", "课程问答区有新帖子发布了", message.subject, @author.try(:realname), format_time(message.created_on) end else - mail_wechat_message member.parent.author_id, "A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c", "您的帖子有新回复了", @author.try(:realname), format_time(message.created_on), message.content.html_safe + mail_wechat_message message.parent.author_id, "A_3f5v90-zK73V9Kijm-paDkl9S-NuM8Cf-1UJi92_c", "您的帖子有新回复了", @author.try(:realname), format_time(message.created_on), message.content.html_safe end end end diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index f77ca01ce..db460655f 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; if(debug===true){ - _openid = "2"; + _openid = "1"; } var getOpenId = function() { @@ -85,7 +85,7 @@ app.controller('ActivityController',function($scope, $http, auth, rms, common){ } else { $scope.activities = response.data.data; } - $scope.current_page = response.data.page + $scope.current_page = response.data.page; $scope.all_count = response.data.all_count; $scope.count = response.data.count; console.log(response.data); From 007fee95bd11cf2c17820a35edea7a1c9d398d4b Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 9 Apr 2016 14:41:45 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=92=8C=E7=95=99?= =?UTF-8?q?=E8=A8=80=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 10 +++++----- public/javascripts/wechat/app.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 99cc8229b..22bc33cd1 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -257,7 +257,7 @@ class JournalsForMessage < ActiveRecord::Base end end if self.jour_type == 'HomeworkCommon' - journal_wechat_message '您的作业有新回复了' + journal_wechat_message '您的作业有新回复了',self.jour.user_id end end @@ -270,7 +270,7 @@ class JournalsForMessage < ActiveRecord::Base if self.reply_id == 0 if self.user_id != self.jour_id # 过滤自己给自己的留言消息 receivers << self.jour - journal_wechat_message "您有新留言了" + journal_wechat_message "您有新留言了",self.jour_id end else # 留言回复 reply_to = User.find(self.reply_id) @@ -280,7 +280,7 @@ class JournalsForMessage < ActiveRecord::Base if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 receivers << self.parent.jour end - journal_wechat_message "您的留言有新回复了" + journal_wechat_message "您的留言有新回复了",self.reply_id end receivers.each do |r| self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) @@ -308,8 +308,8 @@ class JournalsForMessage < ActiveRecord::Base end #微信模板消息 - def journal_wechat_message type - uw = UserWechat.where(user_id: self.reply_id).first + def journal_wechat_message type, user_id + uw = UserWechat.where(user_id: user_id).first #unless uw.nil? && self.reply_id != User.current.id unless uw.nil? data = { diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index db460655f..25cb0f169 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -10,7 +10,7 @@ app.factory('auth', function($http,$routeParams, $cookies, $q){ var _openid = ''; if(debug===true){ - _openid = "1"; + _openid = "6"; } var getOpenId = function() {