作者 邓超

x

... ... @@ -110,8 +110,7 @@ class AutoMail {
}
if(stripos($haystack,$str)!==false){
if(!$this->db->count("select count(*) from `lists_auto` where `list_id` = ".$item['id'])){
$this->db->insert('`lists_auto`',['list_id'=>$item['id']],false);
echo "插入数据 ".$item['id']."\n";
echo "插入数据 ".$item['id'].'==>'.$this->db->create('lists_auto',['list_id'=>$item['id']],false).'==>'.$haystack."\n";
}
}
}
... ...
... ... @@ -172,6 +172,24 @@ trait DbQuery {
*/
public function insert(string $table, array $data, $timeauto = true):int {
if($this->create($table, $data, $timeauto)){
return $this->getClient()->lastInsertId();
}
return 0;
}
/**
* 插入数据
* @param string $table
* @param array $data
* @param bool $timeauto
* @return int
* @author:dc
* @time 2023/2/17 14:04
*/
public function create(string $table, array $data, $timeauto = true):int {
if($timeauto){
$data['created_at'] = empty($data['created_at']) ? date('Y-m-d H:i:s') : $data['created_at'];
}
... ... @@ -183,10 +201,10 @@ trait DbQuery {
$query = $this->query([$sql,$data]);
if($query){
return $this->getClient()->lastInsertId();
return true;
}
return 0;
return false;
}
/**
... ...