WordCountry.php 718 字节
<?php
/**
 * @remark :
 * @name   :WordCountry.php
 * @author :lyh
 * @method :post
 * @time   :2025/3/11 17:24
 */

namespace App\Models\Com;

use App\Models\Base;
use Illuminate\Support\Facades\Cache;

/**
 * @remark :国家信息
 * @name   :WordCountry
 * @author :lyh
 * @method :post
 * @time   :2025/3/11 17:24
 */
class WordCountry extends Base
{
    protected $table = 'gl_world_country_city';

    public static function getCountryByIso2($iso2){
        $key = 'getCountryByIso2_' . $iso2;
        $info = Cache::get($key);
        if (!$info) {
            $info = self::where('pid', 0)->where('iso2', $iso2)->first();
            Cache::put($key, $info, 24 * 3600);
        }
        return $info;
    }
}