本帖最后由 liuzhly 于 2010-01-23 15:32 编辑
拍蚊子,参照我的代码会改的自己改改吧!!其实我以前的帖子都有解决方法!!
if($_REQUEST['type']==1){
$query = $_SGLOBAL['db']->query( "SELECT money,mc_exp,wenzi,mc_clicks FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['uId'] ) );
while ( $value = $_SGLOBAL['db']->fetch_array( $query ) ){
$list[] = $value;
}
//wenzi
$mc_exp = 2;
if($list[0][mc_clicks] >=120){
$mc_exp = 0;//超过120次后增加0经验
}
//$wenzi_num=0;
//$wenzi_mynum=0;
$list[0][wenzi] == '' && exit("{\"errorContent\":\"\\u6CA1\\u6709\\u868A\\u5B50\\uFF0C\\u4F60\\u662F\\u4E0D\\u662F\\u641E\\u9519\\u4E86\\uFF1F\",\"errorType\":\"1011\"}");//防止多窗口
strpos(','.$list[0][wenzi].',',','.$_SGLOBAL['supe_uid'].',') !== false && exit("{\"errorContent\":\"\\u8BC1\\u636E\\u662F\\u4E0D\\u80FD\\u6BC1\\u706D\\u7684\",\"errorType\":\"1011\"}");//
$wenzi = explode(",",$list[0][wenzi],2);
$wenzi_all =$wenzi[1];
$_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set wenzi='".$wenzi_all."' where uid=".intval( $_REQUEST['uId'] ) );
$_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set mc_exp=mc_exp+{$mc_exp},mc_clicks=mc_clicks+1 where uid=".$_SGLOBAL['supe_uid'] );
echo "{\"addExp\":{$mc_exp},\"cId\":1,\"num\":1,\"pos\":".$_REQUEST['pos']."}";
}elseif($_REQUEST['type']==2){
$cId="1506";
$bb = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT dabian FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['uId'] ) ), 0 );
$bb <= 0 && exit("{\"errorContent\":\"\\u60A8\\u4E0B\\u624B\\u592A\\u6162\\uFF0C\\u4FBF\\u4FBF\\u5DF2\\u7ECF\\u88AB\\u6E05\\u7406\\u4E86\",\"errorType\":\"1004\"}");
$mc_package = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT mc_package FROM ".tname( "plug_newfarm" )." where uid=".$_SGLOBAL['supe_uid'] ), 0 );
$mc_package = json_decode( $mc_package );
$bb--;
$mc_package->$cId++;
$mc_package = json_encode( $mc_package );
$_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set dabian=".$bb." where uid=".intval( $_REQUEST['uId'] ) );
$_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set mc_package='".$mc_package."' where uid=".$_SGLOBAL['supe_uid'] );
echo "{\"num\":1,\"pos\":".$_REQUEST['pos'].",\"repNum\":1,\"type\":2}";
}
exit( ); |