111,126
社区成员
发帖
与我相关
我的任务
分享sub page_load()
logreset
issearch=false
isselect=false
canpost=false
id=isnum(request("id"))
dim t1 as datatable
t1=sqldatatable("select top 1 * from ***** where id="& id,1,"cc")
if t1.rows.count=0 then err_norecord
cid=t1.rows(0)("clas")
forecharm=t1.rows(0)("forecharm")
allcount=t1.rows(0)("times")
if t1.rows(0)("mbid")=14 and t1.rows(0)("mbcode")="****" then issearch=true
if t1.rows(0)("onerate")=0 then isselect=true
head_title=t1.rows(0)("title") &"-"& head_title
mainre.datasource=t1
mainre.databind
dim lastnext,wrongtxt,candis
wrongtxt=""
candis=true
lastnext=sqlsum("select top 1 convert(varchar,id)+'(0)'+title from ***** where id<"& id &" order by id desc",1)
if lastnext<>"" then lastone.text="<a href='display.aspx?id="& split(lastnext,"(0)")(0) &"'>"& getleft(split(lastnext,"(0)")(1),20) &"</a>"
lastnext=sqlsum("select top 1 convert(varchar,id)+'(0)'+title from ***** where id>"& id &" order by id asc",1)
if lastnext<>"" then nextone.text="<a href='display.aspx?id="& split(lastnext,"(0)")(0) &"'>"& getleft(split(lastnext,"(0)")(1),20) &"</a>"
if longmbid=0 then
mycharm=0
else
mycharm=sqlsum("select top 1 mbcharm from ***** where mbid="& longmbid,1)
if longmbid=t1.rows(0)("mbid") then subundo.visible=true
end if
printjs("var mycharm="& mycharm)
if t1.rows(0)("isok") then
candis=false
if t1.rows(0)("isbad") then
lastate.text="此竞猜已于 "& t1.rows(0)("badtime") &" 被处罚,处罚原因:<br>"& t1.rows(0)("badtxt")
else
lastate.text="此竞猜已于 "& t1.rows(0)("givetime") &" 正常关闭或撤销<br>正确答案:"& t1.rows(0)("answertxt") &" 本题坐庄会员获得 "& t1.rows(0)("lastcharm") &" 收益"
end if
betcharm2.visible=false
okpan.visible=false
else
if datediff("h",t1.rows(0)("timeend"),datetime.now)>48 and not issearch then
dim tt2,iic
tt2=sqldatatable("select id,mbid,givecharm from ***** where isok=0 and bid="& id,1,"cc36")
for iic=0 to tt2.rows.count-1
sqlexecute("update ***** set isok=1,backcharm=givecharm where id="& tt2.rows(iic)("id"),1)
admincharm(tt2.rows(iic)("givecharm"),61,tt2.rows(iic)("mbid"))
next
sqlexecute("update ***** set isok=1,givetime=getdate(),isbad=1,badtime=getdate(),lastcharm=-"& forecharm &",badtxt='由于坐庄会员没能在结束时间后48小时内给出结果,系统自动扣除200积分' where id="& id,1)
adminpoint(-200,46,t1.rows(0)("mbid"))
sayerr("该问题违规,现已经自动处理!","display.aspx?id="& id)
elseif datediff("h",t1.rows(0)("timeend"),datetime.now)>1 then
dim cansend
cansend=false
if isdbnull(t1.rows(0)("iswake")) then
cansend=true
else
if not(t1.rows(0)("iswake")) then cansend=true
end if
if cansend and not issearch then
sqlexecute("insert into *****(fromuserid,touserid,content,new) values(16,"& t1.rows(0)("mbid") &",'重要提醒-您的竞猜题目: ""& t1.rows(0)("title") &"" 竞猜截止时间已到,请注意及时给出结果,以免于 <b>减200积分</b> 的处罚,谢谢。<br><a href=http://www.searchina.net.cn/amuse/display.aspx?id="& id &" target=_blank><b>点击此处查看该题</b></a>|"& datetime.now &"',1)",1)
sqlexecute("update ***** set iswake=1 where id="& id,1)
end if
end if
end if
if longmbid=0 then
if wrongtxt="" then wrongtxt=logfirst("/amuse/display.aspx?id="& id,"开始下注")
candis=false
elseif datetime.now<t1.rows(0)("timestart") then
if wrongtxt="" then wrongtxt="对不起,下注期限尚未开始"
candis=false
elseif datetime.now>t1.rows(0)("timeend") then
if wrongtxt="" then wrongtxt="对不起,下注期限已经结束"
candis=false
elseif longmbid=t1.rows(0)("mbid") then
if wrongtxt="" then wrongtxt="对不起,出题人不可以下注"
candis=false
else
if mycharm<10 then
if wrongtxt="" then wrongtxt="对不起,您的魅力不到10,不可下注"
candis=false
end if
end if
if t1.rows(0)("onerate")=0 then '''选择题
openq.visible=false
selectpanel.visible=true
allcharm=t1.rows(0)("allcharm")
dim temptable as datatable,ii as integer
temptable=sqldatatable("select id,distxt,times,allcharm,convert(varchar(10),rate) as rate from ***** where bid="& id &" order by id asc",1,"dd")
if t1.rows(0)("autorate")=0 then '''固定赔率
if issearch then
maxcharm="无限"
else
'''selectbutton.autopostback="false"
dim newmax
newmax=sqlsum("select sum(allcharm*rate) from ***** where bid="& id,1)
if newmax="" then newmax=0
maxcharm=forecharm - newmax
if maxcharm<0 then maxcharm=0
if maxcharm<10 then
if wrongtxt="" then wrongtxt="对不起,该题底金已不足以下注"
candis=false
canpost=false
else
canpost=true
end if
end if
else
for ii=0 to temptable.rows.count-1
if allcharm=0 then
temptable.rows(ii)("rate")=1
else
if temptable.rows(ii)("allcharm")=0 then
temptable.rows(ii)("rate")="∞"
else
temptable.rows(ii)("rate")=formatnumber(allcharm/temptable.rows(ii)("allcharm"),-1)
end if
end if
next
maxcharm="无限"
end if
if not ispostback then
for ii=0 to temptable.rows.count-1
selectbutton.items.add(new listitem("<img height=10 src='imgs/voteline.gif' width='"& (temptable.rows(ii)("allcharm")/allcharm)*150 &"'> <b>"& temptable.rows(ii)("distxt") &"</b><br> <font color=#494949>[赔率:1:"& temptable.rows(ii)("rate") &",可接受下注额<font color=#0283FF>"& selectmax(maxcharm,temptable.rows(ii)("rate")) &"</font>,下注情况:下注"& temptable.rows(ii)("times") &"次,下注额"& temptable.rows(ii)("allcharm") &"]</font>",temptable.rows(ii)("id")))
next
end if
else
openq.visible=true
selectpanel.visible=false
openrate=t1.rows(0)("onerate")
if issearch then
maxcharm="无限"
else
dim tempnum
tempnum=sqlsum("select sum(givecharm) from ***** where bid="& id,1)
if tempnum="" then tempnum=0
maxcharm=clng((forecharm - (clng(tempnum)*openrate))/openrate)
maxcharm=clng(maxcharm)
if maxcharm<10 and subs.visible=true then
if wrongtxt="" then wrongtxt="对不起,该题底金已不足以下注"
candis=false
end if
end if
end if
maxcharms.text=maxcharm
if wrongtxt<>"" then wrong2.text=wrongtxt
subs.visible=candis
'''if canpost and candis then selectbutton.autopostback=true
if selectbutton.selectedindex<>-1 then givemax(selectbutton.selecteditem.text)
if issearch and lastate.text="请注意:坐庄会员请在下注结束时间到期后48小时内公布结果" then lastate.text=""
printjs("var maxcharm='"& maxcharm &"'")
if not page.ispostback then
page_allload()
sqlexecute("update ***** set click=click+1 where id="& id,1)
recent.datasource=sqlreader("select mbcode,time1,atxt,givecharm,backcharm from ***** where bid="& id &" order by id desc",1)
recent.databind
end if
end subdim constr1 as string=configurationsettings.appsettings("sqlconstr1")
dim constr2 as string=configurationsettings.appsettings("sqlconstr2")
dim conn as sqlconnection
dim objcmd as new sqlcommand
dim objread as sqldatareader
function sqlexecute(sqlstr as string,constr as string)
if isnothing(conn) then conn=new sqlconnection
if conn.state=1 then conn.close
if constr="1" then
conn.connectionstring=constr1
else
conn.connectionstring=constr2
end if
dim sqlexecute_end as long
try
conn.open
objcmd.connection=conn
objcmd.commandtext=sqlstr
sqlexecute_end=objcmd.executenonquery()
catch
dealerr
end try
conn.close
return sqlexecute_end
end function
function sqlsum(sqlstr as string,constr as string) as string
if isnothing(conn) then conn=new sqlconnection
if conn.state=1 then conn.close
if constr="1" then
conn.connectionstring=constr1
else
conn.connectionstring=constr2
end if
dim sqlsum_end
try
conn.open
objcmd.connection=conn
objcmd.commandtext=sqlstr
sqlsum_end=objcmd.executescalar()
catch
dealerr
end try
conn.close
if isdbnull(sqlsum_end) then
return ""
else
return sqlsum_end
end if
end function
function sqlreader(sqlstr as string,constr as string)
if isnothing(conn) then conn=new sqlconnection
if conn.state=1 then conn.close
if constr="1" then
conn.connectionstring=constr1
else
conn.connectionstring=constr2
end if
try
conn.open
objcmd.connection=conn
objcmd.commandtext=sqlstr
return objcmd.executereader()
catch
dealerr
end try
end function
function sqldataset(sqlstr as string,constr as string) as dataset
if isnothing(conn) then conn=new sqlconnection
if conn.state=1 then conn.close
if constr="1" then
conn.connectionstring=constr1
else
conn.connectionstring=constr2
end if
try
dim mydataset_func as new dataset
conn.open
dim mydataadapter as new sqldataadapter(sqlstr,conn)
mydataadapter.fill(mydataset_func,"customers")
return mydataset_func
catch
dealerr
end try
end function
function sqldatatable(sqlstr as string,constr as string,tablename as string) as datatable
if isnothing(conn) then conn=new sqlconnection
if conn.state=1 then conn.close
if constr="1" then
conn.connectionstring=constr1
else
conn.connectionstring=constr2
end if
try
dim mydataset_func as new dataset
dim table_func as datatable
conn.open
dim mydataadapter as new sqldataadapter(sqlstr,conn)
mydataadapter.fill(mydataset_func,tablename)
table_func=mydataset_func.tables(tablename)
return table_func
catch
dealerr
end try
end function