|
@@ -0,0 +1,30 @@
|
|
|
+<?php
|
|
|
+namespace app\user\model;
|
|
|
+
|
|
|
+use think\Model;
|
|
|
+
|
|
|
+class UserComment extends Model{
|
|
|
+ protected $createTime = "inputtime";
|
|
|
+ protected $updateTime = '';
|
|
|
+ protected $autoWriteTimestamp = 'datetime'; // 开启自动写入时间戳字段
|
|
|
+
|
|
|
+ public function initialize(){
|
|
|
+ parent::initialize();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getInfo($user, $type, $page = 0){
|
|
|
+ $this->db()
|
|
|
+ ->alias("c")
|
|
|
+ ->field("u.short s, c.inputtime t, c.content c")
|
|
|
+ ->where(['c.user_id'=>$user, "c.type"=>$type])
|
|
|
+ ->join("gd_user u", "c.comment_id = u.id", "left")
|
|
|
+ ->page($page, config('paginate.list_rows'))
|
|
|
+ ->order("inputtime DESC")
|
|
|
+ ->select();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function add($data){
|
|
|
+ return $this->save($data);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|