|
@@ -147,13 +147,16 @@ class InvCat extends BaseController{
|
|
|
$condition =[["tax","<>",""]];
|
|
|
$cat_name = isset($this->post['cat_name'])&&$this->post['cat_name']!=''?trim($this->post['cat_name']):"";
|
|
|
if($cat_name!=''){
|
|
|
- $condition[]=["short_name","like","%$cat_name%"];
|
|
|
+ $condition[]=["cat_name","like","%$cat_name%"];
|
|
|
}
|
|
|
$cat_code = isset($this->post['cat_code'])&&$this->post['cat_code']!=''?trim($this->post['cat_code']):"";
|
|
|
if($cat_code!=''){
|
|
|
$condition[]=["cat_code|merge_code","like","%$cat_code%"];
|
|
|
}
|
|
|
- $list =Db::name("inv_cat")->where($condition)->order("addtime desc")->limit(30)->select()->toArray();
|
|
|
+ $list =Db::name("inv_cat")->where($condition)
|
|
|
+ ->field("cat_name,cat_code,status,tax,addtax,sumitem,desc,short_name,merge_code,LENGTH(cat_name) as weight")
|
|
|
+ ->order("weight desc,addtime desc")
|
|
|
+ ->limit(30)->select()->toArray();
|
|
|
foreach ($list as &$value){
|
|
|
$value['tax'] = $value['tax']==''?[]:explode("、",$value['tax']);
|
|
|
}
|