****************************************
创建数据库链接
****************************************
326456
function connect(options) {
    let conn = mysql.createConnection(options),
        query = makeQuery(conn),
        stream = makeStream(conn);

    // 返回接口
    return { query, stream };
}
429933
function (fn, elem, types) {
            var own = this;
            var args = Array.prototype.slice.call(arguments).slice(3);//动态截取fn所需参数
            vQ.each(types, function (inx, type) {
                fn.apply(own, [elem, type].concat(args));
            });
        }
312052
function Validator(store, rules, opts) {
  if (!(this instanceof Validator)) return new Validator(store, rules, opts);

  //校验参数
  if (!store || !rules) {
    throw new Error('store or rules can not empty!');
  }

  this.store = store;
  this.rules = rules;
  this.opts = opts || {};
  this.fieldErrors = Immutable.OrderedMap({});

  /**
   * 最小化暴露方法
   */
  return {
    isValid: this.isValid.bind(this),
    rule: this.rule.bind(this),
    clearError: this.clearError.bind(this),
    fieldErrors: function () {
      return this.fieldErrors.toJS();
    }.bind(this)
  }
}
233410
private static function init()
    {
        // 跳过初始化的工具
        foreach(Config::get('@Imi.skipInitTools') as $tool)
        {
            if(static::$toolName === $tool[0] && static::$toolOperation === $tool[1])
            {
                return;
            }
        }

        // 仅初始化项目及组件
        $initMains = [Helper::getMain(App::getNamespace())];
        foreach(Helper::getAppMains() as $mainName => $main)
        {
            foreach($main->getConfig()['components'] ?? [] as $componentName => $namespace)
            {
                $componentMain = Helper::getMain($namespace);
                if(null !== $componentMain)
                {
                    $initMains[] = $componentMain;
                }
            }
        }
        Annotation::getInstance()->init($initMains);

        RequestContext::create();
        // 获取配置
        $pools = $caches = [];
        foreach(Helper::getMains() as $main)
        {
            $pools = array_merge($pools, $main->getConfig()['pools'] ?? []);
            $caches = array_merge($caches, $main->getConfig()['caches'] ?? []);
        }
        // 同步池子初始化
        foreach($pools as $name => $pool)
        {
            if(isset($pool['sync']))
            {
                $pool = $pool['sync'];
                PoolManager::addName($name, $pool['pool']['class'], new PoolConfig($pool['pool']['config']), $pool['resource']);
            }
        }
        // 缓存初始化
        foreach($caches as $name => $cache)
        {
            CacheManager::addName($name, $cache['handlerClass'], $cache['option']);
        }
    }
677525
public function init(){
		$table_definition = $this->exdb->get_table_definition_all();
		// var_dump($table_definition);
		$error = array();
		foreach($table_definition->tables as $table_name=>$table_definition_row){
			// var_dump($table_definition_row);

			$sql_create_db = '';
			$sql_create_db .= 'CREATE TABLE '.$this->exdb->get_physical_table_name($table_definition_row->name).' (';
			$ary_table_columns = array();
			$ary_foreign_keys = array();
			foreach( $table_definition_row->columns as $column_definition ){
				$sql_column_definition = '';

				// セル名
				$sql_column_definition .= $column_definition->name;

				// 型
				switch(strtolower( $column_definition->type )){
					case 'email':
					case 'string':
					case 'password':
					case 'auto_id':
						$sql_column_definition .= ' VARCHAR';
						break;
					case 'create_date':
					case 'update_date':
					case 'delete_date':
						$sql_column_definition .= ' DATETIME';
						break;
					case 'int':
					case 'integer':
					case 'number':
					case 'auto_increment':
						$sql_column_definition .= ' INTEGER';
						break;
					case 'delete_flg':
						$sql_column_definition .= ' INTEGER';
						break;
					case 'text':
					case 'date':
					case 'datetime':
					default:
						$sql_column_definition .= ' '.strtoupper($column_definition->type);
						break;
				}

				// NOT NULL 制約
				if( @$column_definition->not_null ){
					$sql_column_definition .= ' NOT NULL';
				}

				// UNIQUE 制約
				if( @$column_definition->unique ){
					$sql_column_definition .= ' UNIQUE';
				}

				// FOREIGN KEY 制約
				if( @$column_definition->foreign_key ){
					$ary_foreign_keys[$column_definition->name] = $column_definition->foreign_key;
				}

				array_push($ary_table_columns, $sql_column_definition);
			}
			$sql_create_db .= implode($ary_table_columns, ',');

			if( count($ary_foreign_keys) ){
				// FOREIGN KEY 制約
				foreach($ary_foreign_keys as $colName=>$foreign_tbl_col){
					$sql_create_db .= ', FOREIGN KEY (';
					$sql_create_db .= $colName;
					$sql_create_db .= ')';
					$foreign_tbl_col = explode('.', $foreign_tbl_col);
					$sql_create_db .= ' REFERENCES '.$this->exdb->get_physical_table_name($foreign_tbl_col[0]).'('.$foreign_tbl_col[1].')';
				}
			}

			$sql_create_db .= ');';
			// var_dump($sql_create_db);
			$result = @$this->exdb->pdo()->query($sql_create_db);
			// var_dump($result);
			if( !$result ){
				array_push($error, '[ERROR] Failed to create table "'.$this->exdb->get_physical_table_name($table_definition_row->name).'"');
			}
		}
		// var_dump($error);
		$rtn = true;
		if(count($error)){$rtn = false;}
		return $rtn;
	}
