EsCollection.php 654 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class EsCollection extends Model
  5. {
  6. protected $table = "jm_es_collection";
  7. // 开启自动写入时间戳字段
  8. protected $autoWriteTimestamp = 'int';
  9. // 定义时间戳字段名
  10. protected $createTime = 'createtime';
  11. protected $updateTime = 'updatetime';
  12. public static function checkIsCollection($uid , $md5)
  13. {
  14. $result = EsCollection::where(
  15. [
  16. 'uid' => $uid ,
  17. 'md5' => $md5 ,
  18. ]
  19. )->find();
  20. if( ! $result || 2 == $result->status) {
  21. return 2;
  22. }
  23. return 1;
  24. }
  25. }