作者 邓超

fob 接口调整

... ... @@ -26,7 +26,7 @@ abstract class Base {
protected final function getEmails($filed='*'){
static $data;
if(empty($data)){
$data = db()->all(emailSql::all(dbWhere(['email'=>web_request_emails()])));
$data = db()->cache(600)->all(emailSql::all(dbWhere(['email'=>web_request_emails()])));
if(empty($data)){
app()->e('email_request_required');
}
... ...
... ... @@ -138,10 +138,10 @@ class MailListV2 extends Base {
//目录
// $where['folder_id'] = $folder_id;
$where['_'] = $this->assignSql($folder);
$where['_'] = trim(trim($this->assignSql($folder)),'and');
}else{
// $where['lists|email_id'] = $this->getEmails('id');
$where['_'] = $this->assignSql2();
$where['_'] = trim(trim($this->assignSql2()),'and');
}
if($ids) $where['id'] = $ids;
... ...
... ... @@ -321,6 +321,25 @@ trait DbQuery {
* @time 2023/2/13 14:54
*/
public function all(string|array $sql){
if($this->cache){
$key = 'data:'.md5(is_string($sql) ? $sql : json_encode($sql));
if(redis()->has($key)){
$this->cache = 0;
return redis()->get($key,[]);
}
}
$query = $this->query($sql);
if($query){
$data = $query->fetchAll();
if($this->cache){
redis()->set($key,$data,$this->cache);
$this->cache = 0;
}
return $data;
}
return [];
$query = $this->query($sql);
... ...