10
This commit is contained in:
+42
-3
@@ -6,8 +6,13 @@ use app\model\Base;
|
||||
* @property integer $id 主键(ID) - 无注释
|
||||
* @property string $title 名称
|
||||
* @property float $price 价格
|
||||
* @property float $org_price 原价
|
||||
* @property integer $duration 时长
|
||||
* @property number $role_id 关联角色
|
||||
* @property number $month_discount 月折扣
|
||||
* @property number $quarter_discount 季折扣
|
||||
* @property number $year_discount 年折扣
|
||||
* @property number $month_price 月价
|
||||
* @property number $quarter_price 季价
|
||||
* @property number $year_price 年价
|
||||
* @property string $label 标签
|
||||
* @property integer $status 0:禁用,1启用
|
||||
* @property integer $created_at 创建时间
|
||||
@@ -20,7 +25,41 @@ class Thali extends Base
|
||||
{
|
||||
// 所有的参数配置统一返回
|
||||
return array_merge(parent::getOptions(),[
|
||||
'append' => []
|
||||
'append' => [
|
||||
'month_price',
|
||||
'quarter_price',
|
||||
'year_price'
|
||||
],
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 月价
|
||||
*/
|
||||
public function getMonthPriceAttr($value,$row)
|
||||
{
|
||||
return bcmul($row['price'],$row['month_discount'],2);
|
||||
}
|
||||
/**
|
||||
* 季价
|
||||
*/
|
||||
public function getQuarterPriceAttr($value,$row)
|
||||
{
|
||||
return bcmul($row['price'],$row['quarter_discount'],2);
|
||||
}
|
||||
/**
|
||||
* 年价
|
||||
*/
|
||||
public function getYearPriceAttr($value,$row)
|
||||
{
|
||||
return bcmul($row['price'],$row['year_discount'],2);
|
||||
}
|
||||
function Role(){
|
||||
return $this->hasOne('UserRole','id','role_id')->bind([
|
||||
'name'=>'role_name',
|
||||
'max_send_msg_count'=>'max_send_msg_count',
|
||||
'max_friend_count'=>'max_friend_count',
|
||||
'max_group_join_count'=>'max_group_join_count',
|
||||
'max_gourp_create_count'=>'max_gourp_create_count'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user