-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guoshijiang
committed
Mar 2, 2024
1 parent
047199a
commit ab32f76
Showing
13 changed files
with
171 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AirdropConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'airdrop' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from django.db import models | ||
from common.models import BaseModel, Asset | ||
|
||
|
||
TypeChoice = [(x, x) for x in ['BridgeTransfer', 'BridgeStaking']] | ||
|
||
|
||
class User(BaseModel): | ||
name = models.CharField( | ||
max_length=100, | ||
unique=True, | ||
verbose_name='用户名' | ||
) | ||
photo = models.ImageField( | ||
upload_to='symbol/%Y/%m/%d/', | ||
blank=True, | ||
null=True | ||
) | ||
type = models.CharField( | ||
max_length=100, | ||
choices=TypeChoice, | ||
default="BridgeTransfer", | ||
verbose_name='交易类别' | ||
) | ||
address = models.CharField( | ||
max_length=100, | ||
unique=True, | ||
verbose_name='用户地址' | ||
) | ||
|
||
class Meta: | ||
verbose_name = 'User' | ||
verbose_name_plural = verbose_name | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def as_dict(self): | ||
return { | ||
'id': self.id, | ||
'name': self.name, | ||
} | ||
|
||
|
||
class PointsRecord(BaseModel): | ||
address = models.CharField( | ||
max_length=100, | ||
unique=True, | ||
verbose_name='用户地址' | ||
) | ||
|
||
class Meta: | ||
verbose_name = 'PointsRecord' | ||
verbose_name_plural = verbose_name | ||
|
||
def __str__(self): | ||
return self.address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
import pymysql | ||
|
||
pymysql.version_info = (1, 4, 2, "final", 0) | ||
pymysql.install_as_MySQLdb() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
"wallet", | ||
"services", | ||
"channels", | ||
'airdrop', | ||
] | ||
|
||
MIDDLEWARE = [ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
"""Client and server classes corresponding to protobuf-defined services.""" | ||
import grpc | ||
|
||
from services.savour_rpc import airdrop_pb2 as savourrpc_dot_airdrop__pb2 | ||
|
||
|
||
class AirdropServiceStub(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def __init__(self, channel): | ||
"""Constructor. | ||
Args: | ||
channel: A grpc.Channel. | ||
""" | ||
self.submitDppLinkPoints = channel.unary_unary( | ||
'/savourrpc.airdrop.AirdropService/submitDppLinkPoints', | ||
request_serializer=savourrpc_dot_airdrop__pb2.DppLinkPointsReq.SerializeToString, | ||
response_deserializer=savourrpc_dot_airdrop__pb2.DppLinkPointsRep.FromString, | ||
) | ||
|
||
|
||
class AirdropServiceServicer(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def submitDppLinkPoints(self, request, context): | ||
"""Missing associated documentation comment in .proto file.""" | ||
context.set_code(grpc.StatusCode.UNIMPLEMENTED) | ||
context.set_details('Method not implemented!') | ||
raise NotImplementedError('Method not implemented!') | ||
|
||
|
||
def add_AirdropServiceServicer_to_server(servicer, server): | ||
rpc_method_handlers = { | ||
'submitDppLinkPoints': grpc.unary_unary_rpc_method_handler( | ||
servicer.submitDppLinkPoints, | ||
request_deserializer=savourrpc_dot_airdrop__pb2.DppLinkPointsReq.FromString, | ||
response_serializer=savourrpc_dot_airdrop__pb2.DppLinkPointsRep.SerializeToString, | ||
), | ||
} | ||
generic_handler = grpc.method_handlers_generic_handler( | ||
'savourrpc.airdrop.AirdropService', rpc_method_handlers) | ||
server.add_generic_rpc_handlers((generic_handler,)) | ||
|
||
|
||
# This class is part of an EXPERIMENTAL API. | ||
class AirdropService(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
@staticmethod | ||
def submitDppLinkPoints(request, | ||
target, | ||
options=(), | ||
channel_credentials=None, | ||
call_credentials=None, | ||
insecure=False, | ||
compression=None, | ||
wait_for_ready=None, | ||
timeout=None, | ||
metadata=None): | ||
return grpc.experimental.unary_unary(request, target, '/savourrpc.airdrop.AirdropService/submitDppLinkPoints', | ||
savourrpc_dot_airdrop__pb2.DppLinkPointsReq.SerializeToString, | ||
savourrpc_dot_airdrop__pb2.DppLinkPointsRep.FromString, | ||
options, channel_credentials, | ||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) |