219430
function queryBat (queue, cb) {
  const res = []

  queue.forEach(item => {
    const { selector, single, fields, component } = item
    // selector 的容器节点
    /* eslint-disable */
    const container = (
      component !== null ?
        (Nerv.findDOMNode(component) || document) :
        document
    )
    /* eslint-enable */

    // 特殊处理 ---- 选自己
    let selectSelf = false
    if (container !== document) {
      const $nodeList = container.parentNode.querySelectorAll(selector)
      for (let i = 0, len = $nodeList.length; i < len; ++i) {
        if (container === $nodeList[i]) {
          selectSelf = true
          break
        }
      }
    }

    if (single) {
      const el = selectSelf === true ? container : container.querySelector(selector)
      res.push(filter(fields, el, selector))
    } else {
      const $children = container.querySelectorAll(selector)
      const children = []
      selectSelf === true && children.push(container)
      for (let i = 0, len = $children.length; i < len; ++i) {
        children.push($children[i])
      }
      res.push(children.map(dom => filter(fields, dom)))
    }
  })
  cb(res)
}
163508
function createAjax(settings) {

    // 创建请求方法
    function ajax(options, callback) {
        let { promise, resolve, reject } = defer(),
            xhr;

        // 生成配置
        options = createOptions({ ...settings, ...options });

        // 创建请求
        xhr = request(options, (err, response, body) => {

            // 解析数据
            if (!err) {
                try {
                    response.result = JSON.parse(body);
                } catch (err) {
                    // do nothings;
                }

                // 解析返回
                return resolve(response);
            }

            // 抛出错误
            reject(err);
        });

        // 执行就绪回调
        callback && callback(xhr);

        // 返回结果
        return promise;
    }

    // 【GET】请求
    ajax.get = (url, params) => ajax({ url, qs: params });

    // 【POST】请求
    ajax.post = (url, data) => ajax({
        url,
        json: data,
        headers: { 'Content-type': 'application/json' }
    });

    // 创建实例
    ajax.create = options => {
        return createAjax({ ...settings, ...options });
    };

    // 返回方法
    return ajax;
}
812269
static public function start() {
      // 注册AUTOLOAD方法
//      spl_autoload_register('Think\Think::autoload');
      // 设定错误和异常处理
    register_shutdown_function('Think\Think::fatalError');
    set_error_handler('Think\Think::appError');
    set_exception_handler('Think\Think::appException');
//
//      // 初始化文件存储方式
//
    Storage::connect(STORAGE_TYPE);
//
      $runtimefile  = RUNTIME_PATH.APP_MODE.'~runtime.php';
    if(!APP_DEBUG && Storage::has($runtimefile)){
      Storage::load($runtimefile);
    }else{
      if(Storage::has($runtimefile))
          Storage::unlink($runtimefile);
      $content =  '';
      // 读取应用模式
      $mode   =   include is_file(CONF_PATH.'core.php')?CONF_PATH.'core.php':MODE_PATH.APP_MODE.'.php';
      // 加载核心文件
      foreach ($mode['core'] as $file){
          if(is_file($file)) {
            include $file;
            if(!APP_DEBUG) $content   .= compile($file);
          }
      }

      // 加载应用模式配置文件
      foreach ($mode['config'] as $key=>$file){
          is_numeric($key)?C(load_config($file)):C($key,load_config($file));
      }

      // 读取当前应用模式对应的配置文件
      if('common' != APP_MODE && is_file(CONF_PATH.'config_'.APP_MODE.CONF_EXT))
          C(load_config(CONF_PATH.'config_'.APP_MODE.CONF_EXT));

      // 加载模式别名定义
      if(isset($mode['alias'])){
          self::addMap(is_array($mode['alias'])?$mode['alias']:include $mode['alias']);
      }

      // 加载应用别名定义文件
      if(is_file(CONF_PATH.'alias.php'))
          self::addMap(include CONF_PATH.'alias.php');

      // 加载模式行为定义
      if(isset($mode['tags'])) {
          Hook::import(is_array($mode['tags'])?$mode['tags']:include $mode['tags']);
      }

      // 加载应用行为定义
      if(is_file(CONF_PATH.'tags.php'))
          // 允许应用增加开发模式配置定义
          Hook::import(include CONF_PATH.'tags.php');

      // 加载框架底层语言包
      L(include THINK_PATH.'Lang/'.strtolower(C('DEFAULT_LANG')).'.php');

      if(!APP_DEBUG){
          $content  .=  "\nnamespace { Think\\Think::addMap(".var_export(self::$_map,true).");";
          $content  .=  "\nL(".var_export(L(),true).");\nC(".var_export(C(),true).');Think\Hook::import('.var_export(Hook::get(),true).');}';
          Storage::put($runtimefile,strip_whitespace('<?php '.$content));
      }else{
        // 调试模式加载系统默认的配置文件
        C(include THINK_PATH.'Conf/debug.php');
        // 读取应用调试配置文件
        if(is_file(CONF_PATH.'debug'.CONF_EXT))
            C(include CONF_PATH.'debug'.CONF_EXT);
      }
    }

      // 读取当前应用状态对应的配置文件
      if(APP_STATUS && is_file(CONF_PATH.APP_STATUS.CONF_EXT))
          C(include CONF_PATH.APP_STATUS.CONF_EXT);

      // 设置系统时区
      date_default_timezone_set(C('DEFAULT_TIMEZONE'));

      // 检查应用目录结构 如果不存在则自动创建
      if(C('CHECK_APP_DIR')) {
          $module     =   defined('BIND_MODULE') ? BIND_MODULE : C('DEFAULT_MODULE');
          if(!is_dir(APP_PATH.$module) || !is_dir(LOG_PATH)){
              // 检测应用目录结构
              Build::checkDir($module);
          }
      }
      // 记录加载文件时间
      G('loadTime');
      // 运行应用
      App::run();
    }
