|
rxxj2:
<?php
error_reporting(0);
define("APP_PATH",dirname(__FILE__));
$url = explode('\\',__FILE__);
$filename = end($url);
$sid = intval($_GET['sid']);
$sid == 0 && $sid = 1;
//引入数据库文件
require(APP_PATH."/config.php");
require(APP_PATH."/pdo.php");
$c = $Config['db' . $sid];
$db = new db_pdo_mysql($c);
$i_success = 0;
$i_failed = 0;
$charge_list = $db->getArray('select AccountId,guid,channel,arenaRank from mmo_character.characters where arenaRank = 1000');
if (!empty($charge_list)) {
$url = $c['api_host'];
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//不直接输出response
foreach ($charge_list as $a) {
$dj = $a['arenaRank'];
//$jf = $a['jf'];
$sql = "call mmo_accountdb.order_create(1, {$a['AccountId']}, 1, 1, {$a['guid']}, {$a['channel']});";
$result = $db->callProc($sql);
$order = $result[0];
// var_dump($result);exit;
$data = array(
'pid' => '41',
'gid' => '1001015',
'time' => time(),
'oid' => '936742703',
'doid' => $order['orderid'],
'dsid' => $c['sid'],
'drid' => $a['guid'],
'drname' => 'hello',
'drlevel' => '1',
'uid' => $a['AccountId'],
'money' => $dj / 10,
'coin' => $dj,
'paid' => ''
);
$data['sign'] = md5($data['time'] . $c['key'] . $data['oid'] . $data['doid'] . $data['dsid'] . $data['uid'] . $data['money'] . $data['coin']);
curl_setopt($ch, CURLOPT_URL, $url . http_build_query($data));
$return_content = curl_exec($ch);
$insert_result = json_decode($return_content, true);
//var_dump($insert_result);
if($insert_result['state'] == 1) {
$db->exec("update mmo_character.characters set arenaRank = 999 where guid={$a['guid']}");
$i_success++;
} else {
$i_failed++;
}
}
curl_close($ch);
}
echo '<title>'. $sid .'服充值刷新</title><meta charset="utf-8" /><meta http-equiv="refresh" content="40;url='. $filename .'?sid='. $sid .'"/> ';
echo "<b>更新时间:".date("Y-m-d H:i:s")."</b><br /><b>处理成功{$i_success}个账号数据,失败{$i_failed}个</b>";
vipbenefit:
/*
Navicat MySQL Data Transfer
Source Server : 127.0.0.1
Source Server Version : 50540
Source Host : 127.0.0.1:3306
Source Database : mmo_world
Target Server Type : MYSQL
Target Server Version : 50540
File Encoding : 65001
Date: 2016-07-23 15:06:40
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `vipbenefit`
-- ----------------------------
DROP TABLE IF EXISTS `vipbenefit`;
CREATE TABLE `vipbenefit` (
`viplv` int(11) NOT NULL COMMENT 'VIP等级',
`needrmb` int(11) DEFAULT NULL COMMENT '该等级需要累计充值的元宝数量',
`itemboxid` int(11) DEFAULT NULL COMMENT '奖励银两',
PRIMARY KEY (`viplv`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of vipbenefit
-- ----------------------------
INSERT INTO `vipbenefit` VALUES ('1', '1', '901');
INSERT INTO `vipbenefit` VALUES ('2', '1', '902');
INSERT INTO `vipbenefit` VALUES ('3', '1', '903');
INSERT INTO `vipbenefit` VALUES ('4', '1', '904');
INSERT INTO `vipbenefit` VALUES ('5', '1', '905');
INSERT INTO `vipbenefit` VALUES ('6', '1', '906');
INSERT INTO `vipbenefit` VALUES ('7', '1', '907');
INSERT INTO `vipbenefit` VALUES ('8', '1', '908');
INSERT INTO `vipbenefit` VALUES ('9', '1', '909');
INSERT INTO `vipbenefit` VALUES ('10', '1', '910');
INSERT INTO `vipbenefit` VALUES ('11', '1', '911');
INSERT INTO `vipbenefit` VALUES ('12', '1', '912');
INSERT INTO `vipbenefit` VALUES ('13', '1', '913');
INSERT INTO `vipbenefit` VALUES ('14', '1', '914');
INSERT INTO `vipbenefit` VALUES ('15', '1', '915');
完整代码包 :
|
上一篇: 手游青云志详细架设教程+简易GM工具+全物品代码下一篇: 全民奇迹 IOS客户端 授权教程
|