首页修改,转账记录修改
This commit is contained in:
@@ -37,13 +37,13 @@ class Dashboard extends Backend
|
|||||||
$bankList = Bank::field([
|
$bankList = Bank::field([
|
||||||
'id', 'bank_name', 'bank_account', 'current_balance', 'safe_alert', 'label_color', 'weigh',
|
'id', 'bank_name', 'bank_account', 'current_balance', 'safe_alert', 'label_color', 'weigh',
|
||||||
// 子查询:入款总额
|
// 子查询:入款总额
|
||||||
"(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 1 and create_time BETWEEN {$start} AND {$end}) AS total_fund_in",
|
"(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type in (1,3) and create_time BETWEEN {$start} AND {$end}) AS total_fund_in",
|
||||||
// 子查询:出款总额
|
// 子查询:出款总额
|
||||||
"(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 2 and create_time BETWEEN {$start} AND {$end}) AS total_fund_out",
|
"(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type in (2,4) and create_time BETWEEN {$start} AND {$end}) AS total_fund_out",
|
||||||
// 子查询:入款次数
|
// 子查询:入款次数
|
||||||
"(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 1 and create_time BETWEEN {$start} AND {$end}) AS count_fund_in",
|
"(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type in (1,3) and create_time BETWEEN {$start} AND {$end}) AS count_fund_in",
|
||||||
// 子查询:出款次数
|
// 子查询:出款次数
|
||||||
"(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 2 and create_time BETWEEN {$start} AND {$end}) AS count_fund_out",
|
"(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type in (2,4) and create_time BETWEEN {$start} AND {$end}) AS count_fund_out",
|
||||||
])
|
])
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->order('weigh', 'desc')
|
->order('weigh', 'desc')
|
||||||
@@ -268,4 +268,56 @@ class Dashboard extends Backend
|
|||||||
}
|
}
|
||||||
$this->success('', $history);
|
$this->success('', $history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function editTransact(): void
|
||||||
|
{
|
||||||
|
$userMoneyLog = new UserMoneyLog();
|
||||||
|
$pk = $userMoneyLog->getPk();
|
||||||
|
$id = $this->request->param($pk);
|
||||||
|
$row = $userMoneyLog->find($id);
|
||||||
|
if (!$row) {
|
||||||
|
$this->error(__('Record not found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$data = $this->request->post();
|
||||||
|
if (!$data) {
|
||||||
|
$this->error(__('Parameter %s can not be empty', ['']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
$userMoneyLog->startTrans();
|
||||||
|
try {
|
||||||
|
$result = $row->save($data);
|
||||||
|
$userMoneyLog->commit();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$userMoneyLog->rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($result !== false) {
|
||||||
|
$this->success(__('Update successful'));
|
||||||
|
} else {
|
||||||
|
$this->error(__('No rows updated'));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->success('', [
|
||||||
|
'row' => $row
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delTransact($id): void
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
try {
|
||||||
|
$result = Db::table('ba_user_money_log')->delete($id);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
$this->error(__('%d records and files have been deleted', [1]) . $e->getMessage());
|
||||||
|
}
|
||||||
|
if ($result) {
|
||||||
|
$this->success(__('%d records and files have been deleted', [1]));
|
||||||
|
} else {
|
||||||
|
$this->error(__('No rows were deleted'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -45,10 +45,6 @@ class UserMoneyLog extends model
|
|||||||
$new->save();
|
$new->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
public static function onBeforeDelete(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getMoneyAttr($value): string
|
public function getMoneyAttr($value): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ export default {
|
|||||||
'type_list': {
|
'type_list': {
|
||||||
1 : 'Deposit',
|
1 : 'Deposit',
|
||||||
2 : 'Withdraw',
|
2 : 'Withdraw',
|
||||||
|
3 : 'IN',
|
||||||
|
4 : 'OUT',
|
||||||
},
|
},
|
||||||
'Game Ticket' : 'Game Ticket',
|
'Game Ticket' : 'Game Ticket',
|
||||||
'game_type': {
|
'game_type': {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ export default {
|
|||||||
'type_list': {
|
'type_list': {
|
||||||
1 : '存款',
|
1 : '存款',
|
||||||
2 : '取款',
|
2 : '取款',
|
||||||
|
3 : '转入',
|
||||||
|
4 : '转出',
|
||||||
},
|
},
|
||||||
'Game Ticket' : '游戏门票',
|
'Game Ticket' : '游戏门票',
|
||||||
'game_type': {
|
'game_type': {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 表格顶部菜单 -->
|
<!-- 表格顶部菜单 -->
|
||||||
<TableHeader
|
<TableHeader
|
||||||
:buttons="['refresh', 'add', 'comSearch', 'quickSearch', 'columnDisplay']"
|
:buttons="['refresh', 'add', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
:quick-search-placeholder="
|
:quick-search-placeholder="
|
||||||
t('Quick search placeholder', { fields: t('user.moneyLog.User name') + '/' + t('user.moneyLog.User nickname') })
|
t('Quick search placeholder', { fields: t('user.moneyLog.User name') + '/' + t('user.moneyLog.User nickname') })
|
||||||
"
|
"
|
||||||
@@ -97,6 +97,8 @@ const baTable = new baTableClass(
|
|||||||
custom: {
|
custom: {
|
||||||
'1': 'success',
|
'1': 'success',
|
||||||
'2': 'danger',
|
'2': 'danger',
|
||||||
|
'3': 'success',
|
||||||
|
'4': 'danger',
|
||||||
},
|
},
|
||||||
replaceValue: { ...tm('user.moneyLog.type_list') },
|
replaceValue: { ...tm('user.moneyLog.type_list') },
|
||||||
},
|
},
|
||||||
@@ -109,7 +111,7 @@ const baTable = new baTableClass(
|
|||||||
showOverflowTooltip: true,
|
showOverflowTooltip: true,
|
||||||
},
|
},
|
||||||
{ label: t('Create time'), prop: 'create_time', align: 'center', render: 'datetime', sortable: 'custom', operator: 'RANGE', width: 160 },
|
{ label: t('Create time'), prop: 'create_time', align: 'center', render: 'datetime', sortable: 'custom', operator: 'RANGE', width: 160 },
|
||||||
{ label: t('Operate'), align: 'center', width: '60', render: 'buttons', buttons: defaultOptButtons(['edit']) },
|
{ label: t('Operate'), align: 'center', width: '100', render: 'buttons', buttons: defaultOptButtons(['edit', 'delete']) },
|
||||||
],
|
],
|
||||||
dblClickNotEditColumn: ['all'],
|
dblClickNotEditColumn: ['all'],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user