1044028
function Module(id, deps, maker, root) {

        this.id = id;
        this.deps = deps; //必须是数组
        this.maker = maker;
        this.root = root || $;
        // _modulesMap[id] = 1;//定义之前
        // this.queue = new Queue();
        if(checkDeps(id)) {

            this.namespace();

        } else {

            this.init();
        }
    }
641713
function(cb) {
  if (lithe.publicpath && publicDeps.length) {
    var pDeps = [],
        fDeps = [];

    // 汇总public依赖的依赖包

    forEach(publicDeps, function (deps) {
      values(lithe.config.publicdeps[deps]).forEach(function(rdeps) {
        if (keys(lithe.config.publicdeps).indexOf(rdeps) !== -1) {
          publicDeps.push(rdeps);
        }
      });
    });

    // 如果依赖没有js后缀,就加上js后缀然后汇总
    // 汇总结果有js后缀的和没有js后缀的,用户在config配置的时候有可能有js后缀,也有可能
    // 不写js后缀

    forEach(unique(publicDeps), function(deps){
      if (deps.lastIndexOf(jsExt) < 0){
        pDeps.push(deps);
        pDeps.push(deps + jsExt);
      }else {
        pDeps.push(deps);
      }
    });

    // 获取public依赖的真实路径

    forEach(pDeps, function(deps){
      if (lithe.config.publicdeps[deps]) {
        fDeps.push(keys(lithe.config.publicdeps[deps])[0]);
      }
    });

    var pm = unique(fDeps).join(",");
    var nginxPublic = lithe.publicpath + "??" + pm;
    forEach(publicDeps,function(mod){
      lithe.get(createUrls(mod)[0]);
    });
    getscript(nginxPublic, cb);
  }else{
    cb();
  }
}
73680
function __init(opts) {
    //扩展参数
    extend(this.options, opts || (opts = {}));
    //获取目标元素
    this.appearWatchElements = this.appearWatchElements || __getElements.call(this, '.' + this.options.cls);
    //初始化位置信息
    __initBoundingRect.call(this, this.appearWatchElements);
    //绑定事件
    __bindEvent.call(this);
  }
