<?php

namespace web\admin\demo\bs;

class index {
    public static function json_init() {
        $ret['title'] = '演示大屏';
        return succjson($ret);
    }
    public static function json_bank_c1() {
        $ret['n1'] = '11,303.2';
        $ret['n2'] = '9,395.1';
        $ret['n3'] = '53';
        $ret['name'] = '中国农业银行';
        return succjson($ret);
    }
    public static function json_bank_c2() {
        $ret['bplants'] = array();
        for ($i = 1; $i < 10; $i++) {
            $ret['bplants'][] = array('id' => $i, 'name' => '贷款单位' . $i, 'cmcode' => rand(1, 3), 'lat' => rand(2999, 3099) / 100, 'lng' => rand(11965, 12065) / 100);
        }
        return succjson($ret);
    }
    public static function json_bank_l1() {
        $ret['pie'] = array();
        for ($i = 1; $i < 4; $i++) {
            $ret['pie'][] = array('id' => $i, 'name' => '风控' . $i, 'value' => rand(100, 300));
        }
        return succjson($ret);
    }
    public static function json_bank_l2() {
        $ret['pie'] = array();
        for ($i = 1; $i < 6; $i++) {
            $ret['pie'][] = array('id' => $i, 'name' => '合同类型' . $i, 'value' => rand(10, 30));
        }
        return succjson($ret);
    }
    public static function json_bank_l3() {
        $ret['patrols'] = array();
        $time = time();
        for ($i = 1; $i < 1000; $i++) {
            $ret['patrols'][] = array('id' => $i, 'addtimes' => rand($time - 365 * 86400, $time));
        }
        return succjson($ret);
    }
    public static function json_bank_r1() {
        $ret['bplants'] = array();
        for ($i = 1; $i < 50; $i++) {
            $ret['bplants'][] = array('id' => $i);
        }
        $ret['fbcontracts'] = array();
        for ($i = 1; $i < rand(50, 100); $i++) {
            $ret['fbcontracts'][] = array('id' => $i, 'htmoney' => rand(200000000, 400000000), 'debtorid' => rand(1, 50));
        }
        return succjson($ret);
    }
    public static function json_bank_r2() {
        $ret['videos'] = array();
        for ($i = 1; $i < 50; $i++) {
            $ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.nyyzsoft.cn/vcap/c' . rand(7816, 7846) . '.jpg');
        }
        return succjson($ret);
    }
    public static function json_bank_r3() {
        $ret['fbcontracts'] = array();
        $time = time();
        for ($i = 1; $i < 100; $i++) {
            $st = rand($time - 365 * 86400, $time);
            $ret['fbcontracts'][] = array('id' => $i, 'htmoney' => rand(100000, 10000000), 'htstarttime' => $st, 'htendtime' => $st + rand(120 * 86400, 365 * 86400));
        }
        return succjson($ret);
    }
    public static function json_video_play() {
        $ret['accessToken'] = '';
        $post = new \ciy\post();
        $ret['url'] = $post->get('img');
        return succjson($ret);
    }
    public static function json_farm_cemap1() {
        global $db;
        $csql = new \ciy\sql('zc_cemap_data');
        $csql->order('id desc');
        $ret['cemap'] = $db->getone($csql);
        $ret['base'] = array('lat' => rand(2999, 3099) / 100, 'lng' => rand(11965, 12065) / 100);
        return succjson($ret);
    }
    public static function json_farm_c1() {
        $ret['farm'] = array('name' => '贷款单位1234');
        return succjson($ret);
    }
    public static function json_farm_l1() {
        $ret['farm'] = array('cmcode' => '正常', 'n2' => '840', 'n3' => '740');
        return succjson($ret);
    }
    public static function json_farm_l2() {
        $ret['farm'] = array('dkrname' => '张新成', 'dkrmobile' => '13811111111', 'lxrname' => '李小明', 'lxrmobile' => '13822222222', 'areacode' => '北京市 海淀区', 'addr' => '程文路104号');
        return succjson($ret);
    }
    public static function json_farm_l3() {
        $ret['farm'] = array('picszz' => '/ud/img/mbnone.png~/ud/img/bglogin.png');
        return succjson($ret);
    }
    public static function json_farm_r1() {
        $ret['cameras'] = array();
        for ($i = 1; $i < 50; $i++) {
            $ret['cameras'][] = array('id' => $i, 'lasttimes' => rand(time() - 8 * 86400, time()));
        }
        $ret['iotrbs'] = array();
        for ($i = 1; $i < 50; $i++) {
            $ret['iotrbs'][] = array('id' => $i, 'ioterrtype' => rand(0, 1));
        }
        return succjson($ret);
    }
    public static function json_farm_r2() {
        $ret['patrol'] = '/ud/img/mbnone.png~/ud/img/bglogin.png';
        return succjson($ret);
    }
    public static function json_farm_r3() {
        $ret['videos'] = array();
        for ($i = 1; $i < 50; $i++) {
            $ret['videos'][] = array('id' => $i, 'name' => '监控视频' . $i, 'capture' => 'https://cf4.nyyzsoft.cn/vcap/c' . rand(7816, 7846) . '.jpg');
        }
        return succjson($ret);
    }
}
