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
|
@@ -1517,46 +1517,46 @@ function useCart(userId) {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
|
|
1519
1519
|
// src/business/showmasterpiece/service/client-business/bookingService.ts
|
|
1520
|
+
function appendBookingCredentials(path, credentials) {
|
|
1521
|
+
if (!credentials?.qqNumber?.trim() || !credentials?.phoneNumber?.trim()) {
|
|
1522
|
+
return path;
|
|
1523
|
+
}
|
|
1524
|
+
const params = new URLSearchParams({
|
|
1525
|
+
qqNumber: credentials.qqNumber.trim(),
|
|
1526
|
+
phoneNumber: credentials.phoneNumber.trim()
|
|
1527
|
+
});
|
|
1528
|
+
return `${path}?${params.toString()}`;
|
|
1529
|
+
}
|
|
1530
|
+
function bookingCredentialsBody(credentials) {
|
|
1531
|
+
if (!credentials?.qqNumber?.trim() || !credentials?.phoneNumber?.trim()) {
|
|
1532
|
+
return void 0;
|
|
1533
|
+
}
|
|
1534
|
+
return JSON.stringify({
|
|
1535
|
+
qqNumber: credentials.qqNumber.trim(),
|
|
1536
|
+
phoneNumber: credentials.phoneNumber.trim()
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
async function parseErrorMessage(response, fallback) {
|
|
1540
|
+
const data = await response.json().catch(() => ({}));
|
|
1541
|
+
if (typeof data?.error === "string" && data.error) return data.error;
|
|
1542
|
+
if (typeof data?.message === "string" && data.message) return data.message;
|
|
1543
|
+
return fallback;
|
|
1544
|
+
}
|
|
1520
1545
|
var BookingService = class {
|
|
1521
|
-
/**
|
|
1522
|
-
* 创建新预订
|
|
1523
|
-
*
|
|
1524
|
-
* @param data 预订数据
|
|
1525
|
-
* @returns 创建的预订信息
|
|
1526
|
-
*/
|
|
1527
1546
|
static async createBooking(data) {
|
|
1528
1547
|
return createBooking(data);
|
|
1529
1548
|
}
|
|
1530
|
-
/**
|
|
1531
|
-
* 获取预订列表
|
|
1532
|
-
*
|
|
1533
|
-
* @param params 查询参数
|
|
1534
|
-
* @returns 预订列表和分页信息
|
|
1535
|
-
*/
|
|
1536
1549
|
static async getBookings(params = {}) {
|
|
1537
1550
|
return getBookings(params);
|
|
1538
1551
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
* @param id 预订ID
|
|
1543
|
-
* @returns 预订详情
|
|
1544
|
-
*/
|
|
1545
|
-
static async getBooking(id) {
|
|
1546
|
-
const response = await fetch(`${this.BASE_URL}/${id}`);
|
|
1552
|
+
static async getBooking(id, credentials) {
|
|
1553
|
+
const url = appendBookingCredentials(`${this.BASE_URL}/${id}`, credentials);
|
|
1554
|
+
const response = await fetch(url);
|
|
1547
1555
|
if (!response.ok) {
|
|
1548
|
-
|
|
1549
|
-
throw new Error(error.message || "\u83B7\u53D6\u9884\u8BA2\u8BE6\u60C5\u5931\u8D25");
|
|
1556
|
+
throw new Error(await parseErrorMessage(response, "\u83B7\u53D6\u9884\u8BA2\u8BE6\u60C5\u5931\u8D25"));
|
|
1550
1557
|
}
|
|
1551
1558
|
return response.json();
|
|
1552
1559
|
}
|
|
1553
|
-
/**
|
|
1554
|
-
* 更新预订状态
|
|
1555
|
-
*
|
|
1556
|
-
* @param id 预订ID
|
|
1557
|
-
* @param data 更新数据
|
|
1558
|
-
* @returns 更新后的预订信息
|
|
1559
|
-
*/
|
|
1560
1560
|
static async updateBooking(id, data) {
|
|
1561
1561
|
const response = await fetch(`${this.BASE_URL}/${id}`, {
|
|
1562
1562
|
method: "PUT",
|
|
@@ -1566,41 +1566,32 @@ var BookingService = class {
|
|
|
1566
1566
|
body: JSON.stringify(data)
|
|
1567
1567
|
});
|
|
1568
1568
|
if (!response.ok) {
|
|
1569
|
-
|
|
1570
|
-
throw new Error(error.message || "\u66F4\u65B0\u9884\u8BA2\u5931\u8D25");
|
|
1569
|
+
throw new Error(await parseErrorMessage(response, "\u66F4\u65B0\u9884\u8BA2\u5931\u8D25"));
|
|
1571
1570
|
}
|
|
1572
1571
|
return response.json();
|
|
1573
1572
|
}
|
|
1574
1573
|
/**
|
|
1575
|
-
*
|
|
1576
|
-
*
|
|
1577
|
-
* @param id 预订ID
|
|
1574
|
+
* 删除预订(须携带与下单一致的 QQ + 手机号,与 profile-v1 API 约定一致)
|
|
1578
1575
|
*/
|
|
1579
|
-
static async deleteBooking(id) {
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1576
|
+
static async deleteBooking(id, credentials) {
|
|
1577
|
+
const url = appendBookingCredentials(`${this.BASE_URL}/${id}`, credentials);
|
|
1578
|
+
const body = bookingCredentialsBody(credentials);
|
|
1579
|
+
const response = await fetch(url, {
|
|
1580
|
+
method: "DELETE",
|
|
1581
|
+
headers: body ? { "Content-Type": "application/json" } : void 0,
|
|
1582
|
+
body
|
|
1582
1583
|
});
|
|
1583
1584
|
if (!response.ok) {
|
|
1584
|
-
|
|
1585
|
-
throw new Error(error.message || "\u5220\u9664\u9884\u8BA2\u5931\u8D25");
|
|
1585
|
+
throw new Error(await parseErrorMessage(response, "\u5220\u9664\u9884\u8BA2\u5931\u8D25"));
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
|
-
/**
|
|
1589
|
-
* 获取可预订的画集列表
|
|
1590
|
-
*
|
|
1591
|
-
* @returns 画集简略信息列表
|
|
1592
|
-
*/
|
|
1593
1588
|
static async getBookableCollections() {
|
|
1594
1589
|
return getBookableCollections();
|
|
1595
1590
|
}
|
|
1596
1591
|
};
|
|
1597
1592
|
BookingService.BASE_URL = "/api/showmasterpiece/bookings";
|
|
1598
|
-
var createBooking2 = (data) =>
|
|
1599
|
-
|
|
1600
|
-
};
|
|
1601
|
-
var getBookableCollections2 = () => {
|
|
1602
|
-
return BookingService.getBookableCollections();
|
|
1603
|
-
};
|
|
1593
|
+
var createBooking2 = (data) => BookingService.createBooking(data);
|
|
1594
|
+
var getBookableCollections2 = () => BookingService.getBookableCollections();
|
|
1604
1595
|
|
|
1605
1596
|
// src/business/showmasterpiece/logic/hooks/useBooking.ts
|
|
1606
1597
|
function useBooking(_props = {}) {
|