具体参数格式参照：http://docs.jiguang.cn/server/rest_api_push_schedule/#_4
435685
function setPeriodicalSchedule (start, end, time, timeUnit, frequency, point) {
  var periodical = {
    'start': start,
    'end': end,
    'time': time,
    'time_unit': timeUnit,
    'frequency': frequency,
    'point': point
  }
  this.trigger = JUtil.extend(this.trigger, {
    'periodical': periodical
  })
  return this
}
593205
function fn(metadataGetter, dataAdapter, opts = {}) {
    if (typeof metadataGetter !== 'function') {
        throw new Error(`'metadataGetter' must be a function.`);
    }
    if (typeof dataAdapter !== 'object') {
        throw new Error(`dataAdapter' must be an object.`);
    }
    Object.assign(metadata, metadataGetter.call(null));

    if (!opts.strategy) {
        if (opts.router) {
            opts.strategy = 'ROUTER';
        } else {
            opts.strategy = 'MIDDLEWARE';
        }
    }

    if (typeof opts.getLocaleString !== 'function') {
        opts.getLocaleString = (key) => {
            const object = {
                mongoose_adapter_error_list: '查询失败，请稍后重试',
                mongoose_adapter_error_count: '查询失败，请稍后重试',
                mongoose_adapter_error_id: '查询失败，请稍后重试',
                mongoose_adapter_error_create: '新增失败',
                mongoose_adapter_error_update: '更新失败',
                mongoose_adapter_error_remove: '删除失败',
            };
            return object[key];
        };
    }

    switch (opts.strategy) {
        case 'ROUTER':
            // 路由器挂载
            if (!opts.router) {
                throw new Error(`'router' can not be empty when using ROUTER strategy.`);
            }
            return routerStrategy(metadata, dataAdapter, opts);
        case 'MIDDLEWARE':
            // 中间件过滤
            if (opts.filter && typeof opts.filter !== 'function') {
                throw new Error(`'filter' must be a function type.`);
            }
            return middlewareStrategy(metadata, dataAdapter, opts);
            break;
    }
}
911857
function callBack($from,$to,$customerSerNum,$fromSerNum,$promptTone)
	  {
        //子帐号鉴权信息验证，对必选参数进行判空。
        $auth=$this->subAuth();
        if($auth!=""){
            return $auth;
        }
        // 拼接请求包体
        if($this->BodyType=="json"){
           $body= "{'from':'$from','to':'$to','customerSerNum':'$customerSerNum','fromSerNum':'$fromSerNum','promptTone':'$promptTone'}";
        }else{
           $body= "<CallBack>
                     <from>$from</from>
                     <to>$to</to>
                     <customerSerNum>$customerSerNum</customerSerNum>
                     <fromSerNum>$fromSerNum</fromSerNum>
                     <promptTone>$promptTone</promptTone>
                   </CallBack>";
        }
        $this->showlog("request body = ".$body);
        // 大写的sig参数
        $sig =  strtoupper(md5($this->SubAccountSid . $this->SubAccountToken . $this->Batch));
        // 生成请求URL
        $url="https://$this->ServerIP:$this->ServerPort/$this->SoftVersion/SubAccounts/$this->SubAccountSid/Calls/Callback?sig=$sig";
        $this->showlog("request url = ".$url);
        // 生成授权：子帐号Id + 英文冒号 + 时间戳
        $authen=base64_encode($this->SubAccountSid . ":" . $this->Batch);
        // 生成包头
        $header = array("Accept:application/$this->BodyType","Content-Type:application/$this->BodyType;charset=utf-8","Authorization:$authen");
        // 发请求
        $result = $this->curl_post($url,$body,$header);
        $this->showlog("response body = ".$result);
        if($this->BodyType=="json"){//JSON格式
           $datas=json_decode($result);
        }else{ //xml格式
           $datas = simplexml_load_string(trim($result," \t\n\r"));
        }
      //  if($datas == FALSE){
//            $datas = new stdClass();
//            $datas->statusCode = '172003';
//            $datas->statusMsg = '返回包体错误'; 
//        }
        return $datas;
	}
