goodsservice.js 1.0 KB

123456789101112131415161718192021222324
  1. (function (app) {
  2. app.factory('goodsService', ['$http', 'config', "util", 'data', function ($http, config, util, data) {
  3. return {
  4. //发布货源信息
  5. addGoods: function (model) {
  6. return $http({
  7. url: config.server + 'api/messages',
  8. method: "post",
  9. data: model
  10. })
  11. },
  12. //货源列表
  13. listGoods: function (model) {
  14. var condition = util.format("?include=truck,user&type={0}&begin_address={1}&end_address={2}&midway_address={3}&page={4}"
  15. , model.type, model.begin_address?model.begin_address:'', model.end_address?model.end_address:'', model.midway_address?model.midway_address:'', model.pageIndex);
  16. return $http({
  17. url: config.server + 'api/messages/search' + condition,
  18. method: "get",
  19. data: model
  20. })
  21. }
  22. };
  23. }]);
  24. })(angular.module('app.services'));