Exemplo n.º 1
0
 public function fire($job, $data)
 {
     $orderId = $data['id'];
     $ret = true;
     switch ($data['notify_type']) {
         case 'direct':
             $order = RechargeModel::find($orderId);
             break;
         case 'consume':
             $order = ConsumeModel::find($orderId);
             break;
         case 'refund':
             $order = RefundModel::find($orderId);
             break;
         case 'trans':
             $order = TransModel::find($orderId);
             break;
     }
     if ($order && $order->callback_status != 2 && $order->callback_count < 20) {
         try {
             $ret = BusiNotifyBiz::getInstance()->notifyCallback($order, $data['notify_type']);
         } catch (PayException $e) {
             $ret = true;
         } catch (\Exception $e) {
             $ret = false;
         }
         $job->release(pow($order->callback_count, 2) * 60);
     }
     if ($ret == true) {
         $job->delete();
     }
 }
Exemplo n.º 2
0
 private function _transNotify($notice)
 {
     $errCode = 0;
     $errMsg = '';
     foreach ($notice['details'] as $detail) {
         try {
             $transOrder = TransModel::where('mer_trans_no', $detail['mer_trans_no'])->first();
             if (!$transOrder) {
                 $errCode++;
                 $errMsg = '提现订单不存在' . $detail['mer_trans_no'];
                 continue;
             }
             if ($transOrder->status != TransModel::STATUS_DEFAULT) {
                 $errCode++;
                 $errMsg = '订单状态不正确';
                 continue;
             }
             $upInfo = ['ser_pay_time' => $detail['pay_time'], 'ser_trans_no' => $detail['ser_trans_no'], 'ser_notify_status' => $detail['notify_status'], 'ser_notify_time' => $detail['notify_time'], 'ser_notify_log' => $detail['notify_log']];
             if (true !== TransBiz::getInstance()->confirmTransOrderById($transOrder->id, $upInfo)) {
                 $errCode++;
                 $errMsg = '确认转账订单失败';
                 continue;
             }
         } catch (\Exception $e) {
             $errCode++;
             $errMsg = $e->getMessage();
             continue;
         }
     }
     $ret = new \stdClass();
     $ret->is_success = $errCode === 0 ? 'T' : 'F';
     $ret->code = $errCode;
     $ret->output = $notice['output'];
     $ret->error = $errMsg;
     return $ret;
 }
Exemplo n.º 3
0
 public function transThirdParty($batchNo)
 {
     $transArr = TransModel::where('batch_no', $batchNo)->get();
     foreach ($transArr as $trans) {
         $fields[] = ['channel' => ChannelUtil::calculateAccountChannel($trans['channel']), 'gateway' => $trans['gateway'], 'mer_trans_no' => $trans['mer_trans_no'], 'batch_no' => $trans['batch_no'], 'bank_code' => $trans['bank_code'], 'timestamp' => $trans['create_time'], 'trans_amount' => $trans['trans_amount'], 'subject' => $trans['subject'], 'user_name' => $trans['person_name'], 'user_account' => $trans['person_account'], 'notify_url' => PayVars::getNotifyUrl() . "notify/trans/{$trans['channel']}/{$trans['gateway']}"];
     }
     $gatewayObj = GatewayUtil::getGatewayObj($fields[0]['gateway']);
     return $gatewayObj->trans($fields);
 }