mirror of
https://github.com/sunrin-ana/2025-SSF.git
synced 2026-03-09 18:40:02 +00:00
2025 SSF Public
This commit is contained in:
commit
76a02076c9
192 changed files with 5016 additions and 0 deletions
33
Backend/services/store_service.py
Normal file
33
Backend/services/store_service.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import httpx
|
||||
|
||||
|
||||
class StoreService:
|
||||
def __init__(self):
|
||||
self.SERVER_URL = "https://dotory.ana.st"
|
||||
|
||||
async def get_dotory_by_id(self, user_id: int):
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(f"{self.SERVER_URL}/")
|
||||
response_json = response.json()
|
||||
return
|
||||
|
||||
async def register_user(self, user_id: int):
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(
|
||||
f"{self.SERVER_URL}/", json={"user_id": user_id}
|
||||
)
|
||||
return
|
||||
|
||||
async def buy_product(self, product_id: int, user_id: int):
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(
|
||||
f"{self.SERVER_URL}/", json={"user_id": user_id}
|
||||
)
|
||||
return
|
||||
|
||||
async def update_user_dotory(self, user_id: int, dotoryNum: int):
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.put(
|
||||
f"{self.SERVER_URL}/", json={"num": dotoryNum}
|
||||
)
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue