<?php

namespace app\called\controller;

use fastphp\base\Controller;

class Index  extends Controller
{
    public function index() 
    {
        $time_data = json_decode(file_get_contents("php://input"), true);
        $url = 'https://yunyuzhineng.cn:8888/admin/cdr/today_agent_report';
        //登录
        $header_login = [];
        $login_info = [
            'name' => '河南api',
            'passwd' => md5('qq123656'),
        ];
        $login_data = json_decode(linkcurl('https://yunyuzhineng.cn:8888/login','POST',$login_info,$header_login,0));
        
        $header = [
            'access_token:'.$login_data->data->access_token,
        ];

        $param = [
                'startd' =>isset($time_data['time'][0])?date('Y-m-d',strtotime($time_data['time'][0])):'',
                'endd'=>isset($time_data['time'][1])?date('Y-m-d',strtotime($time_data['time'][1])):'',
                'page'=>"1",
                'limit' =>"10",
                'admin_id' => 0
                
        ];

        if (isset($time_data['time'][0])) {
            $url = 'https://yunyuzhineng.cn:8888/admin/cdr/agent_report';
        }

        $data = json_decode(linkcurl($url,'POST',$param,$header,0))->data;

        \result($data,'',30000);
    }
    
}