mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
sort konto overview, update menu title, tooltip for memo every time not only by long memos
This commit is contained in:
parent
d72dc4b223
commit
b2e812d1fb
@ -20,9 +20,16 @@ class JsonRequestClientComponent extends Component
|
|||||||
if(!is_numeric($user_balance) || intval($user_balance) < 0) {
|
if(!is_numeric($user_balance) || intval($user_balance) < 0) {
|
||||||
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'user_balance invalid'];
|
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'user_balance invalid'];
|
||||||
}
|
}
|
||||||
if(!$this->is_base64($base64Message)) {
|
if(is_array($base64Message)) {
|
||||||
|
foreach($base64Message as $singleMessage) {
|
||||||
|
if(!$this->is_base64($singleMessage)) {
|
||||||
|
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'at least one base64Message contain invalid base64 characters'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(!$this->is_base64($base64Message)) {
|
||||||
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'base64Message contain invalid base64 characters'];
|
return ['state' => 'error', 'type' => 'parameter error', 'msg' => 'base64Message contain invalid base64 characters'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$http = new Client();
|
$http = new Client();
|
||||||
|
|
||||||
$transactionbody = json_encode([
|
$transactionbody = json_encode([
|
||||||
|
|||||||
@ -282,40 +282,32 @@ class TransactionCreationsController extends AppController
|
|||||||
}
|
}
|
||||||
$creationTransactionCount = count($transactions);
|
$creationTransactionCount = count($transactions);
|
||||||
if($creationTransactionCount > 0) {
|
if($creationTransactionCount > 0) {
|
||||||
$http = new Client();
|
$user_balance = 0;
|
||||||
try {
|
if(isset($user['balance'])) {
|
||||||
$loginServer = Configure::read('LoginServer');
|
$user_balance = $user['balance'];
|
||||||
$url = $loginServer['host'] . ':' . $loginServer['port'];
|
}
|
||||||
$session_id = $session->read('session_id');
|
// $session_id, $base64Message, $user_balance = 0
|
||||||
/*
|
$requestResult = $this->JsonRequestClient->sendTransaction(
|
||||||
* $response = $http->post($url . '/checkTransaction', json_encode([
|
$session->read('session_id'),
|
||||||
'session_id' => $session_id,
|
$transactions,
|
||||||
'transaction_base64' => base64_encode($builderResult['transactionBody']->serializeToString()),
|
$user_balance
|
||||||
'balance' => $user['balance']
|
);
|
||||||
]), ['type' => 'json']);
|
if($requestResult['state'] != 'success') {
|
||||||
*/
|
$this->addAdminError('TransactionCreations', 'createMulti', $requestResult, $user['id']);
|
||||||
$transactionbody = json_encode([
|
if($requestResult['type'] == 'request error') {
|
||||||
'session_id' => $session_id,
|
$this->Flash->error(__('Error by requesting LoginServer, please try again'));
|
||||||
'transaction_base64' => $transactions,
|
} else {
|
||||||
'balance' => $user['balance']
|
$this->Flash->error(__('Error, please wait for the admin to fix it'));
|
||||||
]);
|
|
||||||
//die($transactionbody);
|
|
||||||
$response = $http->post($url . '/checkTransaction', $transactionbody, ['type' => 'json']);
|
|
||||||
//var_dump($response->getStringBody());
|
|
||||||
try {
|
|
||||||
//$stringBody = $response->getStringBody();
|
|
||||||
//var_dump($stringBody);
|
|
||||||
$json = $response->getJson();
|
|
||||||
} catch(Exception $ex) {
|
|
||||||
$this->Flash->error(__('result isn\'t json ') . $ex->getMessage());
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$json = $requestResult['data'];
|
||||||
if($json['state'] != 'success') {
|
if($json['state'] != 'success') {
|
||||||
if($json['msg'] == 'session not found') {
|
if($json['msg'] == 'session not found') {
|
||||||
$session->destroy();
|
$session->destroy();
|
||||||
return $this->redirect(Router::url('/', true) . 'account', 303);
|
return $this->redirect(Router::url('/', true) . 'account', 303);
|
||||||
//$this->Flash->error(__('session not found, please login again'));
|
|
||||||
} else {
|
} else {
|
||||||
$this->Flash->error(__('login server return error: ' . json_encode($json)));
|
$this->addAdminError('TransactionCreations', 'createMulti', $json, $user['id']);
|
||||||
|
$this->Flash->error(__('Login Server Error, please wait for the admin to fix it'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$pendingTransactionCount = $session->read('Transactions.pending');
|
$pendingTransactionCount = $session->read('Transactions.pending');
|
||||||
@ -325,25 +317,17 @@ class TransactionCreationsController extends AppController
|
|||||||
$pendingTransactionCount += $creationTransactionCount;
|
$pendingTransactionCount += $creationTransactionCount;
|
||||||
}
|
}
|
||||||
$session->write('Transactions.pending', $pendingTransactionCount);
|
$session->write('Transactions.pending', $pendingTransactionCount);
|
||||||
echo "pending: " . $pendingTransactionCount;
|
//echo "pending: " . $pendingTransactionCount;
|
||||||
if($mode === 'next') {
|
if($mode === 'next') {
|
||||||
return $this->redirect(Router::url('/', true) . 'account/checkTransactions', 303);
|
return $this->redirect(Router::url('/', true) . 'account/checkTransactions', 303);
|
||||||
} else {
|
} else {
|
||||||
$this->Flash->success(__('Transaction submitted for review.'));
|
$this->Flash->success(__('Transaction submitted for review.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(\Exception $e) {
|
|
||||||
$msg = $e->getMessage();
|
|
||||||
$this->Flash->error(__('error http request: ') . $msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user