From c02245adfb7c1eca183c64d0f499d5678862b12f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 18:08:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 6 +----- public/javascripts/wechat/controllers/invite_code.js | 2 +- public/javascripts/wechat/others/routes.js | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0467d6220..1765ce23d 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -193,14 +193,10 @@ module Mobile desc "返回单个课程" params do requires :id, type: Integer - optional :token, type: String end route_param :id do get do - authenticate! - cs = CoursesService.new - course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user)) - #course = Course.find(params[:id]) + course = Course.find(params[:id]) present :data, course, with: Mobile::Entities::Course,user: current_user { status: 0} end diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js index 1b92f592c..8ef93b21b 100644 --- a/public/javascripts/wechat/controllers/invite_code.js +++ b/public/javascripts/wechat/controllers/invite_code.js @@ -8,7 +8,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config vm.course = {}; var courseid = $routeParams.id; - $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( + $http.get(config.apiUrl+ 'courses/'+courseid+").then( function(response){ console.log(response.data); vm.course = response.data.data; diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 2c63609b0..a40951bcc 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -35,7 +35,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/edit_class', makeRoute('edit_class.html', 'EditClassController')) .when('/class_list', makeRoute('class_list.html', 'ClassListController')) .when('/myresource', makeRoute('myresource.html', 'MyResourceController')) - .when('/invite_code', makeRoute('invite_code.html', 'InviteCodeController')) + .when('/invite_code', {templateUrl: rootPath + 'invite_code.html', controller: 'InviteCodeController'}) .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .otherwise({ redirectTo: '/activites' @@ -66,4 +66,4 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func } }; }]); -}]); \ No newline at end of file +}]);