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