master
elf 1 year ago
parent 806e759d86
commit 98aa9aaee0

@ -89,6 +89,20 @@ class YjlyClient
protected function sign($name, $params) protected function sign($name, $params)
{ {
$apiBizFieldMap = [
'mail' => 'mailData',
'prop' => 'propData',
'pay' => 'moneyFen',
];
$signFields = ['appId', 'serverId', 'roleId', 'userId', $apiBizFieldMap[$name], 'orderNum', 'time'];
$signArray = [];
foreach ($signFields as $field) {
$signArray[] = $params[$field];
}
$signString = implode('', $signArray) . self::SIGN_KEY;
$this->log('SignString ' . $signString);
return md5($signString);
$signString = ''; $signString = '';
$signString .= $params['appId']; $signString .= $params['appId'];
$signString .= $params['serverId']; $signString .= $params['serverId'];
@ -155,7 +169,7 @@ class YjlyClient
} }
$result = $this->api('send-prop', [ $result = $this->api('send-prop', [
'roleId' => $order['role_id'], 'roleId' => $order['role_id'],
'propData' => json_encode($props), 'propData' => $props,
'serverId' => $order['server_id'], 'serverId' => $order['server_id'],
'userId' => $order['user_id'], 'userId' => $order['user_id'],
'orderNum' => $this->generateOrderNumber($order), 'orderNum' => $this->generateOrderNumber($order),
@ -190,7 +204,7 @@ class YjlyClient
'serverId' => $order['server_id'], 'serverId' => $order['server_id'],
'roleId' => $order['role_id'], 'roleId' => $order['role_id'],
'userId' => $order['user_id'], 'userId' => $order['user_id'],
'mailData' => json_encode([['mailId' => $giftItem['id']]]), 'mailData' => [['mailId' => $giftItem['id']]],
'orderNum' => date("YmdHis").$order['id'].$order['user_id'].$giftItem['id'].rand(1000, 9999), 'orderNum' => date("YmdHis").$order['id'].$order['user_id'].$giftItem['id'].rand(1000, 9999),
'time' => time(), 'time' => time(),
]); ]);

Loading…
Cancel
Save