Upload.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Upload extends BaseModel {
  16. public function getUploadList($condition, $field = '*') {
  17. $result = Db::name('upload')->field($field)->order('upload_id asc')->where($condition)->select()->toArray();
  18. return $result;
  19. }
  20. /**
  21. * 取单个内容
  22. * @access public
  23. * @author csdeshang
  24. * @param int $id 分类ID
  25. * @return array 数组类型的返回结果
  26. */
  27. public function getOneUpload($id) {
  28. $data['upload_id'] = intval($id);
  29. $result = Db::name('upload')->where($data)->find();
  30. return $result;
  31. }
  32. /**
  33. * 新增
  34. * @access public
  35. * @author csdeshang
  36. * @param array $data 参数内容
  37. * @return bool 布尔类型的返回结果
  38. */
  39. public function addUpload($data) {
  40. $result = Db::name('upload')->insertGetId($data);
  41. return $result;
  42. }
  43. /**
  44. * 更新信息
  45. * @access public
  46. * @author csdeshang
  47. * @param array $data 数据
  48. * @param array $condition 条件
  49. * @return bool
  50. */
  51. public function editUpload($data, $condition) {
  52. $result = Db::name('upload')->where($condition)->update($data);
  53. return $result;
  54. }
  55. /**
  56. * 删除分类
  57. * @access public
  58. * @author csdeshang
  59. * @param int $condition 记录ID
  60. * @return bool
  61. */
  62. public function delUpload($condition) {
  63. return Db::name('upload')->where($condition)->delete();
  64. }
  65. }