|
@@ -34,7 +34,7 @@ class minutesControl extends BaseCronControl
|
|
|
foreach ($merchants as $merchant)
|
|
|
{
|
|
|
$mchid = $merchant['mchid'];
|
|
|
- $phone = $merchant['contact_phone'] ?? "";
|
|
|
+ $phones = empty($merchant['warning_phone']) ? [] : unserialize($merchant['warning_phone']);
|
|
|
$available_pd = intval($merchant['available_predeposit']);
|
|
|
$alarm_pd = intval($merchant['alarm_amount']);
|
|
|
|
|
@@ -44,15 +44,17 @@ class minutesControl extends BaseCronControl
|
|
|
else {
|
|
|
$mch_cache = ['last_time' => 0, 'send_count' => 0];
|
|
|
}
|
|
|
-
|
|
|
- if(!empty($phone) && ($available_pd < $alarm_pd || $available_pd < 10000))
|
|
|
+ if($available_pd < $alarm_pd || $available_pd < 10000)
|
|
|
{
|
|
|
$counts = $mch_cache['send_count'];
|
|
|
if(($mch_cache['last_time'] + 300 < time()) && $counts < 5) {
|
|
|
$mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
|
|
|
- QueueClient::push('sendSMS', ['mobile'=>$merchant['contact_phone'],
|
|
|
- 'type'=>'balance_warning','datas' => [date("m月d日H时") , $merchant['available_predeposit']]]);
|
|
|
-
|
|
|
+ foreach ($phones as $phone) {
|
|
|
+ if(!empty($phone)){
|
|
|
+ QueueClient::push('sendSMS', ['mobile'=>$phone,
|
|
|
+ 'type'=>'balance_warning','datas' => [date("m月d日H时") , $merchant['available_predeposit']]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@@ -84,9 +86,22 @@ class minutesControl extends BaseCronControl
|
|
|
|
|
|
return $items;
|
|
|
};
|
|
|
-
|
|
|
- foreach ($caches as $cache) {
|
|
|
- $item = $reader($cache['mchid'],$cache['time']);
|
|
|
+ $new_caches = [];
|
|
|
+ $card_type = [1 => 'petrochina' , 2 => 'sinopec'];
|
|
|
+ foreach ($caches as $cache)
|
|
|
+ {
|
|
|
+ $items = $reader($cache['mchid'],$cache['time']);
|
|
|
+ foreach ($items as $item) {
|
|
|
+ //指定card_type,refill_amount的单数比缓存中设置单数大,设置对应缓存能否下单为false,key为商户ID-卡类型-额度
|
|
|
+ $cache_num = $cache[$card_type[$item['card_type']]][$item['refill_amount']];
|
|
|
+ if ($cache_num < $item['num']) {
|
|
|
+ $can_add = $cache_num == -1;
|
|
|
+ }
|
|
|
+ $new_caches["{$cache['mchid']}-{$item['card_type']}-{$item['refill_amount']}"] = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!empty($new_caches)) {
|
|
|
+ wcache("mch_can_order" , ['data' => serialize($new_caches)] , 'merchant-');
|
|
|
}
|
|
|
}
|
|
|
|