From ebeb748cc4877468e4d0e1a1a516b9eb72ec5fe5 Mon Sep 17 00:00:00 2001 From: qianhy Date: Fri, 10 Mar 2023 17:20:07 +0800 Subject: [PATCH] biz_type filter in select about --- admin/controllers/Common.php | 3 +++ admin/controllers/app/licheb/Member.php | 8 +++++--- admin/controllers/biz/store/Store.php | 10 ++++++++-- admin/controllers/receiver/Clues.php | 7 ++++++- api/controllers/wxapp/app/City.php | 3 +++ api/controllers/wxapp/licheb/Statistics.php | 8 ++++++-- api/controllers/wxapp/licheb/Transfer.php | 4 +++- api/controllers/wxapp/licheb/User.php | 4 +++- common/models/biz/Biz_model.php | 6 ++++++ 9 files changed, 43 insertions(+), 10 deletions(-) diff --git a/admin/controllers/Common.php b/admin/controllers/Common.php index 90992596..49bc5a1d 100644 --- a/admin/controllers/Common.php +++ b/admin/controllers/Common.php @@ -492,6 +492,9 @@ class Common extends CI_Controller $county_id && $where['county_id'] = $county_id; $type && $where['type'] = $type; $ids && $where['id not in (' . $ids . ')'] = null; + $typeAry = $this->mdBiz->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $type_ids && $where["type in ($type_ids)"] = null; $count = $this->mdBiz->count($where); if ($count) { $resBiz = $this->mdBiz->select($where, 'id desc', $page, $size); diff --git a/admin/controllers/app/licheb/Member.php b/admin/controllers/app/licheb/Member.php index 6824f09c..0852c134 100755 --- a/admin/controllers/app/licheb/Member.php +++ b/admin/controllers/app/licheb/Member.php @@ -106,7 +106,9 @@ class Member extends HD_Controller if ($res_biz) { $biz_id_arr = array_unique(array_column($res_biz, 'biz_id')); $ids = implode(',', $biz_id_arr); - $selectedBrands = $this->biz_model->select(["id in ($ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name'); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $selectedBrands = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name'); } } else if ($row['biz_id']) { $re_biz = $this->biz_model->get(["id" => $row['biz_id'], 'status' => 1], 'id ,biz_name'); @@ -150,7 +152,7 @@ class Member extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '请输入姓名'); } - $exist = $this->userM->get(array('mobile' => $mobile)); + $exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null)); if ($exist) { return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在'); } @@ -188,7 +190,7 @@ class Member extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '输入正确手机号'); } - $exist = $this->userM->get(array('mobile' => $mobile, 'id <>' => $id)); + $exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null, 'id <>' => $id)); if ($exist) { return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在'); } diff --git a/admin/controllers/biz/store/Store.php b/admin/controllers/biz/store/Store.php index 6c00c993..5be7898b 100755 --- a/admin/controllers/biz/store/Store.php +++ b/admin/controllers/biz/store/Store.php @@ -104,10 +104,13 @@ class Store extends HD_Controller $c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00'); $c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59'); } + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $type_ids && $where["type in ($type_ids)"] = null; + $biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize); $count = $this->biz_model->count($where); $bizlists = []; - $typeAry = $this->biz_model->type_ary(); foreach ($biz_lists as $v) { # 230220close /*$brand = $this->bizBrand->get(array('id' => $v['brand_id']), 'brand_name'); @@ -957,6 +960,9 @@ class Store extends HD_Controller $type = $this->input->post('type'); $where = array(); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $type_ids && $where["type in ($type_ids)"] = null; if (strlen($status) > 0) { $where['status'] = $status; } else { @@ -967,7 +973,7 @@ class Store extends HD_Controller } else { if ($_SESSION['admin_info']['biz_id']) { $biz_ids = implode(',', $_SESSION['admin_info']['biz_id']); - $where["id in ($biz_ids)"] = null; + $where["id in ({$biz_ids})"] = null; } } $province_id && $where['province_id'] = $province_id; diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php index 231bffc0..2c9654c8 100644 --- a/admin/controllers/receiver/Clues.php +++ b/admin/controllers/receiver/Clues.php @@ -244,7 +244,9 @@ class Clues extends HD_Controller if ($re['lat'] && $re['lng']) { $info_show['near_bizs'] = $this->biz_model->nearby($re['lat'], $re['lng'], 1, 3, 'id,biz_name'); } else { - $info_show['near_bizs'] = $this->biz_model->select(['city_id' => $re['city_id'], 'county_id' => $re['county_id'], 'status' => 1], 'id desc', 1, 3, 'id,biz_name'); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $info_show['near_bizs'] = $this->biz_model->select(['city_id' => $re['city_id'], 'county_id' => $re['county_id'], "type in ($type_ids)" => null, 'status' => 1], 'id desc', 1, 3, 'id,biz_name'); } //获取分销用户 $cf_user = ''; @@ -568,6 +570,9 @@ class Clues extends HD_Controller ]; $city_id && $where['city_id'] = $city_id; $county_id && $where['county_id'] = $county_id; + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $type_ids && $where["type in ($type_ids)"] = null; $bizList = $this->biz_model->select($where, '', '', '', 'id,biz_name'); $this->data['bizList'] = $bizList; return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); diff --git a/api/controllers/wxapp/app/City.php b/api/controllers/wxapp/app/City.php index b89aa294..61fd71a6 100644 --- a/api/controllers/wxapp/app/City.php +++ b/api/controllers/wxapp/app/City.php @@ -43,6 +43,9 @@ class City extends Wxapp $biz_ids = implode(',', $biz_id_arr); $biz_where["id in ({$biz_ids})"] = null; } + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $type_ids && $biz_where["type in ($type_ids)"] = null; $biz_rows = $this->biz_model->select_groupby('city_id', $biz_where, '', '', '', 'id,city_id'); $city_ids = implode(',', array_column($biz_rows, 'city_id')); $city_ids && $where["city_id in ($city_ids)"] = null; diff --git a/api/controllers/wxapp/licheb/Statistics.php b/api/controllers/wxapp/licheb/Statistics.php index 914f4ca5..ec1c7039 100644 --- a/api/controllers/wxapp/licheb/Statistics.php +++ b/api/controllers/wxapp/licheb/Statistics.php @@ -44,7 +44,9 @@ class Statistics extends Wxapp{ $city_id && $o_where = ['city_id'=>$city_id]; $bizs_lists = $this->biz_model->get_by_id_arr($biz_id_arr,$o_where,$fileds); }else{ - $bizs_lists = $this->biz_model->select(['status'=>1,'city_id'=>$city_id],'id desc','','',$fileds); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $bizs_lists = $this->biz_model->select(['status'=>1,'city_id'=>$city_id,"type in ($type_ids)" => null],'id desc','','',$fileds); } if($bizs_lists){ $bizs = array_column($bizs_lists,'biz_name'); @@ -124,7 +126,9 @@ class Statistics extends Wxapp{ $city_id && $o_where = ['city_id'=>$city_id]; $bizs_lists = $this->biz_model->get_by_id_arr($biz_id_arr,$o_where,$fileds); }else{ - $bizs_lists = $this->biz_model->select(['status'=>1,'city_id'=>$city_id],'id desc','','',$fileds); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $bizs_lists = $this->biz_model->select(['status'=>1,'city_id'=>$city_id,"type in ($type_ids)" => null],'id desc','','',$fileds); } if($bizs_lists){ $bizs = array_column($bizs_lists,'biz_name'); diff --git a/api/controllers/wxapp/licheb/Transfer.php b/api/controllers/wxapp/licheb/Transfer.php index 0ec87b82..caa3a768 100644 --- a/api/controllers/wxapp/licheb/Transfer.php +++ b/api/controllers/wxapp/licheb/Transfer.php @@ -79,7 +79,9 @@ class Transfer extends Wxapp if ($this->session['biz_id'] && $biz_id_arr) { $bizs = $this->biz_model->get_by_id_arr($biz_id_arr, ['city_id' => $city_id, 'type<>' => 4], 'id'); } else { - $bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id, 'type<>' => 4], 'id desc', '', '', 'id'); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id, "type in ($type_ids)" => null, 'type<>' => 4], 'id desc', '', '', 'id'); } $biz_id_str = $bizs ? implode(',', array_column($bizs, 'id')) : 0; $where = ['status <>' => -1, "biz_id in({$biz_id_str})" => null]; diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 7f82fa48..1469fd32 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -473,7 +473,9 @@ class User extends Wxapp $city_id && $o_where = ['city_id' => $city_id, 'type<>' => 4]; $bizs = $this->biz_model->get_by_id_arr($biz_id_arr, $o_where, $fileds); } else { - $bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id, 'type<>' => 4], 'id desc', '', '', $fileds); + $typeAry = $this->biz_model->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $bizs = $this->biz_model->select(['status' => 1, 'city_id' => $city_id, "type in ($type_ids)" => null, 'type<>' => 4], 'id desc', '', '', $fileds); } if ($bizs) { foreach ($bizs as $key => $val) { diff --git a/common/models/biz/Biz_model.php b/common/models/biz/Biz_model.php index 6eb0abc8..fd23ece0 100755 --- a/common/models/biz/Biz_model.php +++ b/common/models/biz/Biz_model.php @@ -46,8 +46,11 @@ class Biz_model extends HD_Model $bizs = []; $ids = implode(',', $ids_arr); if ($ids) { + $typeAry = $this->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); $where = [ "id in ($ids)" => null, + "type in ($type_ids)" => null, "status" => 1 ]; is_array($o_where) && $where = array_merge($where, $o_where); @@ -83,6 +86,9 @@ class Biz_model extends HD_Model $lat = (float)$lat; $lng = (float)$lng; $where = "status=1 and lat>0 and lng>0"; + $typeAry = $this->type_ary(); + $type_ids = implode(',',array_keys($typeAry)); + $where = $where." and type in ($type_ids)"; if ($page) { $offset = ($page - 1) * $size;