1189049
function callServer(params,key) {
  debug("enter proxy!");
  
  //调用接口的配置
  var options = {
    url: params.domain + params.api.url,
    method: params.api.method,
  };
  
  //如果设置api的方法,就使用API的方法
  if (params.api.apiMethod) {
    options.method = params.api.apiMethod;
  }

  //如果是GET采用head传参，否则使用表单传参
  if(options.method === 'GET') {
    options.qs = params.params;
  } else {
    options.form = params.params;
  }
  
  //如果是json字符串，按json raw方式传递
  if(params.api.isJsonRaw) {
    options.headers =  {
       'Content-Type' : 'application/json'
    };
    options.body = JSON.stringify(params.params);
    delete options.form;
  }
  //如果自定义headers，加到服务调用
  if(params.req._yoheaders) {
    options.headers = options.headers||{};
    options.headers = _.merge(options.headers,params.req._yoheaders);
  }

  params.req.app.yolog.api.log('verbose','server api input: ',options);
  params.req.app.yolog.profile('proxy api time:'+options.url,'api');
  request(options, function(error, response, body) {
    params.req.app.yolog.profile('proxy api time:'+options.url,'api');
    if (response && response.statusCode === 200) {
      params.req.app.yolog.api.log('verbose','server api status 200 output:',body);
      if (params.res.setCache && params.api.cache) {
        var cacheKey = params.res.genKey(params.domain, params.api.url, JSON.stringify(params.params));

        params.res.setCache(cacheKey, body, params.api.cache);
      }
      params.body = body;
      debug("proxy callback!");
      debug(params);
      procRet(params,key);
    } else {
      //如果调用出错,设置错误返回
      params.req.input = {
          error:true,
          message:'api server error!'
      };
      params.req.app.yolog.log('error','server api error input: %j',options,{});
      //如果有响应，修改返回
      if (response) {
        params.req.input.message = 'error: ' + response.statusCode;
        params.req.app.yolog.log('error','server api error %d output: %j',response.statusCode,body,{});
      } else {
        params.req.app.yolog.log('error','call server api yo response: %j',params.req.input,{});
      }
      params.next();
    }
  });
}
252026
function(url, params, onsuccess, onfail) {
    // url中包含 get 参数和 params 合并
    if (_typeof(params) == 'object') params = _params_2_url(params);
    else params = '';

    if (params) url = url + '?' + params;
    return request('GET', url, '', onsuccess, onfail);
  }
735524
function procRet(params,key) {
  if(params.body) {
    if (params.apiNum > 1) {
      params.req.apiRet[key] = util.jsonParse(params.body,params.req.app);
    } else {
      params.req.apiRet = util.jsonParse(params.body,params.req.app);
    }
  }

  //默认返回数据存在,合并该数据到返回数据（以返回数据为主）
  var defaultData = params.req.input.config.data;
  if(defaultData) {
    params.res.proxyData = _.merge({},defaultData,params.req.apiRet);
  } else {
    params.res.proxyData = params.req.apiRet;
  } 
 
  params.req.apiCount++;
  if (params.apiNum === params.req.apiCount) {
    delete params.req.apiCount;
    delete params.req.apiRet;
    params.req.app.yolog.api.log('info','server api after proc:',params.res.proxyData);
    params.next();
  }
}
1109983
function ( src, dst, callback ){
      fs.exists( dst, function ( exists ){
          // 已存在
          if( exists ){
              callback( src, dst );
          }

          // 不存在
          else{
              fs.mkdir( dst, function (){
                  callback( src, dst );
              });
          }
      });
  }
958833
function jsonRet(req,res) {
    var state = 200;
    var data = {
        code:state,
        message:""
    };

    //错误判断（404）
    if(!req.input) {
        state = 404;
        req.app.yolog.log('error','error 404');
    } else if(req.input.error) {
        state = 500;
        data.message = req.input.message ? req.input.message:'';
        req.app.yolog.log('error','error 500',req.input);
    } else {
        data.data = res.proxyData;
    } 
    req.app.yolog.log('verbose','pjax vo: %j',data,{});
    data.code = state;
    res.status(state).json(data);
}
827646
function (jsonObj, successCB, failedCB) {
    var $t = this;

    var _json = jsonObj || {};

    // 传递参数
    var newJson = {
      'command': ' --port=' + $bc_$5.App.getServerPort(), // {要求string}
      'currentDirectoryPath': _json.currentDirectoryPath || '',
      'environmentDic': _json.environmentDic || {},
      'mainThread': _json.mainThread !== false
    };

    $t.exec(newJson, successCB, failedCB);
  }
