From 33bb1bbd56370a26b00b672aae78f596ac1b46ec Mon Sep 17 00:00:00 2001 From: 18631081161 <2088094923@qq.com> Date: Sun, 21 Dec 2025 00:32:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../011-create-booking-rules-table.js | 53 +++++++++++++++++++ backend/src/models/BookingRule.js | 10 ++++ miniprogram/src/modules/Config.js | 4 +- .../pages/appointment/air-logistics-page.vue | 36 ++++++++++++- .../appointment/airport-transfer-page.vue | 36 ++++++++++++- .../pages/appointment/appointment-page.vue | 12 ++--- .../appointment/exhibition-service-page.vue | 36 ++++++++++++- .../appointment/guide-translation-page.vue | 36 ++++++++++++- .../insurance-consultation-page.vue | 36 ++++++++++++- .../appointment/medical-consultation-page.vue | 36 ++++++++++++- .../appointment/pet-transportation-page.vue | 36 ++++++++++++- .../pages/appointment/rail-ticket-page.vue | 36 ++++++++++++- .../pages/appointment/sea-freight-page.vue | 36 ++++++++++++- .../pages/appointment/special-needs-page.vue | 36 ++++++++++++- .../appointment/travel-planning-page.vue | 36 ++++++++++++- .../appointment/unaccompanied-minor-page.vue | 36 ++++++++++++- .../src/pages/appointment/vip-lounge-page.vue | 36 ++++++++++++- .../appointment/visa-consultation-page.vue | 36 ++++++++++++- 18 files changed, 561 insertions(+), 22 deletions(-) create mode 100644 backend/src/migrations/011-create-booking-rules-table.js diff --git a/backend/src/migrations/011-create-booking-rules-table.js b/backend/src/migrations/011-create-booking-rules-table.js new file mode 100644 index 0000000..09dd54d --- /dev/null +++ b/backend/src/migrations/011-create-booking-rules-table.js @@ -0,0 +1,53 @@ +'use strict'; + +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.createTable('booking_rules', { + id: { + type: Sequelize.UUID, + defaultValue: Sequelize.UUIDV4, + primaryKey: true, + }, + service_type: { + type: Sequelize.STRING(50), + allowNull: false, + unique: true, + comment: '服务类型标识', + }, + rules: { + type: Sequelize.TEXT, + allowNull: true, + comment: '预约登记规则内容', + }, + status: { + type: Sequelize.ENUM('active', 'inactive'), + defaultValue: 'active', + allowNull: false, + comment: '状态', + }, + created_at: { + type: Sequelize.DATE, + allowNull: false, + defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'), + }, + updated_at: { + type: Sequelize.DATE, + allowNull: false, + defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), + }, + }); + + // 添加索引 + await queryInterface.addIndex('booking_rules', ['service_type'], { + unique: true, + name: 'booking_rules_service_type_unique' + }); + await queryInterface.addIndex('booking_rules', ['status'], { + name: 'booking_rules_status' + }); + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.dropTable('booking_rules'); + } +}; diff --git a/backend/src/models/BookingRule.js b/backend/src/models/BookingRule.js index 899ab7b..e43eb5b 100644 --- a/backend/src/models/BookingRule.js +++ b/backend/src/models/BookingRule.js @@ -39,4 +39,14 @@ const BookingRule = sequelize.define('BookingRule', { ], }); +// 自动同步表结构 +(async () => { + try { + await BookingRule.sync(); + console.log('BookingRule table synced successfully'); + } catch (err) { + console.error('BookingRule sync error:', err.message); + } +})(); + module.exports = BookingRule; diff --git a/miniprogram/src/modules/Config.js b/miniprogram/src/modules/Config.js index 362a3b5..b56df4d 100644 --- a/miniprogram/src/modules/Config.js +++ b/miniprogram/src/modules/Config.js @@ -11,8 +11,8 @@ var Config = Config || {} // API 基础地址 // 注意:微信小程序开发工具无法访问localhost,需要使用本机IP地址 -Config.API_BASE_URL = 'https://sub.zpc-xy.com' // 本地开发环境(使用本机IP) -// Config.API_BASE_URL = 'http://localhost:3000' // 本地开发环境(浏览器可用) +// Config.API_BASE_URL = 'https://sub.zpc-xy.com' // 本地开发环境(使用本机IP) +Config.API_BASE_URL = 'http://localhost:3000' // 本地开发环境(浏览器可用) // Config.API_BASE_URL = 'https://your-production-domain.com' // 生产环境(待配置) // ============================================ diff --git a/miniprogram/src/pages/appointment/air-logistics-page.vue b/miniprogram/src/pages/appointment/air-logistics-page.vue index c56e5e3..621c35e 100644 --- a/miniprogram/src/pages/appointment/air-logistics-page.vue +++ b/miniprogram/src/pages/appointment/air-logistics-page.vue @@ -12,7 +12,12 @@ - + + 预约登记规则 + {{ bookingRules }} + + @@ -122,9 +127,11 @@