Commit b202a44f authored by hujun's avatar hujun

数量计算

parent b650557d
...@@ -125,7 +125,7 @@ class CouponService{ ...@@ -125,7 +125,7 @@ class CouponService{
* *
* @param int $user_id * @param int $user_id
* @param int $type * @param int $type
* @param $order_id * @param $invitee_id
* @return array * @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
...@@ -147,12 +147,20 @@ class CouponService{ ...@@ -147,12 +147,20 @@ class CouponService{
if ($type == 0) { if ($type == 0) {
$count_where['invitee_id'] = $invitee_id; $count_where['invitee_id'] = $invitee_id;
$num = $this->m_coupon->getCount($count_where); $num = $this->m_coupon->getCount($count_where); //是否邀请过该客户
if ($num > 0) { if ($num > 0) {
continue; continue;
} }
} }
$where['user_id'] = $user_id;
$where['activity_id'] = $v['id'];
$where['status'] = ['<>',2];
$num = $this->m_coupon->getCount($where);
if ($num <= $v['available']) {
continue;
}
if (strtotime($v['activity_start_time']) < $time && strtotime($v['activity_end_time']) > $time) { if (strtotime($v['activity_start_time']) < $time && strtotime($v['activity_end_time']) > $time) {
$return_activity[] = $v; $return_activity[] = $v;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment