Snsmember.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * 会与标签
  6. */
  7. /**
  8. *
  9. *
  10. * ----------------------------------------------------------------------------
  11. *
  12. * 数据层模型
  13. */
  14. class Snsmember extends BaseModel
  15. {
  16. public $page_info;
  17. /**
  18. * 选择删除标签记录
  19. * @param type $condition
  20. * @return type
  21. */
  22. public function delSnsmembertag($condition)
  23. {
  24. return Db::name('snsmembertag')->where($condition)->delete();
  25. }
  26. /**
  27. * 获取会员标签列表
  28. * @param type $order
  29. * @param type $pagesize
  30. * @return type
  31. */
  32. public function getSnsmembertagList($order, $pagesize)
  33. {
  34. if ($pagesize) {
  35. $tag_list = Db::name('snsmembertag')->order($order)->paginate(['list_rows' => 10, 'query' => request()->param()], false);
  36. $this->page_info = $tag_list;
  37. return $tag_list->items();
  38. } else {
  39. return Db::name('snsmembertag')->order($order)->select()->toArray();
  40. }
  41. }
  42. /**
  43. *增加会员标签
  44. * @param type $data
  45. * @return type
  46. */
  47. public function addSnsmembertag($data)
  48. {
  49. return Db::name('snsmembertag')->insert($data);;
  50. }
  51. /**
  52. * 编辑会员标签
  53. * @param type $update
  54. * @return type
  55. */
  56. public function editSnsmembertag($update)
  57. {
  58. return $result = Db::name('snsmembertag')->update($update);;
  59. }
  60. /**
  61. * 获取单个会员标签
  62. * @param type $condition
  63. * @return type
  64. */
  65. public function getOneSnsmembertag($condition)
  66. {
  67. return Db::name('snsmembertag')->find($condition);
  68. }
  69. /**
  70. * 获取会员标签数
  71. * @param type $condition
  72. * @return type
  73. */
  74. public function getSnstagmemberCount($condition)
  75. {
  76. return Db::name('snsmtagmember')->where($condition)->count();;
  77. }
  78. /**
  79. * 获取所属标签会员列表
  80. * @param type $condition
  81. * @param type $field
  82. * @param type $pagesize
  83. * @param type $order
  84. * @param type $count
  85. * @return type
  86. */
  87. public function getSnsmtagmemberList($condition, $field, $pagesize, $order, $count)
  88. {
  89. if ($pagesize) {
  90. $result = Db::name('snsmtagmember')->alias('s')->field($field)->join('member m', 's.member_id=m.member_id', 'LEFT')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  91. $this->page_info = $result;
  92. return $result->items();
  93. } else {
  94. $result = Db::name('snsmtagmember')->alias('s')->field($field)->join('member m', 's.member_id=m.member_id', 'LEFT')->where($condition)->order($order)->select()->toArray();
  95. return $result;
  96. }
  97. }
  98. /**
  99. * 删除所属标签会员
  100. * @param type $condition
  101. * @return type
  102. */
  103. public function delSnsmtagmember($condition)
  104. {
  105. return Db::name('snsmtagmember')->where($condition)->delete();
  106. }
  107. public function editSnsmtagmember($condition, $update)
  108. {
  109. return Db::name('snsmtagmember')->where($condition)->update($update);
  110. }
  111. }