作者 邓超

x

@@ -358,6 +358,17 @@ class MailListV2 extends Base { @@ -358,6 +358,17 @@ class MailListV2 extends Base {
358 public function count(){ 358 public function count(){
359 // $emails = $this->getEmails('id'); 359 // $emails = $this->getEmails('id');
360 360
  361 + // 时间 必须是数组
  362 + $udate = app()->request('udate');
  363 + if($udate && is_array($udate) && count($udate) == 2){
  364 + $udate = array_values($udate);
  365 + $where['udate.between'] = array_map(function ($v){
  366 + if(is_numeric($v)) return $v;
  367 + return strtotime($v);
  368 + },$udate);
  369 + }
  370 +
  371 +
361 // show_count_filed 372 // show_count_filed
362 $show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']); 373 $show_count_filed = app()->requestArr('show_count_filed',['inbox', 'send', 'unseen', 'flagged', 'junk', 'hot_inbox', 'hot_send']);
363 374
@@ -142,7 +142,17 @@ function my_filter($value,$filter=null){ @@ -142,7 +142,17 @@ function my_filter($value,$filter=null){
142 /** 142 /**
143 * db 组合条件 143 * db 组合条件
144 * @param array $where 144 * @param array $where
145 - * @param string $ar 145 + * [
  146 + * '字段'=>'value',
  147 + * '字段.in'=>['value',...],
  148 + * '字段.notin'=>['value',...],
  149 + * '字段.like'=>'value',
  150 + * '字段.not like'=>'value',
  151 + * '字段.not in'=>['value',...],
  152 + * '字段.between'=>['value',...]
  153 + * '_' => 'sql' 或者使用 '_' => ['sql','sql',...]
  154 + * ]
  155 + * @param string $ar 每个条件之间的连接符号 or/and
146 * @return string 156 * @return string
147 * @author:dc 157 * @author:dc
148 * @time 2023/2/17 10:41 158 * @time 2023/2/17 10:41
@@ -178,7 +188,10 @@ function dbWhere(array $where, string $ar = 'and'):string{ @@ -178,7 +188,10 @@ function dbWhere(array $where, string $ar = 'and'):string{
178 } 188 }
179 189
180 }elseif (count($v) > 1){ 190 }elseif (count($v) > 1){
181 - $sql[] = "{$f} ".($t=='notin'?'not in':($t?:'in'))." (".implode(',',$v).")"; 191 + if($t == 'between'){
  192 + $sql[] = "{$f} between '{$v[0]}' and '{$v[1]}'";
  193 + }else
  194 + $sql[] = "{$f} ".($t=='notin'?'not in':($t?:'in'))." (".implode(',',$v).")";
182 } 195 }
183 196
184 }else{ 197 }else{