生成要请求给支付宝的参数数组

@param $para_temp 请求前的参数数组
@param $isNew 新版支付宝接口签名时包含sign_type,所以以此参数来区别是否是新版接口
@return mixed 要请求的参数数组
482231
public static function buildRequestPreStr($para_temp, $isNew=false)
    {
        //除去待签名参数数组中的空值和签名参数
        $para_filter = self::paraFilter($para_temp, $isNew);

        //对待签名参数数组排序
        $para_sort = self::argSort($para_filter);

        //把数组所有元素，按照“参数=参数值”的模式用“&”字符拼接成字符串
        $prestr = self::createLinkstring($para_sort);

        return $prestr;
    }
754369
function f_kurum_teklif_temp(_tahta_id, _kurum_id, _para_id, _onay_id) {
        //kurumun verdiği teklif id lerini içeren temp oluştur
        return result.dbQ.exists(result.kp.temp.ssetTahtaKurumTeklifleri(_tahta_id, _kurum_id))
            .then(function (_iExist) {
                if (_iExist) {
                    return 1;
                } else {
                    return result.dbQ.sinterstore(result.kp.temp.ssetTahtaKurumTeklifleri(_tahta_id, _kurum_id),
                        result.kp.kurum.ssetTeklifleri(_kurum_id),
                        result.kp.tahta.ssetTeklifleri(_tahta_id, true));
                }
            })
            .then(function () {
                if (_para_id && _para_id > 0 && _para_id != null) {
                    //teklif tarihine göre x para birimli kurum teklifleri temp i oluştur
                    var anahtar = result.kp.temp.zsetKurumTeklifleriParaBirimli(_tahta_id, _kurum_id, _para_id);
                    return result.dbQ.exists(anahtar)
                        .then(function (_iExist) {
                            if (_iExist) {
                                return 1;
                            } else {
                                return result.dbQ.zinterstore(anahtar, 2, result.kp.temp.ssetTahtaKurumTeklifleri(_tahta_id, _kurum_id), result.kp.teklif.ssetTeklifParaBirimli(_para_id))
                            }
                        });
                } else {
                    return 1;
                }
            })
            .then(function () {
                if (_onay_id && _onay_id > 0 && _onay_id != null) {
                    //teklif tarihine göre x onay durumlu kurum teklifleri temp i oluştur
                    var anahtar = result.kp.temp.zsetKurumTeklifleriOnayDurumunaGore(_tahta_id, _kurum_id, _onay_id);
                    return result.dbQ.exists(anahtar)
                        .then(function (_iExist) {
                            if (_iExist) {
                                return 1;
                            } else {
                                return result.dbQ.zinterstore(anahtar, 2, result.kp.temp.ssetTahtaKurumTeklifleri(_tahta_id, _kurum_id), result.kp.teklif.ssetTeklifOnayDurumlari(_onay_id))
                            }
                        });
                } else {
                    return 1;
                }
            })
            .then(function () {
                return result.dbQ.smembers(result.kp.temp.ssetTahtaKurumTeklifleri(_tahta_id, _kurum_id));
            });
    }
26078
public static function sign(array $params, string $secretKey, array $ignoreParamKeys = [], bool $doNotHash = false): string
    {
        $paramsPrepared = self::getParamsToSign($params, $ignoreParamKeys, 1);
        $stringToSign = implode(self::ITEMS_DELIMITER, $paramsPrepared);
        return $doNotHash
            ? $stringToSign
            : base64_encode(hash_hmac('sha512', $stringToSign, $secretKey, true))
            ;
    }
334311
public function MakeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->ToUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . "&key=".WxPayConfig::$KEY;
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}
1330108
protected function _validate($data, $options, $isNew)
    {
        $errors = parent::_validate($data, $options, $isNew);
        if (!empty($errors)) {
            Log::write('error', json_encode($errors));
        }
        return $errors;
    }
