public function handle_request()
 {
     $today = date('Ymd', time());
     $operateInfos = Bll_Fyk_Payment_MoneyAction::getInstance()->getExecuteInfoByDate($today, $this->per);
     if (!empty($operateInfos)) {
         $actionCode = array(1 => 5, 2 => 6, 3 => 7, 4 => 10);
         foreach ($operateInfos as $operateInfo) {
             $data['userId'] = $operateInfo->userId;
             $data['propId'] = $operateInfo->propId;
             $data['price'] = $operateInfo->price;
             $data['actionMsg'] = $operateInfo->actionMsg;
             $data['actionCode'] = $actionCode[$operateInfo->type];
             $data['status'] = Model_Fyk_MoneyActionQueue::STATUS_NODEAL;
             $data['createTime'] = time();
             $queueId = Model_Fyk_MoneyActionQueue::getInstance()->insertData($data);
             if (empty($queueId)) {
                 $operateInfo->operateStatus = Model_Fyk_MoneyActionTransition::OPERATE_FAILED;
             } else {
                 $operateInfo->queueId = $queueId;
                 $operateInfo->operateStatus = Model_Fyk_MoneyActionTransition::OPERATE_SUCCESS;
             }
             $operateInfo->save();
         }
     } else {
         $this->setShStopFlag();
     }
 }
Esempio n. 2
0
 public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * 获取需要跑的数据
  * @return array
  */
 public function getRequestData()
 {
     $data = Bll_Fyk_Payment_MoneyAction::getInstance()->getQueueDataByBiggerThanId($this->lastJobId, Model_Fyk_MoneyActionQueue::STATUS_NODEAL, $this->actionCode, 'id', 'asc', 0, $this->limit);
     if (empty($data)) {
         $this->textOutput("已经没有待处理数据了", false);
         $this->setMyFlag(0, 'over');
         return array();
     } else {
         return $data;
     }
 }
Esempio n. 4
0
 private function dealDetails($dealDetails, $detailList, $status)
 {
     if (empty($dealDetails) || empty($detailList)) {
         return false;
     }
     foreach ($dealDetails as $val) {
         if ($val['biz_order_no'] && $detailList[$val['biz_order_no']]) {
             $detail = $detailList[$val['biz_order_no']];
             // 查询一次master数据,防止多次处理
             $tmpDetailData = Bll_Fyk_Payment_Transfer::getInstance()->getTransferDetailById($detail->id, Model_Fyk_TransferDetail::STATUS_DEALING, true);
             if (empty($tmpDetailData)) {
                 continue;
             }
             $detail->realPrice = $val['real_amount'] * 100;
             $detail->acOrderNo = $val['order_no'];
             $detail->payOrderNo = $val['alipay_order_no'];
             $detail->payDoneTime = date("Y-m-d H:i:s", strtotime($val['alipay_done_time']));
             if ($status == true) {
                 $detail->status = Model_Fyk_TransferDetail::STATUS_SUCCESS;
                 $detail->save();
             } else {
                 $detail->status = Model_Fyk_TransferDetail::STATUS_ERROR;
                 // 退钱
                 $actionMsg = json_encode(array('msg' => "提现失败,提现detailId=" . $detail->id));
                 $arrQueue = array('userId' => $detail['userId'], 'propId' => 0, 'price' => $detail['price'], 'requestId' => 0, 'actionMsg' => $actionMsg, 'actionCode' => Const_Fyk::THE_THIRD_PARTY_WITHDRAWAL_FAILED, 'status' => Model_Fyk_MoneyActionQueue::STATUS_NODEAL, 'createTime' => time());
                 $detail->save();
                 Bll_Fyk_Payment_MoneyAction::getInstance()->insertQueueData($arrQueue);
             }
         }
     }
 }