WIN-2308041133\Administrator il y a 1 mois
Parent
commit
cb5d910527
2 fichiers modifiés avec 141 ajouts et 3 suppressions
  1. 32 0
      app/api/controller/Pub.php
  2. 109 3
      app/model/api/User.php

+ 32 - 0
app/api/controller/Pub.php

@@ -310,6 +310,38 @@ class Pub extends BaseController
         return app('json')->success($data);
     }
 
+//    /**
+//     * 获取从业人员列表
+//     * @param Request $request
+//     * @return type
+//     */
+//    public function getGoodWorkerList(Request $request)
+//    {
+//        $post = UtilService::getMore([
+//            ['page', 1],
+//            ['pageSize', 50],
+//            ['work_type_id', ""],
+//            ['servicePrice', 0],
+//            ['areaId', ''],
+//            ['is_china', ''],
+//            ['service_area', []],
+//            ['timetype', '']
+//        ], $request);
+//        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+//        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+//        $post["status"] = 1;
+//
+////        @file_put_contents('quanju.txt', json_encode($post['service_area']). "-城市选择\r\n", 8);
+//
+//        $data = (new UserModel)->getGoodApiWorkerList($post);
+//        foreach ($data['list'] as &$item) {
+//            $infoAuditDb = new InfoAudit();
+//            $infoData = $infoAuditDb->getItem(["status" => 1, "uid" => $item["uid"]]);
+//            $item['is_type_audit'] = $item['is_type_audit'] == 1 ? 1 : 0;
+//            $item['ancestral_place'] = !empty($infoData['ancestral_place']) ? $infoData['ancestral_place'] : '';
+//        }
+//        return app('json')->success($data);
+//    }
 
     /**
      * 获取从业人员列表

+ 109 - 3
app/model/api/User.php

@@ -388,7 +388,7 @@ class User extends BaseModel
                 }
             }
 
-            $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->where($where);
+            $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1")->where($where);
             if ($serviceAreaWhere) {
                 $totalModel->where($serviceAreaWhere);
             }
@@ -513,7 +513,7 @@ class User extends BaseModel
             $where[] = ["a.service_type", "=", $post['timetype']];
         }
         $cityModel = new CityModel();
-        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->where($where);
+        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1")->where($where);
         if (!empty($post["service_area"]) && is_array($post["service_area"])) {
             $totalModel->where(function ($query) use ($post, $cityModel) {
                 foreach ($post["service_area"] as $v) {
@@ -593,6 +593,110 @@ class User extends BaseModel
         return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
     }
 
+//    /**
+//     * 获取小程序在职展示列表
+//     * @return type
+//     */
+//    public function getGoodApiWorkerList($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.show_temp_seq", ">", 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 ($post['is_china'] != '') {
+//            $where[] = ["a.is_china", '=', $post['is_china']];
+//        }
+//        if (!empty($post['timetype'])) {
+//            $where[] = ["a.service_type", "=", $post['timetype']];
+//        }
+//        $cityModel = new CityModel();
+//        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1")->where($where);
+//        if (!empty($post["service_area"]) && is_array($post["service_area"])) {
+//            $totalModel->where(function ($query) use ($post, $cityModel) {
+//                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');
+//                    @file_put_contents('quanju.txt', $city_id. "-城市id\r\n", 8);
+//
+//                    $query->whereOr('find_in_set(' . $city_id . ',a.service_area)');
+//                }
+//            });
+//        }
+//        $totalCount = $totalModel->count();
+//        $data = null;
+//        if ($totalCount > 0) {
+////            Log::info('搜索条件:' . json_encode($where, JSON_UNESCAPED_UNICODE));
+//
+//            $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)->where('ut.show_template_id',7);
+//
+//            if (!empty($post["service_area"]) && is_array($post["service_area"])) {
+//                $dataModel->where(function ($query) use ($post, $cityModel) {
+//                    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');
+//                        @file_put_contents('quanju.txt', $city_id. "-城市id2222222\r\n", 8);
+//
+//                        $query->whereOr('find_in_set(' . $city_id . ',a.service_area)');
+//                    }
+//                });
+//            }
+//            $data = $dataModel->order("u.show_temp_seq", "desc")
+//                ->order("u.uid", "desc")
+//                ->page($post["page"], $post["pageSize"])
+//                ->select();
+////            Log::info('搜索语句:' . json_encode($this->getLastSql(), JSON_UNESCAPED_UNICODE));
+//
+//            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];
+//    }
 
     /**
      * 获取小程序在职展示列表
@@ -605,6 +709,8 @@ class User extends BaseModel
         $where = [];
         $where[] = ["u.work_type_id", ">", 0];
         $where[] = ["u.status", "=", 1];
+        $where[] = ["a.status", "=", 1];                             // 名片审核通过
+        $where[] = ["u.regtime", ">", strtotime("-3 months")];       // 最近3个月注册的新用户
         if (!empty($post['work_type_id'])) {
             $where[] = ["u.work_type_id", "=", $post['work_type_id']];
         }
@@ -639,7 +745,7 @@ class User extends BaseModel
             }
         }
 
-        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->where($where);
+        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid and a.status = 1")->where($where);
         if ($serviceAreaWhere) {
             $totalModel->where($serviceAreaWhere);
         }