Beispiel #1
0
 public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 private function isNotify($rechargeOrderId, $userId, $userAccoutId, $price, $amount, $acOrderNo)
 {
     // 更新订单
     $keyData = array('id' => $rechargeOrderId, 'status' => Model_Fyk_RechargeOrder::STATUS_DEALING);
     $updateData = array('status' => Model_Fyk_RechargeOrder::STATUS_SUCCESS, 'acNotifyTime' => time(), 'acOrderNo' => $acOrderNo);
     $flag = Bll_Fyk_Payment_Recharge::getInstance()->updateRechargeOrder($keyData, $updateData);
     if ($flag) {
         // 记录账户流水表
         $requestId = Bll_Fyk_Payment_Common::getInstance()->createRequsetId("recharge", $rechargeOrderId);
         $balanceResult = Bll_Fyk_Payment_Amount::getInstance()->getBalance($userId);
         $addBalanceLogArr = array('userId' => $userId, 'accountId' => $userAccoutId, 'propId' => 0, 'listId' => $rechargeOrderId, 'price' => $price, 'realPrice' => $amount, 'amount' => $balanceResult['status'] ? $balanceResult['balance'] : 0, 'requestId' => $requestId, 'type' => Const_Fyk::THE_THIRD_PARTY_RECHARGE, 'createTime' => time());
         Bll_Fyk_Payment_Log::getInstance()->insertBalanceLog($addBalanceLogArr);
         echo "<result>1</result>";
     }
 }
Beispiel #3
0
 public function handle_request_internal()
 {
     $userId = $this->_params['userId'];
     $type = $this->_params['type'];
     $source = $this->_params['source'];
     $amount = $this->_params['amount'];
     //$amount = 1;
     $userAccoutId = Bll_Fyk_Payment_User::getInstance()->getUserAccountId($userId);
     if (empty($userAccoutId)) {
         return array("status" => "error", "errcode" => Const_APIStatus::E_FYK_PROP_ACTION_ACCOUNT_IS_NULL, "message" => "支付中心账户创建失败");
     }
     /*****************创建充值订单**********/
     $addArr = array('userId' => $userId, 'accountId' => $userAccoutId, 'price' => $amount, 'payType' => $type, 'status' => Model_Fyk_RechargeOrder::STATUS_NODEAL, 'source' => $source, 'createTime' => time());
     $id = Bll_Fyk_Payment_Recharge::getInstance()->insertRechargeOrder($addArr);
     $tmpData = Bll_Fyk_Payment_Recharge::getInstance()->getRechargeOrderDataById($id);
     if (empty($id) || empty($tmpData)) {
         return array("status" => "error", "errcode" => Const_APIStatus::E_UNKNOWN, "message" => "充值插入数据库失败");
     }
     $rechargeOrder = $tmpData[0];
     $requestId = Bll_Fyk_Payment_Common::getInstance()->createRequsetId("recharge", $id);
     $orderNo = Bll_Fyk_Payment_Common::getInstance()->createOrderNo("recharge", $requestId);
     $this->updateRechargeOrderTable($rechargeOrder, array('orderNo' => $orderNo, 'status' => Model_Fyk_RechargeOrder::STATUS_DEALING));
     /*****************生成支付中心充值参数**********/
     // 获取ack
     $tmpAckResult = Bll_Fyk_Payment_Common::getInstance()->getAckValue($userAccoutId);
     $ack = $tmpAckResult['status'] ? $tmpAckResult['sessionkey'] : "";
     $userData = Bll_Broker_User::getBrokerInfoByUserId($userId);
     $apps = APF::get_instance()->get_config('apps', 'acenter');
     $userName = !empty($userData) ? $userData['trueName'] : '';
     $orderName = "移动经纪人钱包充值";
     $appId = $apps['fyk']['appId'];
     $backUrl = $this->getBackUrl($id, $userId, $amount);
     $cityId = !empty($userData) ? $userData['cityId'] : '';
     $mobile = !empty($userData) ? $userData['userMobile'] : '';
     if (empty($userAccoutId) || empty($ack) || empty($userName) || empty($cityId) || empty($mobile)) {
         return array('status' => "error", "errcode" => Const_APIStatus::E_PARAM_MISS, "message" => "参数不正确");
     }
     $objApi = new Uri_PayCenterAPI();
     $acUrl = $objApi->redirectWabPayCenter($amount / 100, $userAccoutId, $ack, $userName, $orderName, $appId, $backUrl, $orderNo, $cityId, $mobile, $orderNo);
     return array('status' => "ok", 'data' => array('acUrl' => $acUrl), "message" => "成功");
 }