<?php

// 获取领导注册qr信息
require_once ("../user_include.inc");

ErrorLogger::doOutput("Compass...test.php....Start.", 0);

$tmpMemberList = array();
//圈主
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "宗彪";
$tmpMemberList[] = $circleMemberDat;

//群员
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "~aimai二一组";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "袁志英";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "宗可欣";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "范晓军";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "石久宴";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "吕立忠";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "宗亦可";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "蔡明";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "毛东瓜";
$tmpMemberList[] = $circleMemberDat;
$circleMemberDat = new CircleMemberDat();
$circleMemberDat->name = "袁总";
$tmpMemberList[] = $circleMemberDat;


//圈主
$ownerList = array();
$ownerList[] = $tmpMemberList[0];
$memberList["圈主(1)"] = $ownerList;
array_shift($tmpMemberList);


//根据拼音首字母分组
$pinyin = new Pinyin();
$tmpOrderList = array();
foreach($tmpMemberList as $tmpMember) {
	//获取拼音首字母
	$firstChar = $pinyin->getFirstChar($tmpMember->name);
	//是否已经存在key
	if (array_key_exists($firstChar,$tmpOrderList)){
		array_push($tmpOrderList[$firstChar], $tmpMember);
	} else {
		$tmp = array();
		$tmp[] = $tmpMember;
		$tmpOrderList[$firstChar] = $tmp;
	}
}
//拼音首字母排序
ksort($tmpOrderList);


//组装返回数据
$otherList = array();
if(!empty($tmpOrderList)) {
	foreach($tmpOrderList as $key => $keyMembers){
	  if($key == "#") {
		  $otherList = $keyMembers;
	  } else {
		  $memberList[$key . "(" . count($keyMembers) . ")"] = $keyMembers;
	  }
	}
	if(!empty($otherList)) {
		$memberList["#" . "(" . count($otherList) . ")"] = $otherList;
	}
}

print_r($memberList);

/**
$userMst = UserMst::getById(31);

//管辖区域
$province = $userMst->province;
$city = $userMst->city;
$district = $userMst->district;



$page = 0;
$rowCount = 20;
$offset = $page * $rowCount;


$param = array();
//$param['province'] = $province;
if(!empty($city)) {
	//$param['city'] = $city;
}
if(!empty($district)) {
	//$param['district'] = $district;
}
$param['delete_flg'] = false;
$tmpMemberList = SchoolMst::getList($param, 'province', 'asc, city asc, district asc', $offset, $rowCount);

$index = 0;
foreach($tmpMemberList as $tmp) {
	$index++;
	$tmp->province = "江苏省";
	$tmp->city = "南京市";
	$tmp->district = "栖霞区";
	$tmp->title = "我们的学校" . $index;
	$tmp->save();
}
print_r($tmpMemberList);




$param = array();
$param['delete_flg'] = false;
$tmpMemberList = CircleDat::getList($param, 'id', 'asc');
foreach($tmpMemberList as $tmp) {
	$tmp->province = "江苏省";
	$tmp->city = "南京市";
	$tmp->district = "建邺区";
	$tmp->save();
}
print_r($tmpMemberList);



$param = array();
$param['delete_flg'] = false;
$tmpMemberList = SocialEventDat::getList($param, 'id', 'asc');
$index = 0;
foreach($tmpMemberList as $tmp) {
	$index++;
	$tmp->title = "社会实践活动" . $index;
	$tmp->author = "老师" . $index;
	$tmp->save();
}
print_r($tmpMemberList);

$param = array();
$param['delete_flg'] = false;
$tmpMemberList = UserMessageDat::getList($param, 'id', 'asc');
$index = 0;
foreach($tmpMemberList as $tmp) {
	if($tmp->attach_dat_type == "CIRCLE") {
		$tmp->title = "您的圈子有一条加入申请";
		$tmp->comment = "嘀嘀嘀！[聪明的一休]申请加入您的圈子！";
		$tmp->save();
	}
}



$param = array();
$param['delete_flg'] = false;
$tmpMemberList = SocialEventDat::getList($param, 'id', 'asc');
$index = 0;
foreach($tmpMemberList as $tmp) {
	$tmp->content = "<font style='color:red'>此处富文本</font><img src='https://www.baidu.com/img/baidu_jgylogo3.gif'/>";
	$tmp->save();

}

*/
ErrorLogger::doOutput("Compass...test.php....End.", 0);




?>