📄 goods_mod.php
字号:
<?php
include("functions/class_mysql.php");
include("functions/func_common.php");
include("configs/Configs.php");
/////////////////////////////判断是出售(action=sale)还是丢弃(action=delete)///////////
$id=$_GET['id'];//获取物品ID号;
//判断开始
if ($_GET['action']=='sale') {
//根据ID查找物品基础表里的s_id;
$query=$db->query("select s_id,i_goodsname from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");
$s_id2=$db->fetch_array($query);
$s_id=$s_id2['s_id'];
$name=$s_id2['i_goodsname'];
//根据s_id查些物品的出售价格;
$query=$db->query("select * from m_goods where id = '".$s_id."';");
$price=$db->fetch_array($query);
$price=$price['s_price'];
//判断是否是元宝物品;
if ($_GET['type_num']<>7) {
if ($name=='金锭') {
$price=1000;
}elseif ($name=='金砖') {
$price=10000;
}else {
//获取钱数;
$price=(int)($price/2);
}
//根据ID删除内政物品;
$query_nu=$db->query("select * from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");
$list_nu=$db->fetch_array($query_nu);
$nu=$list_nu['num'];
if($nu==0||$nu==1){
$query=$db->query("delete from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");}else{
$db->query("update interior_goods set num=(num-1) where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."' ");
}
//增加黄金数,增加仓库占用量
$query=$db->query("update resource set golds = ( golds + '".$price."') where u_id = '".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");
}
}elseif ($_GET['action']=='delete') {
//根据ID删除内政物品;
$query_nu=$db->query("select * from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");
$list_nu=$db->fetch_array($query_nu);
$nu=$list_nu['num'];
if($nu==0||$nu==1){
$query=$db->query("delete from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");}else{
$db->query("update interior_goods set num=(num-1) where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."' ");
}
}elseif ($_GET['action']=='use'){
//根据ID使用内政物品;
$query_nu=$db->query("select * from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");
$note=$db->fetch_array($query_nu);
if ($note['s_id']==80) {
//查询是否有使用免战牌
$query_m=$db->query("select id from add_goods_info where u_id='".$_COOKIE['UserId']."' and type='2' and m_gid='80';");
$n=$db->num_rows($query_m);
if ($n) echomsg("您己有相同的物品在起作用!","goods.php?action_type=".$_GET['type_num']);
$nu=$note['num'];
if($nu==0||$nu==1){
$query=$db->query("delete from interior_goods where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."';");}else{
$db->query("update interior_goods set num=(num-1) where id = '".$id."' and i_uid = '".$_COOKIE['UserId']."' ");
}
$endtimes=time()+24*60*60;
//写入宝物程序
$db->query("insert into add_goods_info values (null,'".$_COOKIE['UserId']."','','80','','','','','','','','','".$endtimes."','2');");
// $db->query("insert into add_goods_info (id,u_id,c_id,m_gid,golds_add,rices_add,woods_add,gong_add,fang_add,size,gong_end_times,stop_times,type) values (null,'".$_COOKIE['UserId']."','','80','','','','','','','','','".$endtimes."','2');");
}
}
//元宝物品使用
if ($_GET['good_act']=='good_bao') {
include_once("use_bao.php");
}
refresh();
$db->close();
echomsg("操作成功!","goods.php?action_type=".$_GET['type_num']);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -