|
在read.htm文件中,像: <li><span>注册时间</span>{$read[regdate]}</li> <li><span>最后登录</span>{$read[lastlogin]}</li> <li><span>发帖</span>$read[postnum]</li> 这样的代码中的变量大多可以直接或(通过read.php)稍加转换就可以输出。有的字段和今日发帖数的字段“todaypost”一样存在于会员数据表(pw_memberdata)中。所以我想,添加“<li><span>今日发帖</span>{$read[todaypost}</li>”这样一行代码就可以了。结果,没有结果! 那可能是没有查询结果,查询在哪里呢?想办法加上查询应该就可以了。 以“regdate”在read.php文件中搜索,果然找到了,而且正是查询,那把“todaypost”添加进去就应该可以了啊(红色的“,md.todaypost”)! //@ $threadService = L::loadClass('threads','forum'); $atData = $threadService->getAtUsers($tid,$pids); //读取用户信息
if ($_uids) { $_userIds = array_keys($_uids); if (perf::checkMemcache()){ $_cacheService = Perf::gatherCache('pw_members'); $pwMembers = $tableinfo ? $_cacheService->getAllByUserIds($_userIds, true, true, true) : $_cacheService->getAllByUserIds($_userIds, true, true); $showCustom && $customdb = $_cacheService->getMemberCreditByUserIds($_userIds); $db_showcolony && $colonydb = $_cacheService->getCmemberAndColonyByUserIds($_userIds); //为了兼容原来版本中的查询字段取别名 'icon as micon' if (S::isArray($pwMembers)){ foreach ($pwMembers as $k=>$v){ $pwMembers[$k]['micon'] = $pwMembers[$k]['icon']; unset($pwMembers[$k]['icon']); } } } else { $_dbCacheService = Perf::gatherCache('pw_membersdbcache'); list($pwMembers, $customdb, $colonydb) = $_dbCacheService->getUserDBCacheByUserIds($_userIds, $showCustom, $db_showcolony, $showfield); /** $skey = array(); foreach ($_uids as $key=>$value) { $skey[$value] = $key; $db_showcolony && $skey['UID_GROUP_'.$key] = $key; $showCustom && $skey['UID_CREDIT_'.$key] = $key; } $_cache = getDatastore(); $arrValues = $_cache->get(array_keys($skey)); $tmpUIDs = $tmpGROUPs = $tmpGROUPs = $tmpCacheData = $tmpColonydb = $tmpCustomdb = array(); foreach ($skey as $key=>$value) { $prefix = substr($key,0,strrpos($key,'_')); switch ($prefix) { case 'UID' : if (!isset($arrValues[$key])) { $tmpUIDs[$key] = $value; $tmpCacheData[$key] = ''; } else { $pwMembers[$value] = $arrValues[$key]; } break; case 'UID_CREDIT' : if (!isset($arrValues[$key])) { $tmpCREDITs[$key] = $value; $tmpCustomdb[$key] = ''; } else { $customdb[$value] = $arrValues[$key]; } break; case 'UID_GROUP' : if (!isset($arrValues[$key])) { $tmpGROUPs[$key] = $value; $tmpColonydb[$key] = ''; } else { $colonydb[$value] = $arrValues[$key]; } break; } } if ($db_showcolony && $tmpGROUPs) {#会员群组信息 $query = $db->query("SELECT c.uid,cy.id,cy.cname" . " FROM pw_cmembers c LEFT JOIN pw_colonys cy ON cy.id=c.colonyid" . " WHERE c.uid IN(".S::sqlImplode($tmpGROUPs,false).") AND c.ifadmin!='-1'"); while ($rt = $db->fetch_array($query)) { $colonydb[$rt['uid']] = $tmpColonydb['UID_GROUP_'.$rt['uid']] = $rt; } is_object($_cache) && $_cache->update($tmpColonydb,3600); $db->free_result($query); } if ($showCustom && $tmpCREDITs) {#自定义积分显示 $query = $db->query("SELECT uid,cid,value FROM pw_membercredit WHERE uid IN(".S::sqlImplode($tmpCREDITs,false).")"); while ($rt = $db->fetch_array($query)) { $customdb[$rt['uid']][$rt['cid']] = $rt['value']; $tmpCustomdb['UID_CREDIT_'.$rt['uid']][$rt['cid']] = $rt['value']; } is_object($_cache) && $_cache->update($tmpCustomdb,3600); $db->free_result($query); } if ($tmpUIDs) {#会员信息 $query = $db->query("SELECT m.uid,m.username,m.gender,m.oicq,m.aliww,m.groupid,m.memberid,m.icon AS micon ,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.thisvisit,md.lastvisit,md.onlinetime,md.starttime,md.todaypost $fieldinfo FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid $tableinfo WHERE m.uid IN (".S::sqlImplode($tmpUIDs,false).") "); while ($rt = $db->fetch_array($query)) { is_array($pwMembers[$rt['uid']]) ? $pwMembers[$rt['uid']] += $rt : $pwMembers[$rt['uid']] = $rt; $tmpCacheData['UID_'.$rt['uid']] = $rt; $todaypost=$rt['todaypost'];//2021.1.13 } is_object($_cache) && $_cache->update($tmpCacheData,3600); $db->free_result($query); } unset($skey,$_uids,$_cache,$tmpUIDs,$tmpCREDITs,$tmpGROUPs,$tmpColonydb,$tmpCustomdb,$tmpCacheData); **/ } }
|