|
@@ -37,16 +37,21 @@ class mchannel_item
|
|
|
class rgroup
|
|
|
{
|
|
|
private $mGroupID;
|
|
|
- private $mQca2Channels;
|
|
|
+ private $mCtlitems;
|
|
|
public function __construct($group_id)
|
|
|
{
|
|
|
$this->mGroupID = $group_id;
|
|
|
+ $this->mCtlitems = [];
|
|
|
$this->load();
|
|
|
}
|
|
|
private function load()
|
|
|
{
|
|
|
- //加载后形成:quality-card_type-amount: channels 映射成一个数组,而不是单个通道
|
|
|
- //将信息存储到$mQca2Channels 中
|
|
|
+ //读数据库,并解析,将所有的信息,都堆到 $mCtlitems 中
|
|
|
+ }
|
|
|
+
|
|
|
+ public function infos()
|
|
|
+ {
|
|
|
+ return $this->mCtlitems;
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -94,7 +99,35 @@ class rgroup_ctl
|
|
|
|
|
|
private function load_merchant($groups)
|
|
|
{
|
|
|
- //查出所有指定了通道的机构,找到分组ids
|
|
|
- //通过分组ids,在groups 中找到分组信息。
|
|
|
+ $mchitems = []; //读取数据库,获取机构列表
|
|
|
+ foreach ($mchitems as $item)
|
|
|
+ {
|
|
|
+ $mchid = intval($item['mchid']);
|
|
|
+ $gids = explode(',',$item[]); //通过分析item 通道参数,获取gids
|
|
|
+ if(empty($gids)) continue;
|
|
|
+ $mchchannel = new mchannel_item($mchid);
|
|
|
+ $this->mMch2Channel[$mchid] = $mchchannel;
|
|
|
+
|
|
|
+ foreach ($gids as $gid)
|
|
|
+ {
|
|
|
+ if(array_key_exists($gid,$groups))
|
|
|
+ {
|
|
|
+ $group = $groups[$gid];
|
|
|
+ $chitems = $group->infos;
|
|
|
+ foreach ($chitems as $text) {
|
|
|
+ //解析text
|
|
|
+ [$spec,$card_type,$quality,$chname] = $this->parase($text);
|
|
|
+ $mchchannel->add_channel($spec,$card_type,$quality,$chname);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private function parase($text)
|
|
|
+ {
|
|
|
+
|
|
|
+ return [$spec,$card_type,$quality,$chname];
|
|
|
}
|
|
|
}
|