|
@@ -1498,50 +1498,73 @@ class Good extends BaseController
|
|
|
}
|
|
|
|
|
|
//贵金属种类列表
|
|
|
- public function linst(){
|
|
|
- $data=[];
|
|
|
- foreach ($this->gold as $key=>$value){
|
|
|
- $v =[];
|
|
|
- $v['type']=$key;
|
|
|
- $v['type_cn']=$value;
|
|
|
- $data[]=$v;
|
|
|
- }
|
|
|
- return app_show(0,"获取成功",$data);
|
|
|
+ public function linst()
|
|
|
+ {
|
|
|
+ $data = [];
|
|
|
+ foreach ($this->gold as $key => $value) {
|
|
|
+ $v = [];
|
|
|
+ $v['type'] = $key;
|
|
|
+ $v['type_cn'] = $value;
|
|
|
+ $data[] = $v;
|
|
|
+ }
|
|
|
+ return json_show(0, "获取成功", $data);
|
|
|
}
|
|
|
|
|
|
//分类列表
|
|
|
- public function wlist(){
|
|
|
+ public function wlist()
|
|
|
+ {
|
|
|
$this->post = $this->request->filter('trim')->post();
|
|
|
- $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']) :"1";
|
|
|
- $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
|
|
|
- $where =[["is_del","=",0],['level',"=",3]];
|
|
|
- $cat_name=isset($this->post['cat_name']) && $this->post['cat_name'] !==""? trim($this->post['cat_name']) :"";
|
|
|
- if($cat_name!==""){
|
|
|
- $where[]=['cat_name',"like","%$cat_name%"];
|
|
|
+ $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
|
|
|
+ $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
|
|
|
+ $where = [["is_del", "=", 0]];
|
|
|
+ $cat_name = isset($this->post['cat_name']) && $this->post['cat_name'] !== "" ? trim($this->post['cat_name']) : "";
|
|
|
+ if ($cat_name !== "") {
|
|
|
+ $where[] = ['cat_name', "like", "%$cat_name%"];
|
|
|
}
|
|
|
- $search=isset($this->post['search']) && $this->post['search'] !==""? trim($this->post['search']) :"";
|
|
|
- if($search!==""){
|
|
|
- $where[]=['search',"like","%$search%"];
|
|
|
+ $search = isset($this->post['search']) && $this->post['search'] !== "" ? trim($this->post['search']) : "";
|
|
|
+ if ($search !== "") {
|
|
|
+ $where[] = ['search', "like", "%$search%"];
|
|
|
}
|
|
|
- $pid=isset($this->post['pid']) && $this->post['pid'] !==""? intval($this->post['pid']) :"";
|
|
|
- if($pid!==""){
|
|
|
- $where[]=['pid',"=",$pid];
|
|
|
+ $pid = isset($this->post['pid']) && $this->post['pid'] !== "" ? intval($this->post['pid']) : "";
|
|
|
+ if ($pid !== "") {
|
|
|
+ $where[] = ['pid', "=", $pid];
|
|
|
}
|
|
|
- $status=isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']) :"";
|
|
|
- if($status!==""){
|
|
|
- $where[]=['status',"=",$status];
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
+ if ($status !== "") {
|
|
|
+ $where[] = ['status', "=", $status];
|
|
|
}
|
|
|
$count = Db::name("cat")->where($where)->count();
|
|
|
$total = ceil($count / $size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
$list = Db::name('cat')->where($where)->page($page, $size)->select();
|
|
|
- $data=[];
|
|
|
- foreach ($list as $value){
|
|
|
- $temp= isset($value['id']) && $value['id'] !=0 ? made($value['id']):[];
|
|
|
- $value['item'] = array_column($temp,'id');
|
|
|
- $data[]=$value;
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $value) {
|
|
|
+ $temp = isset($value['id']) && $value['id'] != 0 ? made($value['id']) : [];
|
|
|
+ $value['item'] = array_column($temp, 'id');
|
|
|
+ $data[] = $value;
|
|
|
}
|
|
|
- return app_show(0, "获取成功", ['list' =>$data, 'count' => $count]);
|
|
|
+ return json_show(0, "获取成功", ['list' => $data, 'count' => $count]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //分类列表-全部
|
|
|
+ public function title()
|
|
|
+ {
|
|
|
+ $where = [["is_del", "=", 0]];
|
|
|
+ $cat_name = isset($this->post['cat_name']) && $this->post['cat_name'] !== "" ? trim($this->post['cat_name']) : "";
|
|
|
+ if ($cat_name !== "") $where[] = ['cat_name', "like", "%$cat_name%"];
|
|
|
+
|
|
|
+ $pid = isset($this->post['pid']) && $this->post['pid'] !== "" ? intval($this->post['pid']) : "";
|
|
|
+ if ($pid !== "") $where[] = ["pid", "=", $pid];
|
|
|
+
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
+ if ($status !== "") $where[] = ['status', "=", $status];
|
|
|
+
|
|
|
+ $list = Db::name('cat')
|
|
|
+ ->where($where)
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return json_show(0, "获取成功", $list);
|
|
|
}
|
|
|
|
|
|
|