Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
rank api
Browse files Browse the repository at this point in the history
  • Loading branch information
udspj committed Jun 6, 2018
1 parent 6e02691 commit 7f4a128
Show file tree
Hide file tree
Showing 144 changed files with 116 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/coin_girl_ranking/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM php:7.0-fpm

MAINTAINER udspj

RUN docker-php-ext-install mbstring pdo pdo_mysql

29 changes: 29 additions & 0 deletions api/coin_girl_ranking/code/addrank.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

header("Access-Control-Allow-Origin: *");

$dsn = 'mysql:dbname=bnrank;host=db;port=3306';
$user = 'root';
$password = 'linkidrank233';

$addr = $_POST['address'];

try {

if (!empty($addr)) {
$conn = new PDO($dsn, $user, $password);
$datetime = date('Y-m-d H:i:s');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// $sql = "REPLACE INTO ranklist (address, collecttime) VALUES (:addr, '$datetime')";
// $conn->bindParam(':addr', $_POST['address'], PDO::PARAM_STR);
// $conn->exec($sql);
$stmt = $conn->prepare("insert ignore into ranklist (address, collecttime) VALUES (:addr, '$datetime')");
$stmt->bindParam(':addr', $_POST['address'], PDO::PARAM_STR);
$stmt->execute();
}

} catch (PDOException $e) {
echo $e->getMessage();
}

?>
24 changes: 24 additions & 0 deletions api/coin_girl_ranking/code/getranklist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

header("Access-Control-Allow-Origin: *");

$dsn = 'mysql:dbname=bnrank;host=db;port=3306';
$user = 'root';
$password = 'linkidrank233';

try {

$conn = new PDO($dsn, $user, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sth = $conn->prepare("SELECT address,collecttime from ranklist ORDER BY collecttime limit 100");
$sth->execute();
$result = $sth->fetchAll(PDO::FETCH_ASSOC);
$json = json_encode($result);
print_r($json);

} catch (PDOException $e) {
echo $e->getMessage();
}

?>
32 changes: 32 additions & 0 deletions api/coin_girl_ranking/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: "3"
services:
app:
build:
context: .
dockerfile: ./app/Dockerfile

db:
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
ports:
- "8800:3306"
volumes:
- "./mysql-data:/var/lib/mysql"

web:
image: nginx:latest
depends_on:
- "db"
- "app"
ports:
- "8888:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/000_site.conf
links:
- "db"
- "app"


2 changes: 2 additions & 0 deletions api/coin_girl_ranking/mysql-data/auto.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[auto]
server-uuid=85bce7b9-3815-11e8-8b3d-0242ac130003
2 changes: 2 additions & 0 deletions api/coin_girl_ranking/mysql-data/bnrank/db.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
default-character-set=latin1
default-collation=latin1_swedish_ci
Binary file not shown.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/ib_logfile0
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/ib_logfile1
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/ibdata1
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions api/coin_girl_ranking/mysql-data/mysql/db.MYD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�% test �% test\_% 
Binary file added api/coin_girl_ranking/mysql-data/mysql/db.MYI
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/db.frm
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/event.frm
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/func.frm
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/plugin.frm
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/proc.frm
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions api/coin_girl_ranking/mysql-data/mysql/proxies_priv.MYD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�localhost root  Z����b8ff28e68184 root  Z���
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/slow_log.CSM
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/user.MYD
Binary file not shown.
Binary file not shown.
Binary file added api/coin_girl_ranking/mysql-data/mysql/user.frm
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions api/coin_girl_ranking/mysql-data/performance_schema/db.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
default-character-set=utf8
default-collation=utf8_general_ci
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions api/coin_girl_ranking/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server {
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /code;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

0 comments on commit 7f4a128

Please sign in to comment.