init
This commit is contained in:
53
app/common/model/Email.php
Executable file
53
app/common/model/Email.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user