sa2kit 1.6.113 → 1.6.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-CdtT3qtg.d.ts → index-CL4cXTf2.d.ts} +9 -92
- package/dist/{index-BQVl--uZ.d.mts → index-D78lqnFG.d.mts} +1 -1
- package/dist/{index-DGuqvsv-.d.ts → index-Dw9P_FAX.d.ts} +1 -1
- package/dist/{index-CcKFeVut.d.mts → index-DyTrbHIH.d.mts} +9 -92
- package/dist/{index-C0YVsYpz.d.ts → index-Sy5rj_Et.d.ts} +2 -2
- package/dist/{index-DPd4bnYA.d.mts → index-anBAKrnN.d.mts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +53 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -70
- package/dist/index.mjs.map +1 -1
- package/dist/showmasterpiece/core.js +41 -50
- package/dist/showmasterpiece/core.js.map +1 -1
- package/dist/showmasterpiece/core.mjs +41 -50
- package/dist/showmasterpiece/core.mjs.map +1 -1
- package/dist/showmasterpiece/db.js +2 -2
- package/dist/showmasterpiece/db.js.map +1 -1
- package/dist/showmasterpiece/db.mjs +2 -2
- package/dist/showmasterpiece/db.mjs.map +1 -1
- package/dist/showmasterpiece/index.js +40 -45
- package/dist/showmasterpiece/index.js.map +1 -1
- package/dist/showmasterpiece/index.mjs +40 -45
- package/dist/showmasterpiece/index.mjs.map +1 -1
- package/dist/showmasterpiece/logic/index.js +41 -50
- package/dist/showmasterpiece/logic/index.js.map +1 -1
- package/dist/showmasterpiece/logic/index.mjs +41 -50
- package/dist/showmasterpiece/logic/index.mjs.map +1 -1
- package/dist/showmasterpiece/server/index.js +2 -2
- package/dist/showmasterpiece/server/index.js.map +1 -1
- package/dist/showmasterpiece/server/index.mjs +2 -2
- package/dist/showmasterpiece/server/index.mjs.map +1 -1
- package/dist/showmasterpiece/service/client-business/index.d.mts +1 -1
- package/dist/showmasterpiece/service/client-business/index.d.ts +1 -1
- package/dist/showmasterpiece/service/client-business/index.js +45 -62
- package/dist/showmasterpiece/service/client-business/index.js.map +1 -1
- package/dist/showmasterpiece/service/client-business/index.mjs +45 -62
- package/dist/showmasterpiece/service/client-business/index.mjs.map +1 -1
- package/dist/showmasterpiece/service/index.d.mts +2 -2
- package/dist/showmasterpiece/service/index.d.ts +2 -2
- package/dist/showmasterpiece/service/index.js +45 -62
- package/dist/showmasterpiece/service/index.js.map +1 -1
- package/dist/showmasterpiece/service/index.mjs +45 -62
- package/dist/showmasterpiece/service/index.mjs.map +1 -1
- package/dist/showmasterpiece/service/web/index.d.mts +2 -2
- package/dist/showmasterpiece/service/web/index.d.ts +2 -2
- package/dist/showmasterpiece/service/web/index.js +45 -62
- package/dist/showmasterpiece/service/web/index.js.map +1 -1
- package/dist/showmasterpiece/service/web/index.mjs +45 -62
- package/dist/showmasterpiece/service/web/index.mjs.map +1 -1
- package/dist/showmasterpiece/ui/miniapp/index.js +5 -5
- package/dist/showmasterpiece/ui/miniapp/index.js.map +1 -1
- package/dist/showmasterpiece/ui/miniapp/index.mjs +5 -5
- package/dist/showmasterpiece/ui/miniapp/index.mjs.map +1 -1
- package/dist/showmasterpiece/ui/web/index.js +40 -45
- package/dist/showmasterpiece/ui/web/index.js.map +1 -1
- package/dist/showmasterpiece/ui/web/index.mjs +40 -45
- package/dist/showmasterpiece/ui/web/index.mjs.map +1 -1
- package/dist/showmasterpiece/web/index.js +40 -45
- package/dist/showmasterpiece/web/index.js.map +1 -1
- package/dist/showmasterpiece/web/index.mjs +40 -45
- package/dist/showmasterpiece/web/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1496,46 +1496,46 @@ function useCart(userId) {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
1498
|
// src/business/showmasterpiece/service/client-business/bookingService.ts
|
|
1499
|
+
function appendBookingCredentials(path, credentials) {
|
|
1500
|
+
if (!credentials?.qqNumber?.trim() || !credentials?.phoneNumber?.trim()) {
|
|
1501
|
+
return path;
|
|
1502
|
+
}
|
|
1503
|
+
const params = new URLSearchParams({
|
|
1504
|
+
qqNumber: credentials.qqNumber.trim(),
|
|
1505
|
+
phoneNumber: credentials.phoneNumber.trim()
|
|
1506
|
+
});
|
|
1507
|
+
return `${path}?${params.toString()}`;
|
|
1508
|
+
}
|
|
1509
|
+
function bookingCredentialsBody(credentials) {
|
|
1510
|
+
if (!credentials?.qqNumber?.trim() || !credentials?.phoneNumber?.trim()) {
|
|
1511
|
+
return void 0;
|
|
1512
|
+
}
|
|
1513
|
+
return JSON.stringify({
|
|
1514
|
+
qqNumber: credentials.qqNumber.trim(),
|
|
1515
|
+
phoneNumber: credentials.phoneNumber.trim()
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
async function parseErrorMessage(response, fallback) {
|
|
1519
|
+
const data = await response.json().catch(() => ({}));
|
|
1520
|
+
if (typeof data?.error === "string" && data.error) return data.error;
|
|
1521
|
+
if (typeof data?.message === "string" && data.message) return data.message;
|
|
1522
|
+
return fallback;
|
|
1523
|
+
}
|
|
1499
1524
|
var BookingService = class {
|
|
1500
|
-
/**
|
|
1501
|
-
* 创建新预订
|
|
1502
|
-
*
|
|
1503
|
-
* @param data 预订数据
|
|
1504
|
-
* @returns 创建的预订信息
|
|
1505
|
-
*/
|
|
1506
1525
|
static async createBooking(data) {
|
|
1507
1526
|
return createBooking(data);
|
|
1508
1527
|
}
|
|
1509
|
-
/**
|
|
1510
|
-
* 获取预订列表
|
|
1511
|
-
*
|
|
1512
|
-
* @param params 查询参数
|
|
1513
|
-
* @returns 预订列表和分页信息
|
|
1514
|
-
*/
|
|
1515
1528
|
static async getBookings(params = {}) {
|
|
1516
1529
|
return getBookings(params);
|
|
1517
1530
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
* @param id 预订ID
|
|
1522
|
-
* @returns 预订详情
|
|
1523
|
-
*/
|
|
1524
|
-
static async getBooking(id) {
|
|
1525
|
-
const response = await fetch(`${this.BASE_URL}/${id}`);
|
|
1531
|
+
static async getBooking(id, credentials) {
|
|
1532
|
+
const url = appendBookingCredentials(`${this.BASE_URL}/${id}`, credentials);
|
|
1533
|
+
const response = await fetch(url);
|
|
1526
1534
|
if (!response.ok) {
|
|
1527
|
-
|
|
1528
|
-
throw new Error(error.message || "\u83B7\u53D6\u9884\u8BA2\u8BE6\u60C5\u5931\u8D25");
|
|
1535
|
+
throw new Error(await parseErrorMessage(response, "\u83B7\u53D6\u9884\u8BA2\u8BE6\u60C5\u5931\u8D25"));
|
|
1529
1536
|
}
|
|
1530
1537
|
return response.json();
|
|
1531
1538
|
}
|
|
1532
|
-
/**
|
|
1533
|
-
* 更新预订状态
|
|
1534
|
-
*
|
|
1535
|
-
* @param id 预订ID
|
|
1536
|
-
* @param data 更新数据
|
|
1537
|
-
* @returns 更新后的预订信息
|
|
1538
|
-
*/
|
|
1539
1539
|
static async updateBooking(id, data) {
|
|
1540
1540
|
const response = await fetch(`${this.BASE_URL}/${id}`, {
|
|
1541
1541
|
method: "PUT",
|
|
@@ -1545,41 +1545,32 @@ var BookingService = class {
|
|
|
1545
1545
|
body: JSON.stringify(data)
|
|
1546
1546
|
});
|
|
1547
1547
|
if (!response.ok) {
|
|
1548
|
-
|
|
1549
|
-
throw new Error(error.message || "\u66F4\u65B0\u9884\u8BA2\u5931\u8D25");
|
|
1548
|
+
throw new Error(await parseErrorMessage(response, "\u66F4\u65B0\u9884\u8BA2\u5931\u8D25"));
|
|
1550
1549
|
}
|
|
1551
1550
|
return response.json();
|
|
1552
1551
|
}
|
|
1553
1552
|
/**
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1556
|
-
* @param id 预订ID
|
|
1553
|
+
* 删除预订(须携带与下单一致的 QQ + 手机号,与 profile-v1 API 约定一致)
|
|
1557
1554
|
*/
|
|
1558
|
-
static async deleteBooking(id) {
|
|
1559
|
-
const
|
|
1560
|
-
|
|
1555
|
+
static async deleteBooking(id, credentials) {
|
|
1556
|
+
const url = appendBookingCredentials(`${this.BASE_URL}/${id}`, credentials);
|
|
1557
|
+
const body = bookingCredentialsBody(credentials);
|
|
1558
|
+
const response = await fetch(url, {
|
|
1559
|
+
method: "DELETE",
|
|
1560
|
+
headers: body ? { "Content-Type": "application/json" } : void 0,
|
|
1561
|
+
body
|
|
1561
1562
|
});
|
|
1562
1563
|
if (!response.ok) {
|
|
1563
|
-
|
|
1564
|
-
throw new Error(error.message || "\u5220\u9664\u9884\u8BA2\u5931\u8D25");
|
|
1564
|
+
throw new Error(await parseErrorMessage(response, "\u5220\u9664\u9884\u8BA2\u5931\u8D25"));
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
/**
|
|
1568
|
-
* 获取可预订的画集列表
|
|
1569
|
-
*
|
|
1570
|
-
* @returns 画集简略信息列表
|
|
1571
|
-
*/
|
|
1572
1567
|
static async getBookableCollections() {
|
|
1573
1568
|
return getBookableCollections();
|
|
1574
1569
|
}
|
|
1575
1570
|
};
|
|
1576
1571
|
BookingService.BASE_URL = "/api/showmasterpiece/bookings";
|
|
1577
|
-
var createBooking2 = (data) =>
|
|
1578
|
-
|
|
1579
|
-
};
|
|
1580
|
-
var getBookableCollections2 = () => {
|
|
1581
|
-
return BookingService.getBookableCollections();
|
|
1582
|
-
};
|
|
1572
|
+
var createBooking2 = (data) => BookingService.createBooking(data);
|
|
1573
|
+
var getBookableCollections2 = () => BookingService.getBookableCollections();
|
|
1583
1574
|
|
|
1584
1575
|
// src/business/showmasterpiece/logic/hooks/useBooking.ts
|
|
1585
1576
|
function useBooking(_props = {}) {
|