(function (app) { app.factory('goodsService', ['$http', 'config', "util", 'data', function ($http, config, util, data) { return { //发布货源信息 addGoods: function (model) { return $http({ url: config.server + 'api/messages', method: "post", data: model }) }, //货源列表 listGoods: function (model) { var condition = util.format("?include=truck,user&type={0}&begin_address={1}&end_address={2}&midway_address={3}&page={4}" , model.type, model.begin_address?model.begin_address:'', model.end_address?model.end_address:'', model.midway_address?model.midway_address:'', model.pageIndex); return $http({ url: config.server + 'api/messages/search' + condition, method: "get", data: model }) } }; }]); })(angular.module('app.services'));