1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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){
- return $this->db()
- ->alias("c")
- ->field("c.comment_id s, c.inputtime t, c.content c, u.nickname n")
- ->join("gd_user u", "u.id = c.comment_id", "LEFT")
- ->where(['c.user_id'=>$user, "c.type"=>$type])
- ->page($page, config('paginate.list_rows'))
- ->order("inputtime DESC")
- ->select();
- }
-
- public function getInfoByComment($user, $comment, $type, $page = 0){
- return $this->db()
- ->alias("c")
- ->field("c.comment_id s, c.inputtime t, c.content c, u.nickname n")
- ->join("gd_user u", "u.id = c.comment_id", "LEFT")
- ->where(['c.user_id'=>$user, "c.comment_id"=>$comment, "c.type"=>$type])
- ->page($page, config('paginate.list_rows'))
- ->order("inputtime DESC")
- ->select();
- }
-
- public function add($data){
- return $this->save($data);
- }
-
- }
|