促销价获取失败的情况下调用此方法
175107
def price_filter price
      price = price.split('-').first.strip if !price.nil? && price.include?('-')
    end
1188242
function sendRequest(method, path, data, callback) {
  if (!CONFIG.isInitialized) {
    throw ERROR_MESSAGE.initializeRequired;
  }

  log("==================================================");
  log("The data below will be sent");
  log("==================================================");
  log(data);

  let dataString = querystring.stringify(data);

  let headers = {
    "Content-Type": "application/x-www-form-urlencoded"
  };

  // 使用 POST 時設定 Content-Length 標頭
  if (method === "POST") {
    headers["Content-Length"] = dataString.length;
  } else {
    path = `${path}?${dataString}`;
  }

  let options = {
    host: CONFIG.host,
    port: CONFIG.port,
    path: path,
    method: method,
    headers: headers
  };

  let request;
  if (!CONFIG.useSSL) {
    request = http.request(options);
  } else {
    request = https.request(options);
  }

  log("==================================================");
  log("HTTP/HTTPS request options");
  log("==================================================");
  log(options);

  if (method === "POST") {
    log("==================================================");
    log("Send request");
    log("==================================================");
    log(dataString);
    request.write(dataString);
  }

  request.end();

  let buffer = "";
  request.on("response", (response) => {
    response.setEncoding("utf8");

    response.on("data", (chunk) => {
      buffer += chunk;
    });

    response.on("end", () => {
      let responseData;

      log("==================================================");
      log("Response data");
      log("==================================================");
      log(buffer);

      if (callback) {
        let err = undefined;

        // 另外處理非 JSON 物件的返回值
        if (NON_JSON_RESPONSE_ENDPOINT.indexOf(path) > -1) {
          if (response.statusCode === 200) {
            if (path === ENDPOINT.aioChargeback) {
              let [status, message] = buffer.split("|");
              responseData = {
                status: status,
                message: message
              };
            } else {
              responseData = {};
              let responseArr = buffer.split("&");
              responseArr.forEach((param) => {
                let [key, value] = param.split("=");
                responseData[key] = value;
              });
            }
          } else {
            err = response.statusCode;
          }
        } else {
          try {
            responseData = JSON.parse(buffer);
          } catch (error) {
            log("==================================================");
            log("Could not convert API response to JSON, the error below is ignored and raw API response is returned to client");
            log("==================================================");
            log(error);
            err = error;
          }
        }

        callback(err, responseData);
      }
    });

    response.on("close", (err) => {
      log("==================================================");
      log("Problem with API request detailed stacktrace below");
      log("==================================================");
      log(err);
      sendErrorResponse(err, callback);
    });
  });

  request.on("error", (err) => {
    log("==================================================");
    log("Problem with API request detailed stacktrace below");
    log("==================================================");
    log(err);
    sendErrorResponse(err, callback);
  });
}
119460
function () {
                    var index = 0;

                    while (index < fireLength) {

                        if ([].indexOf.call(arguments, list[index]) !== -1) {

                            // 从队列中删除当前回调
                            list.splice(index, 1);

                            // 如果当前回调队列被多层嵌套执行
                            // 上几层队列也可能会受到影响
                            if (firing) {
                                if (fireQueue.length) {
                                    fireQueue.forEach(function (value, key) {
                                        // 被删除的回调位于当前索引位置前面
                                        // 当前索引位置自减1
                                        if (index <= value) {
                                            fireQueue[key]--;
                                        }
                                    });
                                }

                                // 如果被删除的函数的索引位置在fireIndex的前面
                                // fireIndex自减1

                                if (index <= fireIndex) {
                                    fireIndex--;
                                }
                            }

                            // 回调列表长度改变
                            fireLength--;
                        } else {
                            index++;
                        }
                    }

                    return this;
                }
844338
function() {
			if(index < count) {
				inspectors[index++].inspect(this); // 执行递归，进行下一轮检查
			} else if(index++ === count) {
				ctrler.execute(); // 当inspector 被执行完时，执行 controller
				end();
			}
		}
360702
private boolean needInitSheet() {
        if (null == this.currentSheet) {
            //证明是第一页,肯定需要初始化
            return true;
        }
        //标识即将写入的下一行的行标
        int nextRowIndex = this.currentRowInSheet;
        if (!this.isBlankLastRow || (this.isBlankLastRow && !this.isSkipBlankRow)) {
            nextRowIndex++;
        }
        return nextRowIndex >= this.allowMaxRows;
    }
742774
protected void invoke(Object pObject) throws APPErrorException {
        try {
            Method method =tgtools.util.ReflectionUtil.findMethod(mService.getClass(),getMethodName(),getModelClass());
            method.invoke(mService,pObject);
        }catch (Exception ex)
        {
            throw new APPErrorException("执行方法错误；原因："+ex.getCause().getMessage(),ex);
        }
    }
664642
private int resolveTimeout(SofaRequest request, ConsumerConfig consumerConfig, ProviderInfo providerInfo) {
        // 先去调用级别配置
        Integer timeout = request.getTimeout();
        if (timeout == null) {
            // 取客户端配置（先方法级别再接口级别）
            timeout = consumerConfig.getMethodTimeout(request.getMethodName());
            if (timeout == null || timeout < 0) {
                // 再取服务端配置
                timeout = (Integer) providerInfo.getDynamicAttr(ATTR_TIMEOUT);
                if (timeout == null) {
                    // 取框架默认值
                    timeout = getIntValue(CONSUMER_INVOKE_TIMEOUT);
                }
            }
        }
        return timeout;
    }
98715
function nextTick(fn, thisArg) {
    if (thisArg) {
        fn = bind(fn, thisArg);
    }
    nextTasks.push(fn);

    if (nextHandler) {
        return;
    }

    nextHandler = function () {
        var tasks = nextTasks.slice(0);
        nextTasks = [];
        nextHandler = null;

        for (var i = 0, l = tasks.length; i < l; i++) {
            tasks[i]();
        }
    };

    // 非标准方法，但是此方法非常吻合要求。
    /* istanbul ignore next */
    if (typeof setImmediate === 'function') {
        setImmediate(nextHandler);
    }
    // 用MessageChannel去做setImmediate的polyfill
    // 原理是将新的message事件加入到原有的dom events之后
    else if (typeof MessageChannel === 'function') {
        var channel = new MessageChannel();
        var port = channel.port2;
        channel.port1.onmessage = nextHandler;
        port.postMessage(1);
    }
    // for native app
    else if (isNativePromise) {
        Promise.resolve().then(nextHandler);
    }
    else {
        setTimeout(nextHandler, 0);
    }
}
389516
function (cell, bottom, ignoreRange) {
            try {
                var cellInfo = this.getCellInfo(cell),
                    nextRowIndex, nextColIndex;
                var len = this.selectedTds.length && !ignoreRange,
                    range = this.cellsRange;
                //末行或者末列没有后置单元格
                if ((!bottom && (cellInfo.rowIndex == 0)) || (bottom && (!len ? (cellInfo.rowIndex + cellInfo.rowSpan > this.rowsNum - 1) : (range.endRowIndex == this.rowsNum - 1)))) return null;

                nextRowIndex = !bottom ? ( !len ? cellInfo.rowIndex - 1 : range.beginRowIndex - 1)
                    : ( !len ? (cellInfo.rowIndex + cellInfo.rowSpan) : range.endRowIndex + 1);
                nextColIndex = !len ? cellInfo.colIndex : range.beginColIndex;
                return this.getCell(this.indexTable[nextRowIndex][nextColIndex].rowIndex, this.indexTable[nextRowIndex][nextColIndex].cellIndex);
            } catch (e) {
                showError(e);
            }
        }
801199
public static void notNull(Object object, String message) {
        if (object == null)
            throw new IllegalArgumentException(message);
        /*
        * 如果是字符串，我不希望你的字符串是一个空字符串，那样没有任何意义，
        * 但是你仍然坚持要为空，那你可以添加一个空格(" ")试试
        * */
        if (object instanceof String)
            if (StringUtils.isEmpty((String) object))
                throw new IllegalArgumentException(message);
    }
