ShopAcceptMessage.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\model\shop;
  11. use app\model\BaseModel;
  12. /**
  13. * 商家接受消息设置
  14. */
  15. class ShopAcceptMessage extends BaseModel
  16. {
  17. /**
  18. * 添加商家消息接收会员
  19. * @param $member_id
  20. * @param $site_id
  21. * @return array
  22. */
  23. public function addShopAcceptMessage($param)
  24. {
  25. $data = [
  26. 'site_id' => $param['site_id'],
  27. 'mobile' => $param['mobile'] ?? '',
  28. 'wx_openid' => $param['wx_openid'] ?? '',
  29. 'nickname' => $param['nickname'],
  30. 'create_time' => time()
  31. ];
  32. $res = model('shop_accept_message')->add($data);
  33. return $this->success($res);
  34. }
  35. /**
  36. * 编辑消息接收人
  37. * @param $data
  38. * @param $condition
  39. * @return array
  40. */
  41. public function editShopAcceptMessage($data, $condition)
  42. {
  43. $res = model('shop_accept_message')->update($data, $condition);
  44. return $this->success($res);
  45. }
  46. /**
  47. * 删除商家消息接收会员
  48. * @param $condition
  49. * @return array
  50. */
  51. public function deleteShopAcceptMessage($condition)
  52. {
  53. $res = model('shop_accept_message')->delete($condition);
  54. return $this->success($res);
  55. }
  56. /**
  57. * 获取商家消息接收会员
  58. * @param array $condition
  59. * @param string $field
  60. * @param string $order
  61. * @param string $limit
  62. */
  63. public function getShopAcceptMessageList($condition = [], $order = '')
  64. {
  65. $list = model('shop_accept_message')->getList($condition, '*', $order);
  66. return $this->success($list);
  67. }
  68. /**
  69. * 获取商家消息接收会员分页列表
  70. * @param array $condition
  71. * @param number $page
  72. * @param string $page_size
  73. * @param string $order
  74. * @param string $field
  75. */
  76. public function getShopAcceptMessagePageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'id desc')
  77. {
  78. $list = model('shop_accept_message')->pageList($condition, '*', $order, $page, $page_size);
  79. return $this->success($list);
  80. }
  81. }