1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include "bbs.h"
inline static void inc(unsigned char *num, int n)
{
if (SALE_MAXVALUE - *num >= n)
(*num) += n;
else
(*num) = SALE_MAXVALUE;
}
inline static void dec(unsigned char *num, int n)
{
if (*num < n)
(*num) -= n;
else
(*num) = 0;
}
void inc_goodpost(int uid, int num)
{
passwd_query(uid, &xuser);
inc(&xuser.goodpost, num);
passwd_update(uid, &xuser);
}
void inc_badpost(int uid, int num)
{
passwd_query(uid, &xuser);
inc(&xuser.badpost, num);
passwd_update(uid, &xuser);
}
void inc_goodsale(int uid, int num)
{
passwd_query(uid, &xuser);
inc(&xuser.goodsale, num);
passwd_update(uid, &xuser);
}
void inc_badsale(int uid, int num)
{
passwd_query(uid, &xuser);
inc(&xuser.badsale, num);
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);
}
|