/** *获得签到全局表信息 * 自动增加组 * @param $key 认筹单二维码key * @param $project 项目 */ function App_Sign_getGroup($key, $project) { $res = array('signed' => false, 'msg' => ''); $pid = $project['id']; //查询是否已有分配的签到 $sign = biz_getSignInfoByQrcode($key, $pid); $chips = biz_getChipsByQrcode($key); if (empty($chips)) { $res['msg'] = '无效认筹单'; return $res; } if (empty($sign) || $sign['preset'] == 1) { if ($chips['projguid'] != $project['projguid']) { $res['msg'] = '认筹单所属非当前项目'; return $res; } //处理已签到信息 if ($chips['singed'] == 1) { $res['msg'] = '认筹单已签到'; return $res; } } if (isset($chips) || !$sign['signed']) { $cachekey = 'lock_sign_' . $pid; //写入签到信息 if (memcached_addKey($cachekey, 30)) { if (empty($sign)) { $info = getGlobalSign($project); $sign = biz_insertSignInfo($chips, $info['group']['dispnum'], $pid, false, true); if (!empty($sign)) { // $sign = biz_getSignInfoByQrcode($key, $pid); $res['signed'] = true; $res['group'] = $info['group']['dispnum']; } } else { if (empty($sign['signed'])) { $update['signed'] = 1; $update['signtime'] = TIMESTAMP; pdo_update('sign', $update, array('id' => $sign['id'])); unset($update); $sign['signed'] = 1; $sign['signtime'] = TIMESTAMP; $res['signed'] = true; $res['group'] = $sign['gid']; } } if (!empty($sign)) { //更新对应组信息 Sign_updateGroup($sign, true); } if ($res['signed']) { //签到记录组号 pdo_update('chips', array('signed' => $sign['gid']), array('id' => $chips['id'])); db_updateChipsStatus($chips['id'], 4); } memcached_delete($cachekey); } } else { $res['signed'] = !empty($sign['signed']); } $res['sign'] = $sign; return $res; }
} $chips = biz_getChipsByQrcode($qrcode); if (empty($chips) || $chips['projguid'] != $_W['project']['projguid']) { exit('无效的认筹单!'); } $num = intval($_GPC['sel_code']); $group = biz_getSignGroupByNum($num, $pid); if (empty($group)) { exit('组数据不存在,请刷新页面!'); } $presign = biz_getSignInfoByQrcode($qrcode, $pid); if (!empty($presign)) { exit("认筹单已在{$presign['gid']}组,不能再次预设!"); } if (biz_insertSignInfo($chips, $num, $pid, true)) { Sign_updateGroup($group); exit('success'); } else { exit('增加失败!'); } } } if ($op == 'addgroup') { if ($_W['isajax'] && $_W['ispost']) { $index = intval($_GPC['num']); if ($index <= 0) { exit('无效号码!'); } if (!in_array($index, $keys)) { biz_addSignGroup($_GPC['num'], $pid); exit('success');