InvitegiftModel.class.php 4.9 KB

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