Merge branch 'master' of http://git.excellentkk.cn/mkm/TaskSystem
This commit is contained in:
commit
c79e87b3d1
@ -229,9 +229,9 @@ class AdminLogic extends BaseLogic
|
||||
{
|
||||
$admin = Admin::field([
|
||||
'id', 'account', 'name', 'disable', 'root',
|
||||
'multipoint_login', 'avatar',
|
||||
'multipoint_login', 'avatar', 'sex', 'province', 'city', 'area', 'street', 'address', 'qualification', 'is_contract', 'id_card'
|
||||
])->findOrEmpty($params['id'])->toArray();
|
||||
|
||||
$admin['qualification'] = json_decode($admin['qualification'], true);
|
||||
if ($action == 'detail') {
|
||||
return $admin;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class WeChatPayService extends BasePayService
|
||||
]);
|
||||
$result = $response->toArray(false);
|
||||
$this->checkResultFail($result);
|
||||
return $result['prepay_id'];
|
||||
return $this->configForPayment($result['prepay_id'], $appId);
|
||||
}
|
||||
|
||||
|
||||
@ -390,8 +390,37 @@ class WeChatPayService extends BasePayService
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
public function configForPayment($prepayId, $appId)
|
||||
{
|
||||
$config = [
|
||||
'appId' => $appId,
|
||||
'timeStamp' => strval(time()),
|
||||
'nonceStr' => uniqid(),
|
||||
'package' => "prepay_id=$prepayId",
|
||||
'signType' => 'RSA',
|
||||
];
|
||||
$message = $config['appId'] . "\n" .
|
||||
$config['timeStamp'] . "\n" .
|
||||
$config['nonceStr'] . "\n" .
|
||||
$config['package'] . "\n";
|
||||
openssl_sign($message, $raw_sign, $this->getPrivateKey(), 'sha256WithRSAEncryption');
|
||||
$sign = base64_encode($raw_sign);
|
||||
|
||||
$config['paySign'] = $sign;
|
||||
$config['timestamp'] = $config['timeStamp'];
|
||||
$config['partnerid'] = $this->config['mch_id'];
|
||||
unset($config['timeStamp']);
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
protected function getPrivateKey()
|
||||
{
|
||||
if (!file_exists($this->config['private_key'])) {
|
||||
throw new \InvalidArgumentException(
|
||||
"SSL certificate not found: {$this->config['private_key']}"
|
||||
);
|
||||
}
|
||||
return openssl_pkey_get_private(file_get_contents($this->config['private_key']));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user