奥门巴黎人手机网址【app】

MySQL存款和储蓄进程(批量生成论坛中发帖、回帖、主题等数码)

2019-12-03 12:20·澳门巴黎人彩票

mysql存款和储蓄进程(批量生成论坛中发帖、回帖、核心等数据),mysql存款和储蓄进度

USE 数据库名称1;
DROP PROCEDURE IF EXISTS 数据库名称1.仓库储存进程名称;
delimiter $$
CREATE PROCEDURE 数据库名称1.囤积进度名称(in v_count bigint,in v_count2 bigint)
BEGIN
set @vCount1=v_count;
set @vCount2=v_count2;

set @i=1;
set @vintervala=10000;
set @vintervalb=10000;
while(@i<[email protected])
do
#随便获得一个版块ID
select fid into @vfid from tps_forum_forum where fup<>0 and `type`='forum' and `status`=1 order by rand() limit 1;

#获取pid
select ifnull(max(pid)+1,1) into @vpid from tps_forum_post;

#获取tid
select ifnull(max(tid)+1,1) into @vtid from tps_forum_post;

#获得发帖的storeid username
select m.uid,m.username into @vuida,@vusernamea from tps_common_member m where m.uid>4 and m.`status`=0 order by rand() limit 1,1;

set @[email protected][email protected];
set @[email protected][email protected]*100;

