Storemsgread.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Storemsgread extends BaseModel
  12. {
  13. /**
  14. * 新增店铺纤细阅读
  15. * @access public
  16. * @author csdeshang
  17. * @param array $data 参数内容
  18. * @return bool
  19. */
  20. public function addStoremsgread($data)
  21. {
  22. $data['storemsg_readtime'] = TIMESTAMP;
  23. return Db::name('storemsgread')->insert($data);
  24. }
  25. /**
  26. * 查看店铺消息阅读详细
  27. * @access public
  28. * @author csdeshang
  29. * @param type $condition 条件
  30. * @param type $field 字段
  31. * @return type
  32. */
  33. public function getStoremsgreadInfo($condition, $field = '*')
  34. {
  35. return Db::name('storemsgread')->field($field)->where($condition)->find();
  36. }
  37. /**
  38. * 店铺消息阅读列表
  39. * @access public
  40. * @author csdeshang
  41. * @param array $condition 条件
  42. * @param string $field 字段
  43. * @param string $order 排序
  44. * @return array
  45. */
  46. public function getStoremsgreadList($condition, $field = '*', $order = 'storemsg_readtime desc')
  47. {
  48. return Db::name('storemsgread')->field($field)->where($condition)->order($order)->select()->toArray();
  49. }
  50. /**
  51. * 删除店铺消息阅读记录
  52. * @access public
  53. * @author csdeshang
  54. * @param type $condition 条件
  55. * @return bool
  56. */
  57. public function delStoremsgread($condition)
  58. {
  59. Db::name('storemsgread')->where($condition)->delete();
  60. }
  61. }