/** * 创建账户 */ private function createAccount($userId) { $result = array('status' => false, 'msg' => '', 'accountId' => ''); $count = 0; while (true) { if ($count >= 3) { break; } // 调用api,开始扣费 $params = array('action' => 'create', 'uid' => $userId); $configPayment = Const_PaymentApp::FYK; $apiResult = Bll_Service_Payment::createAccount($configPayment, $params); if ($apiResult->isSucceeded()) { if ($apiResult['account']) { $result['status'] = true; $result['accountId'] = $apiResult['account']; break; } else { $count++; } } else { $result['msg'] = '链接失败'; $count++; } } return $result; }