查看: 918|回复: 1

薅羊毛了

[复制链接]

290

主题

1935

帖子

100万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1002284
    发表于 2024-3-1 19:53:02 | 显示全部楼层 |阅读模式 大佬来自 LAN
    请各位内行为我把脉:
    装好的完美银行2.1PLUS+虚拟股市1.1

    以前的数据库前缀:CDB_   {该文件夹以前被使用过----留下的原数据与新的前缀名为CCD_  的数据共存.(没留意)}
    出现股票交易后(买入能顺利交易,而买出时)出现如下:
    SQL: update cdb_stock set bargain=bargain+10,leavenum=leavenum+10,nowmoney=6.10,buy=9698,on_cash=1313671.60,total_cash=1372829.40,sellnum=sellnum+1,todaywave=todaywave+0.03,earn_cash=313671.60,totalwave=totalwave+0.03,totalnum=225054 where stockid=58
    Error: Table '04discuz.cdb_stock' doesn't exist
    数据表缺失,请恢复备份数据

    Similar error report has beed dispatched to administrator before.


    查看install_stock.php文件
    <?php
    /*
      **************************************************
      虚拟股市 v1.1 FOR Discuz! 4.0.0                  
      插件作者: skytower (http://www.worldz.net)
      技术支持: https://discuz.dismall.com
      **************************************************
    */
    require './include/common.inc.php';
    if($groupid != 1) showmessage('您不是管理员,不能使用本程序,请您立即离开!');
    include template('header');
    ?>
    <table border=0 cellspacing=<?=BORDERWIDTH?> cellpadding=<?=TABLESPACE?> width=98% align=center bgcolor="<?=BORDERCOLOR?> "class="tableborder">
    <tr><td class="header">
    <center>
    虚拟股市 v1.1 安装程序
    </center>
    </td>
    </tr>
    <?if(empty($step)){?>
    <tr><td bgcolor=<?=ALTBG2?>>
    【请仔细阅读插件文档,选择你的操作】
    <center>
    <br>
    <input type=button value="全新安装" class="bginput" onclick="location.href='install_stock.php?step=install';">  <BR>
    <br><br>  <font color=red><b>注意事项:</b></font>全新安装适用于新用户,并不保留旧有版本的数据!
    <br>
    <br>
    <input type=button value="卸载删除" class="bginput" onclick="location.href='install_stock.php?step=upgrade';">  <BR>
    <br><br>  <font color=red><b>注意事项:</b></font>此操作会删除虚拟股市的数据表,不可逆!
    </center>
    </td>
    </tr>
    </table>
    <?}elseif($step=='install'){?>
    <tr><td bgcolor=<?=ALTBG2?>>
       <b>安装注意事项:</b><br><br>
    <li>安装会新建八个数据表。以防万一请先备份</li><br>
    <li>安装完成后请进入后台导入插件数据,完成虚拟股市的基本设置</li><br>
    <li><font color=red>安装完成后,必定要删除install_stock.php</font></li><br><br>
      点击按钮开始安装    <input type=button value="开始安装" class="bginputbegin" onclick="location.href='install_stock.php?step=doinstall&insertnew=0';">
    </td>
    </tr>
    </table>
    <?}elseif($step=='upgrade'){?>
    <tr><td bgcolor=<?=ALTBG2?>>
       <b>卸载注意事项:</b><br><br>
    <li>注意:此操作不可逆!</li><br>
    <li>卸载会删除八个数据表。另外插件数据请在卸载后自行在后台的插件设置删除.</li><br>
    <li><font color=red>卸载完成后,必定要删除install_stock.php</font></li><br><br>
      点击按钮开始卸载    <input type=button value="开始卸载" class="bginputbegin" onclick="location.href='install_stock.php?step=dodel';">
    </td>
    </tr>
    </table>
    <?}elseif($step=='dodel'){
    [size=red] $db->query("DROP TABLE IF EXISTS {$tablepre}ai;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}bighome;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}client;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}gupiaoconfig;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}personalstock;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}rndevent;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}stock;");
                   $db->query("DROP TABLE IF EXISTS {$tablepre}stocknews;");
    ?>
    <tr><td bgcolor=<?=ALTBG2?>>
    <center>
    <b>虚拟股市 v1.1 For Discuz! 4.0.0 数据表卸载完成。</b><br>  <font color=red><b>请立即删除 install_stock.php 文件。</b></font>
    <br>
    有关虚拟股市网址<a href="http://www.worldz.net">http://www.worldz.net</a>
    </center>
    </td></tr>
    </table>
    <?
    }elseif($step=='doinstall'){
                     
    $db->query("DROP TABLE IF EXISTS {$tablepre}ai;");
    $db->query("CREATE TABLE {$tablepre}ai (
      id mediumint(8) unsigned NOT NULL auto_increment,
      ainame varchar(50) NOT NULL default '',
      cash double NOT NULL default '0',
      fund double NOT NULL default '0',
      stocktypenum int(10) NOT NULL default '0',
      todaybuy int(10) NOT NULL default '0',
      todaysale int(10) NOT NULL default '0',
      totalbuy double NOT NULL default '0',
      totalsale double NOT NULL default '0',
      aid int(10) NOT NULL default '0',
      PRIMARY KEY  (id)
    ) TYPE=MyISAM AUTO_INCREMENT=3 ;");

    $db->query("insert into {$tablepre}ai set ainame='炒股王',cash=1000000,fund=1000000,stocktypenum=0,todaybuy=0,todaysale=0,totalbuy=0,totalsale=0,aid=-1;");
    $db->query("insert into {$tablepre}ai set ainame='大炒家',cash=1000000,fund=1000000,stocktypenum=0,todaybuy=0,todaysale=0,totalbuy=0,totalsale=0,aid=-2;");


    $db->query("DROP TABLE IF EXISTS {$tablepre}bighome;");
    $db->query("CREATE TABLE {$tablepre}bighome (
      acc varchar(50) NOT NULL default '',
      stockid int(10) NOT NULL default '0',
      buymoney float NOT NULL default '0',
      num double NOT NULL default '0',
      averagemoney float NOT NULL default '0',
      work varchar(50) NOT NULL default '',
      buytime int(10) NOT NULL default '0',
      saletime int(10) NOT NULL default '0',
      uid int(10) NOT NULL default '0'
    ) TYPE=MyISAM;");

    $db->query("DROP TABLE IF EXISTS {$tablepre}client;");
    $db->query("CREATE TABLE {$tablepre}client (
      id mediumint(8) unsigned NOT NULL auto_increment,
      acc varchar(50) NOT NULL default '',
      money bigint(100) NOT NULL default '0',
      allmoney bigint(100) NOT NULL default '0',
      ynlock int(6) NOT NULL default '0',
      numtype int(10) NOT NULL default '0',
      nowbuy int(100) NOT NULL default '0',
      nowsell int(100) NOT NULL default '0',
      opendate int(10) NOT NULL default '0',
      lastdate int(10) NOT NULL default '0',
      allbuy int(100) NOT NULL default '0',
      allsell int(100) NOT NULL default '0',
      style int(10) NOT NULL default '0',
      PRIMARY KEY  (id)
    ) TYPE=MyISAM AUTO_INCREMENT=13 ;");

    $db->query("DROP TABLE IF EXISTS {$tablepre}gupiaoconfig;");
    $db->query("CREATE TABLE {$tablepre}gupiaoconfig (
      id mediumint(8) unsigned NOT NULL auto_increment,
      todaybuy int(100) NOT NULL default '0',
      todaysale int(100) NOT NULL default '0',
      todaytotal int(100) NOT NULL default '0',
      todaydate int(10) NOT NULL default '0',
      gupiao_setting varchar(100) NOT NULL default '',
      pstock_setting varchar(100) NOT NULL default '',
      kaihu_setting varchar(100) NOT NULL default '',
      trade_setting varchar(100) NOT NULL default '',
      stopreadme varchar(255) NOT NULL default '',
      user_setting varchar(100) NOT NULL default '',
      ai_setting varchar(100) NOT NULL default '',
      custom_setting text NOT NULL,
      stockmanager varchar(255) NOT NULL default '',
      stockmright varchar(100) NOT NULL default '',
      gpmax float NOT NULL default '0',
      gpmin float NOT NULL default '0',
      noticeshow int(11) NOT NULL default '0',
      PRIMARY KEY  (id)
    ) TYPE=MyISAM AUTO_INCREMENT=2 ;");

    $db->query("INSERT INTO {$tablepre}gupiaoconfig (id, todaybuy, todaysale, todaytotal, todaydate, gupiao_setting, pstock_setting, kaihu_setting, trade_setting, stopreadme, user_setting, ai_setting, custom_setting, stockmanager, stockmright, gpmax, gpmin, noticeshow) VALUES (1, 18, 0, 7013853, 1112060180, '1,60,10,0,8||20,虚拟股市,,,,,0.3,0.8,50,1,0,0,0,0,0', '1|1000000|1|50|255|5000|||10', '1|10|||500|1000|0|0|0|', '1||1|1000|50|1.5|1|1|2|0.3|0.25|0.1|0.6|0.3|0.5|0.4|0|0.8|1.04|0.90', '股票交易所暂时休市!请下次再来。', '1|1|20000|20000|10|1000|1|1', '0|0.3|炒股王@大炒家', '虚拟股市||<font color=red>实现论坛虚拟股票交易</font>', '', '0|1|1|1|1|1|0', '20', '1.5', 0);");

    $db->query("DROP TABLE IF EXISTS {$tablepre}personalstock;");
    $db->query("CREATE TABLE {$tablepre}personalstock (
      stockid mediumint(8) unsigned NOT NULL auto_increment,
      username varchar(50) NOT NULL default '',
      uid int(10) NOT NULL default '0',
      stockname varchar(50) NOT NULL default '',
      price float NOT NULL default '0',
      stocknum double NOT NULL default '0',
      applydate int(10) NOT NULL default '0',
      states int(10) NOT NULL default '0',
      sexplain varchar(255) NOT NULL default '',
      ltdimg varchar(200) NOT NULL default '',
      on_cash double NOT NULL default '0',
      PRIMARY KEY  (stockid)
    ) TYPE=MyISAM AUTO_INCREMENT=1242 ;");

    $db->query("DROP TABLE IF EXISTS {$tablepre}rndevent;");
    $db->query("CREATE TABLE {$tablepre}rndevent (
      id mediumint(8) unsigned NOT NULL auto_increment,
      content varchar(255) NOT NULL default '',
      addtime int(10) NOT NULL default '0',
      PRIMARY KEY  (id)
    ) TYPE=MyISAM AUTO_INCREMENT=1224 ;");

    $db->query("DROP TABLE IF EXISTS {$tablepre}stock;");
    $db->query("CREATE TABLE {$tablepre}stock (
      stockid mediumint(8) unsigned NOT NULL auto_increment,
      work varchar(50) NOT NULL default '',
      openmoney float NOT NULL default '0',
      nowmoney float NOT NULL default '0',
      datet int(10) NOT NULL default '0',
      state varchar(50) NOT NULL default '',
      buynum int(100) NOT NULL default '0',
      sellnum int(100) NOT NULL default '0',
      cid int(10) NOT NULL default '0',
      usename varchar(50) NOT NULL default '',
      uid int(10) NOT NULL default '0',
      todaywave float NOT NULL default '0',
      totalwave double NOT NULL default '0',
      allnum double NOT NULL default '0',
      leavenum double NOT NULL default '0',
      buy int(100) NOT NULL default '0',
      bargain float NOT NULL default '0',
      sexplain varchar(255) NOT NULL default '',
      tongji varchar(255) NOT NULL default '',
      ltdimg varchar(200) NOT NULL default '',
      unum float NOT NULL default '0',
      lnum float NOT NULL default '0',
      on_cash double NOT NULL default '0',
      total_cash double NOT NULL default '0',
      earn_cash double NOT NULL default '0',
      totalnum int(100) NOT NULL default '0',
      vend int(10) NOT NULL default '0',
      PRIMARY KEY  (stockid)
    ) TYPE=MyISAM AUTO_INCREMENT=55 ;");

    $db->query("DROP TABLE IF EXISTS {$tablepre}stocknews;");
    $db->query("CREATE TABLE {$tablepre}stocknews (
      id mediumint(8) unsigned NOT NULL auto_increment,
      title varchar(100) NOT NULL default '',
      content varchar(255) NOT NULL default '',
      color varchar(20) NOT NULL default '',
      addtime int(10) NOT NULL default '0',
      username varchar(255) NOT NULL default '',
      PRIMARY KEY  (id)
    ) TYPE=MyISAM AUTO_INCREMENT=5 ;");

    if($insertnew==1) {
    $query=$db->query("select * from stock_client");
    while($rs = $db->fetch_array($query))
    {
          $db->query("insert into {$tablepre}client (id,acc,money,allmoney,ynlock,numtype,nowbuy,nowsell,opendate,lastdate,allbuy,allsell,style) values ($rs[id],'$rs[acc]',$rs[money],$rs[allmoney],$rs[ynlock],$rs[numtype],$rs[nowbuy],$rs[nowsell],$rs[opendate],$rs[lastdate],$rs[allbuy],$rs[allsell],0);");
    }

    $query=$db->query("select * from stock_bighome");
    while($rs = $db->fetch_array($query))
    {
          if($rs[acc]==$discuz_user) {
          $addmoney=$rs[num]*$rs[averagemoney];
          $db->query("update {$tablepre}client set money=money+$addmoney where acc='$discuz_user'");
          }
          else {
          $db->query("insert into {$tablepre}bighome (acc,stockid,buymoney,num,averagemoney,work,buytime,saletime,uid) values ('$rs[acc]',$rs[stockid],$rs[buymoney],$rs[num],$rs[averagemoney],'$rs[work]',$rs[buytime],$rs[saletime],$rs[uid]);");
    }
    }

    $query=$db->query("select * from stock_rndevent");
    while($rs = $db->fetch_array($query))
    {
          $db->query("insert into {$tablepre}rndevent (id,content,addtime) values ($rs[id],'$rs[content]',$rs[addtime]);");
    }
    $query=$db->query("select id from stock_client where acc='$discuz_user'");
    $mep = $db->fetch_array($query);
    $meid = !empty($mep[id]) ? $mep[id] : '1';
    $query=$db->query("select * from stock_stock");
    while($rs = $db->fetch_array($query))
    {
          if($rs[allnum]>=$rs[leavenum]) {
          $buy=$rs[allnum]-$rs[leavenum];
          $totalnum=$rs[allnum]+intval($rs[allnum]/0.2);
          $oncash=$rs[allnum]*$rs[nowmoney]/0.2;
          $totalcash=$oncash+$rs[allnum]*$rs[nowmoney];
          $db->query("insert into {$tablepre}stock (stockid,work,openmoney,nowmoney,datet,state,buynum,sellnum,cid,usename,uid,todaywave,totalwave,allnum,leavenum,buy,bargain,sexplain,tongji,ltdimg,unum,lnum,on_cash,total_cash,earn_cash,totalnum,vend) values ($rs[stockid],'$rs[work]',$rs[openmoney],$rs[nowmoney],$rs[datet],'$rs[state]',$rs[buynum],$rs[sellnum],$rs[cid],'$discuz_user',$meid,$rs[todaywave],$rs[totalwave],$rs[allnum],$rs[leavenum],$buy,$buy,'$rs[sexplain]','$rs[tongji]','$rs[ltdimg]',$rs[unum],$rs[lnum],$oncash,$totalcash,0,$totalnum,0);");
            }
            elseif ($rs[allnum]<$rs[leavenum]) {
            $allnum=$rs[leavenum];
            $buy=0;
            $totalnum=$allnum+intval($allnum/0.2);
            $oncash=$allnum*$allnum/0.2;
            $totalcash=$oncash+$allnum*$rs[nowmoney];
             $db->query("insert into {$tablepre}stock (stockid,work,openmoney,nowmoney,datet,state,buynum,sellnum,cid,usename,uid,todaywave,totalwave,allnum,leavenum,buy,bargain,sexplain,tongji,ltdimg,unum,lnum,on_cash,total_cash,earn_cash,totalnum,vend) values ($rs[stockid],'$rs[work]',$rs[openmoney],$rs[nowmoney],$rs[datet],'$rs[state]',$rs[buynum],$rs[sellnum],$rs[cid],'$discuz_user',$rs[uid],$rs[todaywave],$rs[totalwave],$allnum,$rs[leavenum],$buy,$buy,'$rs[sexplain]','$rs[tongji]','$rs[ltdimg]',$rs[unum],$rs[lnum],$oncash,$totalcash,0,$totalnum,0);");
            }
    }

    $query=$db->query("select * from stock_stocknews");
    while($rs = $db->fetch_array($query))
    {
          $db->query("insert into {$tablepre}stocknews (id,title,content,color,addtime,username) values ($rs[id],'$rs[title]','$rs[content]','$rs[color]',$rs[addtime],'$rs[username]');");
    }
    }
    /*else {
            $timep=time();
            $db->query("INSERT INTO {$tablepre}stock set stockid='1', work='世界娱乐网', openmoney='10', nowmoney='10', datet='$timep', state='开', buynum='0', sellnum='0', cid='0', usename='$discuz_user', uid='1', totalwave='0', allnum='100000', buy='0', bargain='0', leavenum='100000', sexplain='世界娱乐网股份有限公司。', tongji='0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0', ltdimg='images/LtdImg/1.jpg', unum='10', lnum='10', on_cash='100000000', total_cash='100000000', earn_cash='0', totalnum='10100000', vend='0';");
    }*/         

    ?>
    <tr><td bgcolor=<?=ALTBG2?>>
    <center>
    <b>虚拟股市 v1.1 For Discuz! 4.0.0 数据表安装完成</b><br>  <font color=red><b>请立即删除 install_stock.php 文件。</b></font>
    <br>
    有关虚拟股票交易所网址<a href="http://www.worldz.net">http://www.worldz.net</a>
    </center>
    </td></tr>
    </table>
    <?
    }
    include template('footer');

    ?>
    回复

    使用道具 举报

    290

    主题

    1935

    帖子

    100万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    1002284
       楼主| 发表于 2024-3-1 19:53:59 | 显示全部楼层 大佬来自 LAN
      请求高手解答!!

      多谢!!!
      好象这段有点问题((都要该吗??

      $db->query("DROP TABLE IF EXISTS {$tablepre}stock;");
      $db->query("CREATE TABLE {$tablepre}stock (
        stockid mediumint(8) unsigned NOT NULL auto_increment,
        work varchar(50) NOT NULL default '',
        openmoney float NOT NULL default '0',
        nowmoney float NOT NULL default '0',
        datet int(10) NOT NULL default '0',
        state varchar(50) NOT NULL default '',
        buynum int(100) NOT NULL default '0',
        sellnum int(100) NOT NULL default '0',
        cid int(10) NOT NULL default '0',
        usename varchar(50) NOT NULL default '',
        uid int(10) NOT NULL default '0',
        todaywave float NOT NULL default '0',
        totalwave double NOT NULL default '0',
        allnum double NOT NULL default '0',
        leavenum double NOT NULL default '0',
        buy int(100) NOT NULL default '0',
        bargain float NOT NULL default '0',
        sexplain varchar(255) NOT NULL default '',
        tongji varchar(255) NOT NULL default '',
        ltdimg varchar(200) NOT NULL default '',
        unum float NOT NULL default '0',
        lnum float NOT NULL default '0',
        on_cash double NOT NULL default '0',
        total_cash double NOT NULL default '0',
        earn_cash double NOT NULL default '0',
        totalnum int(100) NOT NULL default '0',
        vend int(10) NOT NULL default '0',
        PRIMARY KEY  (stockid)
      ) TYPE=MyISAM AUTO_INCREMENT=55 ;");

      [ 本帖最后由 userabc 于 2006-2-21 21:41 编辑 ]
      回复

      使用道具 举报

      您需要登录后才可以回帖 登录 | 立即注册

      本版积分规则

      快速回复 返回顶部 返回列表