Browse Source

Default Changelist

yingzi 2 years ago
parent
commit
1c864dcdaf
2 changed files with 22 additions and 28 deletions
  1. 19 27
      app/api/controller/Pub.php
  2. 3 1
      app/api/route/pub.php

+ 19 - 27
app/api/controller/Pub.php

@@ -274,30 +274,37 @@ class Pub extends BaseController
         $data = empty($data)?[]:$data;
         $data = empty($data)?[]:$data;
         return app("json")->success($data);
         return app("json")->success($data);
     }
     }
-    
+
     /**
     /**
      * 获取其他用户名片信息
      * 获取其他用户名片信息
      * @param Request $request
      * @param Request $request
      */
      */
     public function getCommonUserCardInfo(Request $request){
     public function getCommonUserCardInfo(Request $request){
         [$uid] = UtilService::getMore([
         [$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("用户不存在");
             return app('json')->fail("用户不存在");
         }
         }
         $userData->toArray();
         $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("当前用户还未通过审核");
             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();
         (new UserModel)->where('uid', $uid)->inc('card_look_count', 1)->update();
-        $data["card_look_count"] = $userData["card_look_count"] + 1;
-        // 获取名片浏览量排行榜
+        $data["card_look_count"] = $userData["card_look_count"]+1;
+        return app('json')->success($data);
+    }
+
+    /**
+     * 名片浏览量排行榜
+     * @param Request $request
+     */
+    public function getCardLookCountRank(Request $request) {
         $time = $request->param('time', time()); // 时间戳,默认为当前时间
         $time = $request->param('time', time()); // 时间戳,默认为当前时间
         $list = (new UserModel)->where('card_look_count', '>', 0);
         $list = (new UserModel)->where('card_look_count', '>', 0);
         if ($time > 0) {
         if ($time > 0) {
@@ -316,23 +323,8 @@ class Pub extends BaseController
                 'template' => $this->getShowTemplateItem($value['uid']),
                 'template' => $this->getShowTemplateItem($value['uid']),
             ];
             ];
         }
         }
-        $data['rank_list'] = $rankList;
-        return app('json')->success($data);
+        return app('json')->success($rankList);
     }
     }
-
-    //名片浏览次数排行榜
-//    public function getCardRank(Request $request)
-//    {
-//        $count = $request->param('count', 10);
-//
-//        $cardList = (new UserModel())
-//            ->field('uid, nickname, card_look_count')
-//            ->order('card_look_count', 'desc')
-//            ->limit($count)
-//            ->select();
-//
-//        return app('json')->success($cardList);
-//    }
    
    
 
 
     
     

+ 3 - 1
app/api/route/pub.php

@@ -31,7 +31,9 @@ Route::group('pub', function () {
     //获取用户服务标签列表
     //获取用户服务标签列表
     Route::rule('getServiceLabelList','Pub/getServiceLabelList');
     Route::rule('getServiceLabelList','Pub/getServiceLabelList');
     //获取其他用户名片详情
     //获取其他用户名片详情
-    Route::rule('getCommonUserCardInfo/:uid','Pub/getCommonUserCardInfo');
+    Route::rule('getCommonUserCardInfo','Pub/getCommonUserCardInfo');
+    // 获取名片浏览量排行榜
+    Route::get('getCardLookCountRank', 'Pub/getCardLookCountRank');
     //获取分享信息
     //获取分享信息
     Route::rule('getShareInfo','Pub/getShareInfo');
     Route::rule('getShareInfo','Pub/getShareInfo');
     //获取精选列表
     //获取精选列表