InvitegiftModel.class.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. *
  6. * @author cy 2021-03-10
  7. *
  8. */
  9. namespace Seller\Model;
  10. class InvitegiftModel{
  11. /**
  12. * @author cy 2021-03-10
  13. * @desc 邀请成功人数
  14. * @param $user_id
  15. * @return mixed
  16. */
  17. public function getInviteSuccCount($user_id){
  18. $count = M('lionfish_comshop_invitegift_record')->where( array('user_id'=>$user_id,'invitee_status'=>1) )->count();
  19. return empty($count) ? 0 : $count;
  20. }
  21. /**
  22. * @author cy 2021-03-10
  23. * @desc 送出优惠券数量
  24. * @param $user_id
  25. * @param $city_id
  26. * @return mixed
  27. */
  28. public function getInviteSuccSendCouponCount($user_id){
  29. $sql = "select count(1) as count from ".C('DB_PREFIX')."lionfish_comshop_coupon_list c "
  30. . " where c.receive_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r where r.user_id = ".$user_id." ) "
  31. . " and c.receive_type in ('invitegift_new')";
  32. $total_arr = M()->query($sql);
  33. $count = $total_arr[0]['count'];
  34. return empty($count) ? 0 : $count;
  35. }
  36. /**
  37. * @author cy 2021-03-10
  38. * @desc 送出积分数
  39. * @param $user_id
  40. * @param $city_id
  41. * @return mixed
  42. */
  43. public function getInviteSuccSendPointTotal($user_id){
  44. $sql = "select sum(f.score) as score from ".C('DB_PREFIX')."lionfish_comshop_member_integral_flow as f "
  45. . " where f.order_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r where r.user_id = ".$user_id." ) "
  46. . " and f.type in ('invitegift_new') ";
  47. $total_arr = M()->query($sql);
  48. $score = $total_arr[0]['score'];
  49. return empty($score) ? 0 : $score;
  50. }
  51. /**
  52. * @author cy 2021-03-10
  53. * @desc 总送出优惠券数量
  54. * @param $city_id
  55. * @return mixed
  56. */
  57. public function getInviteSendCouponCount(){
  58. $sql = "select count(1) as count from ".C('DB_PREFIX')."lionfish_comshop_coupon_list c "
  59. . " where c.receive_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r ) "
  60. . " and c.receive_type in ('invitegift_new') ";
  61. $total_arr = M()->query($sql);
  62. $count = $total_arr[0]['count'];
  63. return empty($count) ? 0 : $count;
  64. }
  65. /**
  66. * @author cy 2021-03-18
  67. * @desc 总获得优惠券数量
  68. * @param $city_id
  69. * @return mixed
  70. */
  71. public function getInviteCouponCount(){
  72. $sql = "select count(1) as count from ".C('DB_PREFIX')."lionfish_comshop_coupon_list c "
  73. . " where c.receive_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r ) "
  74. . " and c.receive_type in ('invitegift') ";
  75. $total_arr = M()->query($sql);
  76. $count = $total_arr[0]['count'];
  77. return empty($count) ? 0 : $count;
  78. }
  79. /**
  80. * @author cy 2021-03-10
  81. * @desc 总送出积分数量
  82. * @param $city_id
  83. * @return mixed
  84. */
  85. public function getInviteSendPointTotal(){
  86. $sql = "select sum(f.score) as score from ".C('DB_PREFIX')."lionfish_comshop_member_integral_flow as f "
  87. . " where f.order_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r ) "
  88. . " and f.type in ('invitegift_new') ";
  89. $total_arr = M()->query($sql);
  90. $score = $total_arr[0]['score'];
  91. return empty($score) ? 0 : $score;
  92. }
  93. /**
  94. * @author cy 2021-03-18
  95. * @desc 总获得积分数量
  96. * @param $city_id
  97. * @return mixed
  98. */
  99. public function getInvitePointTotal(){
  100. $sql = "select sum(f.score) as score from ".C('DB_PREFIX')."lionfish_comshop_member_integral_flow as f "
  101. . " where f.order_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r ) "
  102. . " and f.type in ('invitegift') ";
  103. $total_arr = M()->query($sql);
  104. $score = $total_arr[0]['score'];
  105. return empty($score) ? 0 : $score;
  106. }
  107. /**
  108. * @author cy 2021-03-18
  109. * @desc 获得优惠券数量
  110. * @param $user_id
  111. * @param $city_id
  112. * @return mixed
  113. */
  114. public function getInviteSuccCouponCount($user_id){
  115. $sql = "select count(1) as count from ".C('DB_PREFIX')."lionfish_comshop_coupon_list c "
  116. . " where c.receive_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r where r.user_id = ".$user_id." ) "
  117. . " and c.receive_type in ('invitegift')";
  118. $total_arr = M()->query($sql);
  119. $count = $total_arr[0]['count'];
  120. return empty($count) ? 0 : $count;
  121. }
  122. /**
  123. * @author cy 2021-03-18
  124. * @desc 获得积分数
  125. * @param $user_id
  126. * @param $city_id
  127. * @return mixed
  128. */
  129. public function getInviteSuccPointTotal($user_id){
  130. $sql = "select sum(f.score) as score from ".C('DB_PREFIX')."lionfish_comshop_member_integral_flow as f "
  131. . " where f.order_id in (select id from ".C('DB_PREFIX')."lionfish_comshop_invitegift_record r where r.user_id = ".$user_id." ) "
  132. . " and f.type in ('invitegift') ";
  133. $total_arr = M()->query($sql);
  134. $score = $total_arr[0]['score'];
  135. return empty($score) ? 0 : $score;
  136. }
  137. }
  138. ?>