setter
parent
42bd496675
commit
9e182dcfe0
|
@ -389,7 +389,7 @@ class Business extends Base
|
|||
|
||||
$data["content"] = (string)$couponMain->content;
|
||||
|
||||
//未登录可以领取 0可领取 1已领取
|
||||
//未登录可以领取 0可领取 1已领取 2 已领完
|
||||
if (empty($account)) {
|
||||
$data["receiveStatus"] = CouponMain::COMMON_OFF;//领取状态
|
||||
}else{
|
||||
|
|
|
@ -23,7 +23,16 @@ class CouponMain extends Base
|
|||
const on_screen_yes = 1;//展示到商圈大屏
|
||||
const on_screen_no = 0;//不展示到商圈大屏
|
||||
|
||||
const min_consumer_money = 0.3;//红包最小金额
|
||||
const min_consumer_money = 0.3;//
|
||||
|
||||
const receive_status_over = 2;//领取状态 已领完
|
||||
const receive_status_received = 1;//领取状态 已领完
|
||||
const receive_status_default = 0;//领取状态 可领取
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function business()
|
||||
{
|
||||
|
|
|
@ -66,38 +66,47 @@ trait CouponTrait
|
|||
*/
|
||||
public function getCouponReceiveStatus($accountCode,CouponMain $couponMain )
|
||||
{
|
||||
|
||||
//如果 领取数量==总数
|
||||
if($couponMain['received_count'] == $couponMain['count'] ){
|
||||
return CouponMain::receive_status_over;
|
||||
}
|
||||
|
||||
|
||||
//没有领取记录就可以领取
|
||||
$ReceiveCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
->where("consumer_code",$accountCode)
|
||||
->count();
|
||||
if($ReceiveCount <= 0){
|
||||
return CouponMain::COMMON_OFF;
|
||||
return CouponMain::receive_status_default;
|
||||
}else{
|
||||
return CouponMain::receive_status_received;
|
||||
}
|
||||
|
||||
//确定使用规则
|
||||
$usingRule =UsingRule::where("coupon_id",$couponMain->id)->find();
|
||||
if(empty($usingRule)){
|
||||
return CouponMain::COMMON_OFF;
|
||||
}
|
||||
//$usingRule =UsingRule::where("coupon_id",$couponMain->id)->find();
|
||||
//if(empty($usingRule)){
|
||||
// return CouponMain::COMMON_OFF;
|
||||
//}
|
||||
|
||||
//单人日限量
|
||||
$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
->where("consumer_code",$accountCode)
|
||||
->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
->count();
|
||||
//$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
// ->where("consumer_code",$accountCode)
|
||||
// ->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
// ->count();
|
||||
|
||||
if($todayReceivesCount >= $usingRule->person_day_total ){
|
||||
//if($todayReceivesCount >= $usingRule->person_day_total ){
|
||||
|
||||
return CouponMain::COMMON_ON;
|
||||
}
|
||||
//return CouponMain::COMMON_ON;
|
||||
//}
|
||||
|
||||
|
||||
//单人总限量
|
||||
if($ReceiveCount >= $usingRule->person_total ){
|
||||
return CouponMain::COMMON_ON;
|
||||
}
|
||||
//if($ReceiveCount >= $usingRule->person_total ){
|
||||
// return CouponMain::COMMON_ON;
|
||||
//}
|
||||
|
||||
|
||||
return CouponMain::COMMON_OFF;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue