UNPKG

unserver-unify

Version:

81 lines (71 loc) 2.34 kB
'use strict'; angular.module('bamboo').controller('SidebarCmecCtrl', function($scope, ApiService, loginService, $http,HomeService, $resource) { var _self = this; var loginhistory = []; this.displayhistory = []; this.topusers = 12; /* this.getStockQuote = function(ticker) { var url = 'https://query.yahooapis.com/v1/public/yql'; var data = encodeURIComponent("select * from yahoo.finance.quotes where symbol in ('" + ticker + "')"); url += '?q=' + data + '&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys'; //return $resource(url); $http.get(url).then(function(response) { console.log(response); $scope.stockData = response.data; }, function(response) { console.log(response); }); } _self.getStockQuote("1829.HK"); */ var serviceFunctions = []; function getAnnouncement(callback) { HomeService.getAnnouncementNames(function(err, items) { $scope.announcementnames = items.reverse(); return callback(); }); } function getSchoolLogin(callback) { HomeService.getLatestSchoolLogin(function(err, items) { console.log(items); _self.lastloginusers = items; console.log(new Date()); return callback(); }); } function getTopScoreUsers(callback) { HomeService.getTopScoreUsers(function(err, items) { console.log(items); _self.lastloginusers = items; return callback(); }); } function getNewBbs(callback) { HomeService.getNewBBS(function(err, items) { console.log(items); $scope.hottopics = items; return callback(); }); } var schoolUrl = ApiService.SHOST + "/public/" + ApiService.RES + "/school/" + ApiService.gid + "/"; if (loginService.school.sideadv) { $scope.sideadv = schoolUrl + loginService.school.sideadv; } _self.counter = ApiService.school.visitercounter; serviceFunctions.push(getAnnouncement); if(loginService.user){ serviceFunctions.push(getSchoolLogin); } serviceFunctions.push(getTopScoreUsers); serviceFunctions.push(getNewBbs); console.log(serviceFunctions); var waterfall=contra; waterfall.waterfall(serviceFunctions,function(err){ console.log(err); }) });