首页| 版块| 我的| 发帖| 消息
主题:关于在线时长的问题
zhangjingyu 
require/functions.php
“/**
* 更新数据缓存库
*
*/
function updateDatanalyse($tag, $action, $num) {
global $db,$tdtime;
$tag = (int)$tag; $num = (int)$num;
$history = 0;
if (!empty($tag) && !empty($action)) {
$isTdtime = $isHistory = 0;
$timeuints = array($tdtime,$history);
$query = $db->query("SELECT timeunit FROM pw_datanalyse WHERE tag=".S::sqlEscape($tag)."AND action=".S::sqlEscape($action));
while($rs = $db->fetch_array($query)){
if($rs['timeunit'] == $tdtime){
$isTdtime = 1;
}elseif($rs['timeunit'] == $history){
$isHistory = 1;
}
}
if($isTdtime && $isHistory){
return $db->query("UPDATE LOW_PRIORITY pw_datanalyse SET num=num+".S::sqlEscape($num) ." WHERE tag=".S::sqlEscape($tag)."AND action=".S::sqlEscape($action)."AND timeunit IN (".S::sqlImplode($timeuints).")");
}elseif($isTdtime == 0 && $isHistory == 0){
return $db->query("REPLACE LOW_PRIORITY INTO pw_datanalyse (tag,action,timeunit,num) VALUES (".S::sqlEscape($tag).",".S::sqlEscape($action).",".S::sqlEscape($tdtime).",".S::sqlEscape($num)."),(".S::sqlEscape($tag).",".S::sqlEscape($action).",".S::sqlEscape($history).",".S::sqlEscape($num).")");
}
if($isTdtime){
$db->query("UPDATE LOW_PRIORITY pw_datanalyse SET num=num+".S::sqlEscape($num) ." WHERE tag=".S::sqlEscape($tag)."AND action=".S::sqlEscape($action)."AND timeunit=".S::sqlEscape($tdtime));
}else{
$db->query("REPLACE LOW_PRIORITY INTO pw_datanalyse SET tag=".S::sqlEscape($tag).",action=".S::sqlEscape($action).",timeunit=".S::sqlEscape($tdtime).",num=".S::sqlEscape($num));
}
if($isHistory){
$db->query("UPDATE LOW_PRIORITY pw_datanalyse SET num=num+".S::sqlEscape($num) ." WHERE tag=".S::sqlEscape($tag)."AND action=".S::sqlEscape($action)."AND timeunit=".S::sqlEscape($history));
}else{
$db->query("REPLACE LOW_PRIORITY INTO pw_datanalyse SET tag=".S::sqlEscape($tag).",action=".S::sqlEscape($action).",timeunit=".S::sqlEscape($history).",num=".S::sqlEscape($num));
}
}
}”(引用内容)
zhangjingyu回帖于2023-06-11 23:52[查看电脑版]
下一页 (1/2)
下一楼»:这是什么,看不懂
«上一楼:global.php
“/**
* 获取用户信息
*/
function User_info() {
  ..

查看全部回帖(27)
«返回主帖