|
@@ -147,47 +147,40 @@ class minutesControl extends BaseCronControl
|
|
|
|
|
|
private function _check_merchant_alarm_amount()
|
|
|
{
|
|
|
- if(defined('COMPANY_NAME') && COMPANY_NAME === 'XYZ_COMPANY')
|
|
|
- {
|
|
|
- $mch_cache = rcache("merchant-notify" , 'refill-');
|
|
|
- $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
|
|
|
+ $mch_cache = rcache("merchant-notify", 'refill-');
|
|
|
+ $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
|
|
|
|
|
|
- $new_caches = [];
|
|
|
- $merchants = Model('merchant')->getMerchantList(['merchant.merchant_state'=>1],'','',true,'merchant.*,member.available_predeposit' ,"0,1000");
|
|
|
- foreach ($merchants as $merchant)
|
|
|
- {
|
|
|
- $mchid = $merchant['mchid'];
|
|
|
- $phones = empty($merchant['warning_phone']) ? [] : unserialize($merchant['warning_phone']);
|
|
|
- $available_pd = intval($merchant['available_predeposit']);
|
|
|
- $alarm_pd = intval($merchant['alarm_amount']);
|
|
|
+ $new_caches = [];
|
|
|
+ $merchants = Model('merchant')->getMerchantList(['merchant.merchant_state' => 1], '', '', true, 'merchant.*,member.available_predeposit', "0,1000");
|
|
|
+ foreach ($merchants as $merchant) {
|
|
|
+ $mchid = $merchant['mchid'];
|
|
|
+ $phones = empty($merchant['warning_phone']) ? [] : unserialize($merchant['warning_phone']);
|
|
|
+ $available_pd = intval($merchant['available_predeposit']);
|
|
|
+ $alarm_pd = intval($merchant['alarm_amount']);
|
|
|
|
|
|
- if(array_key_exists($mchid,$caches)) {
|
|
|
- $mch_cache = $caches[$mchid];
|
|
|
- }
|
|
|
- else {
|
|
|
- $mch_cache = ['last_time' => 0, 'send_count' => 0];
|
|
|
- }
|
|
|
- if($available_pd < $alarm_pd || $available_pd < 10000)
|
|
|
- {
|
|
|
- $counts = $mch_cache['send_count'];
|
|
|
- if(($mch_cache['last_time'] + 300 < time()) && $counts < 2) {
|
|
|
- $mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
|
|
|
- foreach ($phones as $phone) {
|
|
|
- if(!empty($phone)){
|
|
|
- QueueClient::push('sendSMS', ['mobile'=>$phone,
|
|
|
- 'type'=>'balance_warning','datas' => [date("m月d日H时") , $merchant['available_predeposit']]]);
|
|
|
- }
|
|
|
+ if (array_key_exists($mchid, $caches)) {
|
|
|
+ $mch_cache = $caches[$mchid];
|
|
|
+ } else {
|
|
|
+ $mch_cache = ['last_time' => 0, 'send_count' => 0];
|
|
|
+ }
|
|
|
+ if ($available_pd < $alarm_pd || $available_pd < 10000) {
|
|
|
+ $counts = $mch_cache['send_count'];
|
|
|
+ if (($mch_cache['last_time'] + 300 < time()) && $counts < 2) {
|
|
|
+ $mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
|
|
|
+ foreach ($phones as $phone) {
|
|
|
+ if (!empty($phone)) {
|
|
|
+ QueueClient::push('sendSMS', ['mobile' => $phone,
|
|
|
+ 'type' => 'balance_warning', 'datas' => [date("m月d日H时"), $merchant['available_predeposit']]]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- $mch_cache = ['last_time' => 0, 'send_count' => 0];
|
|
|
- }
|
|
|
- $new_caches[$mchid] = $mch_cache;
|
|
|
+ } else {
|
|
|
+ $mch_cache = ['last_time' => 0, 'send_count' => 0];
|
|
|
}
|
|
|
-
|
|
|
- wcache("merchant-notify", ['data' => serialize($new_caches)], 'refill-');
|
|
|
+ $new_caches[$mchid] = $mch_cache;
|
|
|
}
|
|
|
+
|
|
|
+ wcache("merchant-notify", ['data' => serialize($new_caches)], 'refill-');
|
|
|
}
|
|
|
|
|
|
public function check_refill_order_limit()
|