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.
36 lines
769 B
36 lines
769 B
<?php
|
|
namespace backend\modules\shop\logic;
|
|
|
|
use Yii;
|
|
use yii\base\Exception;
|
|
|
|
class CommonManager
|
|
{
|
|
//单位类型
|
|
const UNIT_TYPE_WEIGHT = 1; //重量
|
|
const UNIT_TYPE_MONEY = 2; //金额
|
|
const UNIT_TYPE_ITEM = 3; //件
|
|
|
|
/**
|
|
* @param $type
|
|
* @param $value
|
|
* @return int
|
|
* 比例转换
|
|
*/
|
|
public static function proportionalConversion($type, $value)
|
|
{
|
|
switch ($type) {
|
|
case self::UNIT_TYPE_WEIGHT:
|
|
return 1000;
|
|
break;
|
|
case self::UNIT_TYPE_MONEY:
|
|
return 100;
|
|
break;
|
|
case self::UNIT_TYPE_ITEM:
|
|
return 1;
|
|
break;
|
|
default:
|
|
return 1;
|
|
}
|
|
}
|
|
}
|