ChatRooms.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Lenovo
  5. * Date: 2018/10/30
  6. * Time: 15:09
  7. */
  8. namespace App\Models;
  9. class ChatRooms extends BaseModel
  10. {
  11. protected $table = 'chat_rooms';
  12. function getlist($where,$limit ){
  13. return $this->where($where)
  14. ->limit($limit)
  15. ->get()
  16. ->toArray();
  17. }
  18. function addRecord($data){
  19. $res=$this->insert($data);
  20. if(!$res){
  21. return -6030001222;
  22. }
  23. }
  24. function getIdData($id){
  25. return $this->where("id",$id)->first();
  26. }
  27. public function updateIdData(int $id,$data){
  28. return $this->where("id",$id)->update($data);
  29. }
  30. //获取所有房间 2019-01-19 anton liu
  31. function getAll()
  32. {
  33. $data = $this->select('id','room_name')->orderBy('id','asc')->get()->toArray();
  34. if(!$data){
  35. return -5040000522;//没有数据
  36. }
  37. return $data;
  38. }
  39. }