praise api的修改
This commit is contained in:
parent
938bf48d08
commit
60c8320f82
|
@ -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?
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue