SystemAttachment.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/13
  6. */
  7. namespace app\admin\model\system;
  8. use traits\ModelTrait;
  9. use basic\ModelBasic;
  10. /**
  11. * 文件检验model
  12. * Class SystemFile
  13. * @package app\admin\model\system
  14. */
  15. class SystemAttachment extends ModelBasic
  16. {
  17. use ModelTrait;
  18. /**添加附件记录
  19. */
  20. public static function attachmentAdd($name,$att_size,$att_type,$att_dir,$satt_dir='',$pid = 0 )
  21. {
  22. $data['name'] = $name;
  23. $data['att_dir'] = $att_dir;
  24. $data['satt_dir'] = $satt_dir;
  25. $data['att_size'] = $att_size;
  26. $data['att_type'] = $att_type;
  27. $data['time'] = time();
  28. $data['pid'] = $pid;
  29. return self::create($data);
  30. }
  31. /**
  32. * 获取分类图
  33. * */
  34. public static function getAll($id){
  35. $model = new self;
  36. $where['pid'] = $id;
  37. $model->where($where)->order('att_id desc');
  38. return $model->page($model,$where,'',30);
  39. }
  40. /**
  41. * 获取单条信息
  42. * */
  43. public static function getinfo($att_id){
  44. $model = new self;
  45. $where['att_id'] = $att_id;
  46. return $model->where($where)->select()->toArray()[0];
  47. }
  48. }