作者 邓超

1

<?php
use Model\listsSql;
include_once __DIR__."/../vendor/autoload.php";
//$ids = db()->all('select `id` from `'.\Model\emailSql::$table.'` limit 1000 offset 0');
//print_r($ids);
//print_r(db()->value(listsSql::lastMsgno(1,89)));
start_now_mail();
\ No newline at end of file
... ...
... ... @@ -99,12 +99,7 @@ class DbPool {
$sql = "update `{$table}` set ".dbUpdate($data). " where ".$where;
// 如果存储的值是数组,就json一次
foreach ($data as $k=>$datum){
if(is_array($datum)){
$data[$k] = json_encode($datum,JSON_UNESCAPED_UNICODE);
}
}
$data = $this->getData($data);
$query = $this->query([$sql,$data]);
if($query){
... ... @@ -115,6 +110,26 @@ class DbPool {
/**
* 在更新/插入时处理数据
* @param $data
* @return mixed
* @author:dc
* @time 2023/2/18 14:50
*/
private function getData($data){
// 如果存储的值是数组,就json一次
foreach ($data as $k=>$datum){
if(is_array($datum)){
$data[$k] = json_encode($datum,JSON_UNESCAPED_UNICODE);
}elseif ($datum === null){
$data[$k] = '';
}
}
return $data;
}
/**
* 插入数据
* @param string $table
* @param array $data
... ... @@ -131,12 +146,7 @@ class DbPool {
$sql = "insert into `{$table}` set ".dbUpdate($data);
// 如果存储的值是数组,就json一次
foreach ($data as $k=>$datum){
if(is_array($datum)){
$data[$k] = json_encode($datum,JSON_UNESCAPED_UNICODE);
}
}
$data = $this->getData($data);
$query = $this->query([$sql,$data]);
... ...
... ... @@ -221,11 +221,10 @@ class Mail {
false
);
// 结束操作了
}
// 再次调用
$this->syncMail($email_id,$folder_id,$folder,$db);
}
return true;
... ...
... ... @@ -21,7 +21,7 @@ class folderSql {
* @time 2023/2/18 9:22
*/
public static function all(int $email_id):string {
return "select `folder`,`pid`,`origin_folder`,`last_sync_time`,`folder` from `".static::$table."` where `email_id` = {$email_id} order by `id` asc";
return "select `id`,`folder`,`pid`,`origin_folder`,`last_sync_time`,`folder` from `".static::$table."` where `email_id` = {$email_id} order by `id` asc";
}
... ...
... ... @@ -18,5 +18,9 @@
3.注意:如果使用 进程守护器(supervisord) 执行退出后会被 守护器重新运行
4.非必要的情况下请执行上面命令进行退出,
如果一直没有退出则说明脚本还有任务没有处理完成。
非必要情况请等待,不要直接kill掉进程,
避免出现数据上的错误。
... ...