|
@@ -447,7 +447,6 @@ class minutesControl extends BaseCronControl
|
|
|
try {
|
|
|
$this->_update_earlist_send();
|
|
|
$this->_calc_arrears();
|
|
|
- $this->_update_mixed_cfg();
|
|
|
|
|
|
} catch (Exception $ex) {
|
|
|
Log::record($ex->getMessage(), Log::ERR);
|
|
@@ -617,62 +616,6 @@ class minutesControl extends BaseCronControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function _update_mixed_cfg()
|
|
|
- {
|
|
|
- $read_cfg = function ($cfg)
|
|
|
- {
|
|
|
- $lower_ratio = $cfg['lower_ratio'] ?? [];
|
|
|
- if (empty($lower_ratio)) {
|
|
|
- [$ratio, $period] = [0.0, 3600];
|
|
|
- } else {
|
|
|
- [$ratio, $period] = [$lower_ratio['ratio'], $lower_ratio['period']];
|
|
|
- }
|
|
|
-
|
|
|
- $profit_ratio = $cfg['profit_ratio'] ?? 0.0;
|
|
|
- $profit_formula = $cfg['profit_formula'] ?? 'qts';
|
|
|
-
|
|
|
- return ['ratio' => $ratio, 'period' => $period, 'profit_ratio' => $profit_ratio, 'profit_formula' => $profit_formula];
|
|
|
- };
|
|
|
-
|
|
|
- $mch_configs = function () use ($read_cfg)
|
|
|
- {
|
|
|
- $result = [];
|
|
|
-
|
|
|
- $i = 0;
|
|
|
- while (true)
|
|
|
- {
|
|
|
- $start = $i * 100;
|
|
|
- $items = Model()->table('merchant')->where(['mchid' => ['gt', 0], 'merchant_state' => 1])->field('mchid,retry_times_cfg,quality')->order('mchid asc')->limit("{$start},100")->select();
|
|
|
- if(empty($items)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- $i++;
|
|
|
-
|
|
|
- foreach ($items as $item)
|
|
|
- {
|
|
|
- $mchid = intval($item['mchid']);
|
|
|
- $quality = intval($item['quality']);
|
|
|
- if($mchid <= 0 || $quality <= 0) continue;
|
|
|
- if (!PolicyUtil::mixed_quality($quality)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- $retry_times_cfg = unserialize($item['retry_times_cfg']);
|
|
|
- if(empty($retry_times_cfg)) continue;
|
|
|
-
|
|
|
-
|
|
|
- $result[$mchid] = $read_cfg($retry_times_cfg);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return $result;
|
|
|
- };
|
|
|
-
|
|
|
- $result = $mch_configs();
|
|
|
- $val = json_encode($result);
|
|
|
- wkcachex('stat-merchant-mixed', $val, 'refill-');
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 执行通用任务
|
|
|
*/
|