|
|
@@ -10,6 +10,7 @@ use common\components\imgUtil;
|
|
|
use common\components\util;
|
|
|
use common\services\xhItemService;
|
|
|
use Yii;
|
|
|
+use yii\di\ServiceLocator;
|
|
|
|
|
|
class ProductClass extends BaseClass
|
|
|
{
|
|
|
@@ -500,4 +501,16 @@ class ProductClass extends BaseClass
|
|
|
return self::updateById($productId, ['addPrice' => $addPrice]);
|
|
|
}
|
|
|
|
|
|
+ //根据productId 计算花材的重量
|
|
|
+ public static function getWeight($productId,$bigNum,$smallNum)
|
|
|
+ {
|
|
|
+ $productInfo = self::getById($productId);
|
|
|
+ if(empty($productInfo)){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ $ratio = $productInfo['ratio'];
|
|
|
+ $weight = $productInfo['weight'];
|
|
|
+ $mergeNum = self::mergeItemNum($bigNum,$smallNum,$ratio);
|
|
|
+ return bcmul($mergeNum,$weight,2);
|
|
|
+ }
|
|
|
}
|