Snsmember.php 3.6 KB

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