<?php
namespace app\model;

use think\Model;


class EsCollection extends Model
{
    protected $table = "jm_es_collection";

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime  = 'createtime';
    protected $updateTime  = 'updatetime';



    public static function checkIsCollection($uid , $md5)
    {
        $result = EsCollection::where(
            [
                'uid' => $uid ,
                'md5' => $md5 ,
            ]
        )->find();

        if( ! $result || 2 == $result->status) {
            return 2;
        }
        return 1;
    }
}
