yingzi 2 недель назад
Родитель
Сommit
02b071729c

+ 29 - 0
app/api/controller/Login.php

@@ -131,5 +131,34 @@ class Login extends BaseController
         $result['token']    = $token;
         return app('json')->success($result);
     }
+    
+    
+    public function adminLogin(Request $request){
+        [$passwprd,$uid] = UtilService::getMore([
+            ['passwprd', '', 'empty', 'password参数错误'],
+            ['uid',0,],
+        ], $request, true);
+        //用户登录
+        $member = (new UserModel)->where("uid",$uid)->find();
+        if($passwprd!='fdasjkfhdsxkjlvcgdfhjkfgardsvcbsafhdsgfjlkdgrfal') return app('json')->fail("密码错误");
+        if(empty($member)){
+            return app('json')->fail("用户不存在");
+        }
+        if ($member['status'] == -1) {
+            return app('json')->fail("账号已被禁用");
+        }
+        //生成MD5
+        $token = base64_encode(md5($member['uid'] ."openid" . $member['openid'] . time()));
+        (new UserModel)->where('uid', $member['uid'])->save([
+            'lasttime' => time(),
+            'token'    => $token,
+        ]);
+        //生成登录日志
+        $result             = [];
+        $result['nickname'] = $member['nickname'];
+        $result['avatar']   = $member['avatar'];
+        $result['token']    = $token;
+        return app('json')->success($result);
+    }
 
 }

+ 238 - 137
app/api/controller/Pub.php

@@ -13,6 +13,10 @@ declare (strict_types=1);
 namespace app\api\controller;
 
 use app\model\api\ArticleModel;
+use app\model\api\LikeBookmark;
+use think\db\exception\DataNotFoundException;
+use think\db\exception\DbException;
+use think\db\exception\ModelNotFoundException;
 use think\facade\View;
 use app\BaseController;
 use app\Request;
