|
@@ -629,15 +629,50 @@ class providerControl extends SystemControl
|
|
|
$refill_company = $this->refill_companys(['co_type' => refill_companyModel::co_type_provider]);
|
|
|
$provider_items = $this->providers($cond);
|
|
|
|
|
|
- $datas = [];
|
|
|
+ $providers = $mid_pids = $mids = $datas = $result =[];
|
|
|
foreach ($provider_items as $item)
|
|
|
{
|
|
|
$co_id = $item['co_id'];
|
|
|
if(empty($co_id)) continue;
|
|
|
- $datas[$co_id][] = $item;
|
|
|
+ $pid = $item['provider_id'];
|
|
|
+ $account_id = intval($item['account_id']);
|
|
|
+ if($account_id > 0) {
|
|
|
+ $mid_pids[$account_id] = $pid;
|
|
|
+ $mids[] = $account_id;
|
|
|
+ }
|
|
|
+ $item['available_predeposit'] = 0;
|
|
|
+ $providers[$pid] = $item;
|
|
|
+ }
|
|
|
+ if(!empty($mids))
|
|
|
+ {
|
|
|
+ $member_data = Model('member')->field('member_id,available_predeposit')->where(['member_id' => ['in',$mids]])->select();
|
|
|
+ foreach ($member_data as $member)
|
|
|
+ {
|
|
|
+ $mid = intval($member['member_id']);
|
|
|
+ if(array_key_exists($mid,$mid_pids)) {
|
|
|
+ $pid = $mid_pids[$mid];
|
|
|
+ $providers[$pid]['available_predeposit'] = $member['available_predeposit'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach ($providers as $provider)
|
|
|
+ {
|
|
|
+ $data[$provider['co_id']][] = $provider;
|
|
|
+ }
|
|
|
+ $config = rcache('remit', 'refill-');
|
|
|
+ if (empty($config)) {
|
|
|
+ $config = [];
|
|
|
+ } else {
|
|
|
+ $config = unserialize($config['cfg']);
|
|
|
}
|
|
|
foreach ($datas as $co_id => $data)
|
|
|
{
|
|
|
+ $available_total = 0;
|
|
|
+ foreach ($data as $value)
|
|
|
+ {
|
|
|
+ $available_total += $value['available_predeposit'];
|
|
|
+ }
|
|
|
+ if($available_total > $config['remit_money']) continue;
|
|
|
$result[] = [
|
|
|
'co_name' => $refill_company[$co_id]['co_name'],
|
|
|
'providers' => $data
|