|
@@ -0,0 +1,52 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+namespace app\user\controller;
|
|
|
+
|
|
|
+
|
|
|
+use think\App;
|
|
|
+class TaxCategory extends Base{
|
|
|
+ public function __construct(App $app) {
|
|
|
+ parent::__construct($app);
|
|
|
+ $this->model = new \app\user\model\TaxCategory();
|
|
|
+ }
|
|
|
+ public function list(){
|
|
|
+ $params=$this->request->param(["cat_name"=>"","cat_code"=>"","status"=>[],"page"=>1,"size"=>15],"post","trim");
|
|
|
+ $where=[];
|
|
|
+ if($params["cat_name"]!='') $where[]=["cat_name|short_name","like","%".$params["cat_name"]."%"];
|
|
|
+ if($params["cat_code"]!='') $where[]=["cat_code|merge_code","like","%".$params["cat_code"]."%"];
|
|
|
+ if(!empty($params["status"])) $where[]=["status","in",$params["status"]];
|
|
|
+ $list=$this->model->where($where)->order("status asc,id desc")->paginate(["page"=>$params["page"],"list_rows"=>$params["size"]]);
|
|
|
+ return success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function query(){
|
|
|
+ $params=$this->request->param(["cat_name"=>"","cat_code"=>"","status"=>[]],"post","trim");
|
|
|
+ $where=[["tax","<>",""]];
|
|
|
+ if($params["cat_name"]!='') $where[]=["cat_name|short_name","like","%".$params["cat_name"]."%"];
|
|
|
+ if($params["cat_code"]!='') $where[]=["cat_code|merge_code","like","%".$params["cat_code"]."%"];
|
|
|
+ if(!empty($params["status"])) $where[]=["status","in",$params["status"]];
|
|
|
+ $list=$this->model->where($where)
|
|
|
+ ->field('cat_name,cat_code,status,tax,addtax,sumitem,`desc`,short_name,merge_code,LENGTH(cat_name) as weight')
|
|
|
+ ->order("weight asc,id desc")
|
|
|
+ ->limit(30)->select()->toArray();
|
|
|
+ return success("获取成功",$list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listByCompany(){
|
|
|
+ $params=$this->request->param([
|
|
|
+ "cat_name"=>"",
|
|
|
+ "short_name"=>"",
|
|
|
+ "relation_status"=>"",
|
|
|
+ "cat_code"=>"",
|
|
|
+ "use_status"=>"",
|
|
|
+ "companyNo"=>"",
|
|
|
+ "page"=>1,"size"=>15],"post","trim");
|
|
|
+ $where=[];
|
|
|
+ if($params["cat_name"]!='') $where[]=["cat_name","like","%".$params["cat_name"]."%"];
|
|
|
+ if($params["short_name"]!='') $where[]=["short_name","like","%".$params["short_name"]."%"];
|
|
|
+ if($params["relation_status"]!='') {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|