|
|
@@ -1,46 +1,49 @@
|
|
|
<?php
|
|
|
- //error_reporting(0);
|
|
|
+//error_reporting(0);
|
|
|
session_start();
|
|
|
list($msec, $sec) = explode(' ', microtime());
|
|
|
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
|
|
if ($msectime - (float)$_SESSION['lasttime'] < 2000) {
|
|
|
- echo json_encode(array('info'=>0,msg=>'2秒发送一次'));die;
|
|
|
- // echo json_encode(array('info'=>0,'msg'=>'无此授权卡'));die;
|
|
|
+ echo json_encode(array('info' => 0, msg => '2秒发送一次'));
|
|
|
+ die;
|
|
|
+ // echo json_encode(array('info'=>0,'msg'=>'无此授权卡'));die;
|
|
|
} else {
|
|
|
- $_SESSION['lasttime'] = $msectime;
|
|
|
+ $_SESSION['lasttime'] = $msectime;
|
|
|
}
|
|
|
//date_default_timezone_set('PRC');
|
|
|
header("Content-type: text/html; charset=utf8");
|
|
|
//var_dump($_POST);die;
|
|
|
- include 'config.php';
|
|
|
- $type = $_POST['type'];
|
|
|
- $checknum=$_POST['pswd'];
|
|
|
- // $quid = trim(poststr('qu'));
|
|
|
- $quid=$_POST['qu'];
|
|
|
- $qu = $quarr[$quid];
|
|
|
- // $uid = trim(poststr('uid'));
|
|
|
- $uid=$_POST['username'];
|
|
|
- $gid = $qu['gid'];
|
|
|
- $zoneid = $qu['zoneid'];
|
|
|
- $manageurl = $qu['manageurl'];
|
|
|
- $dbip = $qu['host'];
|
|
|
- $dbname = $qu['dbname'];
|
|
|
- $dbuser = $qu['user'];
|
|
|
- $dbpwd = $qu['pwd'];
|
|
|
- $quname = $qu['name'];
|
|
|
-
|
|
|
-$uid=$_POST['username'];
|
|
|
-
|
|
|
-if(!$uid){
|
|
|
- echo json_encode(array('info'=>0,msg=>'uid不能为空'));die;
|
|
|
+include 'config.php';
|
|
|
+$type = $_POST['type'];
|
|
|
+$checknum = $_POST['pswd'];
|
|
|
+// $quid = trim(poststr('qu'));
|
|
|
+$quid = $_POST['qu'];
|
|
|
+$qu = $quarr[$quid];
|
|
|
+// $uid = trim(poststr('uid'));
|
|
|
+$uid = $_POST['username'];
|
|
|
+$gid = $qu['gid'];
|
|
|
+$zoneid = $qu['zoneid'];
|
|
|
+$manageurl = $qu['manageurl'];
|
|
|
+$dbip = $qu['host'];
|
|
|
+$dbname = $qu['dbname'];
|
|
|
+$dbuser = $qu['user'];
|
|
|
+$dbpwd = $qu['pwd'];
|
|
|
+$quname = $qu['name'];
|
|
|
+
|
|
|
+$uid = $_POST['username'];
|
|
|
+
|
|
|
+if (!$uid) {
|
|
|
+ echo json_encode(array('info' => 0, msg => 'uid不能为空'));
|
|
|
+ die;
|
|
|
}
|
|
|
-$pswd=$_POST['pswd'];
|
|
|
+$pswd = $_POST['pswd'];
|
|
|
|
|
|
-if(!$pswd){
|
|
|
- echo json_encode(array('info'=>0,msg=>'后台密码不能为空'));die;
|
|
|
+if (!$pswd) {
|
|
|
+ echo json_encode(array('info' => 0, msg => '后台密码不能为空'));
|
|
|
+ die;
|
|
|
}
|
|
|
|
|
|
-$db2 = mysqli_connect('127.0.0.1','root','wch123.com','cdks',3306) or die("数据库连接错误1");
|
|
|
+$db2 = mysqli_connect('127.0.0.1', 'root', 'wch123.com', 'cdks', 3306) or die("数据库连接错误1");
|
|
|
|
|
|
|
|
|
$db2->query('set names utf8');
|
|
|
@@ -48,313 +51,317 @@ $db2->query('set names utf8');
|
|
|
//$ss = mysqli_fetch_assoc($mysql->query("SELECT FROM cdk WHERE uid = '$rid' limit 1"));
|
|
|
$ss = mysqli_fetch_assoc($db2->query("SELECT * FROM cdks.cdk WHERE uid = '{$uid}' "));
|
|
|
//var_dump($ss);die;
|
|
|
-if($ss['status'] != 1 && $type != 'pay'){
|
|
|
- echo json_encode(array('info'=>0,msg=>'角色未授权'));die;
|
|
|
+if ($ss['status'] != 1 && $type != 'pay') {
|
|
|
+ echo json_encode(array('info' => 0, msg => '角色未授权'));
|
|
|
+ die;
|
|
|
}
|
|
|
-if($ss['pass'] != $checknum && $type != 'pay'){
|
|
|
- echo json_encode(array('info'=>0,msg=>'后台密码错误'));die;
|
|
|
+if ($ss['pass'] != $checknum && $type != 'pay') {
|
|
|
+ echo json_encode(array('info' => 0, msg => '后台密码错误'));
|
|
|
+ die;
|
|
|
}
|
|
|
|
|
|
|
|
|
-switch($_POST['type']){
|
|
|
+switch ($_POST['type']) {
|
|
|
|
|
|
- case 'charge':
|
|
|
-
|
|
|
- $mailid = trim(poststr('rechargeId'));
|
|
|
+ case 'charge':
|
|
|
|
|
|
- $mailnum = trim(poststr('number'));
|
|
|
- if ($mailnum == '' || $mailnum < 0 || $mailnum > 99999) {
|
|
|
- // exit('发送数量错误');
|
|
|
- echo json_encode(array('info'=>0,msg=>'数量最大99999'));die;
|
|
|
- }
|
|
|
-
|
|
|
- $roleId = $_POST["username"];
|
|
|
+ $mailid = trim(poststr('rechargeId'));
|
|
|
|
|
|
- $connnect = new Mongo("mongodb://127.0.0.1:27017");
|
|
|
+ $mailnum = trim(poststr('number'));
|
|
|
+ if ($mailnum == '' || $mailnum < 0 || $mailnum > 99999) {
|
|
|
+ // exit('发送数量错误');
|
|
|
+ echo json_encode(array('info' => 0, msg => '数量最大99999'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
|
|
|
- $db = $connnect->selectDB($dbname)->selectCollection("char");
|
|
|
+ $roleId = $_POST["username"];
|
|
|
|
|
|
- $cursor = $db->findOne(array('name' => $roleId));
|
|
|
+ $connnect = new Mongo("mongodb://127.0.0.1:27017");
|
|
|
|
|
|
- $roleId11=$cursor['_id']->{'$id'};
|
|
|
+ $db = $connnect->selectDB($dbname)->selectCollection("char");
|
|
|
|
|
|
+ $cursor = $db->findOne(array('name' => $roleId));
|
|
|
|
|
|
-
|
|
|
- $collection = $connnect->selectDB($dbname)->selectCollection("mail");
|
|
|
+ $roleId11 = $cursor['_id']->{'$id'};
|
|
|
|
|
|
- $document = array(
|
|
|
|
|
|
- "flag" => 1,
|
|
|
- "receiverUuid" => $roleId11,
|
|
|
- "senderName" => "充值系统",
|
|
|
- "head" => 0,
|
|
|
- "items" => [
|
|
|
- [
|
|
|
- (int)$mailid,
|
|
|
- (int)$mailnum
|
|
|
- ]
|
|
|
- ],
|
|
|
- "title" => "充值系统",
|
|
|
- "type" => 1,
|
|
|
- "time" => time(),
|
|
|
- "content" => "123"
|
|
|
-);
|
|
|
|
|
|
- $result = $collection->insert($document);
|
|
|
+ $collection = $connnect->selectDB($dbname)->selectCollection("mail");
|
|
|
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'充值成功,邮箱领取!'));
|
|
|
- break;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- case 'mail':
|
|
|
- $mailid = trim(poststr('mailid'));
|
|
|
+ $document = array(
|
|
|
|
|
|
- $mailnum = trim(poststr('mailnumyj'));
|
|
|
- if ($mailnum == '' || $mailnum < 0 || $mailnum > 9) {
|
|
|
- // exit('发送数量错误');
|
|
|
- echo json_encode(array('info'=>0,msg=>'数量最大9'));die;
|
|
|
- }
|
|
|
+ "flag" => 1,
|
|
|
+ "receiverUuid" => $roleId11,
|
|
|
+ "senderName" => "充值系统",
|
|
|
+ "head" => 0,
|
|
|
+ "items" => [
|
|
|
+ [
|
|
|
+ (int)$mailid,
|
|
|
+ (int)$mailnum
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ "title" => "充值系统",
|
|
|
+ "type" => 1,
|
|
|
+ "time" => time(),
|
|
|
+ "content" => "123"
|
|
|
+ );
|
|
|
|
|
|
- $roleId = $_POST["username"];
|
|
|
+ $result = $collection->insert($document);
|
|
|
|
|
|
- $connnect = new Mongo("mongodb://127.0.0.1:27017");
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '充值成功,邮箱领取!'));
|
|
|
+ break;
|
|
|
|
|
|
- $db = $connnect->selectDB($dbname)->selectCollection("char");
|
|
|
|
|
|
- $cursor = $db->findOne(array('name' => $roleId));
|
|
|
|
|
|
- $roleId11=$cursor['_id']->{'$id'};
|
|
|
+ case 'mail':
|
|
|
+ $mailid = trim(poststr('mailid'));
|
|
|
|
|
|
+ $mailnum = trim(poststr('mailnumyj'));
|
|
|
+ if ($mailnum == '' || $mailnum < 0 || $mailnum > 9) {
|
|
|
+ // exit('发送数量错误');
|
|
|
+ echo json_encode(array('info' => 0, msg => '数量最大9'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- $collection = $connnect->selectDB($dbname)->selectCollection("mail");
|
|
|
+ $roleId = $_POST["username"];
|
|
|
|
|
|
- $document = array(
|
|
|
+ $connnect = new Mongo("mongodb://127.0.0.1:27017");
|
|
|
|
|
|
- "flag" => 1,
|
|
|
- "receiverUuid" => $roleId11,
|
|
|
- "senderName" => "系统邮件",
|
|
|
- "head" => 0,
|
|
|
- "items" => [
|
|
|
- [
|
|
|
- (int)$mailid,
|
|
|
- (int)$mailnum
|
|
|
- ]
|
|
|
- ],
|
|
|
- "title" => "系统邮件",
|
|
|
- "type" => 1,
|
|
|
- "time" => time(),
|
|
|
- "content" => "123"
|
|
|
-);
|
|
|
+ $db = $connnect->selectDB($dbname)->selectCollection("char");
|
|
|
|
|
|
- $result = $collection->insert($document);
|
|
|
+ $cursor = $db->findOne(array('name' => $roleId));
|
|
|
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'发送成功,邮箱领取!'));
|
|
|
+ $roleId11 = $cursor['_id']->{'$id'};
|
|
|
|
|
|
-
|
|
|
- break;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-case 'clearbag':
|
|
|
-$roleId = $_POST["username"];
|
|
|
|
|
|
-//链接mongodb
|
|
|
-$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
+ $collection = $connnect->selectDB($dbname)->selectCollection("mail");
|
|
|
|
|
|
-$filter = [ 'name' => ''.$roleId.'' ]; //查询条件 user_id大于0
|
|
|
-$query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
-$list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
+ $document = array(
|
|
|
|
|
|
-foreach ($list as $document) {
|
|
|
-
|
|
|
-$roleId11 = $document->_id;//能打印下吗
|
|
|
-}
|
|
|
-//print_r($roleId11);
|
|
|
+ "flag" => 1,
|
|
|
+ "receiverUuid" => $roleId11,
|
|
|
+ "senderName" => "系统邮件",
|
|
|
+ "head" => 0,
|
|
|
+ "items" => [
|
|
|
+ [
|
|
|
+ (int)$mailid,
|
|
|
+ (int)$mailnum
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ "title" => "系统邮件",
|
|
|
+ "type" => 1,
|
|
|
+ "time" => time(),
|
|
|
+ "content" => "123"
|
|
|
+ );
|
|
|
|
|
|
+ $result = $collection->insert($document);
|
|
|
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '发送成功,邮箱领取!'));
|
|
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
|
-$bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
-$bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
-//print_r($bulk);
|
|
|
+ case 'clearbag':
|
|
|
+ $roleId = $_POST["username"];
|
|
|
|
|
|
+ //链接mongodb
|
|
|
+ $manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
|
|
|
- $result = $manager->executeBulkWrite('goal.PlayerItem', $bulk);
|
|
|
-
|
|
|
- if($result->getDeletedCount()){
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'已清除,请重新登录!'));
|
|
|
- }else{
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'清除失败,没有数据!'));
|
|
|
- }
|
|
|
+ $filter = ['name' => '' . $roleId . '']; //查询条件 user_id大于0
|
|
|
+ $query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
+ $list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
|
|
|
+ foreach ($list as $document) {
|
|
|
|
|
|
+ $roleId11 = $document->_id; //能打印下吗
|
|
|
+ }
|
|
|
+ //print_r($roleId11);
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
-case 'clearresource':
|
|
|
-$roleId = $_POST["username"];
|
|
|
|
|
|
-//链接mongodb
|
|
|
-$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
|
|
|
-$filter = [ 'name' => ''.$roleId.'' ]; //查询条件 user_id大于0
|
|
|
-$query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
-$list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
+ $bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
-foreach ($list as $document) {
|
|
|
-
|
|
|
-$roleId11 = $document->_id;//能打印下吗
|
|
|
-}
|
|
|
-//print_r($roleId11);
|
|
|
+ $bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
+ //print_r($bulk);
|
|
|
|
|
|
|
|
|
+ $result = $manager->executeBulkWrite('goal.PlayerItem', $bulk);
|
|
|
|
|
|
+ if ($result->getDeletedCount()) {
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '已清除,请重新登录!'));
|
|
|
+ } else {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '清除失败,没有数据!'));
|
|
|
+ }
|
|
|
|
|
|
-$bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
-$bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
-//print_r($bulk);
|
|
|
|
|
|
|
|
|
- $result = $manager->executeBulkWrite('goal.PlayerEquipment', $bulk);
|
|
|
-
|
|
|
- if($result->getDeletedCount()){
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'已清除,请重新登录!'));
|
|
|
- }else{
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'清除失败,没有数据!'));
|
|
|
- }
|
|
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
|
+ case 'clearresource':
|
|
|
+ $roleId = $_POST["username"];
|
|
|
|
|
|
+ //链接mongodb
|
|
|
+ $manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
+ $filter = ['name' => '' . $roleId . '']; //查询条件 user_id大于0
|
|
|
+ $query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
+ $list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
|
|
|
-case 'clearherb':
|
|
|
-$roleId = $_POST["username"];
|
|
|
+ foreach ($list as $document) {
|
|
|
|
|
|
-//链接mongodb
|
|
|
-$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
+ $roleId11 = $document->_id; //能打印下吗
|
|
|
+ }
|
|
|
+ //print_r($roleId11);
|
|
|
|
|
|
-$filter = [ 'name' => ''.$roleId.'' ]; //查询条件 user_id大于0
|
|
|
-$query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
-$list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
|
|
|
-foreach ($list as $document) {
|
|
|
-
|
|
|
-$roleId11 = $document->_id;//能打印下吗
|
|
|
-}
|
|
|
-//print_r($roleId11);
|
|
|
|
|
|
|
|
|
|
|
|
+ $bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
+ $bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
-$bulk = new MongoDB\Driver\BulkWrite();
|
|
|
+ //print_r($bulk);
|
|
|
|
|
|
-$bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
-//print_r($bulk);
|
|
|
+ $result = $manager->executeBulkWrite('goal.PlayerEquipment', $bulk);
|
|
|
|
|
|
+ if ($result->getDeletedCount()) {
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '已清除,请重新登录!'));
|
|
|
+ } else {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '清除失败,没有数据!'));
|
|
|
+ }
|
|
|
|
|
|
- $result = $manager->executeBulkWrite('goal.PlayerCoachItem', $bulk);
|
|
|
-
|
|
|
- if($result->getDeletedCount()){
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'已清除,请重新登录!'));
|
|
|
- }else{
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'清除失败,没有数据!'));
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
|
|
|
-case 'clearstone':
|
|
|
-$roleId = $_POST["username"];
|
|
|
+ break;
|
|
|
|
|
|
-//链接mongodb
|
|
|
-$manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
+ case 'clearherb':
|
|
|
+ $roleId = $_POST["username"];
|
|
|
|
|
|
-$filter = [ 'name' => ''.$roleId.'' ]; //查询条件 user_id大于0
|
|
|
-$query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
-$list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
+ //链接mongodb
|
|
|
+ $manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
|
|
|
-foreach ($list as $document) {
|
|
|
-
|
|
|
-$roleId11 = $document->_id;//能打印下吗
|
|
|
-}
|
|
|
-//print_r($roleId11);
|
|
|
+ $filter = ['name' => '' . $roleId . '']; //查询条件 user_id大于0
|
|
|
+ $query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
+ $list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
|
|
|
+ foreach ($list as $document) {
|
|
|
|
|
|
+ $roleId11 = $document->_id; //能打印下吗
|
|
|
+ }
|
|
|
+ //print_r($roleId11);
|
|
|
|
|
|
|
|
|
|
|
|
-$bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
-$bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
-//print_r($bulk);
|
|
|
+ $bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
+ $bulk->delete(array(_id => $roleId11));
|
|
|
|
|
|
- $result = $manager->executeBulkWrite('goal.PlayerEquipPiece', $bulk);
|
|
|
-
|
|
|
- if($result->getDeletedCount()){
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'已清除,请重新登录!'));
|
|
|
- }else{
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'清除失败,没有数据!'));
|
|
|
- }
|
|
|
+ //print_r($bulk);
|
|
|
|
|
|
|
|
|
+ $result = $manager->executeBulkWrite('goal.PlayerCoachItem', $bulk);
|
|
|
|
|
|
+ if ($result->getDeletedCount()) {
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '已清除,请重新登录!'));
|
|
|
+ } else {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '清除失败,没有数据!'));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
-
|
|
|
-case 'pay':{
|
|
|
- $cdk = $_POST['cdk'];
|
|
|
- $pswd = $_POST['pswd'];
|
|
|
|
|
|
- $xxs = mysqli_fetch_assoc($db2->query("SELECT * FROM cdk WHERE uid = '$uid' limit 1"));
|
|
|
|
|
|
- if($xxs['id'] !=''){
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'角色已授权,无需再次授权'));die;
|
|
|
- }
|
|
|
- $xxx = mysqli_fetch_assoc($db2->query("SELECT * FROM cdk WHERE cdk = '$cdk' limit 1"));
|
|
|
- if($xxx['cdk'] ==''){
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'无此授权卡'));die;
|
|
|
- }
|
|
|
- if($xxx['status'] != 0){
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'此授权卡已被使用'));die;
|
|
|
- }
|
|
|
- if($db2->query("UPDATE cdk SET status = 1 , qid = '$quid' ,uid = '$uid', pass = '$pswd' WHERE cdk = '$cdk';")){
|
|
|
- echo json_encode(array('info'=>1,'msg'=>'角色授权成功'));die;
|
|
|
- }else{
|
|
|
- echo json_encode(array('info'=>0,'msg'=>'授权失败.请联系管理员'));die;
|
|
|
- }
|
|
|
|
|
|
-}
|
|
|
-break;
|
|
|
|
|
|
|
|
|
-}
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'clearstone':
|
|
|
+ $roleId = $_POST["username"];
|
|
|
+
|
|
|
+ //链接mongodb
|
|
|
+ $manager = new MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');
|
|
|
+
|
|
|
+ $filter = ['name' => '' . $roleId . '']; //查询条件 user_id大于0
|
|
|
+ $query = new MongoDB\Driver\Query($filter); //查询请求
|
|
|
+ $list = $manager->executeQuery('goal.Player', $query); // 执行查询 location数据库下的box集合
|
|
|
+
|
|
|
+ foreach ($list as $document) {
|
|
|
+
|
|
|
+ $roleId11 = $document->_id; //能打印下吗
|
|
|
+ }
|
|
|
+ //print_r($roleId11);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $bulk = new MongoDB\Driver\BulkWrite();
|
|
|
|
|
|
-?>
|
|
|
+ $bulk->delete(array(_id => $roleId11));
|
|
|
+
|
|
|
+ //print_r($bulk);
|
|
|
+
|
|
|
+
|
|
|
+ $result = $manager->executeBulkWrite('goal.PlayerEquipPiece', $bulk);
|
|
|
+
|
|
|
+ if ($result->getDeletedCount()) {
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '已清除,请重新登录!'));
|
|
|
+ } else {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '清除失败,没有数据!'));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 'pay': {
|
|
|
+ $cdk = $_POST['cdk'];
|
|
|
+ $pswd = $_POST['pswd'];
|
|
|
+
|
|
|
+ $xxs = mysqli_fetch_assoc($db2->query("SELECT * FROM cdk WHERE uid = '$uid' limit 1"));
|
|
|
+
|
|
|
+ if ($xxs['id'] != '') {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '角色已授权,无需再次授权'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ $xxx = mysqli_fetch_assoc($db2->query("SELECT * FROM cdk WHERE cdk = '$cdk' limit 1"));
|
|
|
+ if ($xxx['cdk'] == '') {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '无此授权卡'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ if ($xxx['status'] != 0) {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '此授权卡已被使用'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ if ($db2->query("UPDATE cdk SET status = 1 , qid = '$quid' ,uid = '$uid', pass = '$pswd' WHERE cdk = '$cdk';")) {
|
|
|
+ echo json_encode(array('info' => 1, 'msg' => '角色授权成功'));
|
|
|
+ die;
|
|
|
+ } else {
|
|
|
+ echo json_encode(array('info' => 0, 'msg' => '授权失败.请联系管理员'));
|
|
|
+ die;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+}
|