فهرست منبع

用户消息记录

Jonlin 6 سال پیش
والد
کامیت
83087a0274
1فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 20 0
      application/index/controller/User.php

+ 20 - 0
application/index/controller/User.php

@@ -175,6 +175,26 @@ class User extends Controller
 
     }
 
+    // 用户消息记录
+    public function historyNews()
+    {
+        if(request()->isPost()){
+            $time = input("param.time/s");
+            $user_id = input("param.user_id/s");
+            $time = strtotime($time);
+//            $user_id = 2;
+        }
+        $news = db('chat_log')->where(function($query) use($user_id) {
+            $query->where('from_id', $user_id)->whereor('to_id',$user_id);
+        })->where('time_line' ,'<=' ,$time)->order('time_line','desc')->limit(10)->select();
+
+        for($i=0;$i<count($news);$i++){
+            $news[$i]['time_line'] = date('Y-m-d H:i:s',$news[$i]['time_line']);
+        }
+        return json(['code' => 1, 'data' => $news, 'msg' => '成功']);
+
+    }
+
     // 上传图片
     public function uplodeImg()
     {