This commit is contained in:
commie
2026-02-24 21:02:17 +08:00
parent 6586f27c9e
commit c9c8a120ab
12 changed files with 345 additions and 103 deletions
+3 -3
View File
@@ -37,21 +37,21 @@ class Thali extends Base
*/
public function getMonthPriceAttr($value,$row)
{
return bcmul($row['price'],$row['month_discount'],2);
return round(bcmul($row['price'],$row['month_discount'],2));
}
/**
* 季价
*/
public function getQuarterPriceAttr($value,$row)
{
return bcmul($row['price'],$row['quarter_discount'],2);
return round(bcmul($row['price']*3,$row['quarter_discount'],2));
}
/**
* 年价
*/
public function getYearPriceAttr($value,$row)
{
return bcmul($row['price'],$row['year_discount'],2);
return round(bcmul($row['price']*12,$row['year_discount'],2));
}
function Role(){
return $this->hasOne('UserRole','id','role_id')->bind([
+14
View File
@@ -35,5 +35,19 @@ class UserRole extends Base
{
return $this->rules ? explode(',', $this->rules) : [];
}
public function setRightAttr($v='',$row=[])
{
if(is_array($v)){
return json_encode($v);
}
return $v;
}
/**
* @return mixed
*/
public function getRightIds($v='',$row=[])
{
return $v ? (is_array($v) ? $v : json_decode($v,true)) : [];
}
}