| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace common\logic\notify;
- use common\models\common\PaymentTrade;
- use common\models\order\Order;
- use common\traits\ErrorTrait;
- use Exception;
- /**
- * Class Notify
- * @Author: hua
- * @DateTime: 2021/10/18 9:39
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @package common\logic\notify
- */
- class Notify
- {
- use ErrorTrait;
- /**
- * @Author: hua
- * @DateTime: 2021/10/18 9:57
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param $order_info
- * @return bool
- */
- public function notify($order_info)
- {
- try {
- $payment_trade = PaymentTrade::findOne(['id' => $order_info['trade_id']]);
- $order = Order::findOne(['order_no' => $order_info['order_no']]);
- $res = Order::pay($order,$order_info['pay_type'],$payment_trade['out_trade_no']);
- if($res === false) throw new Exception(Order::getStaticError());
- return true;
- } catch (Exception $e) {
- \Yii::$app->custom->logs('notify:'.$e->getMessage());
- $this->setStaticError($e->getMessage());
- return false;
- }
- }
- }
|