/* eslint-disable */
var wrap = fyCallbackWrap();

var exports = {
    // getUserInfo: function () {
    //     return wrap('用户信息获取', {
    //         fytype: 'innercmd',
    //         method: 'getuserinfo',
    //         mname: '用户信息获取'
    //     })
    // }
};

var isObject = function (data) {
    return Object.prototype.toString.call(data) === '[object Object]';
};

var extObject = function(obj1,obj2){
    for(var key in obj2){
        if(obj1.hasOwnProperty(key))continue;
        obj1[key]=obj2[key];
    }
    return obj1;
}

 /*发送KCXP用户中心请求 */
 var reg3 = (function () {
    // 使用闭包创建一个获取用户信息结构
    return function (namespace, fnId, key) {
      exports[namespace] = exports[namespace] || {};
      exports[namespace][key] = function (reqs) {
        console.info(namespace+fnId+key+reqs)
          var request = {
            fytype:'kcxpcmd',
            funcid:fnId,
            rtsname:namespace
          }
            request = extObject(request,reqs);
            return wrap(key, request);
      };
    };
}());

function createInterface(list){
  // reg3('uc','12007217','客户响应人查询');
  for (var i = 0; i < list.length; i++) {
    reg3(list[i].type,list[i].id,list[i].name);
  }
}

function getLocalUserInfo(){
  return wrap('用户信息获取', {
     fytype: 'innercmd',
     method: 'getuserinfo',
     mname: '用户信息获取'
 })
}
function getInterface(namespace, keyObj){
  for (var key in exports) {
    // exports[key]
    if (exports[key].hasOwnProperty(namespace)) {
      return exports[key][namespace](keyObj)
    }
  }
	// return exports.kcxpcmd[namespace](keyObj)
	/*exports.uc[namespace](keyObj).then(function (res) {
		console.info("ssssss",res)
	})*/
}

// export { getInterface, getLocalUserInfo, createInterface}