361531
function () {
            if (opt.globalTask.state === 'cancel') return;
            for (; that._uploadingThreadCount < that.uploadMaxThread && task.currentIndex < task.chunkCount; task.currentIndex++) {
                var chunk = task.chunks[task.currentIndex];
                if (chunk.state !== 'waiting') continue;
                (function (chunk) {
                    chunk.state = 'uploading';
                    task.uploadingCount++;
                    that._uploadingThreadCount++;
                    uploadSingleChunk.call(that, task, chunk, function (error, data) {
                        task.uploadingCount--;
                        that._uploadingThreadCount--;
                        if (error) { // 错误马上结束
                            chunk.state = 'error';
                            uploadError(error, data);
                        } else {
                            chunk.state = 'success';
                            if (task.uploadingCount <= 0 && task.currentIndex >= task.chunkCount) { // 全部完成
                                uploadSuccess();
                            } else { // 未完成，处理执行下一个分片
                                uploadNextChunk();
                            }
                        }
                    });
                })(chunk);
            }
            if (task.uploadingCount === 0 && task.currentIndex === task.chunks.length) { // 全部不需要上传
                uploadSuccess();
            }
        }
181844
function pGetUrl(url, headers){
    //console.log(`\r\n发起远程请求(${Date()})：${url}\r\n`);
    if(!headers){
        headers = {};
    }
    headers['User-Agent'] = 'Request-Promise';
    return rp({
        uri: url,
        headers: headers,
        json: true // Automatically parses the JSON string in the response
    });
}
75489
function callApi(params,key) {
  
  //如果没有设置URL,直接返回
  if(!params.api.url) {
     procRet(params,key);
     return;
  } 
  
  //缓存接口返回
  if (params.res.getCache && params.api.cache) {

    var cacheKey = params.res.genKey(params.domain, params.api.url, JSON.stringify(params.params));

    params.res.getCache(cacheKey, function(err, body) {
      if (!err && body) {
        debug(cacheKey + ' cached!');
        params.body = body;
        procRet(params,key);
      } else {
        callServer(params,key);
        debug(cacheKey + '  cache expired!');
      }
    });
  } else {
    callServer(params,key);
  }
}
1356535
private function getJsApiTicket() {
        $key  = md5(__FILE__ . 'jsapi_ticket');
        $data = to_array(cache::get($key));
        if (!cache::check($key) || $data['expire_time'] < time()) {
            $accessToken = $this->getAccessToken();
            #提交URL地址
            $url  = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken";
            $res  = to_array($this->httpGet($url));
            $data = array();
            #返回Ticket信息
            $ticket = $res['ticket'];
            if ($ticket) {
                $data['expire_time']  = time() + 7000;
                $data['jsapi_ticket'] = $ticket;
                cache::set($key, to_json($data), 7000);
            }
        } else {
            $ticket = $data['jsapi_ticket'];
        }
        return $ticket;
    }
956254
public function pushGit()
    {
        if (!isset($this->config['git_address'])) {
            Log::info('Git地址没有配置，请在Config.php文件参照如下方式配置：' );
            Log::info('$config[\'git_address\']=\'git@github.com:seeruo/seeruo.github.io.git\';','error');
        }
        $Git = new GitService($this->config);

                        
        $Git->add();
        $Git->commit();
        $Git->push();
    }