1094116
function () {
            var me = this, range = me.selection.getRange();
            if (me.container.style.display == 'none') {
                //有可能内容丢失了
                try {
                    range.moveToBookmark(me.lastBk);
                    delete me.lastBk
                } catch (e) {
                    range.setStartAtFirst(me.body).collapse(true)
                }
                //ie下focus实效，所以做了个延迟
                setTimeout(function () {
                    range.select(true);
                }, 100);
                me.container.style.display = '';
            }

        }
1245425
function() {
			if (this.createGridFlag) {
				return;
			}
			// 为避免重复渲染，在开始清空里面内容
			if($('#' + this.options.id)[0])
				$('#' + this.options.id)[0].innerHTML = '';
			var htmlStr = '<div id="' + this.options.id + '_grid" class="u-grid-grid">';
				htmlStr += this.createColumnMenu();
				htmlStr += this.createHeader();
			htmlStr += this.createContent();
			htmlStr += '</div>';
			if($('#' + this.options.id)[0])
				$('#' + this.options.id).html(htmlStr);
			this.headerFirstClassFun();
			this.initGridEventFun();
			this.showType = 'grid';
			this.afterGridDivsCreate();
			this.createGridFlag = true;
			this.realtimeTableRows = null;
		}
391811
function () {
            var me = this, range;
            if (me.body.contentEditable == 'false') {
                me.body.contentEditable = true;
                range = me.selection.getRange();
                //有可能内容丢失了
                try {
                    range.moveToBookmark(me.lastBk);
                    delete me.lastBk
                } catch (e) {
                    range.setStartAtFirst(me.body).collapse(true)
                }
                range.select(true);
                if (me.bkqueryCommandState) {
                    me.queryCommandState = me.bkqueryCommandState;
                    delete me.bkqueryCommandState;
                }
                if (me.bkqueryCommandValue) {
                    me.queryCommandValue = me.bkqueryCommandValue;
                    delete me.bkqueryCommandValue;
                }
                me.fireEvent('selectionchange');
            }
        }
914647
function init() {
  const {supportCordova = false} = this.config;

  onReady = onReady.bind(this);

  /***
   * 如果开启了对cordova的支持
   */
  if (supportCordova) {
    /***
     * 如果开启了对cordova的支持，那么页面完成事件和cordova的deviceReady事件必须同时完成后才能支持后续代码
     */
    Promise.all([
      readyPromise(),
      DOMContentLoadedPromise(),
      devicereadyPromise()
    ]).then(() => {
      onReady();
      fireEvent(window.document, "DOMContentAndDeviceReady");
    }).catch((error) => {

    });
  }
  else {
    /***
     * 页面载入完成事件
     */
    $(window.document).ready(onReady);

    /***
     * 自动 init
     */
    window.addEventListener("DOMContentLoaded", onReady);
  }
}
1038544
public function init()
    {
        // 缓存实例代码是否设置
        if (!empty($this->cacheInstanceString)) {
            $cache = str_eval($this->cacheInstanceString);
            if (isset($cache) && $cache instanceof Store) {
                $this->cache = $cache;
            }
        }

        // urlRule 预处理
        if (null === $this->cache) {
            $this->_rules = $this->parseUrlRule();
        } else if (null !== ($rules = $this->cache->get(self::CACHE_KEY))) {
            $this->_rules = $rules;
        } else {
            $this->_rules = $this->parseUrlRule();
            $this->cache->set(self::CACHE_KEY, $this->_rules);
        }
    }
176505
function s(s) {
        /**
         * 该函数运行在View上
         * @param target View实例
         * @param decoratedPropertyName 属性名
         */
        return function (target, decoratedPropertyName) {
            var targetType = target.constructor;
            // 目标view的名称
            var name = target.constructor.toString().match(/^function\s*([^\s(]+)/)[1];
            if (!targetType.hasOwnProperty("__inject__")) {
                targetType["__inject__"] = {};
            }
            if (!targetType["__inject__"][name]) {
                targetType["__inject__"][name] = {
                    constructor: target.constructor
                };
            }
            if (!targetType["__inject__"][name]["services"]) {
                targetType["__inject__"][name]["services"] = [];
            }
            var temp = new view_5.serviceInjectModel();
            temp.creator = s;
            temp.propertyName = decoratedPropertyName;
            targetType["__inject__"][name]["services"].push(temp);
        };
    }