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

SendMessagesService.service("SendMessagesService", [
    '$rootScope',
    'BaseService',
    function ($rootScope,BaseService) {
        var _service = {
            operations:[],
            operationPager:function(condition){
                BaseService.request({
                    url:BaseService.url.operationPager_url,
                    method:'post',
                    mark:true,
                    data:condition,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.operations = response.data;
                            $rootScope.$broadcast('operation.list');
                        }
                    }
                });
            },
            sendSms:function (sms,callback) {
                BaseService.request({
                    url:BaseService.url.sendSms_url,
                    method:'post',
                    data:sms,
                    mark:true,
                    fn:function(data){
                        if(callback) {
                            callback.call(this,data);
                        }
                        BaseService.updateAlert(data.message,data.code);
                    }
                });
            }
        }
        return _service;
    }]);