<?php


namespace App\Services\distribution;

use App\Models\shop\mysql\Distribution;
use Api\PhpUtils\Validate\Validate;
use Api\PhpServices\Idgen\Idgen;

class DistributionService
{
   

    public static function addDistribution($params)
    {
        $params = [

        ];
        Distribution::insertRecord($params);

    }


    public static function getDistributionList($params)
    {
        
    }


     /**
     * 通过发号器拿 id （非雪花）
     * number，获取店铺shop_id用生活号id后两位，商品相关的这里是shop_id的后两位
     * @param $number
     * @param $type
     * @param int $count
     * @return array|mixed
     */
    public static function getIdgenId($number, $type, $count = 1)
    {
        $res = Idgen::get(appConfig('idgen.partner'), appConfig('idgen.key'), [], [[
            "type" => $type,
            'number' => (int)$number,
            "count" => $count]]);
        return $res['id_datetime'][$type] ?? [];
    }

    public static function getSnowIdgenId($type, $count = 1)
    {
        $res = Idgen::get(appConfig('idgen.partner'), appConfig('idgen.key'), [[
            "type" => $type,
            "count" => $count]], []);
        return $res['id_snow'][$type] ?? [];
    }
}