|
@@ -278,19 +278,17 @@ async def receive(userModel : models.TransactionNft):
|
|
|
return {"messge: NFT 夠"}
|
|
|
|
|
|
# shop handler
|
|
|
-@app.get("/shop/{userid}")
|
|
|
-def shop(userid):
|
|
|
+@app.get("/shop")
|
|
|
+def shop():
|
|
|
+ # 為了顯示正確的nft網頁和數量,直接顯示nft表出來
|
|
|
# db connect
|
|
|
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/arkcard?charset=utf8mb4')
|
|
|
-
|
|
|
- sql = 'SELECT DISTINCT(title), id, imgurl, userid FROM arkcard.nft WHERE id<1001 and userid IS NULL GROUP BY title LIMIT 5'
|
|
|
- result = db.query(sql)
|
|
|
- rows = {}
|
|
|
+ db = dataset.connect('mysql://root:pAssw0rd@localhost:3306/arkcard?charset=utf8mb4')
|
|
|
+ nfts = {}
|
|
|
i = 0
|
|
|
- for row in result:
|
|
|
- rows[i] = row
|
|
|
+ for row in db['nft']:
|
|
|
+ nfts[i] = row
|
|
|
i += 1
|
|
|
- return rows
|
|
|
+ return nfts
|
|
|
db.close()
|
|
|
|
|
|
@app.post("/buy")
|