422158
function finish(requester) {
        var orgHeaders = normal(requester.res.headers);
        // 恢复当前的请求上下文

        var context = requester.ctx;
        if (app.revertContext(context)) {
            // 透传响应头信息
            var res = context.res;
            headers.forEach(function (name) {
                if (orgHeaders[name]) {
                    // 直接覆盖
                    res.set(name, orgHeaders[name]);
                }
            });
        }
        // Dispose
        requester.ctx = context = null;
    }
792432
private function getMapping(){
        /**
         * restApi 方法映射. 
         * 
         * 每项描述一个method的 包含以下内容:
         *      url: string 方法调用位置
         *      required: array<K,V> 必须的参数列表,K有参数名, V为验证条件
         *      optional: array<K,V> 可选的参数列表,K有参数名, V为验证条件
         *      before: string 指定一个预处理方法. 用于在发送http request之前对payload内容进行一次处理.
         * 
         * @var array
         */
        $apiMapping = array (
            'pushMsgToSingleDevice' => array (
                'url' => '/push/single_device',
                'required' => array (
                    'channel_id' => self::$fieldIdStr,
                    'msg' => self::$fieldMsg,
                ),
                'optional' => array (
                    'msg_type' => self::$fieldMsgType,
                    'msg_expires' => self::$fieldMsgExpires,
                    'deploy_status' => self::$fieldDeployStatus,
                    //'topic_id' => self::$fieldMsgTopic,
                ),
                'before' => 'verifyMessage',
            ),
            'pushMsgToAll' => array (
                'url' => '/push/all',
                'required' => array (
                    'msg' => self::$fieldMsg,
                ),
                'optional' => array (
                    'msg_type' => self::$fieldMsgType,
                    'msg_expires' => self::$fieldMsgExpires,
                    'deploy_status' => self::$fieldDeployStatus,
                    'send_time' => self::$fieldSendTime,
                ),
                'before' => 'verifyMessage',
            ),
            'pushMsgToTag' => array (
                'url' => '/push/tags',
                'required' => array (
                    'tag' => self::$fieldTagName,
                    'msg' => self::$fieldMsg,
                ),
                'optional' => array (
                    'msg_type' => self::$fieldMsgType,
                    'msg_expires' => self::$fieldMsgExpires,
                    'deploy_status' => self::$fieldDeployStatus,
                    'send_time' => self::$fieldSendTime,
                ),
                'before' => 'verifyGroup',
            ),
            'pushToSmartTag' => array (
                'url' => '/push/tags',
                'required' => array (
                    'type' => self::$fieldGroupType,
                    'selector' => self::$fieldGroupSelector,
                    'msg' => self::$fieldMsg,
                ),
                'optional' => array (
                    'msg_type' => self::$fieldMsgType,
                    'msg_expires' => self::$fieldMsgExpires,
                    'deploy_status' => self::$fieldDeployStatus,
                    'send_time' => self::$fieldSendTime,
                ),
                'before' => 'verifyGroup',
            ),
            'pushBatchUniMsg' => array (
                'url' => '/push/batch_device',
                'required' => array (
                    'channel_ids' => self::$fieldChannelIdList,
                    'msg' => self::$fieldMsg,
                ),
                'optional' => array (
                    'msg_type' => self::$fieldMsgType,
                    'msg_expires' => self::$fieldMsgExpires,
                    'deploy_status' => self::$fieldDeployStatus,
                    'topic_id' => self::$fieldMsgTopic,
                ),
                'before' => 'verifyChannelIds',
            ),
            'queryMsgStatus' => array (
                'url' => '/report/query_msg_status',
                'required' => array (
                    'msg_id' => self::$fieldIdOrList,
                ),
                'optional' => array(
                    'statistic_type' => array ( 'type' => 'string'),
                ),
                'before' => 'verifyMsgIds',
            ),
            'queryTimerRecords' => array (
                'url' => '/report/query_timer_records',
                'required' => array (
                    'timer_id' => self::$fieldTimerId,
                ),
                'optional' => array (
                    'start' => self::$fieldPageStart,
                    'limit' => self::$fieldPageLimit,
                    'range_start' => self::$fieldTimestamp,
                    'range_end' => self::$fieldTimestamp,
                ),
            ),
            'queryTopicRecords' => array (
                'url' => '/report/query_topic_records',
                'required' => array (
                    'topic_id' => self::$fieldMsgTopic,
                ),
                'optional' => array (
                    'start' => self::$fieldPageStart,
                    'limit' => self::$fieldPageLimit,
                    'range_start' => self::$fieldTimestamp,
                    'range_end' => self::$fieldTimestamp,
                ),
            ),
            'queryTimerList' => array (
                'url' => '/timer/query_list',
                'required' => array (),
                'optional' => array (
                    'timer_id' => self::$fieldTimerId,
                    'start' => self::$fieldPageStart,
                    'limit' => self::$fieldPageLimit,
                ),
            ),
            'createTag' => array (
                'url' => '/app/create_tag',
                'required' => array (
                    'tag' => self::$fieldTagName,
                ),
            ),
            'deleteTag' => array (
                'url' => '/app/del_tag',
                'required' => array (
                    'tag' => self::$fieldTagName,
                ),
            ),
            'queryTags' => array (
                'url' => '/app/query_tags',
                'required' => array (),
                'optional' => array (
                    'tag' => self::$fieldTagName,
                     'start' => self::$fieldPageStart,
                    'limit' => self::$fieldPageLimit,
                ),
            ),
            'addDevicesToTag' => array (
                'url' => '/tag/add_devices',
                'required' => array (
                    'tag' => self::$fieldTagName,
                    'channel_ids' => self::$fieldChannelIdList,
                ),
                'before' => 'verifyChannelIds',
            ),
            'delDevicesFromTag' => array (
                'url' => '/tag/del_devices',
                'required' => array (
                    'tag' => self::$fieldTagName,
                    'channel_ids' => self::$fieldChannelIdList,
                ),
                'before' => 'verifyChannelIds',
            ),
            'queryDeviceNumInTag' => array (
                'url' => '/tag/device_num',
                'required' => array (
                    'tag' => self::$fieldTagName,
                ),
            ),
            'queryMessageHistory' => array (
                'url' => '/app/query_msg_history',
                'required' => array (),
                'optional' => array (
                    'msg_id' => self::$fieldIdOrList, 
                    'topic_id' => self::$fieldMsgTopic, 
                    'timer_id' => self::$fieldTimerId, 
                    'push_from' => self::$fieldNumber, 
                    'query_str' => array ( 'type' => 'string'), 
                    'send_time_type' => self::$fieldNumber, 
                    'msg_type' => self::$fieldNumber, 
                    'start' => self::$fieldPageStart, 
                    'limit' => self::$fieldPageLimit 
                ),
                'before' => 'verifyMsgIds',
            ),
            'queryStatisticTopic' => array (
                'url' => '/report/statistic_topic',
                'required' => array (
                    'topic_id' => self::$fieldMsgTopic, 
                ),
                'optional' => array (
                ),
            ),
            'queryStatisticMsg' => array (
                'url' => '/report/statistic_msg',
                'required' => array (),
                'optional' => array (
                    'query_type' => array ( 'type' => 'array'), 
                ),
                'before' => 'verifyRangeTypes',
            ),
            'queryStatisticDevice' => array (
                'url' => '/report/statistic_device',
                'required' => array (),
            ),
            'queryTopicList' => array (
                'url' => '/topic/query_list',
                'required' => array (),
            ),
        );
        
        return $apiMapping;
    }
