ReInquiryConfig.php 901 字节
<?php

namespace App\Models\Inquiry;


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


/**
 * Class ReInquiryConfig
 * @package App\Models\Inquiry
 * @author zbj
 * @date 2025/2/12
 */
class ReInquiryConfig extends Base
{
    const TYPE_AI_PARAM = 'ai_param';
    const TYPE_FILTER_WORDS = 'filter_words';

    //设置关联表名
    protected $table = 'gl_re_inquiry_config';


    public static function getDefaultConfigCache($type){
        $cache_key = 'ReInquiryDefaultConfigCache';
        $data = Cache::get($cache_key);
        if(!$data){
            $data = self::all();
            if($data){
                Cache::put($cache_key, $data);
            }
        }
        return  $data->where('type', $type)->pluck('content', 'key');
    }

    public static function delCache(){
        $cache_key = 'ReInquiryDefaultConfigCache';
        Cache::forget($cache_key);
    }
}