|
@@ -318,7 +318,6 @@ class mratio_control
|
|
}
|
|
}
|
|
|
|
|
|
// Log::record("quality={$quality},card_type ={$card_type},spec={$spec}",Log::DEBUG);
|
|
// Log::record("quality={$quality},card_type ={$card_type},spec={$spec}",Log::DEBUG);
|
|
-
|
|
|
|
$prices = $this->getPrice($mchid, $org_quality, $card_type, $spec);
|
|
$prices = $this->getPrice($mchid, $org_quality, $card_type, $spec);
|
|
$out_price = $prices[$org_quality];
|
|
$out_price = $prices[$org_quality];
|
|
$in_price = $prices[$quality] ?? false;
|
|
$in_price = $prices[$quality] ?? false;
|
|
@@ -341,19 +340,8 @@ class mratio_control
|
|
return $cur_pratio > $profit_ratio;
|
|
return $cur_pratio > $profit_ratio;
|
|
};
|
|
};
|
|
|
|
|
|
- $spec_max = function ($mchid,$qtsex, $org_quality, $qualities, $low_ratio,$period)
|
|
|
|
|
|
+ $spec_max = function ($mchid, $qtsex, $org_quality, $qualities, $low_ratio, $period)
|
|
{
|
|
{
|
|
- $specs = [];
|
|
|
|
- $spec_qt = [];
|
|
|
|
- foreach ($qtsex as $qts) {
|
|
|
|
- [$quality, $card_type, $spec] = $qts;
|
|
|
|
- $specs[] = $spec;
|
|
|
|
- $spec_qt[$spec][] = [$quality,$card_type];
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $specs = array_unique($specs);
|
|
|
|
- sort($specs);
|
|
|
|
-
|
|
|
|
$ratio_calc = function ($mchid, $specs, $spec_qt, $max_spec, $org_quality, $qualities, $period)
|
|
$ratio_calc = function ($mchid, $specs, $spec_qt, $max_spec, $org_quality, $qualities, $period)
|
|
{
|
|
{
|
|
$all_succ = 0;
|
|
$all_succ = 0;
|
|
@@ -363,9 +351,9 @@ class mratio_control
|
|
{
|
|
{
|
|
$qts = $spec_qt[$spec];
|
|
$qts = $spec_qt[$spec];
|
|
if($max_spec >= $spec) {
|
|
if($max_spec >= $spec) {
|
|
- $fHigtRatio = true;
|
|
|
|
|
|
+ $fHighRatio = true; //此时采用面额中最高成功率计算
|
|
} else {
|
|
} else {
|
|
- $fHigtRatio = false;
|
|
|
|
|
|
+ $fHighRatio = false;
|
|
}
|
|
}
|
|
|
|
|
|
$card_types = [];
|
|
$card_types = [];
|
|
@@ -380,13 +368,13 @@ class mratio_control
|
|
}
|
|
}
|
|
|
|
|
|
$detail_ratios = $this->detail_ratios($mchid, $qualities,$card_type, $spec, $period);
|
|
$detail_ratios = $this->detail_ratios($mchid, $qualities,$card_type, $spec, $period);
|
|
- if($fHigtRatio)
|
|
|
|
|
|
+ if($fHighRatio)
|
|
{
|
|
{
|
|
$all = 0;
|
|
$all = 0;
|
|
$ratios = [];
|
|
$ratios = [];
|
|
foreach ($detail_ratios as $quality => $sfr) {
|
|
foreach ($detail_ratios as $quality => $sfr) {
|
|
[$succ,$fail,$ratio] = $sfr;
|
|
[$succ,$fail,$ratio] = $sfr;
|
|
-// Log::record("high succ={$succ},fail={$fail},ratio = {$ratio}",Log::DEBUG);
|
|
|
|
|
|
+ Log::record("high succ={$succ},fail={$fail},ratio = {$ratio}",Log::DEBUG);
|
|
$ratios[] = $ratio;
|
|
$ratios[] = $ratio;
|
|
$all += $succ;
|
|
$all += $succ;
|
|
$all += $fail;
|
|
$all += $fail;
|
|
@@ -404,7 +392,7 @@ class mratio_control
|
|
foreach ($detail_ratios as $quality => $sfr)
|
|
foreach ($detail_ratios as $quality => $sfr)
|
|
{
|
|
{
|
|
[$succ,$fail,$ratio] = $sfr;
|
|
[$succ,$fail,$ratio] = $sfr;
|
|
-// Log::record("normal succ={$succ},fail={$fail},ratio = {$ratio}",Log::DEBUG);
|
|
|
|
|
|
+ Log::record("normal succ={$succ},fail={$fail},ratio = {$ratio}",Log::DEBUG);
|
|
$all_succ += $succ;
|
|
$all_succ += $succ;
|
|
$all_fail += $fail;
|
|
$all_fail += $fail;
|
|
}
|
|
}
|
|
@@ -415,11 +403,23 @@ class mratio_control
|
|
return round($ratio,4);
|
|
return round($ratio,4);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
+ $specs = [];
|
|
|
|
+ $spec_qt = [];
|
|
|
|
+ foreach ($qtsex as $qts) {
|
|
|
|
+ [$quality, $card_type, $spec] = $qts;
|
|
|
|
+ $specs[] = $spec;
|
|
|
|
+ $spec_qt[$spec][] = [$quality,$card_type];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $specs = array_unique($specs);
|
|
|
|
+ sort($specs);
|
|
|
|
+
|
|
for ($i = 0; $i < count($specs); $i++)
|
|
for ($i = 0; $i < count($specs); $i++)
|
|
{
|
|
{
|
|
$max_spec = $specs[$i];
|
|
$max_spec = $specs[$i];
|
|
$ratio = $ratio_calc($mchid, $specs, $spec_qt, $max_spec, $org_quality, $qualities, $period);
|
|
$ratio = $ratio_calc($mchid, $specs, $spec_qt, $max_spec, $org_quality, $qualities, $period);
|
|
-// Log::record("spec={$max_spec},ratio={$ratio},low_ratio={$low_ratio}",Log::DEBUG);
|
|
|
|
|
|
+ Log::record("spec={$max_spec},ratio={$ratio},low_ratio={$low_ratio}",Log::DEBUG);
|
|
if($ratio >= $low_ratio) {
|
|
if($ratio >= $low_ratio) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -434,7 +434,7 @@ class mratio_control
|
|
if($can_next)
|
|
if($can_next)
|
|
{
|
|
{
|
|
$max_spec = $spec_max($mchid,$qtsex, $org_quality, $qualities, $low_ratio,$period);
|
|
$max_spec = $spec_max($mchid,$qtsex, $org_quality, $qualities, $low_ratio,$period);
|
|
- Log::record("max_spec={$max_spec}",Log::DEBUG);
|
|
|
|
|
|
+ Log::record("mchid={$mchid} max_spec={$max_spec}",Log::DEBUG);
|
|
if($max_spec >= $spec) {
|
|
if($max_spec >= $spec) {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|