MessageRecords.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\system\Wechat\common\model;
  11. use app\model\BaseModel;
  12. /**
  13. * 微信模板消息消息发送记录
  14. */
  15. class MessageRecords extends BaseModel
  16. {
  17. /**
  18. * 新建微信模板消息发送记录
  19. * @param unknown $data
  20. */
  21. public function addWechatMessageRecords($data)
  22. {
  23. $id = model("nc_site_message_wechat_list")->add($data);
  24. if ($id === false) {
  25. return $this->error('', 'UNKNOW_ERROR');
  26. }
  27. return $this->success($id);
  28. }
  29. /**
  30. * 批量添加微信模板消息发送记录
  31. * @param $data
  32. * @return array
  33. */
  34. public function addWechatMessageRecordsList($data)
  35. {
  36. $id = model("nc_site_message_wechat_list")->addList($data);
  37. if ($id === false) {
  38. return $this->error('', 'UNKNOW_ERROR');
  39. }
  40. return $this->success($id);
  41. }
  42. /**
  43. * 编辑微信模板消息发送记录
  44. * @param $data
  45. * @param $condition
  46. * @return array
  47. */
  48. public function editWechatMessageRecords($data, $condition)
  49. {
  50. $res = model("nc_site_message_wechat_list")->update($data, $condition);
  51. if ($res === false) {
  52. return $this->error('', 'UNKNOW_ERROR');
  53. }
  54. return $this->success($res);
  55. }
  56. /**
  57. * 删除微信模板消息发送记录
  58. * @param $condition
  59. * @return array
  60. */
  61. public function deleteWechatMessageRecords($condition)
  62. {
  63. $res = model("nc_site_message_wechat_list")->delete($condition);
  64. if ($res === false) {
  65. return $this->error('', 'UNKNOW_ERROR');
  66. }
  67. return $this->success($res);
  68. }
  69. /**
  70. * 查询微信模板消息发送记录
  71. * @param $condition
  72. * @param string $field
  73. * @return array
  74. */
  75. public function getWechatMessageRecordsInfo($condition, $field = "*")
  76. {
  77. $res = model("nc_site_message_wechat_list")->getInfo($condition, $field);
  78. if (empty($res)) {
  79. return $this->error('', 'UNKNOW_ERROR');
  80. }
  81. return $this->success($res);
  82. }
  83. /**
  84. * 查询微信模板消息发送记录
  85. * @param $condition
  86. * @param string $field
  87. * @return array
  88. */
  89. public function getWechatMessageRecordsList($condition, $field = "*")
  90. {
  91. $res = model("nc_site_message_wechat_list")->getList($condition, $field);
  92. if (empty($res)) {
  93. return $this->error('', 'UNKNOW_ERROR');
  94. }
  95. return $this->success($res);
  96. }
  97. /**
  98. * 查询微信模板消息发送记录分页列表
  99. * @param array $condition
  100. * @param int $page
  101. * @param int $page_size
  102. * @param string $order
  103. * @param string $field
  104. * @return array
  105. */
  106. public function getWechatMessageRecordsPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*')
  107. {
  108. $res = model("nc_site_message_wechat_list")->pageList($condition, $field, $order, $page, $page_size);
  109. if (empty($res)) {
  110. return $this->error('', 'UNKNOW_ERROR');
  111. }
  112. return $this->success($res);
  113. }
  114. }