noticemodel.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sicilon_IT
  5. * Date: 2021/5/16
  6. * Time: 12:05
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class noticemodel extends Model{
  11. protected $table='t_notice';
  12. /*
  13. * 20210516
  14. */
  15. public function insinfo($arr){
  16. $this->allowField(true)->isUpdate(false)->setAttr('id',null)->save($arr);
  17. return $this->id;
  18. }
  19. /*
  20. * 20210517
  21. * 获取所有的有效公告接口
  22. */
  23. public function selalllist(){
  24. $where_arr['isactive']=1;
  25. $rlist=$this->where($where_arr)->order('id','desc')->select();
  26. $rlist=collection($rlist)->toArray();
  27. return $rlist;
  28. }
  29. /*
  30. * 20210517
  31. */
  32. public function selnewmsg(){
  33. $where_arr['isactive']=1;
  34. $rlist=$this->where($where_arr)->order('id','desc')->limit(0,1)->select();
  35. $rlist=collection($rlist)->toArray();
  36. return $rlist;
  37. }
  38. /*
  39. * 20230215
  40. */
  41. public function sellistbycid($cid){
  42. $where_arr['companyid']=$cid;
  43. $where_arr['isactive']=1;
  44. $rlist=$this->where($where_arr)->order('id','desc')->select();
  45. $rlist=collection($rlist)->toArray();
  46. return $rlist;
  47. }
  48. /*
  49. * 20230218
  50. */
  51. public function selnewmsgbycid($cid){
  52. $where_arr['isactive']=1;
  53. $where_arr['companyid']=$cid;
  54. $rlist=$this->where($where_arr)->order('id','desc')->limit(0,1)->select();
  55. $rlist=collection($rlist)->toArray();
  56. return $rlist;
  57. }
  58. }