统一下单
服务商模式接入文档:https://pay.weixin.qq.com/wiki/doc/api/native_sl.php?chapter=9_1
商户模式接入文档:https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_1

@param isSandbox
是否是沙盒环境
@param params
@return {String}
500843
public static String pushOrder(boolean isSandbox, Map<String, String> params) {
		if (isSandbox)
			return doPost(UNIFIEDORDER_SANDBOXNEW_URL, params);
		return doPost(UNIFIEDORDER_URL, params);
	}
825347
public function QPayMicroPay($params = array()){
      //入参q
/*      $params["out_trade_no"] = "20160512161914_BBC" . "A";
      $params["sub_mch_id"] = "1900005911";
      $params["body"] = "body_test_中文";
      $params["device_info"] = "WP00000001";
      $params["fee_type"] = "CNY";
      $params["notify_url"] = "https://10.222.146.71:80/success.xml";
      $params["spbill_create_ip"] = "127.0.0.1";
      $params["total_fee"] = "1";
      $params["trade_type"] = "MICROPAY";
      $params["auth_code"] = "910728310408849937";*/
//      if (empty($params["out_trade_no"])){
//          throw new Exception('商户订单号参数不能缺少' ,'OUT_TRADE_NO_MUST_INPUT');
//      }
//      if (empty($params["fee_type"])){
//          throw new Exception('货币类型不能缺少' ,'FEE_TYPE');
//      }
//      if (empty($params["total_fee"])){
//          throw new Exception('订单金额不能缺少' ,'TOTAL_FEE');
//      }
//      if (empty($params["spbill_create_ip"])){
//          throw new Exception('终端IP不能缺少' ,'SPBILL_CREATE_IP');
//      }
//      if (empty($params["device_info"])){
//          throw new Exception('设备号不能缺少' ,'DEVICE_INFO');
//      }
//      if (empty($params["auth_code"])){
//          throw new Exception('付款码不能缺少' ,'AUTH_CODE');
//      }
/*      if (empty($params["sub_mch_id"])){
          throw new Exception('' ,'SUB_MCH_ID');
      }*/
/*      if (empty($params["notify_url"])){
          throw new Exception('' ,'NOTIFY_URL');
      }*/
//      if (empty($params["body"])){
//          throw new Exception('商品描述' ,'BODY');
//      }
//      if (empty($params["trade_type"])){
//          throw new Exception('支付场景不能缺少' ,'TRADE_TYPE');
//      }
    //api调用
      $qpayApi = new QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_micro_pay.cgi', null, 10);
      $qpayApi->setMchId($params['mchId']);
      $qpayApi->setMchKey($params['mchKey']);
      unset($params['mchId'], $params['mchKey']);
      $ret = $qpayApi->reqQpay($params);

      return QpayMchUtil::xmlToArray($ret);
    }
1229910
public String getMessage(String key, String... params) {
        // 参数校验
        if (key == null) {
            return null;
        }
        // 得到message内容
        String msg = bundle.getString(key);
        // 如果不存在动态内容,则直接返回msg
        if (params == null || params.length == 0) {
            return msg;
        }
        // 存在动态内容,渲染后返回新的message
        if (StringUtils.isBlank(msg)) {
            // 如果得到的msg为null或者空字符串,则直接返回msg本身
            return msg;
        }
        return MessageFormat.format(msg, (Object[]) params);
    }
586090
public function QPayReverse($params = array()){
        /*       //入参
                $params = array();
                $params["out_trade_no"] = "20160512161914_BBC";
                $params["sub_mch_id"] = "1900005911";*/
        if (empty($params["out_trade_no"])){
            throw new Exception('商户订单号参数不能缺少' ,'OUT_TRADE_NO_MUST_INPUT');
        }
        if (empty($params["sub_mch_id"])){
            throw new Exception('不能缺少' ,'SUB_MCH_ID');
        }

        //api调用
        $qpayApi = new QpayMchAPI('https://api.qpay.qq.com/cgi-bin/pay/qpay_reverse.cgi', true, 10);
        $qpayApi->setMchId('1490434181');
        $qpayApi->setMchKey('8525638f86969d1de5c51ad0494f4f13');
        $qpayApi->setIsSSL(true);
        $qpayApi->setCertFilePath('/Users/aji/documents/Project/sicmouse-api/app/apiclient_cert.pem');
        $qpayApi->setKeyFilePath('/Users/aji/documents/Project/sicmouse-api/app/apiclient_key.pem');
        $ret = $qpayApi->reqQpay($params);
        return QpayMchUtil::xmlToArray($ret);
    }
