This commit is contained in:
guange 2019-01-23 15:43:23 +08:00
parent b2d837ca12
commit 9e5eb88ab2
3 changed files with 24 additions and 0 deletions

View File

@ -25,3 +25,13 @@ def news(request):
response = HttpResponse(json.dumps(data, ensure_ascii=False), response = HttpResponse(json.dumps(data, ensure_ascii=False),
content_type="application/json; charset=utf-8") content_type="application/json; charset=utf-8")
return response return response
def proxys(request):
_proxys = Proxys.objects.order_by('-id').all()[0:20]
datas = []
for proxy in _proxys:
datas.append(
{"ip": proxy.ip, "port": proxy.port, "delay": proxy.checktime, "check_time": proxy.created_at}
)
return _render_json(datas)

View File

@ -67,3 +67,14 @@ class Datas(models.Model):
class Meta: class Meta:
managed = False managed = False
db_table = 'datas' db_table = 'datas'
class Proxys(models.Model):
ip = models.CharField(max_length=100, blank=True, null=True)
port = models.IntegerField(blank=True, null=True)
checktime = models.IntegerField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
class Meta:
managed = False
db_table = 'proxys'

View File

@ -48,3 +48,6 @@ def result(request):
"last_month_sell": last_month_sell, "last_month_sell": last_month_sell,
"hour_sell": hour_sell, "hour_sell": hour_sell,
"sentiments": sentiments}) "sentiments": sentiments})