This commit is contained in:
aozhiwei 2021-11-23 16:22:39 +08:00
parent d38657fb83
commit d2ddba89a2
2 changed files with 43 additions and 72 deletions

View File

@ -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

View File

@ -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;
} }
if ($it['type'] == 12) {
$row = $conn->execQueryOne('SELECT * FROM bag WHERE accountid=:accountid AND id=:id;', $this->addEquip($item_id, $item_num, $time, $this->getAccountId());
array( } else {
':accountid' => $accountid, phpcommon\SqlHelper::upsert
'id' => $item_id ($this->getSelfMysql(),
)); 'bag',
$status = 1; array(
$active_time = 0; 'accountid' => $this->getAccountId(),
if ($item_id != 0){ 'id' => $item_id,
if ($it['type'] == 12) { ),
$this->addEquip($item_id, $item_num, $time, $accountid); array(
} else { 'active_time' => 0,
if ($it['type'] == 10 || $it['type'] == 11 || $it['type'] == 23 || $it['type'] == 24) { 'status' => 1,
$item_num = $row['num'] + $item_num; 'num' => function () use($it, $item_num) {
} else { if (in_array($it['type'], array(
$item_num = 1; 10,
} 11,
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time, num) ' . 23,
' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time, :num) ' . 24
' 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( return "num + ${item_num}";
':account_id' => $accountid, } else {
':id' => $item_id, return 'num';
':active_time' => $active_time, }
':status' => $status, },
':create_time' => phpcommon\getNowTime(), ),
':modify_time' => phpcommon\getNowTime(), array(
':num' => $item_num 'accountid' => $this->getAccountId(),
)); 'id' => $item_id,
if(!$ret){ 'status' => 1,
die(); 'active_time' => 0,
return; '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;