|
|
@@ -256,93 +256,6 @@ class User extends BaseModel
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取小程序在职展示列表
|
|
|
- * @return type
|
|
|
- */
|
|
|
- public function getApiWorkerList($post)
|
|
|
- {
|
|
|
- $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
|
|
|
- $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
|
|
|
- $where = [];
|
|
|
- $where[] = ["u.work_type_id", ">", 0];
|
|
|
- $where[] = ["u.status", "=", 1];
|
|
|
- if (!empty($post['work_type_id'])) {
|
|
|
- $where[] = ["u.work_type_id", "=", $post['work_type_id']];
|
|
|
- }
|
|
|
- if ($post['servicePrice'] > 0) {
|
|
|
- $where[] = ["a.service_min_price", "<=", $post['servicePrice']];
|
|
|
- }
|
|
|
- if (!empty($post['timetype'])) {
|
|
|
- $where[] = ["a.service_type", "=", $post['timetype']];
|
|
|
- }
|
|
|
- if ($post['is_china'] != '') {
|
|
|
- $where[] = ["a.is_china", '=', $post['is_china']];
|
|
|
- }
|
|
|
-
|
|
|
- $cityModel = new CityModel();
|
|
|
- $serviceAreaWhere = null;
|
|
|
- if (!empty($post["service_area"]) && is_array($post["service_area"])) {
|
|
|
- $cityIds = [];
|
|
|
- foreach ($post["service_area"] as $v) {
|
|
|
- $stc = str_replace(['省', '市', '区', '县'], ['', '', '', ''], $v);
|
|
|
- $str = str_replace(['辖'], ['市辖'], $stc);
|
|
|
- $arr = explode(",", $str);
|
|
|
- $city_id = $cityModel->where('merger_name', 'like', "%" . $arr[1] . "," . $arr[2])->value('id');
|
|
|
- if (!$city_id) $city_id = $cityModel->where('merger_name', 'like', "%" . $arr[0] . "," . $arr[1])->value('id');
|
|
|
- if ($city_id) $cityIds[] = $city_id;
|
|
|
- }
|
|
|
- if (!empty($cityIds)) {
|
|
|
- $cityIdStr = implode(',', $cityIds);
|
|
|
- $serviceAreaWhere = function ($query) use ($cityIdStr) {
|
|
|
- foreach (explode(',', $cityIdStr) as $cid) {
|
|
|
- $query->whereOr('find_in_set(' . intval($cid) . ',a.service_area)');
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->where($where);
|
|
|
- if ($serviceAreaWhere) {
|
|
|
- $totalModel->where($serviceAreaWhere);
|
|
|
- }
|
|
|
- $totalCount = $totalModel->count();
|
|
|
-
|
|
|
- $data = null;
|
|
|
- if ($totalCount > 0) {
|
|
|
- $dataModel = $this
|
|
|
- ->alias("u")
|
|
|
- ->field("u.uid,IFNULL(u.longitude,0) as longitude,IFNULL(u.latitude,0) as latitude,ut.show_template_id,a.ancestral_place,a.status as is_type_audit,a.name,a.avatar,a.age,a.birthday,a.service_project")
|
|
|
- ->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1 and a.is_show = 1")
|
|
|
- ->leftJoin("user_show_template ut", "ut.uid = u.uid and ut.is_default = 1")
|
|
|
- ->where($where);
|
|
|
- if ($serviceAreaWhere) {
|
|
|
- $dataModel->where($serviceAreaWhere);
|
|
|
- }
|
|
|
- $data = $dataModel->order("u.show_temp_seq", "desc")
|
|
|
- ->order("u.uid", "desc")
|
|
|
- ->page($post["page"], $post["pageSize"])
|
|
|
- ->select();
|
|
|
- if (!empty($data)) {
|
|
|
- $data = $data->toArray();
|
|
|
- foreach ($data as $k => $v) {
|
|
|
- $data[$k]['name'] = $v['name'] ?? '';
|
|
|
- $data[$k]['avatar'] = $v['avatar'] ?? '';
|
|
|
- $data[$k]['age'] = $v['age'] ?? '';
|
|
|
- $data[$k]['birthday'] = !empty($v['birthday']) ? date('Y-m-d', $v['birthday']) : '';
|
|
|
- $data[$k]['service_project_ar'] = [];
|
|
|
- if (!empty($v['service_project'])) {
|
|
|
- $projectIds = is_array($v['service_project']) ? $v['service_project'] : explode(',', $v['service_project']);
|
|
|
- $data[$k]['service_project_ar'] = (new ServiceType())->where('id', 'in', $projectIds)->select()->toArray();
|
|
|
- }
|
|
|
- $data[$k]['user_work_type_title'] = '';
|
|
|
- $data[$k]['service_area_all'] = [];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- $data = empty($data) ? [] : $data;
|
|
|
- return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
|
|
|
- }
|
|
|
// /**
|
|
|
// * 获取小程序在职展示列表
|
|
|
// * @return type
|
|
|
@@ -357,51 +270,138 @@ class User extends BaseModel
|
|
|
// if (!empty($post['work_type_id'])) {
|
|
|
// $where[] = ["u.work_type_id", "=", $post['work_type_id']];
|
|
|
// }
|
|
|
-// $totalCount = $this->alias("u")->where($where)->count();
|
|
|
+// if ($post['servicePrice'] > 0) {
|
|
|
+// $where[] = ["a.service_min_price", "<=", $post['servicePrice']];
|
|
|
+// }
|
|
|
+// if (!empty($post['timetype'])) {
|
|
|
+// $where[] = ["a.service_type", "=", $post['timetype']];
|
|
|
+// }
|
|
|
+// if ($post['is_china'] != '') {
|
|
|
+// $where[] = ["a.is_china", '=', $post['is_china']];
|
|
|
+// }
|
|
|
+//
|
|
|
+// $cityModel = new CityModel();
|
|
|
+// $serviceAreaWhere = null;
|
|
|
+// if (!empty($post["service_area"]) && is_array($post["service_area"])) {
|
|
|
+// $cityIds = [];
|
|
|
+// foreach ($post["service_area"] as $v) {
|
|
|
+// $stc = str_replace(['省', '市', '区', '县'], ['', '', '', ''], $v);
|
|
|
+// $str = str_replace(['辖'], ['市辖'], $stc);
|
|
|
+// $arr = explode(",", $str);
|
|
|
+// $city_id = $cityModel->where('merger_name', 'like', "%" . $arr[1] . "," . $arr[2])->value('id');
|
|
|
+// if (!$city_id) $city_id = $cityModel->where('merger_name', 'like', "%" . $arr[0] . "," . $arr[1])->value('id');
|
|
|
+// if ($city_id) $cityIds[] = $city_id;
|
|
|
+// }
|
|
|
+// if (!empty($cityIds)) {
|
|
|
+// $cityIdStr = implode(',', $cityIds);
|
|
|
+// $serviceAreaWhere = function ($query) use ($cityIdStr) {
|
|
|
+// foreach (explode(',', $cityIdStr) as $cid) {
|
|
|
+// $query->whereOr('find_in_set(' . intval($cid) . ',a.service_area)');
|
|
|
+// }
|
|
|
+// };
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->where($where);
|
|
|
+// if ($serviceAreaWhere) {
|
|
|
+// $totalModel->where($serviceAreaWhere);
|
|
|
+// }
|
|
|
+// $totalCount = $totalModel->count();
|
|
|
+//
|
|
|
// $data = null;
|
|
|
// if ($totalCount > 0) {
|
|
|
-// $data = $this
|
|
|
+// $dataModel = $this
|
|
|
// ->alias("u")
|
|
|
-// ->field("u.uid,IFNULL(u.longitude,0) as longitude,IFNULL(u.latitude,0) as latitude,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
|
|
|
-// ->leftJoin("info_audit a", "u.uid=a.uid")
|
|
|
-// ->leftJoin("user_show_template ut", "ut.uid = u.uid and ut.is_default = 1")//默认模板
|
|
|
-// ->where($where)
|
|
|
-// ->order("u.show_temp_seq", "desc")
|
|
|
+// ->field("u.uid,IFNULL(u.longitude,0) as longitude,IFNULL(u.latitude,0) as latitude,ut.show_template_id,a.ancestral_place,a.status as is_type_audit,a.name,a.avatar,a.age,a.birthday,a.service_project")
|
|
|
+// ->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1 and a.is_show = 1")
|
|
|
+// ->leftJoin("user_show_template ut", "ut.uid = u.uid and ut.is_default = 1")
|
|
|
+// ->where($where);
|
|
|
+// if ($serviceAreaWhere) {
|
|
|
+// $dataModel->where($serviceAreaWhere);
|
|
|
+// }
|
|
|
+// $data = $dataModel->order("u.show_temp_seq", "desc")
|
|
|
// ->order("u.uid", "desc")
|
|
|
// ->page($post["page"], $post["pageSize"])
|
|
|
// ->select();
|
|
|
// if (!empty($data)) {
|
|
|
// $data = $data->toArray();
|
|
|
-// }
|
|
|
-// $infoAuditDb = new InfoAudit();
|
|
|
-// foreach ($data as $k => $v) {
|
|
|
-// $item = [
|
|
|
-// "name" => "",
|
|
|
-// "avatar" => "",
|
|
|
-// "age" => "",
|
|
|
-// "service_project_ar" => [],
|
|
|
-// "user_work_type_title" => "",
|
|
|
-// "service_area_all" => [],
|
|
|
-// "birthday" => ""
|
|
|
-// ];
|
|
|
-// $infoData = $infoAuditDb->getItem(["status" => 1, "uid" => $v["uid"]]);
|
|
|
-// if (!empty($infoData)) {
|
|
|
-// foreach ($item as $k2 => $v2) {
|
|
|
-// $item[$k2] = $infoData[$k2];
|
|
|
+// foreach ($data as $k => $v) {
|
|
|
+// $data[$k]['name'] = $v['name'] ?? '';
|
|
|
+// $data[$k]['avatar'] = $v['avatar'] ?? '';
|
|
|
+// $data[$k]['age'] = $v['age'] ?? '';
|
|
|
+// $data[$k]['birthday'] = !empty($v['birthday']) ? date('Y-m-d', $v['birthday']) : '';
|
|
|
+// $data[$k]['service_project_ar'] = [];
|
|
|
+// if (!empty($v['service_project'])) {
|
|
|
+// $projectIds = is_array($v['service_project']) ? $v['service_project'] : explode(',', $v['service_project']);
|
|
|
+// $data[$k]['service_project_ar'] = (new ServiceType())->where('id', 'in', $projectIds)->select()->toArray();
|
|
|
// }
|
|
|
+// $data[$k]['user_work_type_title'] = '';
|
|
|
+// $data[$k]['service_area_all'] = [];
|
|
|
// }
|
|
|
-// $data[$k] = array_merge($v, $item);
|
|
|
// }
|
|
|
// }
|
|
|
-//// $datatwo = [];
|
|
|
-//// foreach($data as $v){
|
|
|
-//// if($v['is_show'] == 1){
|
|
|
-//// $datatwo[] = $v;
|
|
|
-//// }
|
|
|
-//// }
|
|
|
// $data = empty($data) ? [] : $data;
|
|
|
// return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
|
|
|
// }
|
|
|
+ /**
|
|
|
+ * 获取小程序在职展示列表
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function getApiWorkerList($post)
|
|
|
+ {
|
|
|
+ $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
|
|
|
+ $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["u.work_type_id", ">", 0];
|
|
|
+ $where[] = ["u.status", "=", 1];
|
|
|
+ if (!empty($post['work_type_id'])) {
|
|
|
+ $where[] = ["u.work_type_id", "=", $post['work_type_id']];
|
|
|
+ }
|
|
|
+ $totalCount = $this->alias("u")->where($where)->count();
|
|
|
+ $data = null;
|
|
|
+ if ($totalCount > 0) {
|
|
|
+ $data = $this
|
|
|
+ ->alias("u")
|
|
|
+ ->field("u.uid,IFNULL(u.longitude,0) as longitude,IFNULL(u.latitude,0) as latitude,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
|
|
|
+ ->leftJoin("info_audit a", "u.uid=a.uid")
|
|
|
+ ->leftJoin("user_show_template ut", "ut.uid = u.uid and ut.is_default = 1")//默认模板
|
|
|
+ ->where($where)
|
|
|
+ ->order("u.show_temp_seq", "desc")
|
|
|
+ ->order("u.uid", "desc")
|
|
|
+ ->page($post["page"], $post["pageSize"])
|
|
|
+ ->select();
|
|
|
+ if (!empty($data)) {
|
|
|
+ $data = $data->toArray();
|
|
|
+ }
|
|
|
+ $infoAuditDb = new InfoAudit();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $item = [
|
|
|
+ "name" => "",
|
|
|
+ "avatar" => "",
|
|
|
+ "age" => "",
|
|
|
+ "service_project_ar" => [],
|
|
|
+ "user_work_type_title" => "",
|
|
|
+ "service_area_all" => [],
|
|
|
+ "birthday" => ""
|
|
|
+ ];
|
|
|
+ $infoData = $infoAuditDb->getItem(["status" => 1, "uid" => $v["uid"]]);
|
|
|
+ if (!empty($infoData)) {
|
|
|
+ foreach ($item as $k2 => $v2) {
|
|
|
+ $item[$k2] = $infoData[$k2];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data[$k] = array_merge($v, $item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// $datatwo = [];
|
|
|
+// foreach($data as $v){
|
|
|
+// if($v['is_show'] == 1){
|
|
|
+// $datatwo[] = $v;
|
|
|
+// }
|
|
|
+// }
|
|
|
+ $data = empty($data) ? [] : $data;
|
|
|
+ return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取小程序在职展示列表
|