Skip to content

Instantly share code, notes, and snippets.

View JellyBool's full-sized avatar
🏠
Working from home

JellyBool JellyBool

🏠
Working from home
View GitHub Profile
@JellyBool
JellyBool / number.js
Last active August 1, 2019 07:27
comes from some day
function makeNum(number, func) {
if (func == null) { return number; }
else { return func(number); }
}
function two(func) {
return makeNum(2, func);
}
function three(func) {
return makeNum(3, func);
}
@JellyBool
JellyBool / pingxx_verify.php
Last active August 1, 2019 07:28
Pingxx verify , depence on pingxx package
<?php
// Ping++ 的数据可以这样获取
// $rawData = file_get_contents('php://input');
// 判断是否返回 1 ,最后记得返回 http_response_code(200);
protected function verifyPing($rawData) {
$headers = \Pingpp\Util\Util::getRequestHeaders();//这是Ping++的package提供的
$signature = isset($headers['X-Pingplusplus-Signature']) ? $headers['X-Pingplusplus-Signature'] : NULL;
$publicKeyContents = file_get_contents(public_path(). '/rsa_public_key.pem');//注意这里面的文件路径相对应
@JellyBool
JellyBool / alipay_return_url_checker.php
Last active August 1, 2019 07:28
alipay payment gateway verify
<?php
protected function isFromAlipay($notifyId)
{
$url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&partner=' . trim(env('ALIPAY_PID')) . '&notify_id=' . $notifyId;
$response = $this->httpGet($url);
return (bool) preg_match("/true$/i",$response);
}