作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

测试

... ... @@ -72,7 +72,8 @@ class Notify extends Api
*/
private function handleCourseOrder($out_trade_no,$payamount,$paytype){
// 处理订单逻辑
$order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
// $order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
$order = CourseOrder::get(['order_sn'=>$out_trade_no,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
// 学习人数加1
... ... @@ -93,7 +94,6 @@ class Notify extends Api
return;
}
$data = $pay->verify();
\think\Log::write(json_encode($data));
try {
$payamount = $paytype == 'alipay' ? $data['total_amount'] : $data['total_fee'] / 100;
$out_trade_no = $data['out_trade_no'];
... ... @@ -101,7 +101,6 @@ class Notify extends Api
//处理订单
$this->handleSecretOrder($out_trade_no,$payamount,$paytype);
} catch (Exception $e) {
\think\Log::write($e->getMessage());
}
echo $pay->success();
}
... ... @@ -132,7 +131,8 @@ class Notify extends Api
*/
private function handleSecretOrder($out_trade_no,$payamount,$paytype){
// 处理订单逻辑
$order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
// $order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
$order = SecretOrder::get(['order_sn'=>$out_trade_no,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
// 购买量加1
... ... @@ -190,7 +190,8 @@ class Notify extends Api
*/
private function handleScoreOrder($out_trade_no,$payamount,$paytype){
// 处理订单逻辑
$order = ScoreOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
// $order = ScoreOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
$order = ScoreOrder::get(['order_sn'=>$out_trade_no,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
// 增加积分
... ... @@ -248,7 +249,8 @@ class Notify extends Api
*/
private function handlePackageOrder($out_trade_no,$payamount,$paytype){
// 处理订单逻辑
$order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
// $order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_price'=>$payamount,'pay_type'=>$paytype]);
$order = PackageOrder::get(['order_sn'=>$out_trade_no,'pay_type'=>$paytype]);
if($order && $order['pay_status'] != '1'){
$order->save(['pay_status'=>'1','pay_time'=>time()]);
foreach ($order['package'] as $v){
... ...