请先登录 | 注册
MM0759.COM
5.x版本 帮派每月1号自动发工资系统 - 文章首页返回版区
■标题:5.x版本 帮派每月1号自动发工资系统
■作者:IPSC [2006/2/23 17:05:19]

数额默认不能超过300,必须在faction表加一个字段用来记录工资额,只要在每月1号有人访问论坛,就能自动处理所有帮派的工资发放,不会重复发放,程序只会运行一次,不会影响BBS速度

涉及文件,setup.asp、faction.asp  

升级文件大家自己去用升级文件生成器生成 http://www.diybbsxp.com/tool
添加一个数字类型字段 givemonthgoldfaction表里,并设置值为0
不会生成的可以下载我生成好的 http://www.diybbsxp.com/dksoft/soft/up_fmgold.zip

1、上传升级文件到服务器并运行创建字段。

2、用记事本打开setup.asp,找到 sub top 并在下面新起一行加上如下代码:


'######### 发帮派工资 代码原创:IPSC
if day(date)=1 then'每月1号发工资,如果发现是1号了,开始发工资
if conn.execute("select count(*) from [faction] where givemonthgold>0 and givemonthgold<10000")(0)>0 then
'上句为判断是否有未发的,已发的值变成 值+10000,未发的即大于0小于10000
'下面得到要发工资的帮派列表 如 心帮,80|梦帮,50...
rs.open "select givemonthgold,factionname from [faction] where givemonthgold>0 and givemonthgold<10000",conn,1,3
do while not rs.eof
if allfn=empty then
allfn=rs("factionname")&","&rs("givemonthgold")
else
allfn=allfn&"|"&rs("factionname")&","&rs("givemonthgold")
end if
rs("givemonthgold")=rs("givemonthgold")+10000
rs.update
rs.movenext
loop
rs.close

'下面开始处理帮派列表
if allfn<>emtpy then
if instr(allfn,"|")>0 then
set allfn1=nothing
allfn1=split(allfn,"|")
for ii8=0 to ubound(allfn1)
gname=split(allfn1(ii8),",")(0)
ggold=cint(split(allfn1(ii8),",")(1))
rs.open "select money,newmessage,username,faction from [user] where faction='"&gname&"'",conn,1,3
do while not rs.eof
rs("money")=rs("money")+ggold
rs("newmessage")=rs("newmessage")+1
conn.execute "insert into message(author,incept,content)values('"&rs("username")&"','"&rs("username")&"','[系统提示]:您属于“"&rs("faction")&"”的成员,今天发工资,您得到的数目为:"&ggold&"')"
rs.update
rs.movenext
loop
rs.close
next
else'只有一个帮派发了工资
gname=split(allfn,",")(0)
ggold=cint(split(allfn,",")(1))
rs.open "select money,newmessage,username,faction from [user] where faction='"&gname&"'",conn,1,3
do while not rs.eof
rs("money")=rs("money")+ggold
rs("newmessage")=rs("newmessage")+1
conn.execute "insert into message(author,incept,content)values('"&rs("username")&"','"&rs("username")&"','[系统提示]:您属于“"&rs("faction")&"”的成员,今天发工资,您得到的数目为:"&ggold&"')"
rs.update
rs.movenext
loop
rs.close
end if
end if
allfn="":ggold="":gname=""
end if
else
if conn.execute("select count(*) from [faction] where givemonthgold>10000")(0)>0 then
conn.execute("update [faction] set givemonthgold=givemonthgold-10000 where givemonthgold>10000")
end if
end if
'##########发帮派工资结束

3、用记事本打开faction.asp并找到门派管理的代码段,在表格适当位置加上如下代码:


<tr class=a3>
<td>  帮派工资: </td>
<td><input size="30" name="givemonthgold" value="<%if rs("givemonthgold")>10000 then:response.write rs("givemonthgold")-10000:else:response.write rs("givemonthgold"):end if%>">
(每月1号自动发工资,有系统短讯通知) </td>
</tr>

在保存提交信息的部分加上:

givemonthgold=request.form("givemonthgold")
if not isnumeric(""&givemonthgold&"") or givemonthgold>300 then error("<li>派工资请填写数字,不能大于300元")
if givemonthgold<0 then error("<li>派工资请填写数字,不能小于0或大于300元")
if rs("givemonthgold")>10000 then givemonthgold=givemonthgold+10000
rs("givemonthgold")=givemonthgold

代码经测试,是OK的!



回复/版区/上篇/下篇/发贴/仅文字/HTML
【倒序/最近21条回复】
■作者:云涧居士 [2006/5/15 14:22:15]


(查看完整版网页)



短讯|首页|登录|算法|电脑版 .
DK MiniBBS Plus v2.0
mm0759.com
140 毫秒 .