Snsmember.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * 会与标签
  6. */
  7. /**
  8. * ============================================================================
  9. * DSMall多用户商城
  10. * ============================================================================
  11. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  12. * 网站地址: http://www.csdeshang.com
  13. * ----------------------------------------------------------------------------
  14. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  15. * 不允许对程序代码以任何形式任何目的的再发布。
  16. * ============================================================================
  17. * 数据层模型
  18. */
  19. class Snsmember extends BaseModel{
  20. public $page_info;
  21. /**
  22. * 选择删除标签记录
  23. * @param type $condition
  24. * @return type
  25. */
  26. public function delSnsmembertag($condition){
  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. if($pagesize){
  37. $tag_list = Db::name('snsmembertag')->order($order)->paginate(['list_rows'=>10,'query' => request()->param()],false);
  38. $this->page_info =$tag_list;
  39. return $tag_list->items();
  40. } else {
  41. return Db::name('snsmembertag')->order($order)->select()->toArray();
  42. }
  43. }
  44. /**
  45. *增加会员标签
  46. * @param type $data
  47. * @return type
  48. */
  49. public function addSnsmembertag($data){
  50. return Db::name('snsmembertag')->insert($data);;
  51. }
  52. /**
  53. * 编辑会员标签
  54. * @param type $update
  55. * @return type
  56. */
  57. public function editSnsmembertag($update){
  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. return Db::name('snsmembertag')->find($condition);
  67. }
  68. /**
  69. * 获取会员标签数
  70. * @param type $condition
  71. * @return type
  72. */
  73. public function getSnstagmemberCount($condition){
  74. return Db::name('snsmtagmember')->where($condition)->count();;
  75. }
  76. /**
  77. * 获取所属标签会员列表
  78. * @param type $condition
  79. * @param type $field
  80. * @param type $pagesize
  81. * @param type $order
  82. * @param type $count
  83. * @return type
  84. */
  85. public function getSnsmtagmemberList($condition,$field,$pagesize,$order,$count){
  86. if($pagesize){
  87. $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);
  88. $this->page_info=$result;
  89. return $result->items();
  90. } else {
  91. $result = Db::name('snsmtagmember')->alias('s')->field($field)->join('member m','s.member_id=m.member_id','LEFT')->where($condition)->order($order)->select()->toArray();
  92. return $result;
  93. }
  94. }
  95. /**
  96. * 删除所属标签会员
  97. * @param type $condition
  98. * @return type
  99. */
  100. public function delSnsmtagmember($condition){
  101. return Db::name('snsmtagmember')->where($condition)->delete();
  102. }
  103. public function editSnsmtagmember($condition,$update){
  104. return Db::name('snsmtagmember')->where($condition)->update($update);
  105. }
  106. }