SharingRewardsService.js 2.6 KB
"use strict";
var SharingRewardsService = angular.module('SharingRewardsService',[]);

SharingRewardsService.service("SharingRewardsService", [
	'$rootScope',
	'BaseService',
	function ($rootScope,BaseService) {
		var _service = {
            withDraws:[],
            shareOrders:[],
            withDrawList:[],
            shareWithDrawRecords:[],
            withDrawRecordPager:function(productQuery) {
                BaseService.request({
                    url:BaseService.url.withDraw_pager_url,
                    method:'post',
                    mark:true,
                    data:productQuery,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.withDrawList = response.data;
                            $rootScope.$broadcast('withdraw.list');
                        }
                    }
                });
            },
            selectTotalWithDrawalsAmount:function() {
                BaseService.request({
                    url:BaseService.url.selectTotalWithDrawalsAmount_url,
                    method:'get',
                    mark:true,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.withDraws = response.data;
                            $rootScope.$broadcast('withDraw.list');
                        }
                    }
                });
            },
            shareRewardOrderPager:function(shareOrderQuery) {
                BaseService.request({
                    url:BaseService.url.shareRewardOrder_pager_url,
                    method:'post',
                    mark:true,
                    data:shareOrderQuery,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.shareOrders = response.data;
                            $rootScope.$broadcast('shareOrder.list');
                        }
                    }
                });
            },
            sharingRewardRankings:function(sharingRewardRankingQuery) {
                BaseService.request({
                    url:BaseService.url.sharingRewardRankings_pager_url,
                    method:'post',
                    mark:true,
                    data:sharingRewardRankingQuery,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.shareWithDrawRecords = response.data;
                            $rootScope.$broadcast('shareWithDrawRecord.list');
                        }
                    }
                });
            },
		};
		return _service;
	}
]);