phpwind 8.7 发布主题 分析
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
涉及到的數(shù)據(jù)表:
一、關(guān)于主題
1、pw_threads(主題表)
2、pw_tmsgs(帖子內(nèi)容信息表)
(1) 發(fā)布帖子是,主題帖子信息入庫
INSERT INTO? `pw_threads`?? SET?? `fid`? =? '2' ,? `icon`? =? '0' ,? `author`? =? 'admin' ,? `authorid`? =? '1' ,? `subject`? =? '我是標(biāo)題' ,? `ifcheck`? =? '1' ,? `type`? =? '0' ,? `postdate`? =? '1386034676' ,? `lastpost`? =? '1386034676' ,? `lastposter`? =? 'admin' ,? `hits`? =? '1' ,? `replies`? =? '0' ,? `topped`? =? '0' ,? `digest`? =? '0' ,? `special`? =? '0' ,? `state`? =? '0' ,? `ifupload`? =? '0' ,? `ifmail`? =? '0' ,? `anonymous`? =? '0' ,? `ptable`? =? '' ,? `ifmagic`? =? '0' ,? `ifhide`? =? '0' ,? `tpcstatus`? =? '0' ,? `modelid`? =? '0' ,? `frommob`? =? ''
(2) 然后帖子內(nèi)容信息入庫
INSERT INTO pw_tmsgs SET?? `tid` ='1',? `aid` ='0',? `userip` ='127.0.0.1',? `ifsign` ='1',? `buy` ='',? `ipfrom` ='本機(jī)地址
',? `tags` ='我是標(biāo)簽??? ',? `ifconvert` ='1',? `ifwordsfb` ='1',? `content` ='我是內(nèi)容
二、關(guān)于標(biāo)簽
1、pw_tags(標(biāo)簽表)
2、pw_tagdata(標(biāo)簽關(guān)系表)
(1) 首先查找標(biāo)簽是否存在
SELECT tagid FROM pw_tags WHERE tagname= '我是標(biāo)簽';
(2) 如果不存在則在標(biāo)簽表插入該標(biāo)簽,并獲得標(biāo)簽唯一id(tagid)
INSERT INTO pw_tags SET?? `tagname` ='我是標(biāo)簽',? `num` ='1';
然后在標(biāo)簽和主題關(guān)系表插入關(guān)系信息
INSERT INTO pw_tagdata (tagid,tid) VALUES? ('1','1');
三、其他
1、pw_memberdata(用戶基本信息表)
2、pw_creditlog(積分日志表)
3、pw_forumdata(版塊內(nèi)相關(guān)統(tǒng)計(jì)信息)
4、pw_weibo_content(新鮮事內(nèi)容表)
5、pw_weibo_relations(新鮮事“我關(guān)注的新鮮事”關(guān)系表)
6、pw_datanalyse(數(shù)據(jù)統(tǒng)計(jì)信息)
7、pw_member_behavior_statistic(用戶連續(xù)行為統(tǒng)計(jì)表)
(1) 更新該用戶的統(tǒng)計(jì)信息
UPDATE pw_memberdata SET money=money+1, rvrc=rvrc+10 WHERE uid= '1';
UPDATE? `pw_memberdata`?? SET?? `postnum`? =? '4' ,? `todaypost`? =? '3' ,? `monthpost`? =? '4' ,? `lastpost`? =? '1386144276' ,? `uploadtime`? =? '1386142361' ,? `uploadnum`? =? '2'? WHERE uid= '1'
(2) 更新積分日志
INSERT INTO pw_creditlog (uid,username,ctype,affect,adddate,logtype,ip,descrip) VALUES? ('1','admin','money','1','1386034676','topic_Post','127.0.0.1','[b]admin[/b] 在版塊 默認(rèn)版塊 發(fā)表主題。
獎(jiǎng)勵(lì)積分:[b]銅幣[/b],影響:+1。');
(3) 板塊統(tǒng)計(jì)信息變更
UPDATE pw_forumdata SET tpost=tpost+'1',article=article+'1',topic=topic+'1' ,lastpost= '我是標(biāo)題??? admin??? 1386034676??? read.php?tid=1&page=e#a'? WHERE fid= '2'
(4) 新鮮事入庫
INSERT INTO? `pw_weibo_content`?? SET?? `uid`? =? '1' ,? `username`? =? 'admin' ,? `content`? =? '我是內(nèi)容' ,? `postdate`? =? '1386034676' ,? `type`? =? '10' ,? `objectid`? =? '1' ,? `contenttype`? =? '0' ,? `extra`? =? 'a:4:{s:5:\"title\";s:8:\"我是標(biāo)題\";s:3:\"fid\";i:2;s:5:\"fname\";s:8:\"默認(rèn)版塊\";s:7:\"atusers\";N;}'
(5) 新鮮事“我關(guān)注的新鮮事”關(guān)系表
INSERT INTO? `pw_weibo_relations`?? SET?? `uid`? =? '1' ,? `mid`? =? '1' ,? `authorid`? =? '1' ,? `type`? =? '10' ,? `postdate`? =? '1386034676';
INSERT INTO pw_weibo_relations (uid,mid,authorid,type,postdate) SELECT a.uid,? '1' ,? '1' ,? '10' ,? '1386034676'? FROM pw_attention a LEFT JOIN pw_friends f ON a.uid=f.uid AND a.friendid=f.friendid AND f.status=0 LEFT JOIN pw_ouserdata o ON a.uid=o.uid WHERE a.friendid= '1'? AND a.uid!=a.friendid AND (o.uid IS NULL OR (o.friend_isfollow=1 AND f.uid IS NOT NULL OR o.cnlesp_isfollow=1 AND f.uid IS NULL)) ORDER BY a.joindate DESC LIMIT 1000;
(6) 數(shù)據(jù)統(tǒng)計(jì)信息
SELECT timeunit FROM pw_datanalyse WHERE tag= '1' AND action= 'memberThread';
REPLACE LOW_PRIORITY INTO pw_datanalyse (tag,action,timeunit,num) VALUES ( '1' , 'memberThread' , '1386000000' , '1' ),( '1' , 'memberThread' , '0' , '1' );
(8) 用戶連續(xù)行為統(tǒng)計(jì)表
SELECT * FROM pw_member_behavior_statistic WHERE uid= '1'? AND behavior= '3'? LIMIT 1;
INSERT INTO? `pw_member_behavior_statistic`?? SET?? `uid`? =? '1' ,? `behavior`? =? '3' ,? `lastday`? =? '1386000000' ,? `num`? =? '1';
SELECT * FROM pw_member_behavior_statistic WHERE uid= '1'? AND behavior= '2'? LIMIT 1;
INSERT INTO? `pw_member_behavior_statistic`?? SET?? `uid`? =? '1' ,? `behavior`? =? '2' ,? `lastday`? =? '1386000000' ,? `num`? =? '1';
轉(zhuǎn)載于:https://my.oschina.net/u/205403/blog/186166
總結(jié)
以上是生活随笔為你收集整理的phpwind 8.7 发布主题 分析的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux运维课程-Mysql之复制(2
- 下一篇: 编写unit test以及自动化测试We