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