|
|
@@ -103,13 +103,26 @@ class ServiceLists extends BaseApiDataLists implements ListsSearchInterface
|
|
|
$catwhere[] = ['cate_id', 'like', $cats, 'or'];
|
|
|
}
|
|
|
|
|
|
- $field = 'id,user_id,name,mobile,type,agricultural_machinery_model,images,cate_id,area_id,money,content,status,audit_status,audit_time,expiration_time,create_time';
|
|
|
+ $mcatwhere=[];
|
|
|
+ if (!empty($this->params['mechanical_cate_id'])) {
|
|
|
+ $m_cate_id_arr = explode(',',$this->params['mechanical_cate_id']);
|
|
|
+
|
|
|
+ $mcats = [];
|
|
|
+ foreach ($m_cate_id_arr as &$v){
|
|
|
+ $mcats[]='%,'.$v.',%';
|
|
|
+
|
|
|
+ }
|
|
|
+ $mcatwhere[] = ['mechanical_cate_id', 'like', $mcats, 'or'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $field = 'id,user_id,name,mobile,type,agricultural_machinery_model,images,cate_id,area_id,mechanical_cate_id,money,content,status,audit_status,audit_time,expiration_time,create_time';
|
|
|
$result = UserService::field($field)
|
|
|
->where($this->queryWhere())
|
|
|
->where($this->searchWhere)
|
|
|
->where($wheres)
|
|
|
->where($catwhere)
|
|
|
- ->append(['type_desc','cate_desc','area_desc','images','user'])
|
|
|
+ ->where($mcatwhere)
|
|
|
+ ->append(['type_desc','cate_desc','area_desc','images','user','mechanical_cate_desc'])
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->select()->toArray();
|
|
|
|
|
|
@@ -126,8 +139,54 @@ class ServiceLists extends BaseApiDataLists implements ListsSearchInterface
|
|
|
*/
|
|
|
public function count(): int
|
|
|
{
|
|
|
+ $wheres = [] ;
|
|
|
+ if (!empty($this->params['area_id'])) {
|
|
|
+ $cwhere=[];
|
|
|
+ $cwhere[]=['pid','=',$this->params['area_id']];
|
|
|
+
|
|
|
+ $cate_list = AssetArea::where($cwhere)->select() ->toArray();
|
|
|
+
|
|
|
+ $cate_ids = array_column($cate_list,'id');
|
|
|
+ array_push($cate_ids,(int)$this->params['area_id']);
|
|
|
+
|
|
|
+
|
|
|
+ $ccs = [];
|
|
|
+ foreach ($cate_ids as &$v){
|
|
|
+ $ccs[]='%,'.$v.',%';
|
|
|
+
|
|
|
+ }
|
|
|
+ $wheres[] = ['area_id', 'like', $ccs, 'or'];
|
|
|
+
|
|
|
+ }
|
|
|
+ $catwhere=[];
|
|
|
+ if (!empty($this->params['cate_id'])) {
|
|
|
+ $cate_id_arr = explode(',',$this->params['cate_id']);
|
|
|
+
|
|
|
+ $cats = [];
|
|
|
+ foreach ($cate_id_arr as &$v){
|
|
|
+ $cats[]='%,'.$v.',%';
|
|
|
+
|
|
|
+ }
|
|
|
+ $catwhere[] = ['cate_id', 'like', $cats, 'or'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $mcatwhere=[];
|
|
|
+ if (!empty($this->params['mechanical_cate_id'])) {
|
|
|
+ $m_cate_id_arr = explode(',',$this->params['mechanical_cate_id']);
|
|
|
+
|
|
|
+ $mcats = [];
|
|
|
+ foreach ($m_cate_id_arr as &$v){
|
|
|
+ $mcats[]='%,'.$v.',%';
|
|
|
+
|
|
|
+ }
|
|
|
+ $mcatwhere[] = ['mechanical_cate_id', 'like', $mcats, 'or'];
|
|
|
+ }
|
|
|
+
|
|
|
return UserService::where($this->searchWhere)
|
|
|
->where($this->queryWhere())
|
|
|
+ ->where($wheres)
|
|
|
+ ->where($catwhere)
|
|
|
+ ->where($mcatwhere)
|
|
|
->count();
|
|
|
}
|
|
|
}
|