UserComment.php 647 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\user\model;
  3. use think\Model;
  4. class UserComment extends Model{
  5. protected $createTime = "inputtime";
  6. protected $updateTime = '';
  7. protected $autoWriteTimestamp = 'datetime'; // 开启自动写入时间戳字段
  8. public function initialize(){
  9. parent::initialize();
  10. }
  11. public function getInfo($user, $type, $page = 0){
  12. return $this->db()
  13. ->field("comment_id s, inputtime t, content c")
  14. ->where(['user_id'=>$user, "type"=>$type])
  15. ->page($page, config('paginate.list_rows'))
  16. ->order("inputtime DESC")
  17. ->select();
  18. }
  19. public function add($data){
  20. return $this->save($data);
  21. }
  22. }