1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Http\Utils\DuoMaiLianMeng;
- use App\Http\Utils\BaseUtil;
- /**
- * 多麦工具栏类(https://open.duomai.com/)
- * Class DuoMaiLianMengUtil
- * @package App\Http\Utils\DuoMaiLianMeng
- */
- class DuoMaiLianMengUtil extends BaseUtil
- {
- /**
- * 获取签名
- * @param $params 请求参数
- * @param $serviceName 服务名称
- */
- public static function getSign($params,$serviceName)
- {
- $systemParams = [
- "app_key"=>env("DUO_MAI_APP_KEY"),
- "timestamp"=>time(),
- "service"=>$serviceName
- ];
- $params = array_merge($params,$systemParams);
- ksort($params);
- $sign = "";
- foreach ($params as $key=>$val){
- $sign .= $key.$val;
- }
- $sign .= json_encode($params);
- $sign = env("DUO_MAI_APP_SECRET").$sign.env("DUO_MAI_APP_SECRET");
- $sign = strtoupper(md5($sign));
- $systemParams["sign"] = $sign;
- return http_build_query($systemParams);
- }
- }
|