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