545914
public Object eval(Scope scope) {
		// 优化：绝大多数情况下 length 等于 1
		if (exprArray.length == 1) {
			return exprArray[0].eval(scope);
		}
		
		if (exprArray.length == 0) {
			return null;
		}
		
		int end = exprArray.length - 1;
		for (int i=0; i<end; i++) {
			exprArray[i].eval(scope);
		}
		return exprArray[end].eval(scope);
	}
836745
@SuppressWarnings("unchecked")
    public static <R> R invoke(Object obj, String methodName, Class<?>[] parameterTypes,
                               Object... args) {
        Assert.isFalse(
            CollectionUtil.safeIsEmpty(parameterTypes) ^ CollectionUtil.safeIsEmpty(args),
            "方法参数类型列表必须和方法参数列表一致");
        Assert.isTrue(parameterTypes == null || parameterTypes.length == args.length,
            "方法参数类型列表长度必须和方法参数列表长度一致");
        Method method;
        if (obj instanceof Class) {
            method = getMethod((Class) obj, methodName, parameterTypes);
        } else {
            method = getMethod(obj.getClass(), methodName, parameterTypes);
        }
        return invoke(obj, method, args);
    }
697945
function checkInvokeReadyState() {
            var readyState = DEP_READY;

            // 先判断resource是否加载完成。如果resource未加载完成，则认为未准备好
            each(
                module.depRs,
                function ( dep ) {
                    if ( !( dep.absId && modIsDefined( dep.absId ) ) ) {
                        readyState = DEP_UNREADY;
                        return false;
                    }
                }
            );

            if ( readyState !== DEP_READY ) {
                return readyState;
            }

            // 检查所有依赖模块，根据以下因素处理readyState
            // 1. 是否定义完成
            // 2. 是否强依赖
            // 3. 是否循环依赖
            each(
                module.depMs,
                function ( dep ) {
                    if ( modIsDefined( dep.absId ) ) {
                        return;
                    }

                    // dep.circular相当于一层cache，尽量减少modHasCircularDependency多次调用的开销
                    if ( dep.circular === CIRCULAR_DEP_UNREADY ) {
                        dep.circular = modHasCircularDependency( id, dep.absId );
                    }

                    switch ( dep.circular ) {
                        case CIRCULAR_DEP_YES:
                            if ( dep.hard ) {
                                readyState = DEP_ANALYZED;
                            }
                            break;
                        case CIRCULAR_DEP_NO:
                            readyState = DEP_ANALYZED;
                            break;
                        case CIRCULAR_DEP_UNREADY:
                            readyState = DEP_UNREADY;
                            return false;
                    }
                }
            );

            return readyState;
        }
