|
|
@@ -20,13 +20,13 @@ class AccountController extends webApp
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
- $params =request()->post();
|
|
|
+ $params = request()->post();
|
|
|
$pageSize = request()->post('pageSize', 15);
|
|
|
- $params['user_id'] = isset($params['user_id'])? $params['user_id'] : $this->userId;
|
|
|
+ $params['user_id'] = isset($params['user_id']) ? $params['user_id'] : $this->userId;
|
|
|
$datas = AccountService::make()->getDataList($params, $pageSize);
|
|
|
- if($datas){
|
|
|
+ if ($datas) {
|
|
|
return message(1010, true, $datas);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return message(1009, false);
|
|
|
}
|
|
|
}
|
|
|
@@ -37,12 +37,12 @@ class AccountController extends webApp
|
|
|
*/
|
|
|
public function payMeal()
|
|
|
{
|
|
|
- $params =request()->post();
|
|
|
- $type = isset($params['type'])? $params['type'] : 1;
|
|
|
+ $params = request()->post();
|
|
|
+ $type = isset($params['type']) ? $params['type'] : 1;
|
|
|
$datas = AccountService::make()->getPayMealList($type);
|
|
|
- if($datas){
|
|
|
+ if ($datas) {
|
|
|
return message(1010, true, $datas);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return message(1009, false);
|
|
|
}
|
|
|
}
|
|
|
@@ -53,14 +53,14 @@ class AccountController extends webApp
|
|
|
*/
|
|
|
public function payLog()
|
|
|
{
|
|
|
- $params =request()->post();
|
|
|
+ $params = request()->post();
|
|
|
$pageSize = request()->post('pageSize', 15);
|
|
|
$params['type'] = 2;
|
|
|
- $params['user_id'] = isset($params['user_id'])? $params['user_id'] : $this->userId;
|
|
|
+ $params['user_id'] = isset($params['user_id']) ? $params['user_id'] : $this->userId;
|
|
|
$datas = AccountService::make()->getDataList($params, $pageSize);
|
|
|
- if($datas){
|
|
|
+ if ($datas) {
|
|
|
return message(1010, true, $datas);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return message(1009, false);
|
|
|
}
|
|
|
}
|
|
|
@@ -71,9 +71,9 @@ class AccountController extends webApp
|
|
|
*/
|
|
|
public function balance()
|
|
|
{
|
|
|
- $params =request()->post();
|
|
|
+ $params = request()->post();
|
|
|
$pageSize = request()->post('pageSize', 15);
|
|
|
- $params['user_id'] = isset($params['user_id'])? $params['user_id'] : $this->userId;
|
|
|
+ $params['user_id'] = isset($params['user_id']) ? $params['user_id'] : $this->userId;
|
|
|
$datas = BalanceLogService::make()->getDataList($params, $pageSize);
|
|
|
return message(1010, true, $datas);
|
|
|
}
|
|
|
@@ -85,10 +85,15 @@ class AccountController extends webApp
|
|
|
public function pay()
|
|
|
{
|
|
|
$params = request()->all();
|
|
|
- if (!$result = AccountService::make()->recharge($this->userId, $params)) {
|
|
|
- return showJson(AccountService::make()->getError(), false);
|
|
|
- } else {
|
|
|
- return showJson(AccountService::make()->getError(), true, $result);
|
|
|
+ try {
|
|
|
+ if (!$result = AccountService::make()->recharge($this->userId, $params)) {
|
|
|
+ return showJson(AccountService::make()->getError(), false);
|
|
|
+ } else {
|
|
|
+ return showJson(AccountService::make()->getError(), true, $result);
|
|
|
+ }
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()];
|
|
|
+ return showJson(1046, false, $error);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -98,11 +103,16 @@ class AccountController extends webApp
|
|
|
*/
|
|
|
public function withdraw()
|
|
|
{
|
|
|
- $params = request()->all();
|
|
|
- if (!$result = BalanceLogService::make()->withdraw($this->userId, $params)) {
|
|
|
- return showJson(BalanceLogService::make()->getError(), false);
|
|
|
- } else {
|
|
|
- return showJson(BalanceLogService::make()->getError(), true, $result);
|
|
|
+ try {
|
|
|
+ $params = request()->all();
|
|
|
+ if (!$result = BalanceLogService::make()->withdraw($this->userId, $params)) {
|
|
|
+ return showJson(BalanceLogService::make()->getError(), false);
|
|
|
+ } else {
|
|
|
+ return showJson(BalanceLogService::make()->getError(), true, $result);
|
|
|
+ }
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()];
|
|
|
+ return showJson(1046, false, $error);
|
|
|
}
|
|
|
}
|
|
|
}
|