宝体数据调用接口
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.
 
 
 
 
 
 

38 lines
811 B

<?php
namespace app\common\model\sharing;
use app\common\model\BaseModel;
/**
* 拼团商品SKU模型
* Class GoodsSku
* @package app\common\model\sharing
*/
class GoodsSku extends BaseModel
{
protected $name = 'sharing_goods_sku';
protected $append = ['diff_price'];
/**
* 规格图片
* @return \think\model\relation\HasOne
*/
public function image()
{
$module = self::getCalledModule() ?: 'common';
return $this->hasOne("app\\{$module}\\model\\UploadFile", 'file_id', 'image_id');
}
/**
* 获取器:拼团价与划线价差额
* @param $value
* @param $data
* @return mixed
*/
public function getDiffPriceAttr($value, $data)
{
return max(0, $data['line_price'] - $data['sharing_price']);
}
}