<?php 
namespace app\common\model;
use think\Model;
use app\common\model\Resume as ResumeModel;
class ResumeBrowse extends Model
{
	public static function saveBrowse($company_id,$id):void
	{
		if ($company_id && $id){
			$Find=self::where(['resume_id'=>$id,'company_id'=>$company_id])->find();
			if (!$Find) {
				$ResumeBrowseModel=new self;
				$ResumeBrowseModel->company_id=$company_id;
				$ResumeBrowseModel->resume_id=$id;
				$ResumeBrowseModel->save();
			}else if ($Find->company_delete_time) {
				$Find->company_delete_time=null;
				$Find->save();
			}
		}
		self::setIncView($id);
	}
	public static function setIncView($id):void
	{
        $view=rand(1,9);
		if ($id) ResumeModel::where(['id'=>$id])->inc('view',$view)->update();
	}
}