WIN-2308041133\Administrator 2 days ago
parent
commit
090b6e7991
2 changed files with 61 additions and 0 deletions
  1. 59 0
      app/api/controller/User.php
  2. 2 0
      app/api/route/user.php

+ 59 - 0
app/api/controller/User.php

@@ -1477,4 +1477,63 @@ class User extends BaseController
         ]);
         ]);
         return app('json')->success("解约成功");
         return app('json')->success("解约成功");
     }
     }
+//    打卡列表
+    /**
+     * 打卡列表
+     * @param \app\Request $request
+     * @return mixed
+     */
+    public function getClockList(\think\Request $request)
+    {
+        $post = UtilService::getMore([
+            ['page', 1],
+            ['pageSize', 50],
+            ['time','']
+        ], $request);
+        $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
+        $post["page"]     = $post["page"]<=0 ? 1 : (int)$post["page"];
+        $where=[];
+        $uid = UtilService::getMore([
+            ['uid', 0],
+        ], $request);
+        $uid=$uid['uid'];
+//        if ($uid>0){
+//            $where[]=["uid","=",$uid];
+//        }
+        $totalCount = (new UserClockModel())->where($where)->count();
+
+        if ($post["status"]!=-2){
+            $where[]=['status','=',$post["status"]];
+        }
+        $data=null;
+        if($totalCount>0){
+            $data = (new UserClockModel)
+                ->where($where)
+                ->order("id", "desc")
+                ->page($post["page"], $post["pageSize"])
+                ->select();
+//            var_dump((new UserContractRecordModel)->getLastSql());die();
+//            foreach($data as $k=>$v){
+//                $data[$k]["is_use"]      = 1;//是否已经购买或者可以使用
+//                switch ($data[$k]["status"]){
+//                    case 0:
+//                        $data[$k]["status_name"] = "未签约";
+//                        break;
+//                    case 1:
+//                        $data[$k]["status_name"] = "已签约";
+//                        break;
+//                    case -1:
+//                        $data[$k]["status_name"] = "已解约";
+//                        break;
+//                }
+////                $data[$k]["comment"] = (new ContractCommentModel())->where('contract_id',$v["id"])->select();
+//                $data[$k]["comment"] = (new ContractCommentModel())->where('contract_id',$v["id"])->find();
+//                if (!empty($data[$k]["comment"])){
+//                    $data[$k]["comment"] = $data[$k]["comment"]->toArray();
+//                }
+//            }
+        }
+        $data = empty($data)?[]:$data;
+        return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
+    }
 }
 }

+ 2 - 0
app/api/route/user.php

@@ -78,6 +78,8 @@ Route::group('user', function () {
     Route::rule('clock_in', 'User/clock_in');
     Route::rule('clock_in', 'User/clock_in');
     //添加客户评论
     //添加客户评论
     Route::rule('comment', 'User/comment');
     Route::rule('comment', 'User/comment');
+    //添加客户评论
+    Route::rule('getClockList', 'User/getClockList');