123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\index\controller;
- use app\common\controller\Frontend;
- use app\common\service\OrderPaySuccService;
- use app\common\service\PayReturnService;
- use think\Db;
- /**
- * 第三方登录控制器
- */
- class Payment extends Frontend
- {
- protected $noNeedLogin='*';
- /**
- * 支付成功回调
- */
- public function notify($order_no)
- {
- Db::startTrans();
- $payment=\app\common\model\Payment::where('order_no',$order_no)
- ->lock(true)
- ->find();
- if(!$payment){
- Db::rollback();
- $this->result([],400);
- }
- $service=new PayReturnService();
- $service->setPayment($payment);
- list($isPay,$succ)=$service->process();
- if(!$payment['pay_time'] && $isPay){
- $payment->payed();
- }
- Db::commit();
- return $succ;
- }
- }
|