<?php

namespace Api\PhpServices\Idgen;


use Api\PhpUtils\Http\Request;

class Idgen
{
    public static function get($partner, $key, $id_snow=[], $id_datetime=[]){
        $url = config('interface','service.idgen');

        $params = [];
        $params['partner']  = $partner;
        $params['key']      = $key;

        if(!empty($id_snow)){
            $params['id_snow'] = $id_snow;
        }

        if(!empty($id_datetime)){
            $params['id_datetime'] = $id_datetime;
        }
        
        $res = (new Request())->post($url, $params,5000, 'json');
        if(isset($res['code']) && $res['code']==0 && isset($res['response']['result'])){
            return $res['response']['result'] ?? [];
        }
        return [];
    }
}