diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-10-14 21:33:33 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-10-14 21:33:33 +0800 |
commit | 994e44a546b9e0a7bfbbd3ee935a3882b780f2cc (patch) | |
tree | 680a6d8cdc213480bc7d6aae28d441bd8952d4e9 /mbbsd | |
parent | 50f20458362cbf06180c0cddd570db13d5c44c87 (diff) | |
download | pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar.gz pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar.bz2 pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar.lz pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar.xz pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.tar.zst pttbbs-994e44a546b9e0a7bfbbd3ee935a3882b780f2cc.zip |
1. add feature assessment of article and sale
2. add file pttbbs/util/cleanshm.c to help clean unused var in PASSWD
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1241 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/Makefile | 4 | ||||
-rw-r--r-- | mbbsd/assess.c | 55 | ||||
-rw-r--r-- | mbbsd/bbs.c | 50 |
3 files changed, 91 insertions, 18 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index e6a9adbd..b1bb69d6 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -8,8 +8,8 @@ LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient .endif PROG= mbbsd -OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ - chat.o chc.o chicken.o dark.o\ +OBJS= admin.o announce.o args.o assess.o bbs.o board.o cache.o cal.o\ + card.o chat.o chc.o chicken.o dark.o\ edit.o friend.o gamble.o gomo.o guess.o indict.o io.o\ kaede.o lovepaper.o mail.o mbbsd.o menu.o more.o name.o osdep.o\ othello.o page.o read.o record.o register.o screen.o stuff.o\ diff --git a/mbbsd/assess.c b/mbbsd/assess.c new file mode 100644 index 00000000..cc5e84b1 --- /dev/null +++ b/mbbsd/assess.c @@ -0,0 +1,55 @@ +#include "bbs.h" + +inline static void inc(unsigned char *num) +{ + if (*num < SALE_MAXVALUE) + (*num)++; +} + +void inc_goodpost(int uid) +{ + passwd_query(uid, &xuser); + inc(&xuser.goodpost); + passwd_update(uid, &xuser); +} + +void inc_badpost(int uid) +{ + passwd_query(uid, &xuser); + inc(&xuser.badpost); + passwd_update(uid, &xuser); +} + +void inc_goodsale(int uid) +{ + passwd_query(uid, &xuser); + inc(&xuser.goodsale); + passwd_update(uid, &xuser); +} + +void inc_badsale(int uid) +{ + passwd_query(uid, &xuser); + inc(&xuser.badsale); + passwd_update(uid, &xuser); +} + +void set_assess(int uid, unsigned char num, int type) +{ + passwd_query(uid, &xuser); + switch (type){ + case GOODPOST: + xuser.goodpost = num; + break; + case BADPOST: + xuser.badpost = num; + break; + case GOODSALE: + xuser.goodsale = num; + break; + case BADSALE: + xuser.badsale = num; + break; + } + passwd_update(uid, &xuser); +} diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index d8289d7f..fa78a7d6 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1404,19 +1404,33 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t print_bidinfo(0, bidinfo); if(!bidinfo.payby) money="Ptt$ "; else money=" NT$ "; if(now>bidinfo.enddate || bidinfo.high==bidinfo.buyitnow) - { - prints("此競標已經結束,"); - if( bidinfo.userid[0]) - { - /*if(!payby && bidinfo.usermax!=-1) - {以Ptt幣自動扣款 - }*/ - prints("恭喜 %s 以 %d 得標!", bidinfo.userid, - bidinfo.high); - } - else prints("無人得標!"); - pressanykey(); - return FULLUPDATE; + { + prints("此競標已經結束,"); + if( bidinfo.userid[0]) { + /*if(!payby && bidinfo.usermax!=-1) + {以Ptt幣自動扣款 + }*/ + prints("恭喜 %s 以 %d 得標!", bidinfo.userid, + bidinfo.high); + if (!(bidinfo.flag & SALE_COMMENTED) && strcmp(bidinfo.userid, currutmp->userid)){ + char tmp = getans("您對於這次交易的評價如何? 1:佳 2:欠佳 3:普通[Q]"); + if ('1' <= tmp && tmp <= '3'){ + switch(tmp){ + case 1: + inc_goodsale(currutmp->uid); + break; + case 2: + inc_badpost(currutmp->uid); + break; + } + bidinfo.flag |= SALE_COMMENTED; + substitute_record(fpath, &bidinfo, sizeof(bidinfo), 1); + } + } + } + else prints("無人得標!"); + pressanykey(); + return FULLUPDATE; } if(bidinfo.userid[0]) { @@ -1531,9 +1545,9 @@ recommend(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } - if( fhdr->filemode & FILE_BID) - return do_bid(ent, fhdr, bp, direct, ptime); - + if( fhdr->filemode & FILE_BID){ + return do_bid(ent, fhdr, bp, direct, ptime); + } setdirpath(path, direct, fhdr->filename); @@ -1565,6 +1579,9 @@ recommend(int ent, fileheader_t * fhdr, char *direct) 51 - strlen(cuser.userid) - strlen(path), " ", fromhost, ptime->tm_mon + 1, ptime->tm_mday); do_add_recommend(direct, fhdr, ent, buf); + /* 每 10 次推文 加一次 goodpost */ + if ((fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0) + inc_goodpost(searchuser(fhdr->owner)); lastrecommend = now; return FULLUPDATE; } @@ -1708,6 +1725,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) fhdr->money = hdr.money; delete_file(genbuf, sizeof(fileheader_t), num, cmpfilename); } + inc_badpost(searchuser(fhdr->owner)); cancelpost(fhdr, not_owned); setbtotal(currbid); |