master
cn.yimian.xyz 3 years ago
parent 61bed92755
commit 2064dcaafd
  1. 2
      functions.php
  2. 2
      index.php
  3. 31
      list.php

@ -360,7 +360,7 @@ function getImgsInfo($type, $isFast = false){
preg_match_all('/img_(\S*?)_(\d{2,4})x(\d{2,4})_(\S*?)_(\S*?)_(\S*?).(jpe?g|png|gif|svg)\b/', $str, $arr);
//echo var_dump($str);
//echo var_dump($arr);
return $arr;

@ -99,7 +99,7 @@ if($type == "moe"){
$redis->set($__num, $_num+1);
$redis->set($__ip, $_ip+1);
if((!in_array($__from, $whiteList) && $_num > 50) || $_ip > 100) {
if(!in_array($__from, $whiteList) && ($_num > 50 || $_ip > 100)) {
header("Location: https://api.vvhan.com/api/acgimg");
yimian__log("log_api", array("api" => "img", "timestamp" => date('Y-m-d H:i:s', time()), "ip" => ip2long(getIp()), "_from" => get_from(), "content" => 'https://api.vvhan.com/api/acgimg'));
die();

@ -0,0 +1,31 @@
<?php
include 'functions.php';
$type = $_GET['type'];
$limit = $_GET['limit'];
$sort = $_GET['sort'];
if(!isset($type) || !($type == 'moe' || $type == 'wallpaper' || $type == 'head' || $type == 'koino' || $type == 'imgbed')) $type = 'moe';
if(!isset($limit)) $limit = 30;
if(!isset($sort)) $sort = 'random';
$data = getImgsInfo($type);
if($sort == 'random') shuffle($data[0]);
if($sort == 'reverse') $data[0] = array_reverse($data[0]);
if($limit >= 0) $data[0] = array_slice($data[0], 0, $limit);
$o = array();
foreach($data[0] as $val){
$o[] = array(
"name" => $val,
"url" => 'https://api.yimian.xyz/img/?path='.$type.'/'.$val
);
}
echo json_encode($o);
Loading…
Cancel
Save