Skip to content

Commit

Permalink
update api interface
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshijiang committed Mar 17, 2024
1 parent b830b24 commit 055c1a2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
5 changes: 4 additions & 1 deletion airdrop/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytz
from django.conf import settings
from django.db import models
from common.models import BaseModel, Asset

Expand Down Expand Up @@ -133,12 +135,13 @@ def __str__(self):
return self.address

def as_dict(self):
tz = pytz.timezone(settings.TIME_ZONE)
return {
'id': self.id,
'name': self.address,
'type': self.type,
'points': self.points,
'created_at': self.created_at
'created_at': self.created_at.astimezone(tz).strftime("%Y-%m-%d %H:%M:%S")
}


Expand Down
52 changes: 45 additions & 7 deletions airdrop_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,42 @@ curl --location 'http://127.0.0.1:8000/api/get_points_record_by_address' \
"ok": true,
"code": 200,
"result": {
"total": 1,
"total": 5,
"points": [
{
"id": 31,
"name": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"type": "Invite",
"points": 2,
"created_at": "2024-03-15 19:58:21"
},
{
"id": 30,
"name": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"type": "Invite",
"points": 2,
"created_at": "2024-03-15 19:57:46"
},
{
"id": 29,
"name": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"type": "Invite",
"points": 2,
"created_at": "2024-03-15 19:56:47"
},
{
"id": 2,
"name": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"type": "Invite",
"points": 2,
"created_at": "2024-03-13 13:41:32"
},
{
"id": 1,
"name": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"type": "BridgeTransfer",
"points": 1
"type": "Invite",
"points": 2,
"created_at": "2024-03-13 13:41:13"
}
]
}
Expand All @@ -111,8 +140,11 @@ curl --location 'http://127.0.0.1:8000/api/get_points_record_by_address' \

接口请求
```
curl --location --request POST 'http://127.0.0.1:8000/api/get_project_interactions' \
--data ''
curl --location 'http://127.0.0.1:8000/api/get_project_interactions' \
--header 'Content-Type: application/json' \
--data '{
"language": "en"
}'
```
返回值

Expand All @@ -137,8 +169,11 @@ curl --location --request POST 'http://127.0.0.1:8000/api/get_project_interactio

接口请求
```
curl --location --request POST 'http://127.0.0.1:8000/api/get_questions' \
--data ''
curl --location 'http://127.0.0.1:8000/api/get_questions' \
--header 'Content-Type: application/json' \
--data '{
"language": "en"
}'
```
返回值

Expand Down Expand Up @@ -189,7 +224,10 @@ curl --location 'http://127.0.0.1:8000/api/get_reward_info' \
"rewards": [
{
"id": 1,
"title": "",
"sub_title": "",
"address": "0xe3b4ECd2EC88026F84cF17fef8bABfD9184C94F0",
"period": "",
"amount": "100",
"is_send": true
}
Expand Down

0 comments on commit 055c1a2

Please sign in to comment.