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`)
|
UNIQUE KEY `accountid_gun_id_skin_id` (`accountid`, `gun_id`,`skin_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) 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
|
-- Dump completed on 2015-08-19 18:51:22
|
||||||
|
@ -5,73 +5,61 @@ require_once('mt/Item.php');
|
|||||||
|
|
||||||
class AdditemController extends BaseAuthedController {
|
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()
|
public function additem()
|
||||||
{
|
{
|
||||||
|
if (SERVER_ENV == _ONLINE) {
|
||||||
|
$this->rspOk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
$item_id = $_REQUEST['item_id'];
|
$item_id = $_REQUEST['item_id'];
|
||||||
$item_num = $_REQUEST['item_num'];
|
$item_num = $_REQUEST['item_num'];
|
||||||
$accountid = $_REQUEST['account_id'];
|
|
||||||
$time = $_REQUEST['time'];
|
$time = $_REQUEST['time'];
|
||||||
// if (phpcommon\getIPv4() != '124.78.1.111') {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if ($_REQUEST['passwd'] != 'kingsome') {
|
if ($_REQUEST['passwd'] != 'kingsome') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$conn = $this->getMysql($accountid);
|
|
||||||
$it = mt\Item::getOldItem($item_id);
|
$it = mt\Item::getOldItem($item_id);
|
||||||
if (!$it) {
|
if (!$it) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具');
|
$this->rspErr(ERR_USER_BASE + 1, '没有这个道具');
|
||||||
die();
|
|
||||||
return;
|
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) {
|
if ($it['type'] == 12) {
|
||||||
$this->addEquip($item_id, $item_num, $time, $accountid);
|
$this->addEquip($item_id, $item_num, $time, $this->getAccountId());
|
||||||
} else {
|
} else {
|
||||||
if ($it['type'] == 10 || $it['type'] == 11 || $it['type'] == 23 || $it['type'] == 24) {
|
phpcommon\SqlHelper::upsert
|
||||||
$item_num = $row['num'] + $item_num;
|
($this->getSelfMysql(),
|
||||||
} else {
|
'bag',
|
||||||
$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(
|
array(
|
||||||
':account_id' => $accountid,
|
'accountid' => $this->getAccountId(),
|
||||||
':id' => $item_id,
|
'id' => $item_id,
|
||||||
':active_time' => $active_time,
|
),
|
||||||
':status' => $status,
|
array(
|
||||||
':create_time' => phpcommon\getNowTime(),
|
'active_time' => 0,
|
||||||
':modify_time' => phpcommon\getNowTime(),
|
'status' => 1,
|
||||||
':num' => $item_num
|
'num' => function () use($it, $item_num) {
|
||||||
));
|
if (in_array($it['type'], array(
|
||||||
if(!$ret){
|
10,
|
||||||
die();
|
11,
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加金币
|
//添加金币
|
||||||
public function addCoin()
|
public function addCoin()
|
||||||
{
|
{
|
||||||
@ -178,7 +167,6 @@ class AdditemController extends BaseAuthedController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function addEquip($id, $num, $time, $accountid)
|
protected function addEquip($id, $num, $time, $accountid)
|
||||||
{
|
{
|
||||||
$item_id = $id;
|
$item_id = $id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user