更新:商家信息补充有效优惠卷数量统计
parent
f4c9de618a
commit
820c38437d
|
@ -6,6 +6,7 @@ use app\exception\RepositoryException;
|
||||||
use app\model\CouponMain;
|
use app\model\CouponMain;
|
||||||
use app\model\UsingRule;
|
use app\model\UsingRule;
|
||||||
use app\model\Coupon;
|
use app\model\Coupon;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
trait CouponMainTrait
|
trait CouponMainTrait
|
||||||
{
|
{
|
||||||
|
@ -191,6 +192,10 @@ trait CouponMainTrait
|
||||||
$q->whereTime('c.received_time', '>=', $startDay);
|
$q->whereTime('c.received_time', '>=', $startDay);
|
||||||
})
|
})
|
||||||
->count('c.id');
|
->count('c.id');
|
||||||
|
$effectiveSize = CouponMain::where($whereMap)
|
||||||
|
->whereTime('start_time', '<=', date('Y-m-d H:i:s'))
|
||||||
|
->whereTime('end_time', '>=', date('Y-m-d H:i:s'))
|
||||||
|
->sum(Db::Raw('(`count` - `received_count`)'));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 发行总次数
|
// 发行总次数
|
||||||
|
@ -203,6 +208,8 @@ trait CouponMainTrait
|
||||||
'unVerificationSize' => $unVerificationSize,
|
'unVerificationSize' => $unVerificationSize,
|
||||||
// 最近($daySize + 1)天内的领取量
|
// 最近($daySize + 1)天内的领取量
|
||||||
'lastReceivedSize' => $lastReceivedSize,
|
'lastReceivedSize' => $lastReceivedSize,
|
||||||
|
// 有效的(进行中且未被领取)
|
||||||
|
'effectiveSize' => $effectiveSize,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue