From b3fedd4221b807a07058be9d5d5d8ba8998adbcb Mon Sep 17 00:00:00 2001
From: Bang Hu <hu_bang@hotmail.com>
Date: 星期四, 11 九月 2025 21:35:31 +0800
Subject: [PATCH] Bug修改代码提交

---
 src/api/cartApi.ts |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/api/cartApi.ts b/src/api/cartApi.ts
index 20cf968..55e853c 100644
--- a/src/api/cartApi.ts
+++ b/src/api/cartApi.ts
@@ -15,20 +15,29 @@
   },
 
   // 浠庤喘鐗╄溅绉婚櫎鍟嗗搧
-  removeFromCart(userId: string, unitId: string, pricingId: string): ApiPromise {
+  removeFromCart(userId: string, unitId: string, productId:string, pricingId: string): ApiPromise {
     return createAxios({
       url: `${baseUrl}/remove`,
       method: 'delete',
-      params: { userId, unitId, pricingId }
+      params: { userId, unitId, productId,pricingId }
     }) as ApiPromise
   },
 
   // 鏇存柊璐墿杞﹀晢鍝佹暟閲�
-  updateCartItem(userId: string, unitId: string, pricingId: number, quantity: number): ApiPromise {
+  updateCartItem(userId: string, unitId: string,productId: string, pricingId: number, quantity: number): ApiPromise {
     return createAxios({
       url: `${baseUrl}/update`,
       method: 'put',
-      params: { userId, unitId, pricingId, quantity }
+      params: { userId, unitId, productId,pricingId, quantity }
+    }) as ApiPromise
+  },
+
+  // 鏇存柊璐墿杞﹀勾闄�
+  updateCartItemDuration(userId: string, unitId: string,productId: string, pricingId: number, duration: number): ApiPromise {
+    return createAxios({
+      url: `${baseUrl}/update/duration`,
+      method: 'put',
+      params: { userId, unitId, productId,pricingId, duration }
     }) as ApiPromise
   },
 
@@ -42,20 +51,20 @@
   },
 
   // 鑾峰彇璐墿杞﹀晢鍝佸垪琛�
-  getCartItems(userId: string, unitId: string): ApiPromise {
+  getCartItems(userId: string, unitId: string,productId: string): ApiPromise {
     return createAxios({
       url: `${baseUrl}/items`,
       method: 'get',
-      params: { userId, unitId }
+      params: { userId, unitId, productId }
     }) as ApiPromise
   },
 
   // 娓呯┖璐墿杞�
-  clearCart(userId: string, unitId: string): ApiPromise {
+  clearCart(userId: string, unitId: string, productId: string): ApiPromise {
     return createAxios({
       url: `${baseUrl}/clear`,
       method: 'delete',
-      params: { userId, unitId }
+      params: { userId, unitId, productId }
     }) as ApiPromise
   }
 }

--
Gitblit v1.8.0