1
This commit is contained in:
parent
d38657fb83
commit
d2ddba89a2
@ -537,21 +537,4 @@ CREATE TABLE `gun_skin` (
|
||||
UNIQUE KEY `accountid_gun_id_skin_id` (`accountid`, `gun_id`,`skin_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
--
|
||||
-- Table structure for table `player_info`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `player_info`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `player_info` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid',
|
||||
`give_me_five` int(11) NOT NULL DEFAULT '0' COMMENT '点赞',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
@ -5,73 +5,61 @@ require_once('mt/Item.php');
|
||||
|
||||
class AdditemController extends BaseAuthedController {
|
||||
|
||||
protected function getBag($bag_id)
|
||||
{
|
||||
$g_conf_bag_cluster = require('../res/bag@bag.php');
|
||||
$bag_conf = getBagConfig($g_conf_bag_cluster, $bag_id);
|
||||
$b = array(
|
||||
'id' => $bag_conf['id'],
|
||||
'name' => $bag_conf['name'],
|
||||
'fuction' => $bag_conf['fuction'],
|
||||
);
|
||||
return $b;
|
||||
}
|
||||
|
||||
public function additem()
|
||||
{
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$this->rspOk();
|
||||
return;
|
||||
}
|
||||
$item_id = $_REQUEST['item_id'];
|
||||
$item_num = $_REQUEST['item_num'];
|
||||
$accountid = $_REQUEST['account_id'];
|
||||
$time = $_REQUEST['time'];
|
||||
// if (phpcommon\getIPv4() != '124.78.1.111') {
|
||||
// return;
|
||||
// }
|
||||
if ($_REQUEST['passwd'] != 'kingsome') {
|
||||
return;
|
||||
}
|
||||
$conn = $this->getMysql($accountid);
|
||||
$it = mt\Item::getOldItem($item_id);
|
||||
if (!$it) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具');
|
||||
die();
|
||||
$this->rspErr(ERR_USER_BASE + 1, '没有这个道具');
|
||||
return;
|
||||
}
|
||||
|
||||
$row = $conn->execQueryOne('SELECT * FROM bag WHERE accountid=:accountid AND id=:id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
'id' => $item_id
|
||||
));
|
||||
$status = 1;
|
||||
$active_time = 0;
|
||||
if ($item_id != 0){
|
||||
if ($it['type'] == 12) {
|
||||
$this->addEquip($item_id, $item_num, $time, $accountid);
|
||||
} else {
|
||||
if ($it['type'] == 10 || $it['type'] == 11 || $it['type'] == 23 || $it['type'] == 24) {
|
||||
$item_num = $row['num'] + $item_num;
|
||||
} else {
|
||||
$item_num = 1;
|
||||
}
|
||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time, num) ' .
|
||||
' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time, :num) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, active_time=:active_time, modify_time=:modify_time, num=:num;',
|
||||
array(
|
||||
':account_id' => $accountid,
|
||||
':id' => $item_id,
|
||||
':active_time' => $active_time,
|
||||
':status' => $status,
|
||||
':create_time' => phpcommon\getNowTime(),
|
||||
':modify_time' => phpcommon\getNowTime(),
|
||||
':num' => $item_num
|
||||
));
|
||||
if(!$ret){
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($it['type'] == 12) {
|
||||
$this->addEquip($item_id, $item_num, $time, $this->getAccountId());
|
||||
} else {
|
||||
phpcommon\SqlHelper::upsert
|
||||
($this->getSelfMysql(),
|
||||
'bag',
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $item_id,
|
||||
),
|
||||
array(
|
||||
'active_time' => 0,
|
||||
'status' => 1,
|
||||
'num' => function () use($it, $item_num) {
|
||||
if (in_array($it['type'], array(
|
||||
10,
|
||||
11,
|
||||
23,
|
||||
24
|
||||
))) {
|
||||
return "num + ${item_num}";
|
||||
} else {
|
||||
return 'num';
|
||||
}
|
||||
},
|
||||
),
|
||||
array(
|
||||
'accountid' => $this->getAccountId(),
|
||||
'id' => $item_id,
|
||||
'status' => 1,
|
||||
'active_time' => 0,
|
||||
'num' => 1,
|
||||
'create_time' => phpcommon\getNowTime(),
|
||||
'modify_time' => phpcommon\getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->rspOk();
|
||||
}
|
||||
|
||||
//添加钻石
|
||||
@ -104,6 +92,7 @@ class AdditemController extends BaseAuthedController {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//添加金币
|
||||
public function addCoin()
|
||||
{
|
||||
@ -178,7 +167,6 @@ class AdditemController extends BaseAuthedController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function addEquip($id, $num, $time, $accountid)
|
||||
{
|
||||
$item_id = $id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user