1366611
public static String buildRequestMysign(Map<String, String> params, String key, String signType) {
		String prestr = createLinkString(params); // 把数组所有元素，按照“参数=参数值”的模式用“&”字符拼接成字符串
		if (signType.equals("MD5")) {
			return HashKit.md5(prestr.concat(key));
		}
		return null;
	}
824103
function paramParser(rawParams) {
    if (rawParams === void 0) { rawParams = ''; }
    var /** @type {?} */ map = new Map();
    if (rawParams.length > 0) {
        var /** @type {?} */ params = rawParams.split('&');
        params.forEach(function (param) {
            var /** @type {?} */ eqIdx = param.indexOf('=');
            var _a = eqIdx == -1 ? [param, ''] : [param.slice(0, eqIdx), param.slice(eqIdx + 1)], key = _a[0], val = _a[1];
            var /** @type {?} */ list = map.get(key) || [];
            list.push(val);
            map.set(key, list);
        });
    }
    return map;
}
885692
public static function open($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }
        $o = '<form';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= (isset($params['onsubmit'])) ? " onsubmit='{$params['onsubmit']}'" : '';
        $o .= (isset($params['method'])) ? " method='{$params['method']}'" : ' method="get"';
        $o .= (isset($params['action'])) ? " action='{$params['action']}'" : '';
        $o .= (isset($params['files'])) ? " enctype='multipart/form-data'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= (isset($params['role'])) ? " role='{$params['role']}'" : '';
        $o .= (isset($params['autocomplete'])) ? " autocomplete='{$params['autocomplete']}'" : '';
        $o .= '>';
        return $o . "\n";
    }
1129894
public static function input($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input ';
        $o .= (isset($params['type'])) ? " type='{$params['type']}'" : 'type="text"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='form-input text {$params['class']}'" : '';
        $o .= (isset($params['onclick'])) ? " onclick='{$params['onclick']}'" : '';
        $o .= (isset($params['onkeypress'])) ? " onkeypress='{$params['onkeypress']}'" : '';
        $o .= (isset($params['value'])) ? ' value="' . $params['value'] . '"' : '';
        $o .= (isset($params['length'])) ? " maxlength='{$params['length']}'" : '';
        $o .= (isset($params['width'])) ? " style='width:{$params['width']}px;'" : '';
        $o .= (isset($params['disabled'])) ? " disabled='{$params['disabled']}'" : '';
        $o .= (isset($params['placeholder'])) ? " placeholder='{$params['placeholder']}'" : '';
        $o .= (isset($params['accept'])) ? " accept='{$params['accept']}'" : '';
        $o .= (isset($params['maxlength'])) ? " maxlength='{$params['maxlength']}'" : '';
        $o .= (isset($params['minlength'])) ? " minlength='{$params['minlength']}'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= (isset($params['required'])) ? " required='required'" : '';
        $o .= (isset($params['autocomplete'])) ? " autocomplete='{$params['autocomplete']}'" : '';
        $o .= (isset($params['autofocus'])) ? " autofocus" : '';
        $o .= " />\n";
        return $o;
    }
168867
public static function buildQueryStr($params) {
        $arrTmp = array();
        foreach ($params as $k => $v){
            //参数为空不参与签名
            if(isset($v) && $v != ''){
                array_push($arrTmp, "$k=$v");
            }
        }
        return implode('&', $arrTmp);
    }
776075
public function post($url, $params = array(), $options = array(), $body = '')
    {
        $client = new \GuzzleHttp\Client($options);
        $query = $this->getQueryParam4AccessToken();
        $response = $client->post($url, array(
            'query' => $query,
            'body' => empty($body) ? json_encode($params, JSON_UNESCAPED_UNICODE) : $body
        ));
        if ($this->isSuccessful($response)) {
            return $this->getJson($response); // $response->json();
        } else {
            throw new Exception("微信服务器未有效的响应请求");
        }
    }
