<?php $project = $_W['project']; $groups = biz_getWillCallGroup($project['id']); $signset = biz_unserializer($project, 'signset'); if (empty($signset)) { message('未配置叫号相关选项!'); } $maxselect = $signset['max']; if (checksubmit()) { if (isset($_GPC['callnum'])) { $callnum = explode(',', $_GPC['callnum']); } $keys = array_keys($groups); if (empty($callnum)) { $callnum[] = $keys[0]; } foreach ($callnum as $num) { biz_callSignGroup($num, $_W['pid']); } memcached_set('callnum', implode(',', $callnum)); $groups = biz_getWillCallGroup($_W['pid']); } $last = memcached_get('callnum'); $called = biz_getCalledGroup($_W['pid']); include $this->template('queuing_list');
/** * 通过id获得楼盘数据 * 查询结果反序列化产品及房型 * @param $id * @param $isGuid id是否为GUID * @param $unzip 是否解压属性 */ function biz_getProject($id, $isGuid = true, $unzip = false) { $key = 'P_' . $id; $info = cache()->get($key); if (empty($info)) { if (memcached_addKey('Add_' . $key)) { $info = db_getProject($id, $isGuid, $unzip); memcached_set($key, $info); memcached_delete('Add_' . $key); } } return $info; }
public static function set(string $key, $var, $ttl = 0) { return memcached_set($key, $var, false, $ttl); }
/** *获得签到全局表信息 * 自动增加组 * @param $pid 项目id */ function getGlobalSign($project) { global $_W; $key = 'sign_' . $project['projguid']; $singset = biz_unserializer($project, 'signset'); $max = empty($singset['num']) ? 10 : $singset['num']; $info = memcached_get($key); $reset = empty($info) || $info['group']['maxnum'] >= $max; if ($reset) { memcached_delete($key); $index = 1; if (!empty($info['group']['dispnum'])) { $index = $info['group']['dispnum']; } //获取组号 $callback = function () use($index, $max, $project) { $info['maxnum'] = $max; //获取未签到组列表 $info['group'] = Sign_GetEmptyGroup($index, $max, $project['id']); $info['group']['maxnum']++; return $info; }; $info = cache_GetData($key, $callback, 1800); } else { $info['group']['maxnum']++; memcached_set($key, $info, 1800); } return $info; }
if ($func == 'get_token') { //检查是否存在token? $guid = trim($_GPC['guid']); $key = 'sync_' . $guid; $token = memcached_get($key); if ($token == '') { $project = db_getProject($guid, true); if (empty($project)) { $res['msg'] = '无效的参数'; returnJson($res); } if (memcached_addKey('Add' . $key)) { $data = array('guid' => $guid, 'ip' => CLIENT_IP); $token = GUID(); memcached_set($key, $token, 300); memcached_set('sync_t_' . $token, $data, 300); memcached_delete('Add' . $key); $res['ok'] = true; $res['token'] = $token; } else { $res['msg'] = '无法增加cache数据'; } } else { $res['msg'] = '此项目已有下载未完成,请等5分钟再试'; } returnJson($res); } if ($func == 'release_token') { $token = $_GPC['token']; $data = memcached_get('sync_t_' . $token); memcached_delete('sync_' . $data['guid']);