nk-lihaink-cn/app/admin/model/Keywords.php
2021-04-12 21:28:00 +08:00

18 lines
399 B
PHP

<?php
namespace app\admin\model;
use think\Model;
// 关键字模型
class Keywords extends Model
{
// 关联关键字
public function increase($keywords)
{
$is_exist = $this->where('title',$keywords)->find();
if( $is_exist ){
$res = $is_exist['id'];
}else{
$res = $this->strict(false)->field(true)->insertGetId(['title' => $keywords,'create_time' => time()]);
}
return $res;
}
}