Files
OMS/app/taskmgr/lib/rpc/sign.php
2025-12-28 23:13:25 +08:00

37 lines
942 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
//加载配置信息
require_once(dirname(__FILE__) . '/../../config/config.php');
class taskmgr_rpc_sign{
/**
*
* 生成签名算法函数
* @param array $params
*/
static public function gen_sign($params){
return strtoupper(md5(strtoupper(md5(self::assemble($params))).REQ_TOKEN));
}
/**
*
* 签名参数组合函数
* @param array $params
*/
static private function assemble($params)
{
if(!is_array($params)) return null;
ksort($params, SORT_STRING);
$sign = '';
foreach($params AS $key=>$val){
if(is_null($val)) continue;
if(is_bool($val)) $val = ($val) ? 1 : 0;
$sign .= $key . (is_array($val) ? self::assemble($val) : $val);
}
return $sign;
}
}