669416
private function convertPhpStormGenericToPsalmGeneric(Type\Union $candidate, $is_property = false)
    {
        $atomic_types = $candidate->getTypes();

        if (isset($atomic_types['array']) && count($atomic_types) > 1) {
            $iterator_name = null;
            $generic_params = null;

            try {
                foreach ($atomic_types as $type) {
                    if ($type instanceof Type\Atomic\TIterable
                        || ($type instanceof Type\Atomic\TNamedObject
                            && (!$type->from_docblock || $is_property)
                            && (
                                strtolower($type->value) === 'traversable'
                                || $this->classlikes->interfaceExtends(
                                    $type->value,
                                    'Traversable'
                                )
                                || $this->classlikes->classImplements(
                                    $type->value,
                                    'Traversable'
                                )
                            ))
                    ) {
                        $iterator_name = $type->value;
                    } elseif ($type instanceof Type\Atomic\TArray) {
                        $generic_params = $type->type_params;
                    }
                }
            } catch (\InvalidArgumentException $e) {
                // ignore class-not-found issues
            }

            if ($iterator_name && $generic_params) {
                if ($iterator_name === 'iterable') {
                    $generic_iterator = new Type\Atomic\TIterable($generic_params);
                } else {
                    if (strtolower($iterator_name) === 'generator') {
                        $generic_params[] = Type::getMixed();
                        $generic_params[] = Type::getMixed();
                    }
                    $generic_iterator = new Type\Atomic\TGenericObject($iterator_name, $generic_params);
                }

                $candidate->removeType('array');
                $candidate->addType($generic_iterator);
            }
        }
    }
837559
public function getSign(array $para)
    {
        /**
         * a.除sign 字段外，对所有传入参数按照字段名的ASCII 码从小到大排序（字典序）后，
         * 使用URL 键值对的格式（即key1=value1&key2=value2…）拼接成字符串string1，
         * 注意： 值为空的参数不参与签名 ；
         */
        // 过滤不参与签名的参数
        $paraFilter = Helpers::paraFilter($para);
        // 对数组进行（字典序）排序
        $paraFilter = Helpers::argSort($paraFilter);
        // 进行URL键值对的格式拼接成字符串string1
        $string1 = Helpers::createLinkstring($paraFilter);
        /**
         * b.
         * 在string1 最后拼接上key=Key(商户支付密钥 ) 得到stringSignTemp 字符串，
         * 并对stringSignTemp 进行md5 运算，再将得到的字符串所有字符转换为大写，得到sign 值signValue。
         */
        $sign = $string1 . '&key=' . $this->getKey();
        $sign = strtoupper(md5($sign));
        
        return $sign;
    }
354251
static public function create($name, $object, $attributes, $params = [])
    {
        // 将属性转换成数组
        if (is_string($attributes)) {
            $attributes = str_explode($attributes, ',');
        }
        // 分析规则适用的场景（scenario）
        if (isset($params['on'])) {
            if (is_array($params['on'])) {
                $on = $params['on'];
            } else {
                $on = str_explode($params['on'], ',');
            }
        } else {
            $on = [];
        }
        // 分析规则不适用的场景（scenario）
        if (isset($params['except'])) {
            if (is_array($params['except'])) {
                $except = $params['except'];
            } else {
                $except = str_explode($params['except'], ',');
            }
        } else {
            $except = [];
        }
        $params['attributes'] = $attributes;
        $params['on'] = empty($on) ? [] : array_combine($on, $on); // 绑定支持的 scenario
        $params['except'] = empty($except) ? [] : array_combine($except, $except); // 绑定拒绝的 scenario

        if (method_exists($object, $name)) {
            $params['class'] = '\ModelSupports\validators\InlineValidator';
            $params['method'] = $name;
        } else if (isset(self::$builtInValidators[$name])) {
            $params['class'] = self::$builtInValidators[$name];
        } else {
            $params['class'] = $name;
        }
        return Unit::createObject($params);
    }
640109
private function GetPostParams($Source, $ParamList, $MergeParams = [])
        {
            // 過濾非法參數
            $PostParams = [];
            foreach ($ParamList as $Name => $Value) {
                if (isset($Source[$Name])) {
                    $PostParams[$Name] = $Source[$Name];
                } else {
                    // 若未設定則帶預設值
                    $PostParams[$Name] = $Value;
                }
            }

            return array_merge($MergeParams, $PostParams);
        }
1018214
function (_tahta_id, _kurum_id, _para_id) {
                return TEMP + ":" + TAHTA + ":" + _tahta_id + ":" + KURUM + ":" + _kurum_id + ":" + PARA_BIRIM + ":" + _para_id + ":" + TEKLIF;
            }
