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

MemberService.service("MemberService", [
    '$rootScope',
    'BaseService',
    function ($rootScope,BaseService) {
        var _service = {
            members:[],
            member:[],
            memberPager:function(query){
                BaseService.request({
                    url:BaseService.url.memberPager_url,
                    method:'post',
                    mark:true,
                    data:query,
                    fn:function(response) {
                        if(response.code == 0) {
                            _service.members = response.data;
                            $rootScope.$broadcast('member.list');
                        }
                    }
                });
            },
            getMemberDetail:function(id,callback){
                BaseService.request({
                    url:BaseService.url.memberDetail_url+id,
                    method:'POST',
                    mark:true,
                    fn:function(response) {
                        if(callback) {
                            callback.call(this, response);
                        }
                    }
                });
            },
            updateMember:function(memberInfo){
                BaseService.request({
                    url:BaseService.url.updateMember_url,
                    method:'POST',
                    data:memberInfo,
                    mark:false,
                    fn:function(data) {

                        BaseService.updateAlert(data.message,data.code);
                    }
                });
            },
            updateAuditIdCard:function(memberDetail,callback){
                BaseService.request({
                    url:BaseService.url.updateAuditIdCard_url,
                    method:'POST',
                    data:memberDetail,
                    mark:false,
                    fn:function(data) {
                        callback.call(this,data);
                    }
                });
            }
        }
        return _service;
    }]);