微信动态详情回复显示修改

weixin_guange
yuanke 9 years ago
parent bf600e8f76
commit 67e87df4d5

@ -6,7 +6,7 @@ module Mobile
resources :blog_comments do resources :blog_comments do
desc "get special topic" desc "get special topic"
get ':id' do post ':id' do
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多 #0一级回复的更多 1 二级回复的更多
@ -15,6 +15,8 @@ module Mobile
blog = BlogComment.find params[:id] blog = BlogComment.find params[:id]
present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0 present :status, 0
end end
end end

@ -7,11 +7,17 @@ module Mobile
include IssuesHelper include IssuesHelper
desc "get special issuse" desc "get special issuse"
get ':id' do post ':id' do
authenticate! authenticate!
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
issue = Issue.find params[:id] 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 present :status, 0
end end
end end

@ -6,11 +6,18 @@ module Mobile
resources :journal_for_messages do resources :journal_for_messages do
desc "get special journal" desc "get special journal"
get ':id' do post ':id' do
authenticate! authenticate!
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
jour = JournalsForMessage.find params[:id] 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 present :status, 0
end end
end end

@ -6,11 +6,17 @@ module Mobile
resources :messages do resources :messages do
desc "get special topic" desc "get special topic"
get ':id' do post ':id' do
authenticate! authenticate!
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
message = Message.find params[:id] 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 present :status, 0
end end
end end

@ -6,11 +6,17 @@ module Mobile
resources :newss do resources :newss do
desc "get special news" desc "get special news"
get ':id' do post ':id' do
authenticate! authenticate!
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id] 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 present :status, 0
end end
end end

@ -6,11 +6,17 @@ module Mobile
resources :whomeworks do resources :whomeworks do
desc "get one homework" desc "get one homework"
get ':id' do post ':id' do
authenticate! authenticate!
user = current_user user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
homework = HomeworkCommon.find params[:id] 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 present :status, 0
end end
end end

@ -20,17 +20,17 @@ module Mobile
ac.act unless ac.nil? || ac.act.nil? ac.act unless ac.nil? || ac.act.nil?
end end
when :reply_count when :reply_count
# if ac.act_type == "HomeworkCommon" if ac.act_type == "HomeworkCommon"
# ac.nil? || ac.act.nil? ? 0 : ac.act.journals_for_messages.count ac.nil? || ac.act.nil? ? 0 : ac.act.journals_for_messages.count
# elsif ac.act_type == "News" elsif ac.act_type == "News"
# ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count ac.nil? || ac.act.nil? ? 0 : ac.act.comments.count
# elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage" elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
# ac.nil? || ac.act.nil? ? 0 : ac.act.children.count
# elsif ac.act_type == "Issue"
# ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
# end
all_comments = [] all_comments = []
ac.nil? || ac.act.nil? ? 0 : get_all_children(all_comments, ac.act).count 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 when :subject
if ac.act_type == "HomeworkCommon" if ac.act_type == "HomeworkCommon"
ac.act.name unless ac.nil? || ac.act.nil? ac.act.name unless ac.nil? || ac.act.nil?

@ -7,13 +7,25 @@ app.controller('BlogController',
scope: $scope, scope: $scope,
type: 'blog_comments', type: 'blog_comments',
replyType: 'BlogComment', replyType: 'BlogComment',
loadCallback: function(data,replytype,page){ loadCallback: function(data){
console.log(data.data); console.log(data.data);
replytype = data.type;
page = data.page;
if (replytype == 0 && page == 0 ) { if (replytype == 0){
if (page == 0){
$scope.blog = data.data; $scope.blog = data.data;
} }
else{ else{
$scope.blog.blog_comment_children = $scope.blog.blog_comment_children.concat(data.data.blog_comment_children);
}
$scope.has_more = $scope.blog.blog_comment_children.length < $scope.blog.comment_count;
console.log($scope.has_more);
}
else{

@ -121,10 +121,18 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, au
}); });
}; };
var loadCommonData = function(id, type){ // var loadCommonData = function(id, type,replytype,page){
// return $http({
// method: 'GET',
// url: apiUrl+ type + "/" + id+"?token="+auth.token(),
// })
// };
var loadCommonData = function(id, type,replytype,page){
return $http({ return $http({
method: 'GET', method: 'POST',
url: apiUrl+ type + "/" + id+"?token="+auth.token() url: apiUrl+ type + "/" + id,
data:{token:auth.token(),type:replytype,page:page}
}) })
}; };
@ -160,7 +168,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, au
args.scope.formData = {comment: ''}; args.scope.formData = {comment: ''};
var loadData = function(id,replytype,page){ var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) { loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
args.loadCallback(response.data,replytype,page); args.loadCallback(response.data);
}, function errorCallback(response) { }, function errorCallback(response) {
}); });
}; };
@ -245,6 +253,14 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms', function($http, au
act.has_praise = false; act.has_praise = false;
decreaseCommonPraise(act); decreaseCommonPraise(act);
}; };
args.scope.morereply = function(data,replytype,page){
loadCommonData(data.id, args.type,replytype,page).then(function successCallback(response) {
args.loadCallback(response.data);
}, function errorCallback(response) {
});
};
} }
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise}; return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};

Loading…
Cancel
Save