Storemsgsetting.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Storemsgsetting extends BaseModel
  12. {
  13. public $page_info;
  14. /**
  15. * 店铺消息接收设置列表
  16. * @access public
  17. * @author csdeshang
  18. * @param type $condition 条件
  19. * @param type $field 字段
  20. * @param type $key 键值
  21. * @param type $pagesize 分页
  22. * @param type $order 排序
  23. * @return type
  24. */
  25. public function getStoremsgsettingList($condition, $field = '*', $key = '', $pagesize = 0, $order = 'storemt_code asc')
  26. {
  27. if ($pagesize) {
  28. $res = Db::name('storemsgsetting')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  29. $this->page_info = $res;
  30. $result = $res->items();
  31. } else {
  32. $result = Db::name('storemsgsetting')->field($field)->where($condition)->order($order)->select()->toArray();
  33. }
  34. return ds_change_arraykey($result, $key);
  35. }
  36. /**
  37. * 店铺消息接收设置详细
  38. * @access public
  39. * @author csdeshang
  40. * @param type $condition 条件
  41. * @param type $field 字段
  42. * @return type
  43. */
  44. public function getStoremsgsettingInfo($condition, $field = '*')
  45. {
  46. return Db::name('storemsgsetting')->field($field)->where($condition)->find();
  47. }
  48. /**
  49. * 添加店铺模板接收设置
  50. * @access public
  51. * @author csdeshang
  52. * @param array $data 新增数据
  53. * @return bool
  54. */
  55. public function addStoremsgsetting($data)
  56. {
  57. return Db::name('storemsgsetting')->insert($data);
  58. }
  59. /**
  60. * 编辑店铺模板接收设置
  61. * @access public
  62. * @author csdeshang
  63. * @param array $data 更新数据
  64. * @return bool
  65. */
  66. public function editStoremsgsetting($data, $condition)
  67. {
  68. return Db::name('storemsgsetting')->where($condition)->update($data);
  69. }
  70. }