-
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.
Co-authored-by: guoshijiang <[email protected]>
- Loading branch information
1 parent
2425dba
commit 44e9033
Showing
13 changed files
with
579 additions
and
0 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,59 @@ | ||
# encoding=utf-8 | ||
|
||
import json | ||
import uuid | ||
|
||
from common.helpers import ( | ||
ok_json, | ||
error_json | ||
) | ||
from solid.models import ( | ||
ServiceType, | ||
AuditProject, | ||
CoreMember, | ||
LoadBoard | ||
) | ||
|
||
|
||
# @check_api_token | ||
def get_services_type(request): | ||
sr_list = ServiceType.objects.all().order_by("-id") | ||
sr_response = [] | ||
for sr in sr_list: | ||
sr_response.append(sr.as_dict()) | ||
return ok_json(sr_response) | ||
|
||
|
||
# @check_api_token | ||
def get_audit_projects(request): | ||
params = json.loads(request.body.decode()) | ||
service_type_id = params.get("service_type_id", 0) | ||
status = params.get("status", "all") | ||
if service_type_id not in ["0", 0] and status in ["all", "All", "ALL"]: | ||
audit_project_lists = AuditProject.objects.filter(service_type__id=service_type_id).order_by("id").all() | ||
elif status in ["all", "All", "ALL"]: | ||
audit_project_lists = AuditProject.objects.all().order_by("id").all() | ||
else: | ||
audit_project_lists = AuditProject.objects.filter(status='Ongoing').order_by("id").all() | ||
projects_ret_lists = [] | ||
for ap in audit_project_lists: | ||
projects_ret_lists.append(ap.as_dict()) | ||
return ok_json(projects_ret_lists) | ||
|
||
|
||
# @check_api_token | ||
def get_core_members(request): | ||
cm_lists = CoreMember.objects.all().order_by("-id").all() | ||
cm_ret_lists = [] | ||
for cm in cm_lists: | ||
cm_ret_lists.append(cm.as_dict()) | ||
return ok_json(cm_ret_lists) | ||
|
||
|
||
# @check_api_token | ||
def get_leadboard_list(request): | ||
leadboard_lists = LoadBoard.objects.all().order_by("-payouts") | ||
ret_leadboard_lists = [] | ||
for ld in leadboard_lists: | ||
ret_leadboard_lists.append(ld.as_dict()) | ||
return ok_json(ret_leadboard_lists) |
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
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
'airdrop', | ||
'website', | ||
'l3staking', | ||
"solid", | ||
] | ||
|
||
MIDDLEWARE = [ | ||
|
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,29 @@ | ||
# encoding=utf-8 | ||
|
||
from django.contrib import admin | ||
from solid.models import ( | ||
ServiceType, | ||
AuditProject, | ||
CoreMember, | ||
LoadBoard | ||
) | ||
|
||
@admin.register(ServiceType) | ||
class ServiceTypeAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'name', 'icon', 'detail') | ||
|
||
|
||
@admin.register(AuditProject) | ||
class AuditProjectAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'name', 'status', 'report_link') | ||
|
||
|
||
@admin.register(CoreMember) | ||
class CoreMemberAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'name') | ||
|
||
|
||
@admin.register(LoadBoard) | ||
class LoadBoardAdmin(admin.ModelAdmin): | ||
list_display = ('id', 'competitor', 'payouts') | ||
|
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 SolidConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'solid' |
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,89 @@ | ||
# Generated by Django 4.1.1 on 2024-06-07 05:32 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CoreMember', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('uuid', models.CharField(blank=True, max_length=100, null=True, unique=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), | ||
('updated_at', models.DateTimeField(auto_now=True, db_index=True)), | ||
('name', models.CharField(default='Social', max_length=100, verbose_name='成员姓名')), | ||
('photo', models.ImageField(blank=True, null=True, upload_to='member/%Y/%m/%d/')), | ||
('detail', models.CharField(default='unknown', max_length=500, verbose_name='成员简介')), | ||
], | ||
options={ | ||
'verbose_name': 'CoreMember', | ||
'verbose_name_plural': 'CoreMember', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='LoadBoard', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('uuid', models.CharField(blank=True, max_length=100, null=True, unique=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), | ||
('updated_at', models.DateTimeField(auto_now=True, db_index=True)), | ||
('competitor', models.CharField(default='unknown', max_length=500, verbose_name='审计员名称')), | ||
('payouts', models.CharField(default='0', max_length=500, verbose_name='获取的总收益')), | ||
('total_findings', models.CharField(default='0', max_length=500, verbose_name='找到的总问题数')), | ||
('solo', models.CharField(default='0', max_length=500, verbose_name='个人找到的问题')), | ||
('high', models.CharField(default='0', max_length=500, verbose_name='找到的高危漏洞数量')), | ||
('med', models.CharField(default='0', max_length=500, verbose_name='找到的中危漏洞数量')), | ||
('solo_high', models.CharField(default='0', max_length=500, verbose_name='个人找到的高危漏洞数量')), | ||
('solo_med', models.CharField(default='0', max_length=500, verbose_name='个人找到的中危漏洞数量')), | ||
('first_place', models.CharField(default='0', max_length=500, verbose_name='第一位置发现数量')), | ||
], | ||
options={ | ||
'verbose_name': 'LeadBoard', | ||
'verbose_name_plural': 'LeadBoard', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='ServiceType', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('uuid', models.CharField(blank=True, max_length=100, null=True, unique=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), | ||
('updated_at', models.DateTimeField(auto_now=True, db_index=True)), | ||
('name', models.CharField(default='', max_length=100, verbose_name='服务名称')), | ||
('icon', models.ImageField(blank=True, null=True, upload_to='icon/%Y/%m/%d/')), | ||
('detail', models.CharField(default='unknown', max_length=500, verbose_name='服务描述')), | ||
], | ||
options={ | ||
'verbose_name': 'ServiceType', | ||
'verbose_name_plural': 'ServiceType', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='AuditProject', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('uuid', models.CharField(blank=True, max_length=100, null=True, unique=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), | ||
('updated_at', models.DateTimeField(auto_now=True, db_index=True)), | ||
('name', models.CharField(default='', max_length=100, verbose_name='审计项目的名称')), | ||
('photo', models.ImageField(blank=True, null=True, upload_to='audit/%Y/%m/%d/')), | ||
('status', models.CharField(choices=[('Prepare', 'Prepare'), ('Ongoing', 'Ongoing'), ('End', 'End')], default='Ongoing', max_length=100, verbose_name='项目状体')), | ||
('project_link', models.CharField(blank=True, default='', max_length=100, null=True, verbose_name='项目链接')), | ||
('detail', models.CharField(default='unknown', max_length=500, verbose_name='项目描述')), | ||
('report_link', models.CharField(blank=True, default='', max_length=100, null=True, verbose_name='项目链接')), | ||
('service_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='services_type', to='solid.servicetype', verbose_name='项目类别')), | ||
], | ||
options={ | ||
'verbose_name': 'AuditProject', | ||
'verbose_name_plural': 'AuditProject', | ||
}, | ||
), | ||
] |
Empty file.
Oops, something went wrong.