mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-23 15:21:36 +08:00
CompoerUpdate & 修改like搜索
This commit is contained in:
parent
60a404e2ea
commit
4aca36f285
@ -51,7 +51,7 @@ class ShopGoods extends Controller
|
|||||||
elseif ($this->type === 'recycle') $query->where(['deleted' => 1]);
|
elseif ($this->type === 'recycle') $query->where(['deleted' => 1]);
|
||||||
else $this->error("无法加载 {$this->type} 数据列表!");
|
else $this->error("无法加载 {$this->type} 数据列表!");
|
||||||
// 列表排序并显示
|
// 列表排序并显示
|
||||||
$query->like('code,name')->like('cate,mark', ',');
|
$query->like('code,name')->like('marks,cateids', ',');
|
||||||
$query->equal('status,vip_entry,truck_type')->order('sort desc,id desc')->page();
|
$query->equal('status,vip_entry,truck_type')->order('sort desc,id desc')->page();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
<div class="layui-form-item layui-inline">
|
<div class="layui-form-item layui-inline">
|
||||||
<label class="layui-form-label">商品标签</label>
|
<label class="layui-form-label">商品标签</label>
|
||||||
<label class="layui-input-inline">
|
<label class="layui-input-inline">
|
||||||
<select class="layui-select" name="mark" lay-search>
|
<select class="layui-select" name="marks" lay-search>
|
||||||
<option value="">-- 全部标签 --</option>
|
<option value="">-- 全部标签 --</option>
|
||||||
{foreach $marks as $mark}{if input('mark','') eq $mark}
|
{foreach $marks as $mark}{if input('marks','') eq $mark}
|
||||||
<option selected value="{$mark}">{$mark}</option>
|
<option selected value="{$mark}">{$mark}</option>
|
||||||
{else}
|
{else}
|
||||||
<option value="{$mark}">{$mark}</option>
|
<option value="{$mark}">{$mark}</option>
|
||||||
@ -36,9 +36,9 @@
|
|||||||
<label class="layui-form-label">商品分类</label>
|
<label class="layui-form-label">商品分类</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<label class="layui-input-inline">
|
<label class="layui-input-inline">
|
||||||
<select class="layui-select" name="cate" lay-search>
|
<select class="layui-select" name="cateids" lay-search>
|
||||||
<option value="">-- 全部分类 --</option>
|
<option value="">-- 全部分类 --</option>
|
||||||
{foreach $cates as $cate}{if input('cate') eq $cate.id}
|
{foreach $cates as $cate}{if input('cateids') eq $cate.id}
|
||||||
<option selected value="{$cate.id}">{$cate.spl}{$cate.name|default=''}</option>
|
<option selected value="{$cate.id}">{$cate.spl}{$cate.name|default=''}</option>
|
||||||
{else}
|
{else}
|
||||||
<option value="{$cate.id}">{$cate.spl}{$cate.name|default=''}</option>
|
<option value="{$cate.id}">{$cate.spl}{$cate.name|default=''}</option>
|
||||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -834,12 +834,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||||
"reference": "efcabe5c0e1f0d87f92a4b67dfdd024a632b4578"
|
"reference": "111780326730bce8f7103d09a97de741d23a8fc7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/efcabe5c0e1f0d87f92a4b67dfdd024a632b4578",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/111780326730bce8f7103d09a97de741d23a8fc7",
|
||||||
"reference": "efcabe5c0e1f0d87f92a4b67dfdd024a632b4578",
|
"reference": "111780326730bce8f7103d09a97de741d23a8fc7",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -856,7 +856,7 @@
|
|||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"topthink/framework": "^6.0"
|
"topthink/framework": "^6.0"
|
||||||
},
|
},
|
||||||
"time": "2021-03-20T06:18:37+00:00",
|
"time": "2021-03-20T09:21:53+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"think": {
|
"think": {
|
||||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// This file is automatically generated at:2021-03-20 17:50:03
|
// This file is automatically generated at:2021-03-20 18:14:47
|
||||||
declare (strict_types = 1);
|
declare (strict_types = 1);
|
||||||
return array (
|
return array (
|
||||||
0 => 'think\\admin\\Library',
|
0 => 'think\\admin\\Library',
|
||||||
|
@ -60,11 +60,12 @@ class QueryHelper extends Helper
|
|||||||
/**
|
/**
|
||||||
* 设置 Like 查询条件
|
* 设置 Like 查询条件
|
||||||
* @param string|array $fields 查询字段
|
* @param string|array $fields 查询字段
|
||||||
|
* @param string $split 前后分割符
|
||||||
* @param array|string|null $input 输入数据
|
* @param array|string|null $input 输入数据
|
||||||
* @param string $alias 别名分割符
|
* @param string $alias 别名分割符
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function like($fields, $input = null, string $alias = '#'): QueryHelper
|
public function like($fields, string $split = '', $input = null, string $alias = '#'): QueryHelper
|
||||||
{
|
{
|
||||||
$data = $this->_getInputData($input ?: $this->input);
|
$data = $this->_getInputData($input ?: $this->input);
|
||||||
foreach (is_array($fields) ? $fields : explode(',', $fields) as $field) {
|
foreach (is_array($fields) ? $fields : explode(',', $fields) as $field) {
|
||||||
@ -73,7 +74,7 @@ class QueryHelper extends Helper
|
|||||||
[$dk, $qk] = explode($alias, $field);
|
[$dk, $qk] = explode($alias, $field);
|
||||||
}
|
}
|
||||||
if (isset($data[$qk]) && $data[$qk] !== '') {
|
if (isset($data[$qk]) && $data[$qk] !== '') {
|
||||||
$this->query->whereLike($dk, "%{$data[$qk]}%");
|
$this->query->whereLike($dk, "%{$split}{$data[$qk]}{$split}%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user