|
@@ -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{
|