Browse Source

<fix>(waitAndBuy): fix the bug that will due to repeat buy

master
Louis Young 3 years ago
parent
commit
261d405e9f
  1. 3
      .idea/workspace.xml
  2. 16
      WaitingAndBuy.py

3
.idea/workspace.xml

@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
<component name="ChangeListManager">
<list default="true" id="557626c8-a0b7-4bf6-b000-aaaff199c3dd" name="默认更改列表" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WaitingAndBuy.py" beforeDir="false" afterPath="$PROJECT_DIR$/WaitingAndBuy.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -71,6 +73,7 @@ @@ -71,6 +73,7 @@
<workItem from="1625960646818" duration="5632000" />
<workItem from="1625970377756" duration="5103000" />
<workItem from="1626100177418" duration="1278000" />
<workItem from="1626104617311" duration="879000" />
</task>
<servers />
</component>

16
WaitingAndBuy.py

@ -711,8 +711,22 @@ class Waiter(): @@ -711,8 +711,22 @@ class Waiter():
@check_login
def initCart(self):
sku_id = global_config.getRaw('config', 'sku_id')
self.add_item_to_cart(sku_id)
self.cancel_select_all_cart_item()
cart = self.cart_detail()
if sku_id in cart:
logger.info('%s 已在购物车中,调整数量为 %s', sku_id, 1)
cart_item = cart.get(sku_id)
self.change_item_num_in_cart(
sku_id=sku_id,
vender_id=cart_item.get('vender_id'),
num=1,
p_type=cart_item.get('p_type'),
target_id=cart_item.get('target_id'),
promo_id=cart_item.get('promo_id')
)
else:
self.add_item_to_cart(sku_id)
logger.info('购物车初始化结束,程序开始后请勿更改购物车')
@check_login
def fastBuy(self):

Loading…
Cancel
Save