63115
public function createPathInfo(UrlManager $urlManager, $route, $params, $ampersand)
    {
        $tr = [];
        if ($route !== $this->route) {
            if (null !== $this->routePattern && preg_match($this->routePattern, $route, $m)) {
                foreach ($this->references as $key => $name) {
                    $tr[$name] = $m[$key];
                }
            } else {
                return false;
            }
        }
        // 默认参数
        foreach ($this->defaultParams as $key => $value) {
            if (isset($params[$key])) { // 一旦设置必须和配置的一致
                if ($params[$key] == $value) {
                    unset($params[$key]);
                } else {
                    return false;
                }
            }
        }
        // 规定参数必须设置，否则不匹配该规则
        foreach ($this->params as $key => $value) {
            if (!isset($this->params[$key])) {
                return false;
            }
            $tr["<$key>"] = urlencode($params[$key]);
            unset($params[$key]);
        }
        $url = strtr($this->template, $tr);
        if (empty($params)) {
            return $url !== '' ? $url . $urlManager->urlSuffix : $url;
        }
        // 还有未在pattern中出现的参数
        if ($this->append) {
            // 允许pathInfo 追加
            $url .= '/' . $urlManager->createPathInfo($params, '/', '/') . $urlManager->urlSuffix;
        } else {
            // 不允许追加时，参数放在 "?" 后面
            if ($url !== '') {
                $url .= $urlManager->urlSuffix;
            }
            $url .= '?' . $urlManager->createPathInfo($params, '=', $ampersand);
        }
        return $url;
    }
1324215
public function toSQL(Parameters $params, bool $inner_clause)
    {
        if ($key = $this->getKey())
        {
            try
            {
                $params->get($key);
            }
            catch (\OutOfRangeException $e)
            {
                $key = null;
            }
        }

        if ($key === null)
        {
            $val = $this->getValue();
            if (is_bool($val))
                $val = $val ? 1 : 0;
            $key = $params->assign($val, $this->getParameterType());
        }
        $this->bind($params, $key, null);

        return ':' . $key;
    }
895347
protected function generateSign($params = [])
    {
        if ($this->sign_method == 'md5') {
            return $this->generateMd5Sign($params);
        } elseif ($this->sign_method == 'hmac') {
            return $this->generateHmacSign($params);
        } else {
            throw new Exception("sign_method错误...");
        }
    }
417201
public function send($mobile, $temp_id, $params = '', $sign_name = '')
    {
        $client = new Client(new App($this->config));
        $req    = new AlibabaAliqinFcSmsNumSend();

        $req->setRecNum($mobile)
            ->setSmsParam($params)
            ->setSmsFreeSignName($sign_name)
            ->setSmsTemplateCode($temp_id);

        return $client->execute($req);
    }
1098031
public function auth($nonce = null, $params = null)
    {
        $params = $params ?: array();

        $client_id = $this->params['client_id'];
        $client_key = $this->params['client_key'];

        // 1) Get nonce
        $nonce = $nonce ?: $this->server->request('auth');

        // 2) Create key hash
        $key_hash = md5("{$client_id}::{$client_key}");

        // 3) Create auth key
        $auth_key = md5("{$nonce}{$client_id}{$key_hash}");

        // 4) Authenticate with client params
        $params['client'] = $client_id;
        $params['key'] = $auth_key;

        if ($this->params['version']) {
            $params['$v'] = $this->params['version'];
        }
        if ($this->params['api']) {
            $params['$api'] = $this->params['api'];
        }
        if ($this->params['session']) {
            $params['$session'] = $this->params['session'];
        }
        if (isset($this->params['route']['client'])) {
            $params['$route'] = $this->params['route'];
        }
        if (isset($_SERVER['REMOTE_ADDR']) && $ip_address = $_SERVER['REMOTE_ADDR']) {
            $params['$ip'] = $ip_address;
        }
        if ($this->cache) {
            $params['$cached'] = $this->cache->get_versions();
        }

        $this->authed = true;
        
        try {
            return $this->server->request('auth', $params);
        } catch (NetworkException $e) {
            $this->request_rescue($e);
            return $this->auth();
        }
    }
846534
public function buildRequestForm($para_temp, $method, $button_name) {
        //待请求参数数组
        $para = $this->buildRequestPara($para_temp);

        $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$this->alipay_gateway_new."_input_charset=".trim(strtolower($this->input_charset))."' method='".$method."'>";
        while (list ($key, $val) = each ($para)) {
            $sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>";
        }

        //submit按钮控件请不要含有name属性
        $sHtml = $sHtml."<input type='submit' style='display:none' value='".$button_name."'>";
        $sHtml = $sHtml."<span>正在跳转支付宝页面......</span></form>";
        $sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";

        return $sHtml;
    }
667312
public function MakeSign()
    {
        //签名步骤一：按字典序排序参数
        ksort($this->values);
        $string = $this->ToUrlParams();
        //签名步骤二：在string后加入KEY
        $string = $string . "&key=" . $this->key;
        if ($this->IsSign_typeSet() && $this->GetSign_type() == 'HMAC-SHA256') {
            //签名步骤三：HMAC-SHA256加密
            $string = hash_hmac('sha256', $string, $this->key);
        } else {
            //签名步骤三：MD5加密
            $string = md5($string);
        }
        //签名步骤四：所有字符转为大写
        $result = strtoupper($string);
        return $result;
    }