196630
public function automatic_rest_api(){
		@header('text/json; charset=UTF-8');

		$rtn = array();
		$rtn['result'] = false;
		// $rtn['options'] = $this->options;
		// $rtn['_SERVER'] = $_SERVER;
		// $rtn['_GET'] = $_GET;
		// $rtn['_POST'] = $_POST;

		if( $this->options['method'] == 'POST' ){
			// --------------------------------------
			// 投稿系リクエスト
			if( !strlen($this->options['table']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Table name not set.';
				echo json_encode( $rtn );
				return null;
			}
			if( strlen($this->options['id']) ){
				// 対象のテーブルが指定された場合はエラー
				$rtn['error'] = 'Resource ID was set.';
				echo json_encode( $rtn );
				return null;
			}

			$params = $this->options['post_params'];
			$result = $this->exdb->insert($this->options['table'], $params);
			$rtn['result'] = $result;
			$last_insert_info = $this->exdb->get_last_insert_info();
			$rtn['given_id'] = $last_insert_info->value;
			echo json_encode( $rtn );
			return null;

		}elseif( $this->options['method'] == 'GET' ){
			// --------------------------------------
			// 取得系リクエスト
			if( !strlen($this->options['table']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Table name not set.';
				echo json_encode( $rtn );
				return null;
			}

			if( !strlen($this->options['id']) ){
				// ID無指定の場合、一覧情報を返す
				$rtn['list'] = $this->exdb->select($this->options['table'], $this->options['get_params'], $this->query_options);
				$rtn['count'] = $this->exdb->count($this->options['table'], $this->options['get_params']);
				$rtn['result'] = true;
				if( count($this->table_definition->system_columns->password) ){
					foreach( $rtn['list'] as $key=>$val ){
						foreach($this->table_definition->system_columns->password as $column_name){
							unset($rtn['list'][$key][$column_name]);
						}
					}
				}
				echo json_encode( $rtn );
				return null;
			}else{
				// ID指定がある場合、詳細情報1件を返す
				$where = $this->options['get_params'];
				// $rtn['table_definition'] = $this->table_definition;
				$where[$this->table_definition->key_column] = $this->options['id'];
				$row = $this->exdb->select($this->options['table'], $where);
				$rtn['row'] = @$row[0];
				foreach($this->table_definition->system_columns->password as $column_name){
					unset($rtn['row'][$column_name]);
				}
				$rtn['result'] = true;
				echo json_encode( $rtn );
				return null;
			}

		}elseif( $this->options['method'] == 'PUT' ){
			// --------------------------------------
			// 更新系リクエスト
			if( !strlen($this->options['table']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Table name not set.';
				echo json_encode( $rtn );
				return null;
			}
			if( !strlen($this->options['id']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Resource ID not set.';
				echo json_encode( $rtn );
				return null;
			}

			$params = $this->options['post_params'];
			$result = $this->exdb->update(
				$this->options['table'],
				array(
					$this->table_definition->key_column => $this->options['id'],
				),
				$params
			);
			$rtn['result'] = ($result ? true : false);
			$rtn['affected_rows'] = $result;
			echo json_encode( $rtn );
			return null;

		}elseif( $this->options['method'] == 'DELETE' ){
			// --------------------------------------
			// 削除系リクエスト
			if( !strlen($this->options['table']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Table name not set.';
				echo json_encode( $rtn );
				return null;
			}
			if( !strlen($this->options['id']) ){
				// 対象のテーブルが不明な場合はエラー
				$rtn['error'] = 'Resource ID not set.';
				echo json_encode( $rtn );
				return null;
			}

			$result = $this->exdb->delete(
				$this->options['table'],
				array(
					$this->table_definition->key_column => $this->options['id'],
				)
			);
			$rtn['result'] = ($result ? true : false);
			$rtn['affected_rows'] = $result;
			echo json_encode( $rtn );
			return null;

		}

		$rtn['error'] = 'Unknown method';

		echo json_encode( $rtn );
		return null;
	}
1222655
function generateThrottle(throttleTime) {
  var time = Date.now();
  return function (now) {
    // 如果没有设置节流时间， 使用默认配置的时间 14毫秒
    if (now - time > (throttleTime || 14)) {
      time = now;
      return true;
    }
  };
}
824815
function _preloadRoute(json, router, controllers) {
  let _path = json.path;
  let method = json.method || 'get';
  let controller = json.controller;

  method = router[method] || router[method.toLowerCase()];
  if (!method) {
    throw new Error(`Could not find a method with "${method}" on router`);
  }
  if (!controller) {
    throw new Error(`The controller is empty for route "${_path}"`);
  }
  if (!Array.isArray(controller)) {
    controller = [controller];
  }

  // 将字符串转换为真实的controller函数
  controller = controller.map((n) => {
    let fn = typeof n === 'function' ? n : get(controllers, n);
    if (typeof fn !== 'function') {
      throw new Error(`Could not find "${n}" as controller for route "${_path}"`);
    }
    return fn;
  });

  // 如果配置了path参数，将中间价挂载至该路由下，即：router.get(path, middleware)
  if (_path) {
    controller.unshift(_path);
  }
  if (Array.isArray(controller)) {
    method.apply(router, controller);
  }
}