You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
4.3 KiB
114 lines
4.3 KiB
9 months ago
|
<?php
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
||
|
// +----------------------------------------------------------------------
|
||
|
|
||
|
namespace app\wap\controller;
|
||
|
|
||
|
use app\admin\model\wechat\WechatReply;
|
||
|
use service\WechatService;
|
||
|
use think\Request;
|
||
|
use service\TouMiniProgramService;
|
||
|
use app\wap\model\store\StoreOrder as StoreOrderWapModel;
|
||
|
use behavior\wechat\PaymentBehavior;
|
||
|
use service\KuaiMiniProgramService;
|
||
|
use service\SystemConfigService;
|
||
|
use think\Log;
|
||
|
|
||
|
/**
|
||
|
* 快手服务器 验证控制器
|
||
|
* Class Wechat
|
||
|
* @package app\wap\controller
|
||
|
*/
|
||
|
class Kuaishou
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* 支付 异步回调
|
||
|
*/
|
||
|
public function notify()
|
||
|
{
|
||
|
try {
|
||
|
|
||
|
$result = \request()->param();
|
||
|
$orderid = $result['data']['out_order_no']; //订单号
|
||
|
$kwaisign = isset($_SERVER['HTTP_KWAISIGN']) ? $_SERVER['HTTP_KWAISIGN'] : '';
|
||
|
if ($result['data']['status'] == 'SUCCESS') {
|
||
|
$appSecret = SystemConfigService::get('kuai_mini_secret');
|
||
|
$result2 = json_encode($result);
|
||
|
$notify = md5($result2 . $appSecret); //签名
|
||
|
if ($notify == $kwaisign) {
|
||
|
//更新你的数据库
|
||
|
$data = [
|
||
|
'result' => 1,
|
||
|
'message_id' => $result['message_id']
|
||
|
];
|
||
|
if (StoreOrderWapModel::be(['order_id' => $orderid, 'paid' => 1])) {
|
||
|
return json($data);
|
||
|
};
|
||
|
if (PaymentBehavior::kuaishouPaySuccess($result['data'])) {
|
||
|
return json($data);
|
||
|
} else {
|
||
|
db()->rollback();
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
return json($data);
|
||
|
} else {
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
} else {
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
} catch (\Throwable $th) {
|
||
|
Log::write('快手订单支付回调异常' . $th->getMessage());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 退款 异步回调
|
||
|
*/
|
||
|
public function refundNotify()
|
||
|
{ $result = \request()->param();
|
||
|
Log::write('快手同步订单异常' . $result);
|
||
|
/* try {
|
||
|
$result = \request()->param();
|
||
|
$orderid = $result['data']['out_order_no']; //订单号
|
||
|
$kwaisign = isset($__SERVER['HTTP_KWAISIGN']) ? $__SERVER['HTTP_KWAISIGN'] : '';
|
||
|
if ($result['data']['status'] == 'SUCCESS') {
|
||
|
$appSecret = SystemConfigService::get('kuai_mini_secret');
|
||
|
$result = json_encode($result);
|
||
|
$notify = md5($result . $appSecret); //签名
|
||
|
if ($notify == $kwaisign) {
|
||
|
//更新你的数据库
|
||
|
$data = [
|
||
|
'result' => 1,
|
||
|
'message_id' => $result['message_id']
|
||
|
];
|
||
|
if (StoreOrderWapModel::be(['order_id' => $orderid, 'paid' => 1])) {
|
||
|
return json($data);
|
||
|
};
|
||
|
if (PaymentBehavior::douyinPaySuccess($result['data'])) {
|
||
|
return json($data);
|
||
|
} else {
|
||
|
db()->rollback();
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
return json($data);
|
||
|
} else {
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
} else {
|
||
|
return 'Signature error';
|
||
|
}
|
||
|
} catch (\Throwable $th) {
|
||
|
Log::write('快手同步订单异常' . $th->getMessage());
|
||
|
} */
|
||
|
}
|
||
|
}
|