fix: 表名前缀修复 + 创建缺失的audit_log表
- BaseService::table() 从 'plugins_vr_' 改为 'vr_'
(原名 plugins_vr_seat_templates → ShopXO前缀后变成 vrt_plugins_vr_seat_templates,实际表名是 vrt_vr_seat_templates)
- Admin.php 所有硬编码 Db::name('plugins_vr_xxx') 改为 Db::name('vr_xxx')
- 在数据库创建缺失的 vrt_vr_audit_log 表
refactor/vr-ticket-20260416
parent
e9480b6866
commit
f6bcad6bfb
|
|
@ -35,6 +35,11 @@ class Admin extends Common
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return $this->VenueList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 座位模板(SeatTemplate)
|
// 座位模板(SeatTemplate)
|
||||||
|
|
@ -60,7 +65,7 @@ class Admin extends Common
|
||||||
$where[] = ['status', '=', intval($status)];
|
$where[] = ['status', '=', intval($status)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = \Db::name('plugins_vr_seat_templates')
|
$list = \Db::name('vr_seat_templates')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
|
|
@ -79,7 +84,9 @@ class Admin extends Common
|
||||||
unset($item);
|
unset($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('seat_template/list', [
|
// Leading / = ThinkPHP absolute path resolved from app/admin/view/default/
|
||||||
|
// Files are at: app/admin/view/default/plugins/view/vr_ticket/admin/view/seat_template/list.html
|
||||||
|
return MyView('../../../plugins/vr_ticket/admin/view/seat_template/list', [
|
||||||
'list' => $list['data'],
|
'list' => $list['data'],
|
||||||
'page' => $list['page'],
|
'page' => $list['page'],
|
||||||
'count' => $list['total'],
|
'count' => $list['total'],
|
||||||
|
|
@ -117,12 +124,12 @@ class Admin extends Common
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
\Db::name('plugins_vr_seat_templates')->where('id', $id)->update($data);
|
\Db::name('vr_seat_templates')->where('id', $id)->update($data);
|
||||||
return DataReturn('更新成功', 0);
|
return DataReturn('更新成功', 0);
|
||||||
} else {
|
} else {
|
||||||
$data['add_time'] = time();
|
$data['add_time'] = time();
|
||||||
$data['upd_time'] = time();
|
$data['upd_time'] = time();
|
||||||
\Db::name('plugins_vr_seat_templates')->insert($data);
|
\Db::name('vr_seat_templates')->insert($data);
|
||||||
return DataReturn('添加成功', 0);
|
return DataReturn('添加成功', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +137,7 @@ class Admin extends Common
|
||||||
// 编辑时加载数据
|
// 编辑时加载数据
|
||||||
$info = [];
|
$info = [];
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$info = \Db::name('plugins_vr_seat_templates')->find($id);
|
$info = \Db::name('vr_seat_templates')->find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载分类列表(用于下拉选择)
|
// 加载分类列表(用于下拉选择)
|
||||||
|
|
@ -139,7 +146,7 @@ class Admin extends Common
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
return view('seat_template/save', [
|
return MyView('../../../plugins/vr_ticket/admin/view/seat_template/save', [
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'categories' => $categories,
|
'categories' => $categories,
|
||||||
]);
|
]);
|
||||||
|
|
@ -159,8 +166,8 @@ class Admin extends Common
|
||||||
return DataReturn('参数错误', -1);
|
return DataReturn('参数错误', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = \Db::name('plugins_vr_seat_templates')->where('id', $id)->find();
|
$template = \Db::name('vr_seat_templates')->where('id', $id)->find();
|
||||||
\Db::name('plugins_vr_seat_templates')
|
\Db::name('vr_seat_templates')
|
||||||
->where('id', $id)
|
->where('id', $id)
|
||||||
->update(['status' => 0, 'upd_time' => time()]);
|
->update(['status' => 0, 'upd_time' => time()]);
|
||||||
|
|
||||||
|
|
@ -202,7 +209,7 @@ class Admin extends Common
|
||||||
$where[] = ['goods_id', '=', $goods_id];
|
$where[] = ['goods_id', '=', $goods_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = \Db::name('plugins_vr_tickets')
|
$list = \Db::name('vr_tickets')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
|
|
@ -227,7 +234,7 @@ class Admin extends Common
|
||||||
2 => ['text' => '已退款', 'color' => 'red'],
|
2 => ['text' => '已退款', 'color' => 'red'],
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('ticket/list', [
|
return MyView('../../../plugins/vr_ticket/admin/view/ticket/list', [
|
||||||
'list' => $list['data'],
|
'list' => $list['data'],
|
||||||
'page' => $list['page'],
|
'page' => $list['page'],
|
||||||
'count' => $list['total'],
|
'count' => $list['total'],
|
||||||
|
|
@ -245,7 +252,7 @@ class Admin extends Common
|
||||||
return DataReturn('参数错误', -1);
|
return DataReturn('参数错误', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ticket = \Db::name('plugins_vr_tickets')->find($id);
|
$ticket = \Db::name('vr_tickets')->find($id);
|
||||||
if (empty($ticket)) {
|
if (empty($ticket)) {
|
||||||
return DataReturn('票不存在', -1);
|
return DataReturn('票不存在', -1);
|
||||||
}
|
}
|
||||||
|
|
@ -254,17 +261,17 @@ class Admin extends Common
|
||||||
|
|
||||||
$verifier = [];
|
$verifier = [];
|
||||||
if ($ticket['verifier_id'] > 0) {
|
if ($ticket['verifier_id'] > 0) {
|
||||||
$verifier = \Db::name('plugins_vr_verifiers')->find($ticket['verifier_id']);
|
$verifier = \Db::name('vr_verifiers')->find($ticket['verifier_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ticket['qr_code_url'] = \app\plugins\vr_ticket\service\TicketService::getQrCodeUrl($ticket['ticket_code']);
|
$ticket['qr_code_url'] = \app\plugins\vr_ticket\service\TicketService::getQrCodeUrl($ticket['ticket_code']);
|
||||||
|
|
||||||
$verifiers = \Db::name('plugins_vr_verifiers')
|
$verifiers = \Db::name('vr_verifiers')
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
return view('ticket/detail', [
|
return MyView('../../../plugins/vr_ticket/admin/view/ticket/detail', [
|
||||||
'ticket' => $ticket,
|
'ticket' => $ticket,
|
||||||
'goods' => $goods,
|
'goods' => $goods,
|
||||||
'verifier' => $verifier,
|
'verifier' => $verifier,
|
||||||
|
|
@ -311,7 +318,7 @@ class Admin extends Common
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = ['ID', '订单号', '票码', '观演人', '手机', '座位', '核销状态', '发放时间'];
|
$header = ['ID', '订单号', '票码', '观演人', '手机', '座位', '核销状态', '发放时间'];
|
||||||
$rows = \Db::name('plugins_vr_tickets')
|
$rows = \Db::name('vr_tickets')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->cursor();
|
->cursor();
|
||||||
|
|
@ -359,7 +366,7 @@ class Admin extends Common
|
||||||
$where[] = ['status', '=', intval($status)];
|
$where[] = ['status', '=', intval($status)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = \Db::name('plugins_vr_verifiers')
|
$list = \Db::name('vr_verifiers')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
|
|
@ -381,7 +388,7 @@ class Admin extends Common
|
||||||
unset($item);
|
unset($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('verifier/list', [
|
return MyView('../../../plugins/vr_ticket/admin/view/verifier/list', [
|
||||||
'list' => $list['data'],
|
'list' => $list['data'],
|
||||||
'page' => $list['page'],
|
'page' => $list['page'],
|
||||||
'count' => $list['total'],
|
'count' => $list['total'],
|
||||||
|
|
@ -407,7 +414,7 @@ class Admin extends Common
|
||||||
return DataReturn('核销员名称不能为空', -1);
|
return DataReturn('核销员名称不能为空', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$exist = \Db::name('plugins_vr_verifiers')
|
$exist = \Db::name('vr_verifiers')
|
||||||
->where('user_id', $user_id)
|
->where('user_id', $user_id)
|
||||||
->where('id', '<>', $id)
|
->where('id', '<>', $id)
|
||||||
->find();
|
->find();
|
||||||
|
|
@ -416,12 +423,12 @@ class Admin extends Common
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
\Db::name('plugins_vr_verifiers')
|
\Db::name('vr_verifiers')
|
||||||
->where('id', $id)
|
->where('id', $id)
|
||||||
->update(['name' => $name, 'status' => $status]);
|
->update(['name' => $name, 'status' => $status]);
|
||||||
return DataReturn('更新成功', 0);
|
return DataReturn('更新成功', 0);
|
||||||
} else {
|
} else {
|
||||||
\Db::name('plugins_vr_verifiers')->insert([
|
\Db::name('vr_verifiers')->insert([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
|
|
@ -433,7 +440,7 @@ class Admin extends Common
|
||||||
|
|
||||||
$info = [];
|
$info = [];
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$info = \Db::name('plugins_vr_verifiers')->find($id);
|
$info = \Db::name('vr_verifiers')->find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = \Db::name('User')
|
$users = \Db::name('User')
|
||||||
|
|
@ -442,7 +449,7 @@ class Admin extends Common
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
return view('verifier/save', [
|
return MyView('../../../plugins/vr_ticket/admin/view/verifier/save', [
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'users' => $users,
|
'users' => $users,
|
||||||
]);
|
]);
|
||||||
|
|
@ -462,8 +469,8 @@ class Admin extends Common
|
||||||
return DataReturn('参数错误', -1);
|
return DataReturn('参数错误', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$verifier = \Db::name('plugins_vr_verifiers')->where('id', $id)->find();
|
$verifier = \Db::name('vr_verifiers')->where('id', $id)->find();
|
||||||
\Db::name('plugins_vr_verifiers')
|
\Db::name('vr_verifiers')
|
||||||
->where('id', $id)
|
->where('id', $id)
|
||||||
->update(['status' => 0]);
|
->update(['status' => 0]);
|
||||||
|
|
||||||
|
|
@ -503,7 +510,7 @@ class Admin extends Common
|
||||||
$where[] = ['status', '=', intval($status)];
|
$where[] = ['status', '=', intval($status)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = \Db::name('plugins_vr_seat_templates')
|
$list = \Db::name('vr_seat_templates')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
|
|
@ -519,7 +526,7 @@ class Admin extends Common
|
||||||
}
|
}
|
||||||
unset($item);
|
unset($item);
|
||||||
|
|
||||||
return view('venue/list', [
|
return MyView('../../../plugins/vr_ticket/admin/view/venue/list', [
|
||||||
'list' => $list['data'],
|
'list' => $list['data'],
|
||||||
'page' => $list['page'],
|
'page' => $list['page'],
|
||||||
'count' => $list['total'],
|
'count' => $list['total'],
|
||||||
|
|
@ -613,20 +620,20 @@ class Admin extends Common
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
\Db::name('plugins_vr_seat_templates')->where('id', $id)->update($data);
|
\Db::name('vr_seat_templates')->where('id', $id)->update($data);
|
||||||
return DataReturn('更新成功', 0);
|
return DataReturn('更新成功', 0);
|
||||||
} else {
|
} else {
|
||||||
$data['add_time'] = time();
|
$data['add_time'] = time();
|
||||||
$data['upd_time'] = time();
|
$data['upd_time'] = time();
|
||||||
$data['spec_base_id_map'] = '';
|
$data['spec_base_id_map'] = '';
|
||||||
\Db::name('plugins_vr_seat_templates')->insert($data);
|
\Db::name('vr_seat_templates')->insert($data);
|
||||||
return DataReturn('添加成功', 0);
|
return DataReturn('添加成功', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = [];
|
$info = [];
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$row = \Db::name('plugins_vr_seat_templates')->find($id);
|
$row = \Db::name('vr_seat_templates')->find($id);
|
||||||
if (!empty($row)) {
|
if (!empty($row)) {
|
||||||
$seatMap = json_decode($row['seat_map'] ?? '{}', true);
|
$seatMap = json_decode($row['seat_map'] ?? '{}', true);
|
||||||
$row['venue_name'] = $seatMap['venue']['name'] ?? '';
|
$row['venue_name'] = $seatMap['venue']['name'] ?? '';
|
||||||
|
|
@ -648,7 +655,7 @@ class Admin extends Common
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
return view('venue/save', [
|
return MyView('../../../plugins/vr_ticket/admin/view/venue/save', [
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'categories' => $categories,
|
'categories' => $categories,
|
||||||
]);
|
]);
|
||||||
|
|
@ -668,8 +675,8 @@ class Admin extends Common
|
||||||
return DataReturn('参数错误', -1);
|
return DataReturn('参数错误', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = \Db::name('plugins_vr_seat_templates')->where('id', $id)->find();
|
$template = \Db::name('vr_seat_templates')->where('id', $id)->find();
|
||||||
\Db::name('plugins_vr_seat_templates')
|
\Db::name('vr_seat_templates')
|
||||||
->where('id', $id)
|
->where('id', $id)
|
||||||
->update(['status' => 0, 'upd_time' => time()]);
|
->update(['status' => 0, 'upd_time' => time()]);
|
||||||
|
|
||||||
|
|
@ -715,7 +722,7 @@ class Admin extends Common
|
||||||
$where[] = ['created_at', '<=', strtotime($end_date . ' 23:59:59')];
|
$where[] = ['created_at', '<=', strtotime($end_date . ' 23:59:59')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = \Db::name('plugins_vr_verifications')
|
$list = \Db::name('vr_verifications')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('id', 'desc')
|
->order('id', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
|
|
@ -724,7 +731,7 @@ class Admin extends Common
|
||||||
// 补充票信息
|
// 补充票信息
|
||||||
$ticket_ids = array_filter(array_column($list['data'], 'ticket_id'));
|
$ticket_ids = array_filter(array_column($list['data'], 'ticket_id'));
|
||||||
if (!empty($ticket_ids)) {
|
if (!empty($ticket_ids)) {
|
||||||
$tickets_raw = \Db::name('plugins_vr_tickets')
|
$tickets_raw = \Db::name('vr_tickets')
|
||||||
->where('id', 'in', $ticket_ids)
|
->where('id', 'in', $ticket_ids)
|
||||||
->select();
|
->select();
|
||||||
$tickets = [];
|
$tickets = [];
|
||||||
|
|
@ -753,11 +760,11 @@ class Admin extends Common
|
||||||
}
|
}
|
||||||
|
|
||||||
// 核销员列表(用于筛选)
|
// 核销员列表(用于筛选)
|
||||||
$verifiers = \Db::name('plugins_vr_verifiers')
|
$verifiers = \Db::name('vr_verifiers')
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->column('name', 'id');
|
->column('name', 'id');
|
||||||
|
|
||||||
return view('verification/list', [
|
return MyView('../../../plugins/vr_ticket/admin/view/verification/list', [
|
||||||
'list' => $list['data'],
|
'list' => $list['data'],
|
||||||
'page' => $list['page'],
|
'page' => $list['page'],
|
||||||
'count' => $list['total'],
|
'count' => $list['total'],
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class BaseService
|
||||||
*/
|
*/
|
||||||
public static function table($name)
|
public static function table($name)
|
||||||
{
|
{
|
||||||
return 'plugins_vr_' . $name;
|
return 'vr_' . $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue