From 60c8320f824f51e11f0ece75256d1e27e82fcc14 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 7 Apr 2016 15:42:08 +0800 Subject: [PATCH] =?UTF-8?q?praise=20api=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/api.rb | 2 ++ app/api/mobile/apis/praise.rb | 2 +- public/javascripts/wechat/app.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 7235a447b..23014b0c1 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -15,6 +15,7 @@ module Mobile require_relative 'apis/messages' require_relative 'apis/blog_comments' require_relative 'apis/new_comment' + require_relative 'apis/praise' class API < Grape::API version 'v1', using: :path @@ -56,6 +57,7 @@ module Mobile mount Apis::Messages mount Apis::BlogComments mount Apis::NewComment + mount Apis::Praise #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? diff --git a/app/api/mobile/apis/praise.rb b/app/api/mobile/apis/praise.rb index e5577eeb3..b3bc8f466 100644 --- a/app/api/mobile/apis/praise.rb +++ b/app/api/mobile/apis/praise.rb @@ -15,7 +15,7 @@ module Mobile obj_id = params[:id] obj_type = params[:type] user = UserWechat.find_by_openid(params[:openid]).user - obj = find_object_by_type_and_id(obj_id,obj_type) + obj = PraiseTreadCache.find_object_by_type_and_id(obj_id,obj_type) pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",obj_id,obj_type.to_s,user.id) if pts.empty? praise_or_cancel(obj_type,obj_id,user,1) diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index cfbda146e..0d79caaed 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -148,7 +148,7 @@ app.factory('common', function($http, auth, $routeParams){ url: apiUrl + "praise/" + act.act_id, data:{openid:auth.openid(),type:act.act_type} }).then(function successCallback(response) { - console.log("η‚Ήθ΅žζˆεŠŸ"); + console.log(response.data); }, function errorCallback(response) { });