|
@@ -110,7 +110,6 @@ class chctlex
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //
|
|
|
|
public function match($names, int $spec, int $card_type, int $quality, $max_inprice)
|
|
public function match($names, int $spec, int $card_type, int $quality, $max_inprice)
|
|
{
|
|
{
|
|
$trace = new scope_trace(__METHOD__);
|
|
$trace = new scope_trace(__METHOD__);
|
|
@@ -312,8 +311,8 @@ class chctlex
|
|
return [[],[]];
|
|
return [[],[]];
|
|
}
|
|
}
|
|
|
|
|
|
- $count = count($feeds);
|
|
|
|
- $pos = mt_rand(0, $count * 5);
|
|
|
|
|
|
+ $max = count($feeds) - 1;
|
|
|
|
+ $pos = mt_rand(0, $max);
|
|
|
|
|
|
$cur_feeds = [];
|
|
$cur_feeds = [];
|
|
$next_feeds = [];
|
|
$next_feeds = [];
|
|
@@ -349,13 +348,43 @@ class chctlex
|
|
return array_merge($header,$ender);
|
|
return array_merge($header,$ender);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ //for log
|
|
|
|
+ $header_fun = function (int $spec, int $card_type, int $quality) {
|
|
|
|
+ return "auto_match {$quality}-{$spec}-{$card_type}";
|
|
|
|
+ };
|
|
|
|
+ $header = $header_fun($spec,$card_type,$quality);
|
|
|
|
+
|
|
|
|
+ $names_getter = function ($ctls) {
|
|
|
|
+ $names = [];
|
|
|
|
+ foreach ($ctls as $item) {
|
|
|
|
+ $names[] = $item->name();
|
|
|
|
+ }
|
|
|
|
+ return $names;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ $ctlitem_logger = function ($tag, $ctls) use ($header,$names_getter)
|
|
|
|
+ {
|
|
|
|
+ $names = $names_getter($ctls);
|
|
|
|
+ $sname = implode(',', $names);
|
|
|
|
+ Log::record("{$header} {$tag} :{$sname}",Log::DEBUG);
|
|
|
|
+ };
|
|
|
|
+ //end for log
|
|
|
|
+
|
|
|
|
+ //working .....
|
|
$names = array_unique($names);
|
|
$names = array_unique($names);
|
|
Log::record("auto_match outprice= {$out_price} names=" . implode(',', $names), Log::DEBUG);
|
|
Log::record("auto_match outprice= {$out_price} names=" . implode(',', $names), Log::DEBUG);
|
|
- $ctls = $price_filter($names,$spec,$card_type,$quality);
|
|
|
|
- [$feeds,$workers,$overloads] = $ctl_splitor($ctls);
|
|
|
|
|
|
+ $ctls = $price_filter($names, $spec, $card_type, $quality);
|
|
|
|
+ $ctlitem_logger("price filter", $ctls);
|
|
|
|
|
|
|
|
+ [$feeds,$workers,$overloads] = $ctl_splitor($ctls);
|
|
[$cur_feeds,$next_feeds] = $assign_feeds($feeds);
|
|
[$cur_feeds,$next_feeds] = $assign_feeds($feeds);
|
|
|
|
+
|
|
|
|
+ $ctlitem_logger("cur feeds",$cur_feeds);
|
|
|
|
+ $ctlitem_logger("next feeds",$next_feeds);
|
|
|
|
+ $ctlitem_logger("over loads",$overloads);
|
|
|
|
+
|
|
usort($workers, $desc_profit);
|
|
usort($workers, $desc_profit);
|
|
|
|
+ $ctlitem_logger("sort works",$workers);
|
|
|
|
|
|
if(!empty($overloads)) {
|
|
if(!empty($overloads)) {
|
|
$assigner = new overload_assigner();
|
|
$assigner = new overload_assigner();
|
|
@@ -365,13 +394,9 @@ class chctlex
|
|
|
|
|
|
$ctls = array_merge($cur_feeds, $workers, $overloads, $next_feeds);
|
|
$ctls = array_merge($cur_feeds, $workers, $overloads, $next_feeds);
|
|
$ctls = $time_map($ctls,$left_time);
|
|
$ctls = $time_map($ctls,$left_time);
|
|
|
|
+ $ctlitem_logger("result ctls",$ctls);
|
|
|
|
|
|
- $names = [];
|
|
|
|
- foreach ($ctls as $item) {
|
|
|
|
- $names[] = $item->name();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Log::record("auto_match {$card_type}-{$spec} result names=" . implode(',', $names), Log::DEBUG);
|
|
|
|
|
|
+ $names = $names_getter($ctls);
|
|
return $names;
|
|
return $names;
|
|
}
|
|
}
|
|
}
|
|
}
|