74549
protected void checkParameters() {
        // 检查注入的ref是否接口实现类
        Class proxyClass = providerConfig.getProxyClass();
        String key = providerConfig.buildKey();
        T ref = providerConfig.getRef();
        if (!proxyClass.isInstance(ref)) {
            throw ExceptionUtils.buildRuntime("provider.ref",
                ref == null ? "null" : ref.getClass().getName(),
                "This is not an instance of " + providerConfig.getInterfaceId()
                    + " in provider config with key " + key + " !");
        }
        // server 不能为空
        if (CommonUtils.isEmpty(providerConfig.getServer())) {
            throw ExceptionUtils.buildRuntime("server", "NULL", "Value of \"server\" is not specified in provider" +
                " config with key " + key + " !");
        }
        checkMethods(proxyClass);
    }
379968
function on(ele, type, callback) {
    let body = document.body;

    // 注册事件元素和类型
    if (!eventList[ele]) {
        eventList[ele] = {};
    }
    eventList[ele][type] = callback;

    /**
     * 在 body 元素上绑定事件, 统一管理事件
     */
    body.addEventListener(type, (e)=> {
        let eTag     = e.target,
            eleEvent = eventList[ele],
            eleList  = document.querySelectorAll(ele);

        // 向上冒泡匹配元素
        while (!([].indexOf.call(eleList, eTag) !== -1) && eTag !== body) {
            eTag = eTag.parentNode;
        }
        e.stopPropagation();
        e.preventDefault();
        if (eTag !== body && !!eleEvent) {
            if (!!eleEvent[type]) {
                eleEvent[type](eTag);

                // 如果当前元素事件属于需要被移除的事件，则在队列中进行删除
                if (offList.indexOf(ele + type) !== -1) {
                    delete eventList[ele][type];
                }
            }
        }
    });
}