Storemsgsetting.php 2.4 KB

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