\app\api\service\bargainAmount

Summary

Methods
Properties
Constants
__construct()
handle()
No public properties found
No constants found
apportion()
calcCouponAmount()
calcCouponAmountMax()
apportionRandRatio()
decimal_number()
$amount
$num
$coupon_min
$items
N/A
No private methods found
No private properties found
N/A

Properties

$amount

$amount : float

砍价金额

Type

float

$num

$num : integer

砍价人数

Type

integer

$coupon_min

$coupon_min : float

砍价的最小金额

Type

float

$items

$items : array

砍价分配结果

Type

array

Methods

__construct()

__construct(float  $amount, integer  $num = 1, float  $coupon_min = 0.01) 

初始化

Parameters

float $amount

砍价金额(单位:元)最多保留2位小数

integer $num

砍价个数

float $coupon_min

每个至少领取的砍价金额

handle()

handle() : array

处理返回

Throws

\Exception

Returns

array

apportion()

apportion() 

分配砍价

calcCouponAmount()

calcCouponAmount(float  $avg_amount, float  $amount, integer  $num) : float

计算分配的砍价金额

Parameters

float $avg_amount

每次计算的平均金额

float $amount

剩余可领取金额

integer $num

剩余可领取的砍价个数

Returns

float

calcCouponAmountMax()

calcCouponAmountMax(  $amount,   $num) : float|integer

计算分配的砍价金额-可领取的最大金额

Parameters

$amount
$num

Returns

float|integer

apportionRandRatio()

apportionRandRatio() 

砍价金额浮动比例

decimal_number()

decimal_number(float  $amount) : float

格式化金额,保留2位

Parameters

float $amount

Returns

float