This commit is contained in:
wangwei01 2019-03-27 17:22:56 +08:00
parent e61d6ea8fa
commit 17f9a521a3

View File

@ -9,6 +9,7 @@ class teamController{
'host' => $redis_conf['host'],
'port' => $redis_conf['port'],
'passwd' => $redis_conf['passwd']
));
return $r;
}
@ -21,19 +22,22 @@ class teamController{
'team_uuid' => $team_uuid,
'auto_fill' => $_REQUEST['auto_fill'],
'member_list' => array(
'idx' => 1,
'accout_id' => $_REQUEST['accout_id'],
'name' => $_REQUEST['name'],
'avatar_url' => $_REQUEST['avatar_url'],
array(
'idx' => 1,
'account_id' => $_REQUEST['account_id'],
'name' => $_REQUEST['name'],
'avatar_url' => $_REQUEST['avatar_url'],
)
));
$r = $this->getRedis($team_uuid);
$r->set(TEAMID_KEY.$team_uuid, json_encode($team_db));
$r->pexpire(TEAMID_KEY.$team_uuid, 1000 * 3600);
$r->set(TEAMID_KEY . $team_uuid, json_encode($team_db));
$r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'team_uuid' => $team_uuid
));
}
@ -46,24 +50,24 @@ class teamController{
}else{
$accountid = $_REQUEST['accout_id'];
$sessionid = $_REQUEST['session_id'];
$user_db_str = $r->get(TEAMID_KEY.$team_uuid);
if(empty($user_db_str)){
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
$team_uuid = $_REQUEST['team_uuid'];
$user_db_str = $r->get(TEAMID_KEY . $team_uuid);
if (empty($user_db_str)) {
phpcommon\sendError(ERR_USER_BASE + 1,'session失效1');
return;
}
$user_db = json_decode($user_db_str, true);
if(empty($user_db)){
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
if (empty($user_db)) {
phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return;
}
$member_list = array();
for($i = 0; $i < count($user_db['member_list']); $i++)
{
foreach ($user_db['member_list'] as $member) {
array_push($member_list, array(
'idx' => $user_db['idx'],
'account_id' => $user_db['account_id'],
'name' => $user_db['name'],
'avatar_url' => $user_db['avatar_url'],
'idx' => $member['idx'],
'account_id' => $member['account_id'],
'name' => $member['name'],
'avatar_url' => $member['avatar_url'],
));
}
echo json_encode(array(