userservice.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. (function (app) {
  2. app.factory('userService', ['$http', 'config', "util", 'storage', function ($http, config, util, storage) {
  3. return {
  4. wechat_login:function(wechat){
  5. return $http({
  6. url: config.server + 'api/auth/wechat_login?wechat=' + wechat+'&jpush=' + localStorage['jpush'],
  7. method: "get",
  8. })
  9. },
  10. login: function (phone, verify_code,wechat) {
  11. return $http({
  12. url: config.server + 'api/auth/login',
  13. method: "post",
  14. data: { phone: phone, verify_code: verify_code, wechat:wechat}
  15. })
  16. },
  17. getVerifyCode: function (mobile) {
  18. return $http({
  19. url: config.server + 'api/auth/code',
  20. method: "post",
  21. data: { phone: mobile}
  22. })
  23. },
  24. isTest: function () {
  25. return $http({
  26. url: config.server + 'api/test',
  27. method: "get",
  28. })
  29. },
  30. isLogin: function () {
  31. return !util.empty(storage.get("token")) && storage.getObject("user");
  32. }
  33. };
  34. }]);
  35. })(angular.module('app.services'));