homeservice.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. (function (app) {
  2. app.factory('homeService', ['$http', 'config', "util", function ($http, config, util) {
  3. return {
  4. sent_list: function (filter) {
  5. return $http({
  6. url: config.server + 'api/service/sent_list?q=' + filter.q + "&status=" + filter.status+ "&page=" + filter.page+"&f="+filter.f,
  7. method: "get"
  8. })
  9. },
  10. supportDream:function(data){
  11. return $http({
  12. url:config.server + "api/dream/support",
  13. method:"post",
  14. data:data
  15. })
  16. },
  17. collectionDream:function(id,is_collection){
  18. return $http({
  19. url:config.server + "api/dream/collection?id=" + id+"&is_collection="+is_collection,
  20. method:"get"
  21. })
  22. },
  23. search:function (keyword){
  24. return $http({
  25. url: config.server + 'api/index/search?keyword='+keyword,
  26. method:"get"
  27. })
  28. },
  29. dreamDetail: function (id) {
  30. return $http({
  31. url: config.server + 'api/dream/show?id=' + id,
  32. method: "get"
  33. })
  34. },
  35. index: function (type, page) {
  36. var url = util.format('{0}api/index/home?type={1}&page={2}', config.server,type,page);
  37. return $http({
  38. url: url,
  39. method: "get"
  40. })
  41. },
  42. news_info: function (id) {
  43. return $http({
  44. url: config.server + 'api/index/news_info?id='+id,
  45. method: "get"
  46. })
  47. },
  48. user_search: function (keyword) {
  49. return $http({
  50. url: config.server + 'api/index/user_search?keyword='+keywords,
  51. method: "get"
  52. })
  53. },
  54. add_interaction: function (data) {
  55. return $http({
  56. url: config.server + 'api/interaction/store',
  57. method:"post",
  58. data:data
  59. })
  60. },
  61. add_comment: function (data) {
  62. return $http({
  63. url: config.server + '/api/interaction/comment',
  64. method:"post",
  65. data:data
  66. })
  67. },
  68. myInfo:function(){
  69. return $http({
  70. url:config.server + "api/my/show",
  71. method:"get"
  72. })
  73. },
  74. toUserDetail:function(id){
  75. return $http({
  76. url:config.server + "api/user/show?user_id=" + id ,
  77. method:"get"
  78. })
  79. },
  80. attentionUser:function(id,is_care){
  81. return $http({
  82. url:config.server + "api/user/care?id=" + id+"&is_care="+is_care,
  83. method:"get"
  84. })
  85. },
  86. messageInfo:function(){
  87. return $http({
  88. url:config.server + "api/my/info",
  89. method:"get"
  90. })
  91. },
  92. doFilter:function(sex,age,area){
  93. return $http({
  94. url:config.server + "api/index/filter?sex=" + sex+"&age="+age + "&area="+area,
  95. method:"get"
  96. })
  97. },
  98. share:function(id){
  99. return $http({
  100. url:config.server + "api/dream/share?id=" + id,
  101. method:"get"
  102. })
  103. },
  104. testcharge:function(number,type){
  105. return $http({
  106. url:config.server + "api/my/recharge?coin="+number,
  107. method:"post"
  108. })
  109. },
  110. charge:function(number,type){
  111. return $http({
  112. url:config.server + "api/pay/charge",
  113. method:"post",
  114. data: { number:number,goods:1,type:type}
  115. })
  116. },
  117. deleteComment:function(id){
  118. return $http({
  119. url:config.server + "api/comment/delete?id=" + id,
  120. method:"get"
  121. })
  122. }
  123. };
  124. }]);
  125. })(angular.module('app.services'));