473588
function _check(&$data, $param)
    {
        foreach ($param as $k => $p)
        {
            if (!isset($data[$k]))
            {
                if (isset($p['require']) and $p['require'])
                {
                    self::raise('param require');
                }
                else
                {
                    continue;
                }
            }

            if (isset($p['type']))
            {
                $data[$k] = Validate::$p['type']($data[$k]);
                if ($data[$k] === false)
                {
                    self::raise();
                }

                //最小值参数
                if (isset($p['min']) and is_numeric($data[$k]) and $data[$k] < $p['min'])
                {
                    self::raise('num too small');
                }
                //最大值参数
                if (isset($p['max']) and is_numeric($data[$k]) and $data[$k] > $p['max'])
                {
                    self::raise('num too big');
                }

                //最小值参数
                if (isset($p['short']) and is_string($data[$k]) and mb_strlen($data[$k]) < $p['short'])
                {
                    self::raise('string too short');
                }
                //最大值参数
                if (isset($p['long']) and is_string($data[$k]) and mb_strlen($data[$k]) > $p['long'])
                {
                    self::raise('string too long');
                }

                //自定义的正则表达式
                if ($p['type'] == 'regx' and isset($p['regx']) and preg_match($p['regx'], $data[$k]) === false)
                {
                    self::raise();
                }
            }
        }
        //如果为拒绝模式，所有不在过滤参数$param中的键值都将被删除
        if ($this->mode == 'deny')
        {
            $allow = array_keys($param);
            $have = array_keys($data);
            foreach ($have as $ha)
            {
                if (!in_array($ha, $allow))
                {
                    unset($data[$ha]);
                }
            }
        }
    }
605743
public static <E> Page<E> startPage(Object params) {
        Page<E> page = PageObjectUtil.getPageFromObject(params, true);
        //当已经执行过orderBy的时候
        Page<E> oldPage = getLocalPage();
        if (oldPage != null && oldPage.isOrderByOnly()) {
            page.setOrderBy(oldPage.getOrderBy());
        }
        setLocalPage(page);
        return page;
    }
558446
public static <T> Page<T> getPageFromObject(Object params, boolean required) {
        if (params == null) {
            throw new PageException("无法获取分页查询参数!");
        }
        if(params instanceof IPage){
            IPage pageParams = (IPage) params;
            Page page = null;
            if(pageParams.getPageNum() != null && pageParams.getPageSize() != null){
                page = new Page(pageParams.getPageNum(), pageParams.getPageSize());
            }
            if (StringUtil.isNotEmpty(pageParams.getOrderBy())) {
                if(page != null){
                    page.setOrderBy(pageParams.getOrderBy());
                } else {
                    page = new Page();
                    page.setOrderBy(pageParams.getOrderBy());
                    page.setOrderByOnly(true);
                }
            }
            return page;
        }
        int pageNum;
        int pageSize;
        MetaObject paramsObject = null;
        if (hasRequest && requestClass.isAssignableFrom(params.getClass())) {
            try {
                paramsObject = MetaObjectUtil.forObject(getParameterMap.invoke(params, new Object[]{}));
            } catch (Exception e) {
                //忽略
            }
        } else {
            paramsObject = MetaObjectUtil.forObject(params);
        }
        if (paramsObject == null) {
            throw new PageException("分页查询参数处理失败!");
        }
        Object orderBy = getParamValue(paramsObject, "orderBy", false);
        boolean hasOrderBy = false;
        if (orderBy != null && orderBy.toString().length() > 0) {
            hasOrderBy = true;
        }
        try {
            Object _pageNum = getParamValue(paramsObject, "pageNum", required);
            Object _pageSize = getParamValue(paramsObject, "pageSize", required);
            if (_pageNum == null || _pageSize == null) {
                if(hasOrderBy){
                    Page page = new Page();
                    page.setOrderBy(orderBy.toString());
                    page.setOrderByOnly(true);
                    return page;
                }
                return null;
            }
            pageNum = Integer.parseInt(String.valueOf(_pageNum));
            pageSize = Integer.parseInt(String.valueOf(_pageSize));
        } catch (NumberFormatException e) {
            throw new PageException("分页参数不是合法的数字类型!", e);
        }
        Page page = new Page(pageNum, pageSize);
        //count查询
        Object _count = getParamValue(paramsObject, "count", false);
        if (_count != null) {
            page.setCount(Boolean.valueOf(String.valueOf(_count)));
        }
        //排序
        if (hasOrderBy) {
            page.setOrderBy(orderBy.toString());
        }
        //分页合理化
        Object reasonable = getParamValue(paramsObject, "reasonable", false);
        if (reasonable != null) {
            page.setReasonable(Boolean.valueOf(String.valueOf(reasonable)));
        }
        //查询全部
        Object pageSizeZero = getParamValue(paramsObject, "pageSizeZero", false);
        if (pageSizeZero != null) {
            page.setPageSizeZero(Boolean.valueOf(String.valueOf(pageSizeZero)));
        }
        return page;
    }
