MiniproLiveRoomGoods.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * DSKMS多用户商城
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class MiniproLiveRoomGoods extends BaseModel
  12. {
  13. public $page_info;
  14. public function getMiniproLiveRoomGoodsList($condition, $field = '*', $pagesize = 10, $order = 'minipro_live_room_goods_id desc')
  15. {
  16. if ($pagesize) {
  17. $result = Db::name('minipro_live_room_goods')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  18. $this->page_info = $result;
  19. return $result->items();
  20. } else {
  21. $result = Db::name('minipro_live_room_goods')->field($field)->where($condition)->order($order)->select()->toArray();
  22. return $result;
  23. }
  24. }
  25. /**
  26. * 取单个内容
  27. * @access public
  28. * @author csdeshang
  29. * @param int $id 分类ID
  30. * @return array 数组类型的返回结果
  31. */
  32. public function getMiniproLiveRoomGoodsInfo($condition)
  33. {
  34. $result = Db::name('minipro_live_room_goods')->where($condition)->find();
  35. return $result;
  36. }
  37. /**
  38. * 新增
  39. * @access public
  40. * @author csdeshang
  41. * @param array $data 参数内容
  42. * @return bool 布尔类型的返回结果
  43. */
  44. public function addMiniproLiveRoomGoods($data)
  45. {
  46. $result = Db::name('minipro_live_room_goods')->insertGetId($data);
  47. return $result;
  48. }
  49. /**
  50. * 更新信息
  51. * @access public
  52. * @author csdeshang
  53. * @param array $data 数据
  54. * @param array $condition 条件
  55. * @return bool
  56. */
  57. public function editMiniproLiveRoomGoods($data, $condition)
  58. {
  59. $result = Db::name('minipro_live_room_goods')->where($condition)->update($data);
  60. return $result;
  61. }
  62. /**
  63. * 删除分类
  64. * @access public
  65. * @author csdeshang
  66. * @param int $condition 记录ID
  67. * @return bool
  68. */
  69. public function delMiniproLiveRoomGoods($condition)
  70. {
  71. return Db::name('minipro_live_room_goods')->where($condition)->delete();
  72. }
  73. }