MiniproLiveRoomGoods.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. * DSKMS多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class MiniproLiveRoomGoods extends BaseModel {
  16. public $page_info;
  17. public function getMiniproLiveRoomGoodsList($condition, $field = '*', $pagesize=10, $order = 'minipro_live_room_goods_id desc') {
  18. if ($pagesize) {
  19. $result = Db::name('minipro_live_room_goods')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  20. $this->page_info = $result;
  21. return $result->items();
  22. } else {
  23. $result = Db::name('minipro_live_room_goods')->field($field)->where($condition)->order($order)->select()->toArray();
  24. return $result;
  25. }
  26. }
  27. /**
  28. * 取单个内容
  29. * @access public
  30. * @author csdeshang
  31. * @param int $id 分类ID
  32. * @return array 数组类型的返回结果
  33. */
  34. public function getMiniproLiveRoomGoodsInfo($condition) {
  35. $result = Db::name('minipro_live_room_goods')->where($condition)->find();
  36. return $result;
  37. }
  38. /**
  39. * 新增
  40. * @access public
  41. * @author csdeshang
  42. * @param array $data 参数内容
  43. * @return bool 布尔类型的返回结果
  44. */
  45. public function addMiniproLiveRoomGoods($data) {
  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. $result = Db::name('minipro_live_room_goods')->where($condition)->update($data);
  59. return $result;
  60. }
  61. /**
  62. * 删除分类
  63. * @access public
  64. * @author csdeshang
  65. * @param int $condition 记录ID
  66. * @return bool
  67. */
  68. public function delMiniproLiveRoomGoods($condition) {
  69. return Db::name('minipro_live_room_goods')->where($condition)->delete();
  70. }
  71. }