You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
713 B

<?php
namespace App\Model\v3;
use App\Model\Model;
class Coupon extends Model
{
const DISCOUNT_TYPE_CASH = 1;
const DISCOUNT_TYPE_RATE = 2;
protected $table = 'lanzu_coupon';
protected $appends = [
'full_amount_text',
'discounts_text'
];
public function getFullAmountTextAttribute()
{
return '满'.$this->attributes['full_amount'].'可用';
}
public function getDiscountsTextAttribute()
{
if($this->attributes['discount_type'] == 1){
return '¥'.$this->attributes['discounts'];
}elseif($this->attributes['discount_type'] == 2){
return floatval($this->attributes['discounts'])."";
}
}
}