set @vtitlea=concat('发帖标题',floor(1+RAND(卡塔尔*10000000));
set @vpostdate=unix_timestamp(DATE_FORMAT(LOCALTIME()[email protected],'%Y-%m-%d %H:%i:%S'));

set @vip='211.161.61.12';
set @vmessagea=concat('发帖内容',floor(1+RAND(卡塔尔国*10000000),'\r\n');
set @vporta=floor(10000+RAND()*55535);

#set @vportb=floor(10000+RAND()*55535);
set @vmessageb=concat('回复的第',@vtid,'个帖子的内容'卡塔尔(英语:State of Qatar);

#3新添发送帖子的音讯
INSERT INTO `tps_forum_post` (`pid`, `fid`, `tid`, `first`, `author`, `authorid`, `subject`, `dateline`, `message`, `useip`, `port`,
`科技世界,invisible`, `anonymous`, `usesig`, `htmlon`, `bbcodeoff`, `smileyoff`, `parseurloff`, `attachment`, `rate`, `ratetimes`, `status`, `tags`, `comment`, `replycredit`, `position`)
VALUES (@vpid, @vfid, @vtid, 1, @vusernamea, @vuida, @vtitlea,@vpostdate,@vmessagea, @vip, @vporta, 0, 0, 1, 0, -1, -1, 0, 0, 0, 0, 0, '', 0, 0, 1);

#摩登主题音信表
INSERT INTO `tps_forum_newthread` (`tid`, `fid`, `dateline`) VALUES (@vtid,@vfid, @vpostdate);

#分表协和新闻表
insert into tps_forum_post_tableid values();

#假定1个帖子有50000个回复
set @j=1;
while(@j<[email protected])
do
#获取回帖的storeid username
select m.uid,m.username into @vuidb,@vusernameb from tps_common_member m where m.uid>4 and m.`status`=0 order by rand() limit 1000,1;

#获取pid
select ifnull(max(pid)+1,1) into @vpid from tps_forum_post;

set @vreplaydate=unix_timestamp(DATE_FORMAT(LOCALTIME()[email protected],'%Y-%m-%d %H:%i:%S'));

set @[email protected]+1;

#2分表协和表
insert into tps_forum_post_tableid values();

#3新扩充回复帖子的消息
INSERT INTO `tps_forum_post` (`pid`, `fid`, `tid`, `first`, `author`, `authorid`, `subject`, `dateline`, `message`, `useip`, `port`,
`invisible`, `anonymous`, `usesig`, `htmlon`, `bbcodeoff`, `smileyoff`, `parseurloff`, `attachment`, `rate`, `ratetimes`, `status`, `tags`, `comment`, `replycredit`, `position`)
VALUES (@vpid, @vfid, @vtid, 0, @vusernameb, @vuidb, '', @vreplaydate, @vmessageb, @vip, @vporta, 0, 0, 1, 0, -1, -1, 0, 0, 0, 0, 0, '0', 0, 0, @vposition);

#核心参与者记录表,第二个回复的帖子音信
INSERT INTO `tps_forum_threadpartake` (`tid`, `uid`, `dateline`)
select tid,authorid,dateline
from tps_forum_post where [email protected] and [email protected] and first=0 and position=2;

#核心到场者记录表,第@vCount2+1个回复的帖子音信
INSERT INTO `tps_forum_threadpartake` (`tid`, `uid`, `dateline`)
select tid,authorid,dateline
from tps_forum_post where [email protected] and [email protected] and first=0 and [email protected]+1;

COMMIT;

set @[email protected]+1;
end while;

#获取position
select max(position) into @vposition from tps_forum_post where first=0 and [email protected];
select count(0) into @vreplay from tps_forum_post where first=0 and [email protected];
select max(dateline) into @vreplaydate from tps_forum_post where first=0 and [email protected];

#1论坛主题消息表
INSERT INTO `tps_forum_thread` (`tid`, `fid`, `posttableid`, `typeid`, `sortid`, `readperm`, `price`, `author`, `authorid`, `subject`, `dateline`, `lastpost`,
`lastposter`, `views`, `replies`, `displayorder`, `highlight`, `digest`, `rate`, `special`, `attachment`, `moderated`, `closed`, `stickreply`, `recommends`,
`recommend_add`, `recommend_sub`, `heats`, `status`, `isgroup`, `favtimes`, `sharetimes`, `stamp`, `icon`, `pushedaid`, `cover`, `replycredit`, `relatebytag`,
`maxposition`, `bgcolor`, `comments`, `hidden`)
VALUES (@vtid,@vfid, 0, 0, 0, 0, 0, @vusernamea, @vuida, @vtitlea, @vpostdate, @vreplaydate,@vusernamea, floor(1000+rand()*10000), @vreplay, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, floor(0+rand()*2), 32, 0, 0, 0, -1, -1, 0, 0, 0, '0', @vposition, '', 0, 0);

#获得版块内大旨数量
select count(0) into @vthreadCount from tps_forum_thread where [email protected];

#赢得版块内发帖子数量
select count(0) into @vpostCount from tps_forum_post where first=1 and [email protected];

#收获前天发帖数量
select count(0) into @vtodayposts from tps_forum_post where first=1 and [email protected]
and dateline>=unix_timestamp(date_format(localtime(),'%Y-%m-%d')) and
dateline<=unix_timestamp(DATE_ADD(date_format(localtime(),'%Y-%m-%d'),INTERVAL 24*60*60-1 SECOND));

#获得发帖综合消息
select fp.pid,fp.message,fp.dateline,fp.author into @vpid,@vmessage,@vdateline,@vauthor
from tps_forum_post fp where first=1 and [email protected] order by dateline desc limit 1;

#更新版块表中 宗旨 帖子 几如今发帖数据 及发帖综合音讯
update tps_forum_forum ff set [email protected],[email protected],[email protected],
ff.lastpost=concat(@vpid,@vmessage,@vdateline,@vauthor) where [email protected];

COMMIT;

set @[email protected]+1;

END WHILE;
end $$
delimiter ;

call 数据库名称1.囤积进程名称(3,10卡塔尔(قطر‎;

USE 数据库名称1; DROP PROCEDURE IF EXISTS 数据库名称1.囤积进程名称...

set @vreplaydate=unix_timestamp(DATE_FORMAT(LOCALTIME()+@vintervalb,'%Y-%m-%d %H:%i:%S'));

PS:对原来的小说件的更改很大,程序中注释已经很详细,这里就十分的少说了。 复制代码 代码如下:$forum[name] $navigation"; $navtitle = $navtitle.strip_tags.' - '; if($forum['type'] == 'sub') { $query = $db->query("SELECT name, fid FROM {$tablepre}forums WHERE fid='$forum[fup]'"); $fup = $db->fetch_array; $navigation = "» $fup[name] $navigation"; $navtitle = $navtitle.strip_tags.' - '; } $special = empty || !is_numeric || $special < 0 || $special > 6 ? 0 : intval; $allowpostattach = !empty($forum['allowpostattach']) || (!$forum['postattachperm'] && $allowpostattach) || ($forum['postattachperm'] && forumperm($forum['postattachperm'])); $attachextensions = $forum['attachextensions'] ? $forum['attachextensions'] : $attachextensions; $enctype = $allowpostattach ? 'enctype="multipart/form-data"' : ''; $maxattachsize_kb = $maxattachsize / 1000; $postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post']; $replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply']; $digestcredits = $forum['digestcredits'] ? $forum['digestcredits'] : $creditspolicy['digest']; $postattachcredits = $forum['postattachcredits'] ? $forum['postattachcredits'] : $creditspolicy['postattach']; $maxprice = isset($extcredits[$creditstrans]) ? $maxprice : 0; $extra = rawurlencode; $blogcheck = empty && empty ? '' : 'checked="checked"'; $notifycheck = empty ? '' : 'checked="checked"'; $stickcheck = empty ? '' : 'checked="checked"'; $digestcheck = empty ? '' : 'checked="checked"'; $subject = isset ? dhtmlspecialchars)) : ''; $message = isset ? censor : ''; $readperm = isset ? intval : 0; $price = isset ? intval : 0; $urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = ''; $seccodecheck = && (!$seccodedata['minposts'] || $posts < $seccodedata['minposts']); $secqaacheck = $secqaa['status'][2] && (!$secqaa['minposts'] || $posts < $secqaa['minposts']); if($iscircle = $supe['status'] && $supe['circlestatus'] && $forum['status'] == 2) { unset($forum['threadtypes']); } $allowpostpoll = $allowpost && $allowpostpoll && ($forum['allowpostspecial'] & 1); $allowposttrade = $allowpost && $allowposttrade && ($forum['allowpostspecial'] & 2); $allowpostreward = $allowpost && $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]); $allowpostactivity = $allowpost && $allowpostactivity && ($forum['allowpostspecial'] & 8); $allowpostdebate = $allowpost && $allowpostdebate && ($forum['allowpostspecial'] & 16); $allowpostvideo = $allowpost && $allowpostvideo && ($forum['allowpostspecial'] & 32) && $videoopen; $allowanonymous = $forum['allowanonymous'] || $allowanonymous ? 1 : 0; $editorid = 'posteditor'; $editoroptions = str_pad(decbin, 2, 0, STR_PAD_LEFT); $editormode = $editormode == 2 ? $editoroptions{0} : $editormode; $allowswitcheditor = $editoroptions{1}; $advanceeditor = $special ? 0 : 1; $previewdisplay = !empty ? '' : 'none'; if($action == 'newthread') { //复制newthread.inc.php $discuz_action = 11; if || $forum['type'] == 'group') { exit; } $isblog = empty ? '' : 'yes'; if($subject == '' || $message == '') { exit; } if($post_invalid = checkpost { exit; } if($allowpostattach && is_array { foreach($_FILES['attach']['name'] as $attachname) { if { checklowerlimit; break; } } } $typeid = isset && isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0; $iconid = !empty && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0; $displayorder = $modnewthreads ? -2 : (($forum['ismoderator'] && !empty ? 1 : 0); $digest = ($forum['ismoderator'] && !empty ? 1 : 0; $blog = $allowuseblog && $forum['allowshare'] && !empty ? 1 : 0; $readperm = $allowsetreadperm ? $readperm : 0; $isanonymous = $isanonymous && $allowanonymous ? 1 : 0; $price = intval; $price = $maxprice && !$special ? ($price <= $maxprice ? $price : $maxprice) : 0; //echo $typeid.','.','.',' if(!$typeid && $forum['threadtypes']['required'] && !$special) { // exit; } $discuz_user=$_POST['username']; $discuz_user = checkAndTranslate; $sql_tmp = "SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'"; $query =$db->query; if ($rs=$db->fetch_row{ list($discuz_uid,$discuz_pw, $discuz_secques 卡塔尔(英语:State of Qatar) =$rs; } else { // exit('不设有的客商名'.$discuz_user); exit; } //var_dump;exit('
this.line='.__line__卡塔尔(英语:State of Qatar); $messages = explode; //是不是供给去除对最棒答案的商讨 //$messages = array_merge(array_slice, array_slice; $mc = count; $replycount = $mc -1; $author = !$isanonymous ? $discuz_user : ''; $moderated = $digest || $displayorder > 0 ? 1 : 0; $attachment = ($allowpostattach && $attachments = attach_upload ? 1 : 0; $subscribed = !empty && $discuz_uid ? 1 : 0; $supe_pushstatus = $supe['status'] && $forum['supe_pushsetting']['status'] == 1 && !$modnewthreads ? '1' : '0'; $sgidadd1 = $sgidadd2 = ''; if { $sgidadd1 = ', sgid'; $sgidadd2 = ", '$sgid'"; } /*预管理数量*/ //$price = mt_rand; $price = 0; $views = mt_rand; $timestamp = mt_rand(strtotime ,strtotime; $tagstatus = 0; $tags = ""; //已解决: //$price = -$price; //$closed = 1; //未解决: $closed = 0; $db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, blog,attachment, subscribed, moderated, supe_pushstatus $sgidadd1 ,special ,closed ,views) VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$author', '$discuz_uid', '".checkAndTranslate."', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest', '$blog', '$attachment', '$subscribed', '$moderated', '$supe_pushstatus' $sgidadd2 ,0 ,$closed ,$views )"); $tid = $db->insert_id(); // making reward logs ! $db->query("INSERT INTO {$tablepre}rewardlog (tid,authorid,netamount,dateline) VALUES ('$tid', '$discuz_uid', '$price', '0')"); // updating members logs ! //if minus credits ? //$db->query("UPDATE {$tablepre}members SET posts=posts+1,credits=credits+$price,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); $db->query("UPDATE {$tablepre}members SET posts=posts+1,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); if { $db->query("REPLACE INTO {$tablepre}subscriptions (uid, tid, lastpost, lastnotify) VALUES ('$discuz_uid', '$tid', '$timestamp', '$timestamp')", 'UNBUFFERED'); } $db->query("REPLACE INTO {$tablepre}mythreads (uid, tid, dateline, special) VALUES ('$discuz_uid', '$tid', '$timestamp', '0')", 'UNBUFFERED'); if { updatemodlog($tid, ($displayorder > 0 ? 'STK' : 'DIG')); updatemodworks(($displayorder > 0 ? 'STK' : 'DIG'), 1); } if($forum['threadtypes']['special'][$typeid] && $optiondata && is_array { foreach($optiondata as $optionid => $value) { $db->query("INSERT INTO {$tablepre}typeoptionvars (typeid, tid, optionid, value, expiration) VALUES ('$typeid', '$tid', '$optionid', '$value', '".($typeexpiration ? $timestamp + $typeexpiration : 0)."')"); } } $bbcodeoff = checkbbcodes($message, !empty; $smileyoff = checksmilies($message, !empty; $parseurloff = !empty; //$htmlon = bindec(($tagstatus && !empty.($allowhtml && !empty; $htmlon = 1; $pinvisible = $modnewthreads ? -2 : 0; $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '".checkAndTranslate."', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')"); $pid = $db->insert_id(); if($tagstatus && $tags != '') { $tags = str_replace.chr.chr.chr, ' ', $tags); $tagarray = array_unique(explode; $tagcount = 0; foreach($tagarray as $tagname) { $tagname = trim; if(preg_match{3,20}$/', $tagname)) { $query = $db->query("SELECT closed FROM {$tablepre}tags WHERE tagname='".checkAndTranslate; if) { if(!$tagstatus = $db->result { $db->query("UPDATE {$tablepre}tags SET total=total+1 WHERE tagname='".checkAndTranslate."'", 'UNBUFFERED'); } } else { $db->query("INSERT INTO {$tablepre}tags (tagname, closed, total) VALUES ('".checkAndTranslate."', 0, 1)", 'UNBUFFERED'); $tagstatus = 0; } if { $db->query("INSERT {$tablepre}threadtags VALUES ('".checkAndTranslate."', $tid)", 'UNBUFFERED'); } $tagcount++; if { unset; break; } } } } $tradeaid = 0; if { $searcharray = $pregarray = $replacearray = array(); foreach($attachments as $key => $attach) { $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); $searcharray[] = '[local]'.$localid[$key].'[/local]'; $pregarray[] = '/\[localimg=\]'.$localid[$key].'\[\/localimg\]/is'; $replacearray[] = '[attach]'.$db->insert_id().'[/attach]'; } $message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); $db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate."' WHERE pid='$pid'"); updatecredits($discuz_uid, $postattachcredits, count; } if { supe_dbconnect(); $query = $supe['db']->query("UPDATE {$supe[tablepre]}groups SET lastpost='$timestamp' WHERE gid='$sgid'", 'SILENT'); } if { $db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); } else { if { foreach($digestcredits as $id => $addcredits) { $postcredits[$id] = (isset ? $postcredits[$id] : 0) + $addcredits; } } updatepostcredits('+', $discuz_uid, $postcredits); $subject = str_replace; $lastpost = "$tid\t".checkAndTranslate."\t$timestamp\t$author"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'卡塔尔; } } echo; } if { //早先发布回复 $discuz_action = 12; require_once DISCUZ_ROOT.'./include/forum.func.php'; print_r; $replyusers = explode; $reusercount = count; for($re=1;$re<=$replycount;$re++) { $index = mt_rand; while( in_array || $replyusers[$index] ==$_POST['username'] ){ $index = mt_rand; } $post_arr[] = $index; $discuz_user = $replyusers[$index]; $discuz_user = checkAndTranslate; $query =$db->query("SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'"); if ($rs=$db->fetch_row{ list($discuz_uid,$discuz_pw, $discuz_secques 卡塔尔 =$rs; } else { echo('官样文章的顾客名'.$discuz_user); continue; } $attachnum = 0; if($allowpostattach && !empty && is_array { foreach($_FILES['attach']['name'] as $attachname) { if { $attachnum ++; } } $attachnum && checklowerlimit($postattachcredits, $attachnum); } else { $_FILES = array(); } $attachments = $attachnum ? attach_upload; $attachment = empty ? 0 : 1; $subscribed = $thread['subscribed'] && $timestamp - $thread['lastpost'] < 7776000; $newsubscribed = !empty && $discuz_uid; if($subscribed && !$modnewreplies) { $db->query("UPDATE {$tablepre}subscriptions SET lastpost='$timestamp' WHERE tid='$tid' AND uid<>'$discuz_uid'", 'UNBUFFERED'); } if { $db->query("REPLACE INTO {$tablepre}subscriptions (uid, tid, lastpost, lastnotify) VALUES ('$discuz_uid', '$tid', '".($modnewreplies ? $thread['lastpost'] : $timestamp)."', '$timestamp')", 'UNBUFFERED'); } $bbcodeoff = checkbbcodes($message, !empty; $smileyoff = checksmilies($message, !empty; $parseurloff = !empty; // $htmlon = $allowhtml && !empty ? 1 : 0; $htmlon = 1; $usesig = !empty ? 1 : 0; $isanonymous = $allowanonymous && !empty? 1 : 0; //$discuz_user = checkAndTranslate; $author = empty ? $discuz_user : ''; $pinvisible = $modnewreplies ? -2 : 0; $rand_time = mt_rand; $timestamp = $timestamp

mysql存款和储蓄进度例子(插入数据到差别的分表卡塔尔,mysql存款和储蓄进程

USE test;
DROP PROCEDURE IF EXISTS test.generate_records;
delimiter $$
CREATE PROCEDURE test.generate_records(in v_count bigint,in v_phone bigint)
BEGIN
set @vCount=v_count;
set @vPhone=v_phone;
set @vLoopCount=3;
set @i=1;

while(@i<[email protected])
do
set @[email protected]+1;

select max(id)+1 into @vPersonId from person;

#person_0~9 顾客个人新闻表
set @vcounta=1;
while(@vcounta<[email protected]*5)
do
#获得顾客个人新闻表的主键
set @vSqlStr1=concat('select IF(length(max(id))<>0,max(id)+1,2) into');
set @vSqlStr2=concat(' @vPersonId');
set @vSqlStr3=concat(' from person_',@vPersonId%10);
set @vSqlStr=concat(@vSqlStr1,@vSqlStr2,@vSqlStr3);

prepare stmt from @vSqlStr;
execute stmt;
deallocate prepare stmt;

set @vtype=FLOOR(1+RAND()*3);

if @vtype=1 then
set @vother=concat('是老客商',@i卡塔尔(英语:State of Qatar);
elseif @vtype=2 then
set @vother=concat('是新客商',@i卡塔尔;
else
set @vother=concat('是不合规客商',@i卡塔尔;
end if;

#用户个人音信表表 pk=personId 顾客id
set @vSqlStr1=concat('insert into `person_',@vPersonId%10,'`');
set @vSqlStr2=concat(' (`personId`,`phone`, `personName`, `age`, `sex`, `intertest`, `income`, `other`, `created`, `updated`, `status`)');
set @vSqlStr3=concat(" VALUES (",@vPersonId,", ",@vPhone,",",@vPersonName,",",FLOOR(18+RAND()*68),", ",FLOOR(1+RAND()*1),",",FLOOR(0+RAND()*10),",
",FLOOR(8000+RAND()*10000),", ",@vother,", ",localtime(),", ",localtime(),",",FLOOR(1+RAND()*2),")");
set @vSqlStr=concat(@vSqlStr1,@vSqlStr2,@vSqlStr3);

prepare stmt from @vSqlStr;
execute stmt;
deallocate prepare stmt;

set @[email protected]+1;

end while;

COMMIT;

set @[email protected]+1;

END WHILE;

select @vPersonId,@vPhone;

end $$
delimiter ;

CALL test.generate_records(10,10200000001);

USE test; DROP PROCEDURE IF EXISTS test.generate_records; delimiter $$ CREATE PROCEDURE test.generate_re...

#核心加入者记录表,第@vCount2+1个回复的帖子新闻
INSERT INTO `tps_forum_threadpartake` (`tid`, `uid`, `dateline`)
select tid,authorid,dateline
from tps_forum_post where fid=@vfid and tid=@vtid and first=0 and position=@vCount2+1;

  • $rand_time; $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '0', '$discuz_user', '$discuz_uid', '', '$timestamp', '".trimAndCurl."', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')"); $pid = $db->insert_id(); // updating reward logs $db->query("UPDATE {$tablepre}rewardlog SET answererid='$discuz_uid',dateline='$timestamp' WHERE tid='$tid'"); // updating members logs ! if{ //加多积分问题$db->query("UPDATE {$tablepre}members SET posts=posts+1,credits=credits+$price,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); }else{ $db->query("UPDATE {$tablepre}members SET posts=posts+1,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' "); } $db->query("REPLACE INTO {$tablepre}myposts (uid, tid, pid, position, dateline, special) VALUES ('$discuz_uid', '$tid', '$pid', '".($thread['replies'] + 1)."', '$timestamp', '0')", 'UNBUFFERED'); $tradeaid = 0; if { $searcharray = $pregarray = $replacearray = array(); foreach($attachments as $key => $attach) { $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); $searcharray[] = '[local]'.$localid[$key].'[/local]'; $pregarray[] = '/\[localimg=\]'.$localid[$key].'\[\/localimg\]/is'; $insertid = $db->insert_id(); $replacearray[] = '[attach]'.$insertid.'[/attach]'; } if && $thread['special'] == 2 && !empty($_FILES['tradeattach']['tmp_name'][0])) { $tradeaid = $insertid; } $message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); $db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate."' WHERE pid='$pid'"); updatecredits($discuz_uid, $postattachcredits, count; } if { $db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if { $db->query("UPDATE {$tablepre}threads SET subscribed='1' WHERE tid='$tid'", 'UNBUFFERED'); } } else { $db->query("UPDATE {$tablepre}threads SET lastposter='$author', lastpost='$timestamp', replies=replies+1 ".($attachment ? ', attachment=\'1\'' : '').", subscribed='".($subscribed || $newsubscribed ? 1 : 0)."' WHERE tid='$tid'", 'UNBUFFERED'); updatepostcredits('+', $discuz_uid, $replycredits); $lastpost = "$thread[tid]\t".checkAndTranslate."\t$timestamp\t$author"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'卡塔尔; } } echo "成功回复"; } } //exit('Run end.this.line='.__line__);

#获取tid
select ifnull(max(tid)+1,1) into @vtid from tps_forum_post;

#获取pid
select ifnull(max(pid)+1,1) into @vpid from tps_forum_post;

#得到版块内发帖子数量
select count(0) into @vpostCount from tps_forum_post where first=1 and fid=@vfid;

END WHILE;
end $$
delimiter ;

#获取position
select max(position) into @vposition from tps_forum_post where first=0 and tid=@vtid;
select count(0) into @vreplay from tps_forum_post where first=0 and tid=@vtid;
select max(dateline) into @vreplaydate from tps_forum_post where first=0 and tid=@vtid;

#新颖大旨新闻表
INSERT INTO `tps_forum_newthread` (`tid`, `fid`, `dateline`) VALUES (@vtid,@vfid, @vpostdate);

#得到不久前发帖数量
select count(0) into @vtodayposts from tps_forum_post where first=1 and fid=@vfid
and dateline>=unix_timestamp(date_format(localtime(),'%Y-%m-%d')) and
dateline<=unix_timestamp(DATE_ADD(date_format(localtime(),'%Y-%m-%d'),INTERVAL 24*60*60-1 SECOND));