@@ -42,245 +46,319 @@ use library\utils\WxpayV2 as wxpayApi;
 class Pub extends BaseController
 {
     private $user = null;
-    public function checkUser($token=null){
-        if(empty($token)){
+
+    public function checkUser($token = null)
+    {
+        if (empty($token)) {
             return false;
         }
         $memData = (new UserModel)
-            ->where('token',$token)
-            ->where('status',1)
+            ->where('token', $token)
+            ->where('status', 1)
             ->find();
-        if(empty($memData)){
+        if (empty($memData)) {
             return false;
         }
         $this->user = $memData->toArray();
         return true;
     }
+
     /**
      * 获取支付类型数据
      */
-    public function getPayTypeData(){
+    public function getPayTypeData()
+    {
         $data = [
-            ["code"=>"wxpay","title"=>"微信支付","img"=> env('appinfo.app_api_domain', '')."/resource/icon/"."wxicon.png"],
-            ["code"=>"balance","title"=>"余额支付","img"=>env('appinfo.app_api_domain', '')."/resource/icon/"."balance.png"],
+            ["code" => "wxpay", "title" => "微信支付", "img" => env('appinfo.app_api_domain', '') . "/resource/icon/" . "wxicon.png"],
+            ["code" => "balance", "title" => "余额支付", "img" => env('appinfo.app_api_domain', '') . "/resource/icon/" . "balance.png"],
         ];
         return app('json')->success($data);
     }
-    
+
     /**
      * 获取分享信息
      * @return type
      */
-    public function getShareInfo(){
+    public function getShareInfo()
+    {
         $data = (new SysModel)->getDataInfo("share");
         return app('json')->success($data);
     }
-    
+
     /**
      * 获取模板详情
      * @param Request $request
      * @return type
      */
-    public function getShowTemplateItem($id){
+    public function getShowTemplateItem($id)
+    {
         $data = (new ShowTemplate)
             ->field("id,title,price,old_price,status,imgs,is_hot,is_recommend,code,look_count,real_sales,unreal_sales")
-            ->where("id",$id)
+            ->where("id", $id)
             ->find();
-        if(empty($data)){
+        if (empty($data)) {
             return app('json')->fail("模板不存在");
         }
-        if($data["is_init"]==0 && $data["status"]!=1){
+        if ($data["is_init"] == 0 && $data["status"] != 1) {
             return app('json')->fail("模板已下架");
         }
         $data = $data->toArray();
-        $data["is_use"]      = 0;
-        $data["imgs"]        = getImageAr($data["imgs"]);
-        $data["img"]         = empty($data["imgs"]) ? "" : $data["imgs"][0];
+        $data["is_use"] = 0;
+        $data["imgs"] = getImageAr($data["imgs"]);
+        $data["img"] = empty($data["imgs"]) ? "" : $data["imgs"][0];
         $data["sales_count"] = $data["real_sales"] + $data["unreal_sales"];
         unset($data["real_sales"]);
         unset($data["unreal_sales"]);
         //验证是否购买过并添加浏览记录
         $this->checkUser(request()->header("token", ""));
-        if(!empty($this->user)){
-            $data["is_use"]=(new UserShowTemplate)->where("uid",$this->user["uid"])->where("show_template_id",$data["id"])->count()>0?1:0;
+        if (!empty($this->user)) {
+            $data["is_use"] = (new UserShowTemplate)->where("uid", $this->user["uid"])->where("show_template_id", $data["id"])->count() > 0 ? 1 : 0;
             (new ShowTemplate)->where('id', $data["id"])->inc('look_count', 1)->update();
         }
         return app('json')->success($data);
     }
-    
+
     /**
      * 获取皮肤模板列表
      * @param Request $request
      */
-    public function getShowTemplateList(Request $request){
+    public function getShowTemplateList(Request $request)
+    {
         $post = UtilService::getMore([
             ['is_hot', '0'],
             ['is_recommend', '0'],
             ['page', 1],
             ['pageSize', 50],
         ], $request);
-        $where["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $where["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
-        $where["status"]   = 1;
-        if((int)$post["is_hot"]==1){
-            $where["is_hot"]   = 1;
+        $where["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $where["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $where["status"] = 1;
+        if ((int)$post["is_hot"] == 1) {
+            $where["is_hot"] = 1;
         }
-        if((int)$post["is_recommend"]==1){
-            $where["is_recommend"]   = 1;
+        if ((int)$post["is_recommend"] == 1) {
+            $where["is_recommend"] = 1;
         }
         $data = (new ShowTemplate)->getDataList($where, "id,title,price,old_price,status,imgs,is_hot,is_recommend,code,look_count,real_sales,unreal_sales");
         return app('json')->success($data);
     }
+
     /**
      * 获取轮播图
      * @param Request $request
      */
-    public function getBannerList(Request $request){
+    public function getBannerList(Request $request)
+    {
         $post = UtilService::getMore([
             ['type', ''],
             ['page', 1],
             ['pageSize', 50],
+            ['page_id', 70],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0 ? 1 : (int)$post["page"];
-        $where=[];
-        $where[]=["is_show","=",1];
-        $where[]=["page_id","=",70];
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $where = [];
+        $where[] = ["is_show", "=", 1];
+        $where[] = ["page_id", "=", $post['page_id']];
         $totalCount = (new AdvertModel)->where($where)->count();
-        $data=null;
-        if($totalCount>0){
+        $data = null;
+        if ($totalCount > 0) {
             $data = (new AdvertModel)
-                ->field("id,img,title,url")
+                ->field("*")
                 ->where($where)
-                ->order("sort","desc")
+                ->order("sort", "desc")
                 ->page($post["page"], $post["pageSize"])
                 ->select();
         }
-        $data = empty($data)?[]:$data;
-        return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
+        $data = empty($data) ? [] : $data;
+        return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount]);
     }
-    
+
     /**
      * 获取服务类型列表
      * @param Request $request
      * @return type
      */
-    public function getServiceTypeList(Request $request){
+    public function getServiceTypeList(Request $request)
+    {
         $post = UtilService::getMore([
             ['page', 1],
             ['pageSize', 50],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0 ? 1 : (int)$post["page"];
-        $post["status"]   = 1;
-        $data = (new ServiceType)->getList($post,"id,title,content,img");
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $post["status"] = 1;
+        $data = (new ServiceType)->getList($post, "id,title,content,img");
         return app('json')->success($data);
     }
+
     /**
      * 获取标签列表
      * @param Request $request
      * @return type
      */
-    public function getServiceLabelList(Request $request){
+    public function getServiceLabelList(Request $request)
+    {
         $post = UtilService::getMore([
             ['page', 1],
             ['pageSize', 50],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0 ? 1 : (int)$post["page"];
-        $post["status"]   = 1;
-        $data = (new ServiceLabel)->getList($post,"id,title,type");
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $post["status"] = 1;
+        $data = (new ServiceLabel)->getList($post, "id,title,type");
         return app('json')->success($data);
     }
-    
+
     /**
      * 获取用户工作服务类型
      * @param Request $request
      */
-    public function getUserWorkTypeList(Request $request){
+    public function getUserWorkTypeList(Request $request)
+    {
         $post = UtilService::getMore([
             ['page', 1],
             ['pageSize', 50],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
-        $post["status"]   = 1;
-        $data = (new UserWorkType)->getList($post,"id,title,content,img");
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $post["status"] = 1;
+        $data = (new UserWorkType)->getList($post, "id,title,content,img");
         return app('json')->success($data);
     }
 
+
     /**
      * 获取从业人员列表
      * @param Request $request
      * @return type
      */
-    public function getWorkerList(Request $request){
+    public function getWorkerList(Request $request)
+    {
         $post = UtilService::getMore([
             ['page', 1],
             ['pageSize', 50],
             ['work_type_id', ""],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
-        $post["status"]   = 1;
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $post["status"] = 1;
         $data = (new UserModel)->getApiWorkerList($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;
+            $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);
+    }
+
+    /**
+     * 获取从业人员列表
+     * @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;
+        $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);
+    }
+
+
+    /**
+     * 获取从业人员列表
+     * @param Request $request
+     * @return type
+     */
+    public function getNewWorkerList(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;
+        $data = (new UserModel)->getNewApiWorkerList($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);
     }
-    
-    
-    
-    
+
+
     /**
      * 获取服务时长类型
      * @param Request $request
      * @return type
      */
-    public function getServiceTimeTypeList(Request $request){
+    public function getServiceTimeTypeList(Request $request)
+    {
         $post = UtilService::getMore([
             ['page', 1],
             ['pageSize', 50],
         ], $request);
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
-        $post["status"]   = 1;
-        $data = (new ServiceTimeType)->getList($post,"title,code");
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $post["status"] = 1;
+        $data = (new ServiceTimeType)->getList($post, "title,code");
         return app('json')->success($data);
     }
-    
-    
-    
-    
-    
-    
-     
+
+
     /**
      * 获取系统信息
      * @param Request $request
      */
-    public function getSysData(Request $request){
-        $data = (new Sys)->where("id",1)->find()->toArray();
-        $data=[];
+    public function getSysData(Request $request)
+    {
+        $data = (new Sys)->where("id", 1)->find()->toArray();
+        $data = [];
         return app("json")->success($data);
     }
+
     /**
      * 首页轮播
      * @param Request $request
      */
-    public function getHomeBanner(Request $request){
+    public function getHomeBanner(Request $request)
+    {
         $data = (new AdvertModel)
-                ->field("id,img,title,url")
-                ->where("page_id",70)
-                ->where("is_show",1)
-                ->order("sort","desc")
-                ->select()
-                ->toArray();
-        $data = empty($data)?[]:$data;
+            ->field("id,img,title,url")
+            ->where("page_id", 70)
+            ->where("is_show", 1)
+            ->order("sort", "desc")
+            ->select()
+            ->toArray();
+        $data = empty($data) ? [] : $data;
         return app("json")->success($data);
     }
 
@@ -288,21 +366,22 @@ class Pub extends BaseController
      * 获取其他用户名片信息
      * @param Request $request
      */
-    public function getCommonUserCardInfo(Request $request){
+    public function getCommonUserCardInfo(Request $request)
+    {
         [$uid] = UtilService::getMore([
-            ['uid', '','empty',"用户信息为空"],
-        ], $request,true);
-        $userData = (new UserModel)->where("uid",$uid)->find();
-        if(empty($userData)){
+            ['uid', '', 'empty', "用户信息为空"],
+        ], $request, true);
+        $userData = (new UserModel)->where("uid", $uid)->find();
+        if (empty($userData)) {
             return app('json')->fail("用户不存在");
         }
         $userData->toArray();
-        $data = (new InfoAudit)->getItem(["uid"=>$uid,"status"=>1]);
-        if(empty($data)){
+        $data = (new InfoAudit)->getItem(["uid" => $uid, "status" => 1]);
+        if (empty($data)) {
             return app('json')->fail("当前用户还未通过审核");
         }
-        $typeData = (new TypeAudit)->where("uid",$uid)->order("id","desc")->find();
-        $data["is_type_audit"] = (empty($typeData) || $typeData["status"]!=1)?0:1;
+        $typeData = (new TypeAudit)->where("uid", $uid)->order("id", "desc")->find();
+        $data["is_type_audit"] = (empty($typeData) || $typeData["status"] != 1) ? 0 : 1;
         //名片浏览次数
         (new UserModel)->where('uid', $uid)->inc('card_look_count', 1)->update();
         $accessiInfo = [
@@ -314,7 +393,27 @@ class Pub extends BaseController
         $res = AccessIp::create($accessiInfo);
 //        $add_time = time();//访问时间
 //        $url_ip = $request->url();//访问IP
-        $data["card_look_count"] = $userData["card_look_count"]+1;
+        $data["card_look_count"] = $userData["card_look_count"] + 1;
+        $data['like_count'] = $userData['like_count'];
+        $data['bookmark_count'] = $userData['bookmark_count'];
+        if (isset($request->user['uid'])) {
+            $likeCount = (new LikeBookmark())->where('uid', $request->user['uid'])->where('aid', $uid)->where('type', 1)->where('is_del', 0)->count();
+            if ($likeCount > 0) {
+                $data['is_like'] = 1;
+            } else {
+                $data['is_like'] = 0;
+            }
+            $bookmarkCount = (new LikeBookmark())->where('uid', $request->user['uid'])->where('aid', $uid)->where('type', 2)->where('is_del', 0)->count();
+            if ($bookmarkCount > 0) {
+                $data['is_bookmark'] = 1;
+            } else {
+                $data['is_bookmark'] = 0;
+            }
+        } else {
+            $data['is_like'] = 0;
+            $data['is_bookmark'] = 0;
+        }
+
         return app('json')->success($data);
     }
 
@@ -322,10 +421,11 @@ class Pub extends BaseController
      * 名片浏览量排行榜
      * @param Request $request
      */
-    public function getCardLookCountRank(Request $request) {
+    public function getCardLookCountRank(Request $request)
+    {
         $time = $request->param();
-        $users = AccessIp::where('add_time','>=',$time['time'])
-            ->where('add_time','<=',$time['times'])
+        $users = AccessIp::where('add_time', '>=', $time['time'])
+            ->where('add_time', '<=', $time['times'])
             ->field('uid, count(*) as ip_count')
             ->group('uid')
             ->order('ip_count', 'desc')
@@ -334,9 +434,9 @@ class Pub extends BaseController
         $rankList = [];
         foreach ($users as $key => $value) {
             $userInfo = (new UserModel)->where('uid', $value['uid'])->find();
-            $auth = (new InfoAudit)->where('uid',$value['uid'])->find();
+            $auth = (new InfoAudit)->where('uid', $value['uid'])->find();
             $template = $this->getShowTemplateItem($value['uid']);
-            $user_work_type_title = (new UserWorkType)->where('id',$auth['user_work_type_id'])->find();
+            $user_work_type_title = (new UserWorkType)->where('id', $auth['user_work_type_id'])->find();
             $rankList[] = [
                 'rank' => $key + 1,
                 'uid' => $value['uid'],
@@ -350,14 +450,13 @@ class Pub extends BaseController
                 'user_work_type_id' => $user_work_type_title['title'],
             ];
         }
-        $rankList = array_values(array_filter($rankList, function($item){
+        $rankList = array_values(array_filter($rankList, function ($item) {
             return !empty($item['ancestral_place']);
         }));
         return app('json')->success($rankList);
     }
 
 
-
     //获取文章详情
     public function getArtDetail(\think\Request $request)
     {
@@ -370,44 +469,47 @@ class Pub extends BaseController
     }
 
 
-    
     /**
      * bug提交
      * @param Request $request
      */
-    public function appBugSub(Request $request){
+    public function appBugSub(Request $request)
+    {
         [$error] = UtilService::getMore([
-            ['error', '','empty',"错误信息为空"],
-        ], $request,true);
-        $deviceId   = $request->header("deviceId", "");
+            ['error', '', 'empty', "错误信息为空"],
+        ], $request, true);
+        $deviceId = $request->header("deviceId", "");
         $deviceType = $request->header("deviceType", "");
-        $fromPlat   = $request->header("fromPlat", "");
-        $version    = $request->header("version", "");
+        $fromPlat = $request->header("fromPlat", "");
+        $version = $request->header("version", "");
         (new AppBug)->insert([
-            "device_id"   => $deviceId,
+            "device_id" => $deviceId,
             "device_type" => $deviceType,
-            "from_plat"   => $fromPlat,
-            "version"     => $version,
-            "error"       => $error,
-            "time"        => time()
+            "from_plat" => $fromPlat,
+            "version" => $version,
+            "error" => $error,
+            "time" => time()
         ]);
         return app("json")->success("提交成功");
     }
-    
+
     /**
      * 测试
      */
-    public function appTest(Request $request){
-        
-        
-        $labelData = (new ServiceLabel)->where("status",1)->where("id","in",["",1,2,6,7,8,0])->column('id');
-        var_dump($labelData);exit;
-        
-        $money = $request->post("money",0);
-        $money = bcadd("0", $money."",2);
-        echo $money;exit;
-        
-        
+    public function appTest(Request $request)
+    {
+
+
+        $labelData = (new ServiceLabel)->where("status", 1)->where("id", "in", ["", 1, 2, 6, 7, 8, 0])->column('id');
+        var_dump($labelData);
+        exit;
+
+        $money = $request->post("money", 0);
+        $money = bcadd("0", $money . "", 2);
+        echo $money;
+        exit;
+
+
         $xml = "<xml><appid><![CDATA[wx57a473fc2f83f7e5]]></appid>
 <attach><![CDATA[微信小程序支付]]></attach>
 <bank_type><![CDATA[OTHERS]]></bank_type>
@@ -426,15 +528,14 @@ class Pub extends BaseController
 <trade_type><![CDATA[JSAPI]]></trade_type>
 <transaction_id><![CDATA[4200001803202304202712861307]]></transaction_id>
 </xml>";
-        
+
         $wxpay = new wxpayApi();
 //        $r = $wxpay->notifyCheckSign($xml);
         $r = $wxpay->searchOrderQuery("A202304201681959554328879382");
         var_dump($r);
-        
-        
+
+
     }
 
-    
-    
+
 }

Разница между файлами не показана из-за своего большого размера
+ 366 - 298
app/api/controller/User.php


+ 1 - 0
app/api/route/login.php

@@ -16,6 +16,7 @@ use think\facade\Route;
 Route::group('login', function () {
     //微信登录
     Route::rule('weixinLogin','Login/weixinLogin');
+    Route::rule('adminLogin','Login/adminLogin');
 })->middleware([
     AllowOriginMiddleware::class,
     SeretKeyMiddleware::class

+ 17 - 16
app/api/route/pub.php

@@ -15,41 +15,42 @@ use think\facade\Route;
 
 Route::group('pub', function () {
     //获取皮肤模板列表
-    Route::rule('getShowTemplateList','Pub/getShowTemplateList');
+    Route::rule('getShowTemplateList', 'Pub/getShowTemplateList');
     //获取模板详情
-    Route::rule('getShowTemplateItem','Pub/getShowTemplateItem');
+    Route::rule('getShowTemplateItem', 'Pub/getShowTemplateItem');
     //获取服务类型列表
-    Route::rule('getServiceTypeList','Pub/getServiceTypeList');
+    Route::rule('getServiceTypeList', 'Pub/getServiceTypeList');
     //获取收费时长类型
-    Route::rule('getServiceTimeTypeList','Pub/getServiceTimeTypeList');
+    Route::rule('getServiceTimeTypeList', 'Pub/getServiceTimeTypeList');
     //获取轮播图列表
-    Route::rule('getBannerList','Pub/getBannerList');
+    Route::rule('getBannerList', 'Pub/getBannerList');
     //获取支付类型
-    Route::rule('getPayTypeData','Pub/getPayTypeData');
+    Route::rule('getPayTypeData', 'Pub/getPayTypeData');
     //获取用户服务类型
-    Route::rule('getUserWorkTypeList','Pub/getUserWorkTypeList');
+    Route::rule('getUserWorkTypeList', 'Pub/getUserWorkTypeList');
     //获取用户服务标签列表
-    Route::rule('getServiceLabelList','Pub/getServiceLabelList');
+    Route::rule('getServiceLabelList', 'Pub/getServiceLabelList');
     //获取其他用户名片详情
-    Route::rule('getCommonUserCardInfo','Pub/getCommonUserCardInfo');
+    Route::rule('getCommonUserCardInfo', 'Pub/getCommonUserCardInfo');
     //获取名片浏览量排行榜
     Route::rule('getCardLookCountRank', 'Pub/getCardLookCountRank');
     //获取分享信息
-    Route::rule('getShareInfo','Pub/getShareInfo');
+    Route::rule('getShareInfo', 'Pub/getShareInfo');
     //获取精选列表
-    Route::rule('getWorkerList','Pub/getWorkerList');
+    Route::rule('getWorkerList', 'Pub/getWorkerList');
+    Route::rule('getGoodWorkerList', 'Pub/getGoodWorkerList');
+    Route::rule('getNewWorkerList', 'Pub/getNewWorkerList');
     //获取文章详情
-    Route::rule('getArtDetail','pub/getArtDetail');
+    Route::rule('getArtDetail', 'pub/getArtDetail');
     //课程列表页面
-    Route::rule('index','Pub/index');
-    
-    
+    Route::rule('index', 'Pub/index');
+
 
     //bug提交
     Route::rule('appBugSub', 'Pub/appBugSub');
     //接口测试
     Route::rule('appTest', 'Pub/appTest');
-    
+
 })->middleware([
     AllowOriginMiddleware::class,
     SeretKeyMiddleware::class

+ 11 - 5
app/api/route/user.php

@@ -17,6 +17,8 @@ use think\facade\Route;
 Route::group('user', function () {
     //获取用户信息
     Route::rule('userInfo', 'User/userInfo');
+    //获取用户信息
+    Route::rule('useCode', 'User/useCode');
     //设置用户信息
     Route::rule('setUserInfo', 'User/setUserInfo');
     //资料申请审核
@@ -26,7 +28,7 @@ Route::group('user', function () {
     //获取用户子级列表
     Route::rule('getChildList', 'User/getChildList');
     //获取用户总邀请人数排行榜
-    Route::rule('getInviterRanking','User/getInviterRanking');
+    Route::rule('getInviterRanking', 'User/getInviterRanking');
     //提交模板订单
     Route::rule('subShowTemplateOrder', 'User/subShowTemplateOrder');
     //模板支付订单状态查询
@@ -53,11 +55,15 @@ Route::group('user', function () {
     Route::rule('qiniuUpload', 'User/qiniuUpload');
     //获取小程序邀请码
     Route::rule('getWxmpInviteQrcode', 'User/getWxmpInviteQrcode');
-    
-    
-    
+    Route::rule('getWxmpShowQrcode', 'User/getWxmpShowQrcode');
+    //点赞收藏
+    Route::rule('likeAndBookmark', 'User/likeAndBookmark');
+    //收藏列表
+    Route::rule('BookmarkList', 'User/BookmarkList');
+    //获取其他用户名片详情
+    Route::rule('getCommonUserCardInfo', 'Pub/getCommonUserCardInfo');
+
 
-    
 })->middleware([
     AllowOriginMiddleware::class,
     SeretKeyMiddleware::class,

+ 38 - 0
app/model/api/ActiveCode.php

@@ -0,0 +1,38 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\model\api;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class ActiveCode extends Model
+{
+    public function getDataList($post,$field="*"){
+        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
+        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
+        $where=[];
+        if(isset($post["status"]) && in_array((string)$post["status"], ["0","1"])){
+            $where[]=["status","=",(int)$post["status"]];
+        }
+        $totalCount = $this->where($where)->count();
+        $data=null;
+        if($totalCount>0){
+            $data = $this
+                ->field($field)
+                ->where($where)
+                ->order("id", "desc")
+                ->page($post["page"], $post["pageSize"])
+                ->select();
+            if(!empty($data)){
+                $data = $data->toArray();
+            }
+        }
+        $data = empty($data)?[]:$data;
+        
+        
+        return ["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount];
+    }
+}

+ 1 - 0
app/model/api/InfoAudit.php

@@ -137,6 +137,7 @@ class InfoAudit extends Model
         $data["service_audit_imgs"] = getImageAr($data["service_audit_imgs"]);//我的证书
         $data["service_intro_imgs"] = getImageAr($data["service_intro_imgs"]);//我的介绍图片
         $data["service_imgs"]       = getImageAr($data["service_imgs"]);//我的服务展示照片
+        $data["model_imgs"]       = getImageAr($data["model_imgs"]);
         //服务区域
         $data["service_area"]       = getImageAr($data["service_area"]);
         $data["service_area_all"]   = [];

+ 14 - 0
app/model/api/LikeBookmark.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types=1);
+
+namespace app\model\api;
+
+use library\basic\BaseModel;
+
+/**
+ * @mixin \think\Model
+ */
+class LikeBookmark extends BaseModel
+{
+    protected $pk = 'id';
+}

+ 356 - 162
app/model/api/User.php

@@ -1,8 +1,9 @@
 <?php
-declare (strict_types = 1);
+declare (strict_types=1);
 
 namespace app\model\api;
 
+use app\model\api\City as CityModel;
 use Closure;
 use library\basic\BaseModel;
 use think\db\exception\DbException;
@@ -19,6 +20,7 @@ class User extends BaseModel
 {
     //
     protected $pk = 'uid';
+
     /**
      * 获取列表数据
      * @param $page
@@ -32,40 +34,40 @@ class User extends BaseModel
         $data = $this
             ->alias("m")
             ->field("m.*,u.nickname as i_nickname,u.uuid as i_uuid,t.name as i_tname,t.tuuid as i_tuuid,s.day_surplus_talk,s.day_surplus_video,s.time as surplus_time"
-                    . ",(select count(*) from table_user_friends   as p where p.uid = m.uid)   as friendsCount"//朋友数
-                    . ",(select count(*) from table_user_attention as a where a.uid = m.uid)   as attentionCount"//关注数
-                    . ",(select count(*) from table_user_attention as f where f.i_uid = m.uid) as fasCount"//粉丝数
-                    . ",(select count(*) from table_user_visitors  as v where v.uid = m.uid)   as visitorsCount"//访客数
-                    . "")
-            ->leftJoin("user u","u.uid = m.i_uid")
-            ->leftJoin("user_surplus s","s.uid = m.uid and s.time = {$today}")
-            ->leftJoin("tuser t","t.tuid = m.i_tuid")
+                . ",(select count(*) from table_user_friends   as p where p.uid = m.uid)   as friendsCount"//朋友数
+                . ",(select count(*) from table_user_attention as a where a.uid = m.uid)   as attentionCount"//关注数
+                . ",(select count(*) from table_user_attention as f where f.i_uid = m.uid) as fasCount"//粉丝数
+                . ",(select count(*) from table_user_visitors  as v where v.uid = m.uid)   as visitorsCount"//访客数
+                . "")
+            ->leftJoin("user u", "u.uid = m.i_uid")
+            ->leftJoin("user_surplus s", "s.uid = m.uid and s.time = {$today}")
+            ->leftJoin("tuser t", "t.tuid = m.i_tuid")
             ->when(!empty($where), function ($query) use ($where) {
 
                 if (!empty($where['mobile'])) {
                     $query->where('m.mobile', $where['mobile']);
                 }
-                
+
                 if (!empty($where['nickname'])) {
                     $query->whereLike('m.nickname', "%{$where['nickname']}%");
                 }
-                
-                if (is_numeric($where['levelid']) && in_array(strval($where['levelid']),['0','1','2'])) {
+
+                if (is_numeric($where['levelid']) && in_array(strval($where['levelid']), ['0', '1', '2'])) {
                     $query->where('m.levelid', intval($where['levelid']));
                 }
-                
-                if (is_numeric($where['is_certification']) && in_array(strval($where['is_certification']),['0','1','2'])) {
+
+                if (is_numeric($where['is_certification']) && in_array(strval($where['is_certification']), ['0', '1', '2'])) {
                     $query->where('m.is_certification', intval($where['is_certification']));
                 }
-                
-                if (is_numeric($where['is_goddess']) && in_array(strval($where['is_goddess']),['0','1','2'])) {
+
+                if (is_numeric($where['is_goddess']) && in_array(strval($where['is_goddess']), ['0', '1', '2'])) {
                     $query->where('m.is_goddess', intval($where['is_goddess']));
                 }
-                
+
                 if (!empty($where['address'])) {
                     $query->whereLike('m.address', "%{$where['address']}%");
                 }
-                
+
                 if (!empty($where['now_address'])) {
                     $query->whereLike('m.now_address', "%{$where['now_address']}%");
                 }
@@ -76,41 +78,41 @@ class User extends BaseModel
                 if (!empty($where['i_tuid'])) {
                     $query->where('m.i_tuid', $where['i_tuid']);
                 }
-                
-                if (is_numeric($where["sex"]) && in_array(strval($where["sex"]),["0","1","2"])) {
+
+                if (is_numeric($where["sex"]) && in_array(strval($where["sex"]), ["0", "1", "2"])) {
                     $query->where('m.sex', $where["sex"]);
                 }
-                
-                if (is_numeric($where["is_im"]) && in_array(strval($where["is_im"]),["0","1"])) {
+
+                if (is_numeric($where["is_im"]) && in_array(strval($where["is_im"]), ["0", "1"])) {
                     $query->where('m.is_im', $where["is_im"]);
                 }
-                
-                if (is_numeric($where["is_online"]) && in_array(strval($where["is_online"]),["0","1"])) {
+
+                if (is_numeric($where["is_online"]) && in_array(strval($where["is_online"]), ["0", "1"])) {
                     $query->where('m.is_online', $where["is_online"]);
                 }
-                
-                if (is_numeric($where["status"]) && in_array(strval($where["status"]),["0","1","-1"])) {
+
+                if (is_numeric($where["status"]) && in_array(strval($where["status"]), ["0", "1", "-1"])) {
                     $query->where('m.status', $where["status"]);
                 }
 
                 if (!empty($where['uid'])) {
                     $query->where('m.uid', $where['uid']);
                 }
-                
+
                 if (!empty($where['uuid'])) {
                     $query->where('m.uuid', $where['uuid']);
                 }
                 //注册时间
                 $startTime = "";
                 $endTime = "";
-                if(!empty($where['time']) && !empty($where['time'][0]) && !empty($where['time'][1])) {
-                   $startTime =  strtotime($where['time'][0]);
-                   $endTime = strtotime($where['time'][1]);
+                if (!empty($where['time']) && !empty($where['time'][0]) && !empty($where['time'][1])) {
+                    $startTime = strtotime($where['time'][0]);
+                    $endTime = strtotime($where['time'][1]);
                 }
                 if (!empty($startTime) && !empty($endTime)) {
-                    $query->whereBetween("m.regtime","{$startTime},{$endTime}");
+                    $query->whereBetween("m.regtime", "{$startTime},{$endTime}");
                 }
-                
+
             })
             ->order($desc)
             ->paginate(['list_rows' => $pageCount, 'page' => $page])
@@ -128,78 +130,78 @@ class User extends BaseModel
     {
         try {
             self::beginTrans();
-            
-            if(!is_numeric($data["levelid"]) || !in_array(strval($data["levelid"]),["0","1","2"])){
+
+            if (!is_numeric($data["levelid"]) || !in_array(strval($data["levelid"]), ["0", "1", "2"])) {
                 unset($data["levelid"]);
             }
-            if(empty($data["mobile"])){
+            if (empty($data["mobile"])) {
                 unset($data["mobile"]);
-            }else{
-                if(!isMobile($data["mobile"])){
+            } else {
+                if (!isMobile($data["mobile"])) {
                     return [0, '请输入正确的手机号码'];
                 }
             }
-            if(empty($data["nickname"])){
+            if (empty($data["nickname"])) {
                 unset($data["nickname"]);
             }
-            if(empty($data["address"])){
+            if (empty($data["address"])) {
                 unset($data["address"]);
             }
-            if(empty($data["now_address"])){
+            if (empty($data["now_address"])) {
                 unset($data["now_address"]);
             }
-            if(!is_numeric($data["status"]) || !in_array(strval($data["status"]),["0","1","-1"])){
+            if (!is_numeric($data["status"]) || !in_array(strval($data["status"]), ["0", "1", "-1"])) {
                 unset($data["status"]);
             }
-            if(!is_numeric($data["is_shield"]) || !in_array(strval($data["is_shield"]),["0","1"])){
+            if (!is_numeric($data["is_shield"]) || !in_array(strval($data["is_shield"]), ["0", "1"])) {
                 unset($data["is_shield"]);
             }
-            
+
             //密码
             if (!empty($data['password'])) {
                 $data['password'] = md5($data['password']);
-            }else{
+            } else {
                 unset($data["password"]);
             }
-            if(empty($data["avatar"])){
+            if (empty($data["avatar"])) {
                 unset($data["avatar"]);
             }
-            if(!is_numeric($data["sex"]) || !in_array(strval($data["sex"]),["0","1","2"])){
+            if (!is_numeric($data["sex"]) || !in_array(strval($data["sex"]), ["0", "1", "2"])) {
                 unset($data["sex"]);
             }
             //特殊设置
-            if(empty($data["msg_price"]) || !is_numeric($data["msg_price"])){
+            if (empty($data["msg_price"]) || !is_numeric($data["msg_price"])) {
                 unset($data["msg_price"]);
             }
-            if(empty($data["video_price"]) || !is_numeric($data["video_price"])){
+            if (empty($data["video_price"]) || !is_numeric($data["video_price"])) {
                 unset($data["video_price"]);
             }
-            if(empty($data["audio_price"]) || !is_numeric($data["audio_price"])){
+            if (empty($data["audio_price"]) || !is_numeric($data["audio_price"])) {
                 unset($data["audio_price"]);
             }
-            if(empty($data["phone_price"]) || !is_numeric($data["phone_price"])){
+            if (empty($data["phone_price"]) || !is_numeric($data["phone_price"])) {
                 unset($data["phone_price"]);
             }
-            if(empty($data["wx_price"]) || !is_numeric($data["wx_price"])){
+            if (empty($data["wx_price"]) || !is_numeric($data["wx_price"])) {
                 unset($data["wx_price"]);
             }
-            if(empty($data["qq_price"]) || !is_numeric($data["qq_price"])){
+            if (empty($data["qq_price"]) || !is_numeric($data["qq_price"])) {
                 unset($data["qq_price"]);
             }
             //开关设置
-            if(!is_numeric($data["is_rank"]) || !in_array(strval($data["is_rank"]),["0","1"])){
+            if (!is_numeric($data["is_rank"]) || !in_array(strval($data["is_rank"]), ["0", "1"])) {
                 unset($data["is_rank"]);
             }
-            if(!is_numeric($data["is_gift"]) || !in_array(strval($data["is_gift"]),["0","1"])){
+            if (!is_numeric($data["is_gift"]) || !in_array(strval($data["is_gift"]), ["0", "1"])) {
                 unset($data["is_gift"]);
             }
-            if(!is_numeric($data["is_msg"]) || !in_array(strval($data["is_msg"]),["0","1"])){
+            if (!is_numeric($data["is_msg"]) || !in_array(strval($data["is_msg"]), ["0", "1"])) {
                 unset($data["is_msg"]);
             }
-            if(!is_numeric($data["is_video"]) || !in_array(strval($data["is_video"]),["0","1"])){
+            if (!is_numeric($data["is_video"]) || !in_array(strval($data["is_video"]), ["0", "1"])) {
                 unset($data["is_video"]);
             }
-            if(!is_numeric($data["is_audio"]) || !in_array(strval($data["is_audio"]),["0","1"])){
+            if (!is_numeric($data["is_audio"]) || !in_array(strval($data["is_audio"]), ["0", "1"])) {
                 unset($data["is_audio"]);
             }
             //uid
@@ -208,7 +210,7 @@ class User extends BaseModel
                 if (empty($uData)) {
                     return [0, '会员不存在'];
                 }
-                if(!empty($data["mobile"])){
+                if (!empty($data["mobile"])) {
                     //判断手机是否重复
                     $count = $this
                         ->where('mobile', $data['mobile'])
@@ -251,54 +253,55 @@ class User extends BaseModel
             ->select();
         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']];
+    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 = null;
+        if ($totalCount > 0) {
             $data = $this
                 ->alias("u")
                 ->field("u.uid,ut.show_template_id,a.ancestral_place,a.status as is_type_audit")
-                ->leftJoin("info_audit a","u.uid=a.uid")
+                ->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)){
+            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"             =>""
+            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){
+                $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);
+                $data[$k] = array_merge($v, $item);
             }
         }
 //        $datatwo = [];
@@ -307,63 +310,253 @@ class User extends BaseModel
 //                $datatwo[] = $v;
 //            }
 //        }
-        $data = empty($data)?[]:$data;
-        return ["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount];
+        $data = empty($data) ? [] : $data;
+        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")->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');
+                    $query->whereOr('find_in_set(' . $city_id . ',a.service_area)');
+                }
+            });
+        }
+        $totalCount = $totalModel->count();
+        $data = null;
+        if ($totalCount > 0) {
+            $dataModel = $this
+                ->alias("u")
+                ->field("u.uid,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);
+            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');
+                        $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();
+            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];
+    }
+
+
+    /**
+     * 获取小程序在职展示列表
+     * @return type
+     */
+    public function getNewApiWorkerList($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();
+        $totalModel = $this->alias("u")->leftJoin("info_audit a", "u.uid=a.uid")->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');
+                    $query->whereOr('find_in_set(' . $city_id . ',a.service_area)');
+                }
+            });
+        }
+        $totalCount = $totalModel->count();
+        $data = null;
+        if ($totalCount > 0) {
+            $dataModel = $this
+                ->alias("u")
+                ->field("u.uid,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);
+            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');
+                        $query->whereOr('find_in_set(' . $city_id . ',a.service_area)');
+                    }
+                });
+            }
+            $data = $dataModel->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];
     }
 
 
-    
-    
-    
     /**
      * 获取从业人员列表
      * @param type $post
      * @param type $field
      * @param type $is_admin
      */
-    public function getWorkerList($post,$field="*",$is_admin=0){
-        $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];
+    public function getWorkerList($post, $field = "*", $is_admin = 0)
+    {
+        $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];
         //用户uid
-        if(!empty($post['uid'])){
-            $where[]=["u.uid","=",$post['uid']];
+        if (!empty($post['uid'])) {
+            $where[] = ["u.uid", "=", $post['uid']];
         }
-        if(!empty($post['work_type_id'])){
-            $where[]=["u.work_type_id","=",$post['work_type_id']];
+        if (!empty($post['work_type_id'])) {
+            $where[] = ["u.work_type_id", "=", $post['work_type_id']];
         }
         //手机号码
-        if(!empty($post["mobile"])){
-            $where[]=["u.mobile","=",$post["mobile"]];
+        if (!empty($post["mobile"])) {
+            $where[] = ["u.mobile", "=", $post["mobile"]];
         }
         //状态
-        if(isset($post["status"]) && in_array((string)$post["status"], ["0","1","-1"])){
-            $where[]=["u.status","=",(int)$post["status"]];
+        if (isset($post["status"]) && in_array((string)$post["status"], ["0", "1", "-1"])) {
+            $where[] = ["u.status", "=", (int)$post["status"]];
         }
         //父级uid
-        if(!empty($post["parent_uid"])){
-            $where[]=["u.parent_uid","=",$post["parent_uid"]];
+        if (!empty($post["parent_uid"])) {
+            $where[] = ["u.parent_uid", "=", $post["parent_uid"]];
         }
         //
-        if($is_admin==1){
+        if ($is_admin == 1) {
             $field = "u.*"
-                    . ",ut.show_template_id"
-                    . ",(select is_show from table_info_audit where uid = u.uid and status = 1 ) as is_show"
-                    . ",p.nickname as p_nickname,p.mobile as p_mobile"
-                    . ",wt.title as work_type_title"
-                    . ",(select count(*) from table_user_show_template where uid = u.uid) as showTempCount"
-                    . ",(select count(*) from table_info_audit where uid = u.uid and status = 1) as is_info_audit"
-                    . ",(select count(*) from table_type_audit where uid = u.uid and status = 1) as is_type_audit"
-                    . ",(select count(*) from table_user where parent_uid = u.uid) as branchCount";
+                . ",ut.show_template_id"
+                . ",(select is_show from table_info_audit where uid = u.uid and status = 1 limit 1 ) as is_show"
+                . ",p.nickname as p_nickname,p.mobile as p_mobile"
+                . ",wt.title as work_type_title"
+                . ",(select count(*) from table_user_show_template where uid = u.uid) as showTempCount"
+                . ",(select count(*) from table_info_audit where uid = u.uid and status = 1) as is_info_audit"
+                . ",(select count(*) from table_type_audit where uid = u.uid and status = 1) as is_type_audit"
+                . ",(select count(*) from table_user where parent_uid = u.uid) as branchCount";
         }
         $totalCount = $this->alias("u")->where($where)->count();
-        $data=null;
-        if($totalCount>0){
+        $data = null;
+        if ($totalCount > 0) {
             $data = $this
                 ->alias("u")
                 ->field($field)
-                ->leftJoin("user p","p.uid = u.parent_uid")
+                ->leftJoin("user p", "p.uid = u.parent_uid")
                 ->leftJoin("user_work_type wt", "wt.id  = u.work_type_id")//职称
                 ->leftJoin("user_show_template ut", "ut.uid  = u.uid and ut.is_default = 1")//职称
                 ->where($where)
@@ -371,18 +564,19 @@ class User extends BaseModel
                 ->order("u.uid", "desc")
                 ->page($post["page"], $post["pageSize"])
                 ->select();
-            if(!empty($data)){
+            // var_dump($this->getLastSql());
+            if (!empty($data)) {
                 $data = $data->toArray();
             }
         }
-        $data = empty($data)?[]:$data;
+        $data = empty($data) ? [] : $data;
         $ShowTemplateDb = new ShowTemplate();
-        foreach($data as $k=>$v){
-            if(!empty($v["regtime"])){
-                $data[$k]["regtime"]  = date("Y-m-d H:i:s",$v["regtime"]);
+        foreach ($data as $k => $v) {
+            if (!empty($v["regtime"])) {
+                $data[$k]["regtime"] = date("Y-m-d H:i:s", $v["regtime"]);
             }
-            if(!empty($v["parent_time"])){
-                $data[$k]["parent_time"]  = date("Y-m-d H:i:s",$v["parent_time"]);
+            if (!empty($v["parent_time"])) {
+                $data[$k]["parent_time"] = date("Y-m-d H:i:s", $v["parent_time"]);
             }
         }
 //        $datatwo = [];
@@ -391,82 +585,82 @@ class User extends BaseModel
 //                $datatwo[] = $v;
 //            }
 //        }
-        return ["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount];
+        return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
     }
-    
+
     /**
      * 前端获取用户列表
      * @param type $post
      * @param type $field
      * @return type
      */
-    public function getDataList($post,$field="*",$is_admin=0){
-        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
-        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
-        $where=[];
+    public function getDataList($post, $field = "*", $is_admin = 0)
+    {
+        $post["pageSize"] = $post["pageSize"] > 50 ? 50 : (int)$post["pageSize"];
+        $post["page"] = $post["page"] <= 0 ? 1 : (int)$post["page"];
+        $where = [];
         //用户uid
-        if(!empty($post['uid'])){
-            $where[]=["u.uid","=",$post['uid']];
+        if (!empty($post['uid'])) {
+            $where[] = ["u.uid", "=", $post['uid']];
         }
         //状态
-        if(isset($post["status"]) && in_array((string)$post["status"], ["0","1","-1"])){
-            $where[]=["u.status","=",(int)$post["status"]];
+        if (isset($post["status"]) && in_array((string)$post["status"], ["0", "1", "-1"])) {
+            $where[] = ["u.status", "=", (int)$post["status"]];
         }
         //昵称
-        if(!empty($post["nickname"])){
-            $where[]=["u.nickname","like","%{$post["nickname"]}%"];
+        if (!empty($post["nickname"])) {
+            $where[] = ["u.nickname", "like", "%{$post["nickname"]}%"];
         }
         //手机号码
-        if(!empty($post["mobile"])){
-            $where[]=["u.mobile","=",$post["mobile"]];
+        if (!empty($post["mobile"])) {
+            $where[] = ["u.mobile", "=", $post["mobile"]];
         }
         //父级uid
-        if(!empty($post["parent_uid"])){
-            $where[]=["u.parent_uid","=",$post["parent_uid"]];
+        if (!empty($post["parent_uid"])) {
+            $where[] = ["u.parent_uid", "=", $post["parent_uid"]];
         }
         //注册时间
-        if(!empty($post['time']) && !empty($post['time'][0]) && !empty($post['time'][1])) {
+        if (!empty($post['time']) && !empty($post['time'][0]) && !empty($post['time'][1])) {
             $startTime = strtotime($post['time'][0]);
             $endTime = strtotime($post['time'][1]);
-            $where[]=["u.regtime","between","{$startTime},{$endTime}"];
+            $where[] = ["u.regtime", "between", "{$startTime},{$endTime}"];
         }
-        if($is_admin==1){
+        if ($is_admin == 1) {
             $field = "u.*"
-                    . ",p.nickname as p_nickname,p.mobile as p_mobile"
-                    . ",wt.title as work_type_title"
-                    . ",(select count(*) from table_user_show_template where uid = u.uid) as showTempCount"
-                    . ",(select count(*) from table_info_audit where uid = u.uid and status = 1) as is_info_audit"
-                    . ",(select count(*) from table_type_audit where uid = u.uid and status = 1) as is_type_audit"
-                    . ",(select count(*) from table_user where parent_uid = u.uid) as branchCount";
+                . ",p.nickname as p_nickname,p.mobile as p_mobile"
+                . ",wt.title as work_type_title"
+                . ",(select count(*) from table_user_show_template where uid = u.uid) as showTempCount"
+                . ",(select count(*) from table_info_audit where uid = u.uid and status = 1) as is_info_audit"
+                . ",(select count(*) from table_type_audit where uid = u.uid and status = 1) as is_type_audit"
+                . ",(select count(*) from table_user where parent_uid = u.uid) as branchCount";
         }
         $totalCount = $this->alias("u")->where($where)->count();
-        $data=null;
-        if($totalCount>0){
+        $data = null;
+        if ($totalCount > 0) {
             $data = $this
                 ->alias("u")
                 ->field($field)
-                ->leftJoin("user p","p.uid = u.parent_uid")
+                ->leftJoin("user p", "p.uid = u.parent_uid")
                 ->leftJoin("user_work_type wt", "wt.id  = u.work_type_id")//职称
                 ->where($where)
                 ->order("u.uid", "desc")
                 ->page($post["page"], $post["pageSize"])
                 ->select();
-            if(!empty($data)){
+            if (!empty($data)) {
                 $data = $data->toArray();
             }
         }
-        $data = empty($data)?[]:$data;
-        foreach($data as $k=>$v){
-            if(!empty($v["regtime"])){
-                $data[$k]["regtime"]  = date("Y-m-d H:i:s",$v["regtime"]);
+        $data = empty($data) ? [] : $data;
+        foreach ($data as $k => $v) {
+            if (!empty($v["regtime"])) {
+                $data[$k]["regtime"] = date("Y-m-d H:i:s", $v["regtime"]);
             }
-            if(!empty($v["parent_time"])){
-                $data[$k]["parent_time"]  = date("Y-m-d H:i:s",$v["parent_time"]);
+            if (!empty($v["parent_time"])) {
+                $data[$k]["parent_time"] = date("Y-m-d H:i:s", $v["parent_time"]);
             }
         }
-        return ["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount];
+        return ["list" => $data, "pageSize" => $post["pageSize"], "page" => $post["page"], "totalCount" => $totalCount];
     }
-    
-    
-    
+
+
 }

+ 88 - 0
app/system/controller/Code.php

@@ -0,0 +1,88 @@
+<?php
+declare (strict_types = 1);
+namespace app\system\controller;
+
+use app\BaseController;
+use app\model\api\ActiveCode;
+use app\model\api\ShowTemplate;
+use app\Request;
+use library\services\UtilService;
+
+// +----------------------------------------------------------------------
+// | [ WE CAN DO IT MORE SIMPLE  ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2018-2020 rights reserved.
+// +----------------------------------------------------------------------
+// | [ 皮肤模板管理 ]
+// +----------------------------------------------------------------------
+// | Date: 2020-09-06 21:53
+// +----------------------------------------------------------------------
+
+class Code extends  BaseController{
+    /**
+     * 商品列表
+     * @param Request $request
+     * @return type
+     */
+    public function list(Request $request) {
+        $post = UtilService::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['pageSize', 50],
+        ], $request);
+        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
+        $post["page"]     = $post["page"]<=0     ? 1  : (int)$post["page"];
+        $data = (new ActiveCode)->getDataList($post,"*",1);
+        return app('json')->success(["list" =>$data["list"], "pageSize" => $data["pageSize"],"page"=>$data["page"],"pageCount"=>$data["totalCount"]]);
+    }
+
+    
+    /**
+     * 添加编辑商品
+     * @param Request $request
+     * @return type
+     */
+    public function add(Request $request){
+        $post = UtilService::getMore([
+            ['show_template_id','','empty','请选择适用模板'],
+            ['num','','empty','请输入生成数量'],
+        ],$request);
+        $save=[];
+        
+        for($i = 0;$i<$post['num'];$i++){
+            do{
+                $code = strtoupper(md5($post['show_template_id'].'_'.time().'_'.rand(1000,9999)));
+            }while((new ActiveCode)->where("code",$code)->find());
+            $j = [
+                'show_template_id'=>$post["show_template_id"],
+                'code'=>$code,
+                'times'=>1,
+                'add_time'=>time()
+            ];
+            $save[] = $j;
+        }
+        
+        $r=0;
+        $r = (new ActiveCode)->insertAll($save);
+        if($r){
+            return app('json')->success("数据保存成功");
+        }else{
+            return app('json')->fail("数据保存失败");
+        }
+    }
+    
+    /**
+     * 分类删除
+     * @param Request $request
+     */
+    public function serviceTimeTypeDel(Request $request) {
+        [$id] = UtilService::getMore([
+            ['id',0,'empty','参数错误']
+        ],$request,true);
+        return app('json')->success("暂不支持删除");
+        $bool =   (new ServiceTimeTypeModel)->where("id",$id)->delete();
+        return app('json')->success("删除成功");
+    }
+    
+    
+}

+ 18 - 0
app/system/controller/Member.php

@@ -711,6 +711,24 @@ class Member extends BaseController
      * @return type
      */
     public function getWorkerList(Request $request){
+        
+        // $infoAuditDb = new InfoAudit();
+        // $uids = $infoAuditDb->column('uid');
+        // var_dump($uids);
+        // foreach (array_unique($uids) as $v){
+        //     $last = $infoAuditDb->where('status',1)->where('uid',$v)->order('id','desc')->find();
+        //     UserModel::where('uid',$v)->update(['work_type_id'=>$last['user_work_type_id']]);
+        //     $infoAuditDb->where('id','<>',$last['id'])->where('uid',$v)->delete();
+        // }
+        
+        
+        
+        
+        
+        
+        
+        
+        
         $pageSize = 50;
         $post =  UtilService::getMore([
             ['page',1],

+ 23 - 0
app/system/route/code.php

@@ -0,0 +1,23 @@
+<?php
+// +----------------------------------------------------------------------
+// | [ WE CAN DO IT MORE SIMPLE  ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2018-2020 rights reserved.
+// +----------------------------------------------------------------------
+// | [ 礼物管理 ]
+// +----------------------------------------------------------------------
+// | Date: 2020-09-06 21:52
+// +----------------------------------------------------------------------
+use think\facade\Route;
+
+//@标签管理
+Route::group('code', function () {
+    //@标签列表
+    Route::rule('list', 'Code/list');
+    //@标签添加编辑
+    Route::rule('add', 'Code/add');
+})->middleware([
+    \app\system\middleware\AllowOriginMiddleware::class,
+    \app\system\middleware\AdminAuthTokenMiddleware::class,
+    \app\system\middleware\AdminCkeckRoleMiddleware::class
+]);

+ 1 - 0
public/.well-known/acme-challenge/yD4z9K0Pui9GT0lyBua-yIY5Zt-X1f1S7-yVzceq84g

@@ -0,0 +1 @@
+yD4z9K0Pui9GT0lyBua-yIY5Zt-X1f1S7-yVzceq84g.mwRRt_FEAgFaylAOG8Enym_g9yIC6n-SuUFvceY4efE

+ 1 - 0
public/MP_verify_TIavqMOdcobLBRHS.txt

@@ -0,0 +1 @@
+TIavqMOdcobLBRHS

BIN
public/static/img/indexLeft.png


BIN
public/static/img/indexRight.png


BIN
public/static/viedo/ddd.mp4


BIN
public/static/viedo/jiaocheng.mp4


+ 0 - 0
查看用户名


+ 0 - 0
查看邮箱


Некоторые файлы не были показаны из-за большого количества измененных файлов