Files
2024-10-29 14:04:59 +08:00

54 lines
1.1 KiB
PHP
Executable File

<?php
/**
* Created by PhpStorm.
* User: kingliang
* Date: 2020-10-21
* Time: 15:09
*/
namespace app\common\model;
use app\common\traits\IndexModel;
use think\Model;
use think\Request;
use think\Config;
class Email extends Model
{
use \app\common\traits\IndexModel;
protected $insert = ['state' => 0, 'ip', 'createtime'];
public function insertRow($data) {
$object = $this::create($data);
return $object;
}
public function chickEmail($email) {
$list = $this->where(['email' => $email, 'state' => 0])->select();
if (!$list) {
return true;
}else{
return false;
}
}
// 属性修改器 创建时间
protected function setCreatetimeAttr($value, $data) {
if (empty($value)) {
return time();
} else {
return strtotime($value);
}
}
protected function setContentAttr($value) {
return htmlspecialchars($value);
}
protected function setIpAttr() {
return Request::instance()->ip();
}
}