1195413
public String params(String param) {
        if (param == null) {
            return null;
        }

        if (param.startsWith(":")) {
            return params.get(param.toLowerCase()); // NOSONAR
        } else {
            return params.get(":" + param.toLowerCase()); // NOSONAR
        }
    }
1059460
function(params){
    var id = this.get('id');
    var basename = this.get('basename');
    var ids = this.get('ids');
    var spriteId = id ? basename + id : basename;
    var imgPath = this.get('imgPath');

    this.sprites[spriteId] = mixin(conf, {});
    this.sprites[spriteId]['images'] = {};
    var config = this.get('config');
    //合并全局配置
    mixin(config['global'], this.sprites[spriteId]);
    if (imgPath) {
      var imgDest = imgPath + '/' + spriteId + '-sprite.png';
      this.sprites[spriteId]['filename'] = imgDest;
      var imgCss = imgDest;
      if (this.get('relative')) {
        imgCss = this.get('relative') + '/' + spriteId + '-sprite.png';
        this.sprites[spriteId]['relative'] = imgCss;
      }

      var output = this.get('output');
      output[imgCss] = path.join(path.dirname(this.get('file')), imgDest);
    }

    var dir = params[PARAMS['direction']];
    if (dir && dir == PARAMS['horizontal']) {
      this.sprites[spriteId]['layout'] = 'horizontal';
    }

    if (config[id]) mixin(config[id], this.sprites[spriteId]);

    ids[id] = spriteId;
    id++;
    this.set('id', id);
    return spriteId;
  }
219910
public static String sprintf( String s, Object[] params ) {
        if ((s == null) || (params == null)) {
            return s;
        }
        StringBuffer result = new StringBuffer("");
        String[] ss = split(s);
        int p = 0;
        for( int i = 0; i < ss.length; i++ ) {
            char c = ss[i].charAt(0);
            String t = ss[i].substring(1);
            if (c == '+') {
                result.append(t);
            } else {
                Object param = params[p];
                if (param instanceof Integer) {
                    result.append(new Format(t).form((Integer) param));
                } else if (param instanceof Long) {
                    result.append(new Format(t).form((Long) param));
                } else if (param instanceof Character) {
                    result.append(new Format(t).form((Character) param));
                } else if (param instanceof Double) {
                    result.append(new Format(t).form((Double) param));
                } else if (param instanceof Double) {
                    result.append(new Format(t).form(new Float((Double) param)));
                } else {
                    result.append(new Format(t).form(param.toString()));
                }
                p++;
            }
        }
        return result.toString();
    }
196085
function(params) {
			var newparams = ''; 
			
			for (par in params) {
				var obj = params[par];
				if(typeof obj ==  'string'){
					if (params[par]) {
						if(newparams)newparams += "&";
						newparams += par + "=" + params[par];
					}
				}else if(obj instanceof  Array){
					if(newparams)newparams += "&";
					
					var i = 0;
					for(i=0; i<obj.length; i++){
						if (obj[i]) {
							newparams += par + "=" + obj[i];
							if(i != obj.length-1)newparams += ";";
						}
						
					}
				}
			}
			//newparams=newparams.encode();
			//encode(newparams);
			//return escape('?'+newparams);
			return encodeURI('?'+newparams); //The old version (escape('?'+newparams);) gave problems because it encoded ? and &
		}