|
@@ -31,15 +31,41 @@ class pubevent
|
|
|
return ['ratio' => $ratio, 'period' => $period, 'profit_ratio' => $profit_ratio, 'profit_formula' => $profit_formula];
|
|
|
};
|
|
|
|
|
|
- $mch_configs = function () use ($read_cfg)
|
|
|
+ $read_transfer_cfg = function ($mchid,$cfg)
|
|
|
+ {
|
|
|
+ if(empty($cfg)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $transfer_cfg = unserialize($cfg);
|
|
|
+ if($transfer_cfg === false) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $opened = intval($transfer_cfg['transfer_opened']);
|
|
|
+ $tmchid = intval($transfer_cfg['transfer_mchid']);
|
|
|
+
|
|
|
+ if ($opened == 1 and $tmchid > 0 and $tmchid != $mchid) {
|
|
|
+ return $tmchid;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $mch_configs = function () use ($read_cfg,$read_transfer_cfg)
|
|
|
{
|
|
|
$result = [];
|
|
|
+ $transfer_mchids = [];
|
|
|
+
|
|
|
|
|
|
$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();
|
|
|
+ $items = Model()->table('merchant')
|
|
|
+ ->where(['mchid' => ['gt', 0], 'merchant_state' => 1])
|
|
|
+ ->field('mchid,retry_times_cfg,quality,timeout_transfer_cfg,transfer_cfg')
|
|
|
+ ->order('mchid asc')->limit("{$start},100")->select();
|
|
|
if(empty($items)) {
|
|
|
break;
|
|
|
}
|
|
@@ -59,15 +85,37 @@ class pubevent
|
|
|
|
|
|
|
|
|
$result[$mchid] = $read_cfg($retry_times_cfg);
|
|
|
+
|
|
|
+ $mchids = [];
|
|
|
+
|
|
|
+ $tid = $read_transfer_cfg($mchid, $item['transfer_cfg']);
|
|
|
+ if($tid !== false) {
|
|
|
+ $mchids[] = $tid;
|
|
|
+ }
|
|
|
+
|
|
|
+ $tid = $read_transfer_cfg($mchid, $item['transfer_cfg']);
|
|
|
+ if($tid !== false) {
|
|
|
+ $mchids[] = $tid;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($mchids)) {
|
|
|
+ $mchids = array_unique($mchids);
|
|
|
+ $transfer_mchids[$mchid] = $mchids;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return $result;
|
|
|
+ return [$result,$transfer_mchids];
|
|
|
};
|
|
|
|
|
|
- $result = $mch_configs();
|
|
|
+ [$result,$transfer_mchids] = $mch_configs();
|
|
|
+
|
|
|
$val = json_encode($result);
|
|
|
Log::record("stat-merchant-mixed val = {$val}",Log::DEBUG);
|
|
|
wkcachex('stat-merchant-mixed', $val, 'refill-');
|
|
|
+
|
|
|
+ $val = json_encode($transfer_mchids);
|
|
|
+ Log::record("stat-merchant-transfer val = {$val}",Log::DEBUG);
|
|
|
+ wkcachex('stat-merchant-transfer', $val, 'refill-');
|
|
|
}
|
|
|
}
|