添加后台代理代码
This commit is contained in:
705
codes/agent/game/dlweb/api/lib/1.0/admin.php
Normal file
705
codes/agent/game/dlweb/api/lib/1.0/admin.php
Normal file
@@ -0,0 +1,705 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'BaseMethodHelper.php';
|
||||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'game_config.inc.php';
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'Tangjian.php';
|
||||
|
||||
class Admin extends Tangjian
|
||||
{
|
||||
/**
|
||||
* 校验管理员信息
|
||||
* @param $params
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function _checkAdmin($params)
|
||||
{
|
||||
if($params['account'] !== 'tiansheng' || $params['password'] !== 'tiansheng88!')
|
||||
throw new Exception('账号密码错误', 2000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* manage 登录
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function login($request, &$return)
|
||||
{
|
||||
try {
|
||||
/*$params = $this->checkParams($request, array(
|
||||
'account/R', 'password/R'
|
||||
));*/
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有代理商
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function agentList($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
$agent_list = $Agent->getAllAgentList();
|
||||
|
||||
$return->biz_content = $agent_list;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有渠道
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function channelList($request, &$return)
|
||||
{
|
||||
try {
|
||||
/*$params = $this->checkParams($request, array(
|
||||
'account/R', 'password/R'
|
||||
));*/
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$channel_list = $Agent->getAllChannelList();
|
||||
|
||||
$return->biz_content = $channel_list;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代理信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function salesInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/ 'salesid/R', 'agentid/R', 'channelid/R'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Sales = new \models\SalesUser();
|
||||
$result = $Sales->querySalesInfo($params);
|
||||
|
||||
if(empty($result)) throw new Exception('暂无该代理信息', 1100);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代理信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function changeSalesInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'salesid/R', 'agentid/R', 'channelid/R', 'parentid/0', 'global_power/0', 'statistic_type/0', 'is_vip/0', 'announcement/'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Sales = new \models\SalesUser();
|
||||
$Sales->setSalesInfo($params);
|
||||
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成新代理商
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function createAgent($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'agentid/R', 'name/R', 'power/R'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$Agent->addAgent($params);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成新渠道
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function createChannel($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'agentid/R', 'channelid/R', 'parentid/R', 'name/R', 'logo/R', 'qq/', 'wechat/',
|
||||
'is_show_recharge_star/1', 'recharge_roomcard_to_sales/1',
|
||||
'become_sales_mode/0', 'invitation_model/0', 'buy_card_mode/0', 'is_open/0'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$Agent->addChannel($params);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏列表
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function gameList($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getAllGameList();
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加游戏
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function createGame($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'channelid/R', 'gameid/R', 'gamename/R', 'logo/R', 'description/R',
|
||||
'ios_download_url/R', 'ios_market_type/2', 'ios_app_size/R', 'android_download_url/R', 'android_app_size/R',
|
||||
'is_open/1'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$Agent->addGame($params);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改游戏
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function saveGame($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'channelid/R', 'gameid/R', 'gamename/R', 'logo/R', 'description/R',
|
||||
'ios_download_url/R', 'ios_market_type/2', 'ios_app_size/R', 'android_download_url/R', 'android_app_size/R',
|
||||
'is_open/1', 'id/R'
|
||||
));
|
||||
|
||||
//$this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$Agent->setGameInfo($params);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取代理商信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function queryAgentInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'id/R'
|
||||
));
|
||||
|
||||
// $this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getAgentInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取渠道信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function queryChannelInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'id/R'
|
||||
));
|
||||
|
||||
// $this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getChannelInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function queryGameInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'id/R'
|
||||
));
|
||||
|
||||
// $this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getGameInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改代理商信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function changeAgentInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'agentid/R', 'name/R', 'power/R', 'id/R'
|
||||
));
|
||||
|
||||
// $this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->setAgentInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改渠道信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function changeChannelInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
/*'account/R', 'password/R',*/
|
||||
'agentid/R', 'channelid/R', 'parentid/R', 'name/R', 'logo/R', 'qq/', 'wechat/',
|
||||
'is_show_recharge_star/1', 'recharge_roomcard_to_sales/1',
|
||||
'become_sales_mode/0', 'invitation_model/0', 'buy_card_mode/0', 'share_title/', 'share_desc/',
|
||||
'share_img/', 'share_text/', 'pay_desc/', 'announcement/', 'is_open/0', 'id/R'
|
||||
));
|
||||
|
||||
// $this->_checkAdmin($params);
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->setChannelInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员 给 (代理、玩家) 充 (房卡、星星)
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function recharge($request, &$return)
|
||||
{
|
||||
try {
|
||||
/**
|
||||
* userid userid 充值人(代理、玩家)
|
||||
* u_type user_type 1:玩家 2:代理
|
||||
* p_type production_type 1:房卡 2:金币
|
||||
*/
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R', 'userid/R', 'adminid/R',
|
||||
'u_type/0', 'p_type/0', 'amount/0'
|
||||
));
|
||||
|
||||
if($params['amount'] < 1)
|
||||
throw new Exception('数量必须大于0', 2001);
|
||||
|
||||
$Sales = new \models\SalesUser();
|
||||
if($params['u_type'] === 1) {
|
||||
$Sales->playerRecharge($params);
|
||||
} elseif ($params['u_type'] === 2) {
|
||||
$Sales->salesRecharge($params);
|
||||
} else {
|
||||
throw new Exception('用户类型错误', 2000);
|
||||
}
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 指定渠道的商品列表
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function productList($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R'
|
||||
));
|
||||
|
||||
$return->biz_content = $Agent->getAllProductList($params['agentid']);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单个产品信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function productInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
|
||||
$params = $this->checkParams($request, array(
|
||||
'idx/R'
|
||||
));
|
||||
|
||||
$return->biz_content = $Agent->getProductInfo($params['idx']);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个商品信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function changeProductInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
|
||||
$params = $this->checkParams($request, array(
|
||||
'sapr_agentid/R', 'sapr_type/r', 'sapr_name/R', 'sapr_amount/R', 'sapr_money/R', 'sapr_memo/',
|
||||
'sapr_state/r', 'product_type/r', 'parent_id/', 'sort/0', 'make_vip/r', 'idx/R'
|
||||
));
|
||||
|
||||
$return->biz_content = $Agent->setProductInfo($params);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function addProductInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$Agent = new \models\Agent();
|
||||
|
||||
$params = $this->checkParams($request, array(
|
||||
'sapr_agentid/R', 'sapr_type/r', 'sapr_name/R', 'sapr_amount/R', 'sapr_money/R', 'sapr_memo/',
|
||||
'sapr_state/r', 'product_type/r', 'parent_id/', 'sort/0', 'make_vip/r'
|
||||
));
|
||||
|
||||
$return->biz_content = $Agent->addProductInfo($params);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 茶水费配置
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function agentServiceConfig($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getAgentServiceConfig($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个茶水费配置
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function agentServiceConfigSingle($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'id/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getAgentServiceConfigSingle($params['id']);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个茶水费配置
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function agentServiceConfigSave($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'id/R', 'min_value/r', 'max_value/r', 'type/r', 'value/r'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$Agent->getAgentServiceConfigSave($params);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家的上级信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function playerParentInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R', 'playerid/R'
|
||||
));
|
||||
|
||||
$User = new \models\SalesUser();
|
||||
$result = $User->getPlayerParentInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改玩家上级
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function setPlayerParent($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R', 'playerid/R', 'parentid/r'
|
||||
));
|
||||
|
||||
$User = new \models\SalesUser();
|
||||
$User->setPlayerParent($params);
|
||||
|
||||
//if(!$result) throw new Exception('修改失败', 1000);
|
||||
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
codes/agent/game/dlweb/api/lib/1.0/agent.php
Normal file
25
codes/agent/game/dlweb/api/lib/1.0/agent.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: win7
|
||||
* Date: 2017-07-03
|
||||
* Time: 14:14
|
||||
*/
|
||||
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/public/usefull.php';
|
||||
|
||||
|
||||
require_once __DIR__ . '/model/user.php';
|
||||
require_once __DIR__ . '/model/game.php';
|
||||
require_once __DIR__ . '/model/order.php';
|
||||
require_once __DIR__ . '/model/card.php';
|
||||
require_once __DIR__ . '/model/agent.php';
|
||||
require_once __DIR__ . '/model/demand.php';
|
||||
require_once __DIR__ . '/model/player.php';
|
||||
require_once __DIR__ . '/model/settle.php';
|
||||
require_once __DIR__ . '/model/manage.php';
|
||||
require_once __DIR__ . '/model/gift.php';
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEYjCCA8ugAwIBAgIDEOVzMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MDIwMzA0NDAwN1oX
|
||||
DTI2MDEzMTA0NDAwN1owgZIxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEnMCUGA1UEAxQe5rGf6KW/5aSp55ub572R57uc5pyJ6ZmQ5YWs5Y+4
|
||||
MREwDwYDVQQEEwgxMDY4NjEyMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAOw+QLt0FlpT6IxEKR30JSyVIYy9ShS9KMfjNsLOUZLQyNmZhov+E6PdcUTs
|
||||
6YwylWEOfmFKqIiVZG2zd2xlq7qEu8aD9Fk/xxO7RRJP4vnkmUyNLaK5d+Kxc/77
|
||||
q8HWZWUyDuCoxEsRuEVez8fkMBbtyqzlysf0V4hrUMdxreIJDqcQbRTCfi4j7D2h
|
||||
WSb6/xC5xxFC7xr1TdBatCeLaYWiYuMnlUrdC3sXvE+qhFsjxDqM8n+iOVByIQ4R
|
||||
lOtV8wEKWIRMwgK5WSd4Fetdl+vsRwkdEZwTKli8MDqBTCqJnzYPosXuE0pY8xr6
|
||||
nBHkq6mrFskyhso+BLb6svHNfHMCAwEAAaOCAUYwggFCMAkGA1UdEwQCMAAwLAYJ
|
||||
YIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNhdGUiMB0GA1Ud
|
||||
DgQWBBQ8viOAiSWjFdhsowaiKzIiAloafzCBvwYDVR0jBIG3MIG0gBQ+BSb2ImK0
|
||||
FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgTCUd1
|
||||
YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQxDDAK
|
||||
BgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJARYQ
|
||||
bW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAWBgNV
|
||||
HSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQCPgdGBRrVE5Fet
|
||||
w/Mi8NMMgOcxZGs/xHZKtw/kHaZqWfmEGa4W5+X3juVG6TrYuek+2RwGE6qfLhAG
|
||||
HtiESs2Pvws1WbUSaFeyjWFzgbcyjMlj/3DS+J2Hq4voRSBruxJ0DaunwTzlwtIn
|
||||
MaKfGusX4QlLZIa3Ga+37bHKp29HEA==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEugIBADANBgkqhkiG9w0BAQEFAASCBKQwggSgAgEAAoIBAQDsPkC7dBZaU+iM
|
||||
RCkd9CUslSGMvUoUvSjH4zbCzlGS0MjZmYaL/hOj3XFE7OmMMpVhDn5hSqiIlWRt
|
||||
s3dsZau6hLvGg/RZP8cTu0UST+L55JlMjS2iuXfisXP++6vB1mVlMg7gqMRLEbhF
|
||||
Xs/H5DAW7cqs5crH9FeIa1DHca3iCQ6nEG0Uwn4uI+w9oVkm+v8QuccRQu8a9U3Q
|
||||
WrQni2mFomLjJ5VK3Qt7F7xPqoRbI8Q6jPJ/ojlQciEOEZTrVfMBCliETMICuVkn
|
||||
eBXrXZfr7EcJHRGcEypYvDA6gUwqiZ82D6LF7hNKWPMa+pwR5KupqxbJMobKPgS2
|
||||
+rLxzXxzAgMBAAECggEALiMOQ02tm+BtNw+MtCPdKrLJRZImKJy0nSz7odnnRnPt
|
||||
9cks5KQvM75og5x9E/tA/x50gg2xklMStPXqqcnFWvzXKzLUAqYY+/qDx8rAOitx
|
||||
4OhldDUie6xKSg7egVGcpcG79BYhl8OTKEEW9SPUXHX+MfwCuUA35BWJRhomalEY
|
||||
csgdCV+g95zcSGHAJAg4Hd1cl/FLVujMyIogdhXtR3lJvfLGNS95fSnELfPG45RR
|
||||
38d1NPdV28zv7y/nMnypnJ5ccp3vl3TYl8OsSNttLkchFVpuB4p2/3Ze3fe3LtAU
|
||||
luAJ5xpU790LyaFm7CDo1kcSMasRZgLTecfqJRa/8QKBgQD4dIPFLKKE4fusdVr3
|
||||
EbwwF4Lco8n9Osv3RYgvcjXNlP54iv2APOUiNGpf/nKtVuQDhrzYrbRpQ9h1gImH
|
||||
JRj/xmw8nCMa77fZX6MxUopJ+f0f2Eeogei8GR+4QgD0/buZZA0IFTmSPx3Uqqky
|
||||
DN+7BbEOU2kNbBACqbairX2fqQKBgQDzas127uRh4X4JtpfHb2zZX2SXEzUnZU8g
|
||||
jR/TDNp+AnhoXpg1LYmHdKfac+bWNZvUs7TMi6cSF3cXvSNwMbqyraWrFBk1CZir
|
||||
gwVbE1xau2I8H2wI4BJCC+ZZCqGPY4s1n/5jbFCnzZEDORwjkEDnxq5l0AdgqhTG
|
||||
vCv2kJR8uwKBgEVgY5sfR5JLd/dEHc53yVC0f/oUUka/sEyvwcNd5OAvBo+qX/b7
|
||||
ChBvCnUbm/IDHVBOw1TNzF7Ibx0Ac2alWUGyqm6SOss+vNuZ9PvEzJCzmZbW0cuf
|
||||
2tkLOuw8of/HCide5LSpGJZZwX6s2On85kxW3oXdjKwOzLmxoinyv+1hAoGACv9r
|
||||
UxFODkIS4Lt4NhGJuHR/5fd/Mk14er8FjhKJmKHh8M09UUHCcfVKVCtiZZE8fiq0
|
||||
Y313yfB3eAIapMoKZmJEFuusi+HoHO+pgUjppkvLD25YAjqleIhzGtjJHeJgesbE
|
||||
xpcxObOm9p9Q7yZoWFB4tq7kdnCYybXcwqIbo1sCf0HF5pBw9vqB94Pm5QkkEz/l
|
||||
i7vFKDGciivLV5GpINAZ7Bp6FVzUEyLBtWO50KyLwL/VHIiPJG2p3appShNnKyPN
|
||||
Ve9NuFqSSFfKygSvHne4uceuY/wW9wDK6io5KPhGHjdE3K4fpXR/xU417wk0sQCo
|
||||
X6obKKFmExUdyqWiNrs=
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
|
||||
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
|
||||
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
|
||||
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
|
||||
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
|
||||
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
|
||||
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
|
||||
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
|
||||
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
|
||||
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
|
||||
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
|
||||
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
|
||||
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
|
||||
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
|
||||
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
||||
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
|
||||
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,20 @@
|
||||
欢迎使用微信支付!
|
||||
微信支付API共四份(证书pkcs12格式、证书pem格式、证书密钥pem格式、CA证书),为接口中强制要求时需携带的证书文件。
|
||||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
|
||||
不同开发语言下的证书格式不同,以下为说明指引:
|
||||
证书pkcs12格式(apiclient_cert.p12)
|
||||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
|
||||
部分安全性要求较高的API需要使用该证书来确认您的调用身份
|
||||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户ID(如:10010000)
|
||||
证书pem格式(apiclient_cert.pem)
|
||||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
|
||||
证书密钥pem格式(apiclient_key.pem)
|
||||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
|
||||
CA证书(rootca.pem)
|
||||
微信支付api服务器上也部署了证明微信支付身份的服务器证书,您在使用api进行调用时也需要验证所调用服务器及域名的真实性
|
||||
该文件为签署微信支付证书的权威机构的根证书,可以用来验证微信支付服务器证书的真实性
|
||||
某些环境和工具已经内置了若干权威机构的根证书,无需引用该证书也可以正常进行验证,这里提供给您在未内置所必须根证书的环境中载入使用
|
||||
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEazCCA9SgAwIBAgIDFIzzMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MDMwNzA5MTAxOVoX
|
||||
DTI2MDMwNTA5MTAxOVowgZsxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEwMC4GA1UEAxQn5Y2X5piM5biC57qs5bqm5paH5YyW5Lyg5aqS5pyJ
|
||||
6ZmQ5YWs5Y+4MREwDwYDVQQEEwgxMTQ5OTYzODCCASIwDQYJKoZIhvcNAQEBBQAD
|
||||
ggEPADCCAQoCggEBAKnCWH1h9+C1ql7MxGqz3h2AA1fDIKmDu7sETB5gmPY8bu1t
|
||||
1GaxiZb5771jEWMa14/cjUtvTaRgCb0fwANIaP+eeovEC2alZLxytTAgLgsiToxt
|
||||
8Q6NP4xQBfYmyL3bswggnr1EKIC2Kr8HMcxFb04xJVAx0h4RHqZYd/0q/t1vV1re
|
||||
yv2VZR+g+E7SGhO2GiKHn9C74QZWU5qe4PDblwLjqYZbxOQslF433zY7DkTrAg7m
|
||||
wxNxKBXRH3ddvVdVWH0uq1pbuZ9oYJsjhuWARr1BlmUhwXGeXiTiIkSBbO8cxauX
|
||||
XtsthCjKnn1zHHUcNWKb6n4AS/pqaTALBI4xEZ8CAwEAAaOCAUYwggFCMAkGA1Ud
|
||||
EwQCMAAwLAYJYIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNh
|
||||
dGUiMB0GA1UdDgQWBBQQMIGcrddYlWvqyEDH28EqxguTATCBvwYDVR0jBIG3MIG0
|
||||
gBQ+BSb2ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQ
|
||||
BgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1Rl
|
||||
bmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqG
|
||||
SIb3DQEJARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQE
|
||||
AwIGwDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAU
|
||||
kvUtbEqjnzI+96Q2i+CqouD5b1VaRppaRFfbuE9oBNwouS3Im/EtIBI+LV4pQmYM
|
||||
x64fdPZp7sxseOciX1qAruoYSB7mjSdiqB3vbk6hJ62viA2jqzXO4ol+ghKC5nmO
|
||||
lJIBZaHJZB8jXkxIbeMlLu8EiJMi/VyL6dlGk82fLg==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCpwlh9Yffgtape
|
||||
zMRqs94dgANXwyCpg7u7BEweYJj2PG7tbdRmsYmW+e+9YxFjGteP3I1Lb02kYAm9
|
||||
H8ADSGj/nnqLxAtmpWS8crUwIC4LIk6MbfEOjT+MUAX2Jsi927MIIJ69RCiAtiq/
|
||||
BzHMRW9OMSVQMdIeER6mWHf9Kv7db1da3sr9lWUfoPhO0hoTthoih5/Qu+EGVlOa
|
||||
nuDw25cC46mGW8TkLJReN982Ow5E6wIO5sMTcSgV0R93Xb1XVVh9LqtaW7mfaGCb
|
||||
I4blgEa9QZZlIcFxnl4k4iJEgWzvHMWrl17bLYQoyp59cxx1HDVim+p+AEv6amkw
|
||||
CwSOMRGfAgMBAAECggEATNaK9zXA3RVdaEuHHEUN5Ixs9ux7fD8EWkI3sghHNC1m
|
||||
iFGOMm1pucynlzGgTRt5NsS9r8dRfXV68v/MCbBc1lcFYP37qxpx3lqNaJsoPCHr
|
||||
K+UXl16XxQrzp9cmRcmL38HkGAchziCmeJDpGWzUVLAqE4J5eOKG3QRuS0mK0u81
|
||||
5lU9X29CYab05jrm/4lhQUijR6ubt8XRz6Gpskzf3hvMpiScHSEK8qCRfa6IV9z4
|
||||
G6cjwAM9kd8IT8lxCEvA2AQIHBtmwYcSBqfD2o40SBUVqwMlaH+4KtR+5y/VJ7H1
|
||||
lF3oogknpWGRgMqSIq2jA7Z3nAZY3SmCihG9C7NaAQKBgQDXwoBBn5y8ZfDYK16X
|
||||
qiFG78zbi0Bmni8wmyPX4jcvSjA69GWJvx1XBXFFle/sDP74p+6Wv5suZTx93jMI
|
||||
yaMs67vRzA7neLzFsT8R/QZb93bdvXPDPwORqGE5i9NnXPGzqPXh/UCkLW1u+4Lz
|
||||
5iqeUj5L+RTP48rBJgO8rFPkCQKBgQDJa4kIf43FBhqHTvK0cgA+iEDw3linHZOV
|
||||
sfzjU8N0VH4KTrTDABQkC+dtdKj52Ax8WSr93vXBK8bxR9KacQDL/AESKtown8j8
|
||||
R5Bp13mDS+y1VxphynK/99ZvP5g8mZArFhHpHzi8O1qArZrwG4LNCp9itYqmCMuR
|
||||
gFNwf/ZCZwKBgDMzNLxd5BPRHRYvNINJHBx5S2PN57pyT0B5kEfqpq3SLR/QX0gQ
|
||||
0iWUZQzeR9D8RIU9VKDxVyHrZC96SyIKt24xgqCGjALh4+oF5bGfGaM5VjvIeXAb
|
||||
w/0MuAWv6Lrek3zO24qFTpGnNhDgHnNCa1qmqaHdudKbe8HaA4kCW+YBAoGAVci+
|
||||
7CenMaqP0eEF7WRARmGxhuSrzUEDglXz5r3eGMWDiNBMnGCEM3X+ctekwAQMDUnM
|
||||
zaMP9921NT3prG1EcZw6uIoXs23aI9g24V0sG4dSoUkfq1aV2LytT2Q+alDc3fzg
|
||||
U/FAMKr2uKc3vdt5seo8R8YZ7u0ABlApOVjGgTECgYAf7HvCi4SPe7vkaWA3XkYK
|
||||
LQ1TFgKlcXHXdQA/EkvQ2bXiEDIvB+3jpYN9OUgzVA8AmA7V5ExLhz+QMBIwZQjN
|
||||
xejgan72hzn01MCd3Ldg8KWfQ4Wvey8S4AHNYi1tj/0xOV1hUROIZFtdMVWxjQ6K
|
||||
DyE+u6fwkPfMD9qNi/v7Nw==
|
||||
-----END PRIVATE KEY-----
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEYjCCA8ugAwIBAgIDI9viMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MDUwNjA1MTAwNloX
|
||||
DTI2MDUwNDA1MTAwNlowgZIxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEnMCUGA1UEAxQe5rGf6KW/5LqR5a6256eR5oqA5pyJ6ZmQ5YWs5Y+4
|
||||
MREwDwYDVQQEEwgxMjA0MjQ0NzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAKMJHRRqSqelvD7BJ/EsWXNkJEmOJW+dsB0/Zc4phMK+oh06FdNr57Ekk2Ga
|
||||
5vo4fLIw0VEXN49P4XKZRhVKwupVGocIe97/ovt2vzg8uqD4H/Go9Dxc3bphGkzo
|
||||
0s0ps5Gy5TW0zOVwotBxDwd7tMs2++JzJ2ZcnesqNfYiHYsTb+ljIAYP0bCaYGNi
|
||||
3NDbaykV9f1BkfgddV1LPn1XGRsOQFMcsjhRGP8TFGs0aLU5Rhm0jimmF4yvZwS7
|
||||
81Ah8wBquTCwy9+qrW+SCHmMFpftPmcKWTqhb683GX99l1+wKhWhTvab1UH5eQPR
|
||||
U+mk2Hak1kSFapTY1ojvlWerB/sCAwEAAaOCAUYwggFCMAkGA1UdEwQCMAAwLAYJ
|
||||
YIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNhdGUiMB0GA1Ud
|
||||
DgQWBBQG9ruoebdmJpnT3uFhkzVHdpEtUDCBvwYDVR0jBIG3MIG0gBQ+BSb2ImK0
|
||||
FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgTCUd1
|
||||
YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQxDDAK
|
||||
BgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJARYQ
|
||||
bW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAWBgNV
|
||||
HSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQBX1xDB9Og/B9lQ
|
||||
roNlzQcm/LEhRZ1YIgDY8SkuXRBcXRcxpUY45oI8XrpCYEGAfjIxuSC8v1kgduSR
|
||||
Moy/06aaKT4AGO8z6q2jhBAywKEWGqqkPgiGe/meuba5z/0rSp32dC7upMVW4hlC
|
||||
F9udaeeGcWiq4qi34nDvg10GgtIZEQ==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCjCR0Uakqnpbw+
|
||||
wSfxLFlzZCRJjiVvnbAdP2XOKYTCvqIdOhXTa+exJJNhmub6OHyyMNFRFzePT+Fy
|
||||
mUYVSsLqVRqHCHve/6L7dr84PLqg+B/xqPQ8XN26YRpM6NLNKbORsuU1tMzlcKLQ
|
||||
cQ8He7TLNvvicydmXJ3rKjX2Ih2LE2/pYyAGD9GwmmBjYtzQ22spFfX9QZH4HXVd
|
||||
Sz59VxkbDkBTHLI4URj/ExRrNGi1OUYZtI4ppheMr2cEu/NQIfMAarkwsMvfqq1v
|
||||
kgh5jBaX7T5nClk6oW+vNxl/fZdfsCoVoU72m9VB+XkD0VPppNh2pNZEhWqU2NaI
|
||||
75Vnqwf7AgMBAAECggEAG1ZS3vJ3tCaxKuCefu0NzrBy+TZxhoatWiogOvJxRWpL
|
||||
qpTrxfio7+YPJGWh50EDf6l535wB//DH/7w9qSJRDpPYj93XT2wT+xBNPfPI42bX
|
||||
jGDlGx4DO9Y+X7kGZ8pfRsX1cwzu8mXxlvvuJjYS+aQtliny6FINVLpONAhCZehG
|
||||
3G8GY3Gc7lOR0oNOOO13inL+BxJtsoqWfzXqXXT6hXuiXdBJ9fgQ35wpQwO9nxo2
|
||||
3BKuJD0z2z06bZS0Y+Vq4oy/SkhSV6lxpWWZxMkagrghqq4VpfDKC3bGpzDeHhFi
|
||||
hW02Lq12zpFcavc6PlFMuE9cgu/CGClzF+54nc7FMQKBgQDWB6cMcFIBc/3MhvuZ
|
||||
NKCNpu9QvI0ta5I+WxaLaDGeyOOqboV+K1hSezoXnWBCYEsHvr/QRLbZtKuIrXud
|
||||
1obSbimPAf+oDleUQAC7b5xTQWhs0KsyPJ3oeV7N1Ihk+/X2eKYwLCRa5GAdbmor
|
||||
Sws07VssbRY2KwgaePIV2UZw0wKBgQDDAYlRkJHYWF5rmn72WvA8uKDAjd+uoYzY
|
||||
Pr4b/8yany3rnKMi2imbippHEVE2FWIGk/LleeGcdkNVquGFDgeHWqfPj2cdJ8f3
|
||||
pKvC6F63EKmSIidT0C4pBMOtBczXR8Kq6qH/sXpy1xtxbXtZ+Jp0C3bKwHtFd8fC
|
||||
e7ifWUrTOQKBgCbWNKW5K+g/l+opBDaEqi2KARrxW9zGDD9sX+bj/T0Gzuj6LRb7
|
||||
3ob4/U2TrQfeWT8KidvM3DEc65Ndh3TYnJZKjxf4EN/52kJ4aqmYUxF4aO513tq6
|
||||
zRyGCYHn8ugAIF2c/ur215H2psowYuuALoRoHYcuND2YCVxkXelBB9spAoGAaNSH
|
||||
nGhqbvI6eAAK5qbGZO4fxMPADqHcFFfOXUDrHegaiIGhFVhQa8Rb4X6GuNtP4hdg
|
||||
yUn3JeRRmFkPeTash3ANrD/7/6lmD1Pf3hyK5kC3184ydBUC65wbEQWAM+7o0Hbn
|
||||
9YvUNq46m4RuflRtu5p6Fs7YteSJZ5yZCFi5J8kCgYAlWHO1QiEC0ITue2aIKZhT
|
||||
MmUzl601jG+/T6WoI50JB60RZt6SIPwF881pDt3UmPgAqIxVav5Dbh27P34r8dNE
|
||||
4ACaxVFUJhjB0l4oWmSH72zibn5XtanoKPHyKQAn7/Pu7SzDrka5ulUn9tYsRmPW
|
||||
Jfw2Cj+hnWXZZms+9YCboA==
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
|
||||
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
|
||||
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
|
||||
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
|
||||
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
|
||||
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
|
||||
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
|
||||
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
|
||||
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
|
||||
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
|
||||
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
|
||||
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
|
||||
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
|
||||
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
|
||||
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
||||
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
|
||||
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,20 @@
|
||||
欢迎使用微信支付!
|
||||
微信支付API共四份(证书pkcs12格式、证书pem格式、证书密钥pem格式、CA证书),为接口中强制要求时需携带的证书文件。
|
||||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
|
||||
不同开发语言下的证书格式不同,以下为说明指引:
|
||||
证书pkcs12格式(apiclient_cert.p12)
|
||||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
|
||||
部分安全性要求较高的API需要使用该证书来确认您的调用身份
|
||||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户ID(如:10010000)
|
||||
证书pem格式(apiclient_cert.pem)
|
||||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
|
||||
证书密钥pem格式(apiclient_key.pem)
|
||||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
|
||||
CA证书(rootca.pem)
|
||||
微信支付api服务器上也部署了证明微信支付身份的服务器证书,您在使用api进行调用时也需要验证所调用服务器及域名的真实性
|
||||
该文件为签署微信支付证书的权威机构的根证书,可以用来验证微信支付服务器证书的真实性
|
||||
某些环境和工具已经内置了若干权威机构的根证书,无需引用该证书也可以正常进行验证,这里提供给您在未内置所必须根证书的环境中载入使用
|
||||
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEYjCCA8ugAwIBAgIDKzqrMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MDYwNjA1MzAwNFoX
|
||||
DTI2MDYwNDA1MzAwNFowgZIxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEnMCUGA1UEAxQe5rGf6KW/5LqR5a6256eR5oqA5pyJ6ZmQ5YWs5Y+4
|
||||
MREwDwYDVQQEEwgxMjcxNzUwODCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAMFQt5XNX8LigHtIrqhv8yGivPkRLPrsiNi1a2h8EYu3C409o/q4uwAuGH7s
|
||||
Fl/7ccH/+fY1qmfDt2MR5dAMZqV3/l7RG4bEPtJTEwNd6nzFvYZDcv7/KSdGDeF4
|
||||
dhNpT9oE0LaiC6P0Zdeur3AA92WbH2eN80IARYHp7vQQ4mXpxIJSB7jK93jCeCee
|
||||
Ss6ZZuk8PU/8b/B76XdwQ3R8eNvIqctjvWujVg/bA24TeGZEkBOHB4sXDpw8gHrX
|
||||
7sxYKcNIW6ZIy9/MKCS3hWbojp2JQq2FBktArmZ8pO++P2xpy86BK+x+hHc+ewKK
|
||||
dtOXGUI8Uxq08odZn8LzSpf9nJkCAwEAAaOCAUYwggFCMAkGA1UdEwQCMAAwLAYJ
|
||||
YIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNhdGUiMB0GA1Ud
|
||||
DgQWBBTIHrH8dXCHClscuO+GWQNVDiL9hjCBvwYDVR0jBIG3MIG0gBQ+BSb2ImK0
|
||||
FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgTCUd1
|
||||
YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQxDDAK
|
||||
BgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJARYQ
|
||||
bW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAWBgNV
|
||||
HSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQBouw/N2u/qILi6
|
||||
rpxauVLzCLaDzMiewSpezEQq/jL44rxDkC6dvbphT7vYO487h1k2GfnbUA7R9Hsi
|
||||
W6l4bfRdHOLFYmF5nuXJSrgtsjko+iUQ+MJm/M2pb8ndHzZb5jq2MdQAN1VlIxdo
|
||||
uOgQ2R2OKSKNlQV6Ls4zHQ3uBPcd5g==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDBULeVzV/C4oB7
|
||||
SK6ob/Mhorz5ESz67IjYtWtofBGLtwuNPaP6uLsALhh+7BZf+3HB//n2Napnw7dj
|
||||
EeXQDGald/5e0RuGxD7SUxMDXep8xb2GQ3L+/yknRg3heHYTaU/aBNC2oguj9GXX
|
||||
rq9wAPdlmx9njfNCAEWB6e70EOJl6cSCUge4yvd4wngnnkrOmWbpPD1P/G/we+l3
|
||||
cEN0fHjbyKnLY71ro1YP2wNuE3hmRJAThweLFw6cPIB61+7MWCnDSFumSMvfzCgk
|
||||
t4Vm6I6diUKthQZLQK5mfKTvvj9sacvOgSvsfoR3PnsCinbTlxlCPFMatPKHWZ/C
|
||||
80qX/ZyZAgMBAAECggEAGMoVAKy5XvBUsXp8izTv5JxNx1KghfzW/5MkFt3yEgyC
|
||||
+rWw1XHi6P8APSZhKCXCTLJah2wSUgQS/C1LXwZ4Ezfz8oy2Du4TcD0e7wuYCjAB
|
||||
QbpcgL6PtG2TUhp0acDTcI21hfX5sCii9ql77czx7KGbwVe+nfQS9bnd3oZbwd2j
|
||||
OXFqTRcBtDFyQL20DhNe70EtNOBwMfLpPKRv2sTQ4ONuRHj6PxebAntSUqunpZpb
|
||||
Thyh4vd13Tr7p7jt4jPLsHwfrAgs+m7T7PojcfDtJhYVloXHff12v75zTzbLXzAq
|
||||
K1OleCt2XLVA/Dc9ueq9lJwCBU6QKx4nLRQNT8tRQQKBgQDiL8QHyRVVRXwOIJFI
|
||||
nq8ao/ZRIjaAoc4ykb7RHRD9M9qy+PShyrQPH9yFhaZJhRSAoktRAaZMgKw+qKx2
|
||||
AFI81uTi8skZ3EEY7/kJ4YBmZFHtvt25z+K/1TCY6e8X41IkTmNZzr6X6LF7AxIb
|
||||
qvDVn3nxEJi2UIpuaeQC4UA8tQKBgQDay8XQN82NY41gVcPgUgy/8e00P+DUjNj+
|
||||
rbbqJBoZo6fOXzCjurWzj6oHC/IMHXDa6X91ugQq3/RjXkaYQodkFLm79LEDNMZy
|
||||
4fJ/iiXHQ3mBJOUDgLL1WqxVsHPP/Tn5Rm17+eX8JeVovcmwyCH0NiU+Df3ZtfJW
|
||||
K0TR5Ijy1QKBgH0kuG0mUGtReoXGdxua0H8I4KubJlSdMZzBDrZcQp4VJpeHLrKl
|
||||
mGIV2sj1XT+oJePV5532L7B8MNCqOmE/ZEDNFO6MLb/lIQ9PFpbk8Um1j67ev4aj
|
||||
Am3o4m54YBTzbOsxg76YqNMbp7bLyCUOuxk2lx1NdXDJtw3IAKOnRQdRAoGBANP9
|
||||
H5pQlv5o+G/gaTqNBQFs29EGG0aVeSG5GkLd29P/tvTDUhMxMh/aEHlnX4vRcqkI
|
||||
F5DvPF52QwmMLIYV36xeUF8GBAQBPE3PEe/04AmjHLS+FI5CQiJrShJ0NqHMzkDx
|
||||
td6rD+Qwq4fCawq3vf4qAAeR8uTf3v8SSUm8TdxJAoGAc2vfH5EeriwsKFhNbgg0
|
||||
dUvi0HjfksaUnLDTp6I2ZwgIIMohiYyvK2G0nMOUqjXaVWISebmXI9l7dD0WWiB1
|
||||
5oEdvzYSgXts3tG8PsluIYEdN/mMwnOSpZlMda0wK5SEXf7Okjn3b+I6cxryrWsk
|
||||
Uq3cA5DteK4q4AskLnpHK3w=
|
||||
-----END PRIVATE KEY-----
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEYjCCA8ugAwIBAgIDXpxMMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MTEwNzAzMDAwOVoX
|
||||
DTI2MTEwNTAzMDAwOVowgZIxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEnMCUGA1UEAxQe5rGf6KW/5aSp55ub572R57uc5pyJ6ZmQ5YWs5Y+4
|
||||
MREwDwYDVQQEEwgxNTE4OTU1NDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBAMvhG0BGBoncCvsq4SPNgKrUb++quF++L7+LR//zQ2WvFYbwwAcEadPH5gMh
|
||||
eTCoMKYsTFCOndlnhEO11ViGxoYeF9TmyTBGddk70HlAs5/kqerNRIvIxovvKhJ1
|
||||
AX1Kdt6QupKISUaQpX8DrzAuyGT+H2rlvUNiw5BlwncKmEY7NmYOum5n/T6EbSHw
|
||||
n8+/ZQc0pPK9C+QzmbRLL0GssFxPVuBQGAEgdCnNJq5Skzg7wyChZGZm6S4LjHqU
|
||||
f1+Sv6SuOO7VKrrbvwneT3qbrn2IQJHqVEooP+j3/9QJ6R89AO1eEIIrlnk3Q5PE
|
||||
wTPPWYCakrfvG9DQ3/ctN8R/LEkCAwEAAaOCAUYwggFCMAkGA1UdEwQCMAAwLAYJ
|
||||
YIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNhdGUiMB0GA1Ud
|
||||
DgQWBBQSWXDhGBe7ETTFO6eJXF4IvRDl4jCBvwYDVR0jBIG3MIG0gBQ+BSb2ImK0
|
||||
FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgTCUd1
|
||||
YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQxDDAK
|
||||
BgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJARYQ
|
||||
bW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAWBgNV
|
||||
HSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAv4TowAS6g2zac
|
||||
SCC4yt4tgz4kqZNGGWYzbjV1r2GOJCyHClr6d+O+iFimogCmTqObhzQcKqPq0PuH
|
||||
5fTO6L2vfhfrBOTEEAwOzCRyHgt+QdN0JWWgXjTWSIfv1+Y1Dyf446RrI14JvRuL
|
||||
Q5ayU6KR+9z8HEv9utjEA51lMg17Wg==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDL4RtARgaJ3Ar7
|
||||
KuEjzYCq1G/vqrhfvi+/i0f/80NlrxWG8MAHBGnTx+YDIXkwqDCmLExQjp3ZZ4RD
|
||||
tdVYhsaGHhfU5skwRnXZO9B5QLOf5KnqzUSLyMaL7yoSdQF9SnbekLqSiElGkKV/
|
||||
A68wLshk/h9q5b1DYsOQZcJ3CphGOzZmDrpuZ/0+hG0h8J/Pv2UHNKTyvQvkM5m0
|
||||
Sy9BrLBcT1bgUBgBIHQpzSauUpM4O8MgoWRmZukuC4x6lH9fkr+krjju1Sq6278J
|
||||
3k96m659iECR6lRKKD/o9//UCekfPQDtXhCCK5Z5N0OTxMEzz1mAmpK37xvQ0N/3
|
||||
LTfEfyxJAgMBAAECggEBAK4Ei4AGxRnySSUs6lHm3AXzoT9N1mVSLest9NyQRFyM
|
||||
XrF42E6lA7cSDk9pyMkxJaUQdmrj7/Namdg5YcpX7ycWlHzSJ7Me0QQEO+LiyO6W
|
||||
/Dk/z1wImP9jueNbH1RTtLYvji/4R6MFX1zURjm4FK+vAB37zdmweP/M+3kj/+kg
|
||||
pdY//QxrpJcoS2EAKuWK1UDFqX0S0yp+VPym19349RkZWIrwfSYMmAlD3NZS345o
|
||||
faSSHkkbUcQ0gQfGD3La6hV/V4GQQJmu2otX18MKaJ+Pfh0aFDqYSKd5jtEHc0zm
|
||||
QvhzpyW3QApM2O+2LfTTEA/LEf9jqyrN7zrntRqYiAECgYEA+N8nJ7k4I6mEm5c7
|
||||
akMa6r6QC+sIL4aJZbNosMRnNR9GakBaXp9kVNAeOnB6YTKWsQZPRtcV74fhGt2p
|
||||
Sy2vy05QgPdmNLNY9I3nkFLDcPgm4Fvm5T9tS6qbVL5bq3e5l+8lLx6kmM8EKJxh
|
||||
lXRUazmfIhikD9JzADAc8krHHIECgYEA0bgMO+h3zAXVU/BFga0XUQ0k8u/CxbJx
|
||||
MQiL7DiHV2d5qdDcDLLw/WAEgxBPSRdDnAPlo7NRG8YLX3YYj33kLTioecSP7euK
|
||||
t2Y7ni66Gd7JSDWJXQaXPhdOIcvZ9Do6hoRwVMGG1h3oXZHy5t37ggezz0C+iWfe
|
||||
QPp/w5DQS8kCgYBi0/LvklzZxJJ1WuvsObOxrnTzVqUMgmeDbGhRcdzuOnoy7VU1
|
||||
qCQmjfLDEDF48abnq3LF1dnPIe1hRs7YnM7ndDUB0bzThrj3fHaNWGBmNxTxGW2q
|
||||
cbKMTraaQ3GRuNyJmhzxBkEksWicW+VgfS6c2ef4mUJlShQC6hhEmy9QgQKBgQDA
|
||||
+57uZd4PNXL4GcqsKK6jG/hbQTw3FhxI5bd0eRQ53vM6zAIiAWv3jKq6PIDpHmpN
|
||||
n9xqRjEl4JlIj/DL4indXxzRaIqVgkEUwROtXQxNkBAizXkIzG7SaTmxqdd3gTmn
|
||||
3SlNJQTB9aWErTAbODwfjJzu44IyCQ2hN6HoQVMb2QKBgEBdrjQGvdjlrn5jP1OG
|
||||
dWbiSSTmDLSNVO4ck3HDWD4ngrpyr/W3HOnC1mrTY9yWlIsDxAUedKmRTqkCYzV/
|
||||
WdHA55LgvLWIUDnrdk/NFmLs/y4pW63rq/3uvaOT6zEOuz/UfA5YiE0NsiTbGhu5
|
||||
Vr0Uc1b37c+KPUm2XbIFrY+V
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
|
||||
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
|
||||
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
|
||||
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
|
||||
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
|
||||
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
|
||||
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
|
||||
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
|
||||
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
|
||||
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
|
||||
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
|
||||
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
|
||||
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
|
||||
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
|
||||
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
||||
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
|
||||
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,20 @@
|
||||
欢迎使用微信支付!
|
||||
微信支付API共四份(证书pkcs12格式、证书pem格式、证书密钥pem格式、CA证书),为接口中强制要求时需携带的证书文件。
|
||||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
|
||||
不同开发语言下的证书格式不同,以下为说明指引:
|
||||
证书pkcs12格式(apiclient_cert.p12)
|
||||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
|
||||
部分安全性要求较高的API需要使用该证书来确认您的调用身份
|
||||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户ID(如:10010000)
|
||||
证书pem格式(apiclient_cert.pem)
|
||||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
|
||||
证书密钥pem格式(apiclient_key.pem)
|
||||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
|
||||
CA证书(rootca.pem)
|
||||
微信支付api服务器上也部署了证明微信支付身份的服务器证书,您在使用api进行调用时也需要验证所调用服务器及域名的真实性
|
||||
该文件为签署微信支付证书的权威机构的根证书,可以用来验证微信支付服务器证书的真实性
|
||||
某些环境和工具已经内置了若干权威机构的根证书,无需引用该证书也可以正常进行验证,这里提供给您在未内置所必须根证书的环境中载入使用
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEazCCA9SgAwIBAgIDdCZUMA0GCSqGSIb3DQEBBQUAMIGKMQswCQYDVQQGEwJD
|
||||
TjESMBAGA1UECBMJR3Vhbmdkb25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UE
|
||||
ChMHVGVuY2VudDEMMAoGA1UECxMDV1hHMRMwEQYDVQQDEwpNbXBheW1jaENBMR8w
|
||||
HQYJKoZIhvcNAQkBFhBtbXBheW1jaEB0ZW5jZW50MB4XDTE2MTIzMDA3NTA1M1oX
|
||||
DTI2MTIyODA3NTA1M1owgZsxCzAJBgNVBAYTAkNOMRIwEAYDVQQIEwlHdWFuZ2Rv
|
||||
bmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdUZW5jZW50MQ4wDAYDVQQL
|
||||
EwVNTVBheTEwMC4GA1UEAxQn5rGf6KW/5riU5LmQ5a62572R57uc56eR5oqA5pyJ
|
||||
6ZmQ5YWs5Y+4MREwDwYDVQQEEwgxNzY2NTIwMjCCASIwDQYJKoZIhvcNAQEBBQAD
|
||||
ggEPADCCAQoCggEBAKHpH7LqOvYdWFl3mLUc7gG8/9E90d0gN83xhWvegah7VT3s
|
||||
oOJoygX4599jcgVFZXVWiyEzqTRZZQ7f5FeDSb9ZynBg6fanYb1C/FqswN3pYJWy
|
||||
d+a+Op2XsT7QoSK+4Eev/vqP6OX9xt3Kys4tu2190XvScI2Gsk5So31zkrIkHX3W
|
||||
HLCa+J/cI2cbcR4pSsJRBGgvLNxbfes98xUPqI9j9Ui0KT/5+4qgmvKbXuwvmOYQ
|
||||
h9m62+K4H+33V/ANetNouIJWh92LSorlDzRtazZSMth4utTw9WRy0mVRu7qd6s7A
|
||||
aMv+uslrrRnzIbjf0cZDUAXRn0U3POwIkaIgpp8CAwEAAaOCAUYwggFCMAkGA1Ud
|
||||
EwQCMAAwLAYJYIZIAYb4QgENBB8WHSJDRVMtQ0EgR2VuZXJhdGUgQ2VydGlmaWNh
|
||||
dGUiMB0GA1UdDgQWBBTHAqvjBd+m7degGIxTjZBKj22lkzCBvwYDVR0jBIG3MIG0
|
||||
gBQ+BSb2ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQ
|
||||
BgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1Rl
|
||||
bmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqG
|
||||
SIb3DQEJARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQE
|
||||
AwIGwDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAa
|
||||
caf82+6e5AgCTOyP6Ozq1+ao1nWVjzgMy4yRKmsUUczf/v+rUdz8U7UFZ1ICN3NY
|
||||
bs57gJ/ZLSHtCk/L6AkvBwY+ri0iC2oD88AiMjdycgyjHHoheEYSV6T3qLwkMqZY
|
||||
FCXJMDqIgoakpVv+l+du1kJVoOwAY1M9SHN791z5nw==
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCh6R+y6jr2HVhZ
|
||||
d5i1HO4BvP/RPdHdIDfN8YVr3oGoe1U97KDiaMoF+OffY3IFRWV1VoshM6k0WWUO
|
||||
3+RXg0m/WcpwYOn2p2G9QvxarMDd6WCVsnfmvjqdl7E+0KEivuBHr/76j+jl/cbd
|
||||
ysrOLbttfdF70nCNhrJOUqN9c5KyJB191hywmvif3CNnG3EeKUrCUQRoLyzcW33r
|
||||
PfMVD6iPY/VItCk/+fuKoJrym17sL5jmEIfZutviuB/t91fwDXrTaLiCVofdi0qK
|
||||
5Q80bWs2UjLYeLrU8PVkctJlUbu6nerOwGjL/rrJa60Z8yG439HGQ1AF0Z9FNzzs
|
||||
CJGiIKafAgMBAAECggEAahlcPmAjlxgPx0EJ/tUgWl9BvBoopiDwsLHuXouGp6N6
|
||||
boPbwcItcNB1EfwWwcGCBOxba7xwyu8xvBeXiIluEEiE0jOP3aQ99kopGDpQgJro
|
||||
QfCbhcduncrDyYfpr90pF5ELI6KeWeh9IuY7E/T/93YVinCSdQupWI3quNC9dqIN
|
||||
EgYKDctBFGe+f1KtzcJfUWDeD8MWTOqhDnt77gxekFxli4O//ARDRN6i1mZjU/Bo
|
||||
GH02DsdK/rA12qGhrfJP6sfyNoBlTBIurUT7VG9AIT2UknG+uH4qLGCEMU09cKzg
|
||||
F1cH+6qsI6s03tfQK8voYtGvK4fg1KXrolaQgL4mQQKBgQDQhOjUdpfsz1KyRZKd
|
||||
s41aovGi1dkzZS4AXWbIGW1ovB7IdbGd/NZq7N194SbG5+sn7JFED6statvV/gwa
|
||||
7XviGWAWh4AWnQT3A+EH6x0izRLs3iQB3x6JnL6tDdA3XfcwvSAUjicHP+HTfJPK
|
||||
6zqY5Mihz07r6lt6tg01DYOnjwKBgQDGx0oI0JQML6tLfK7EReBmOQ0lmbh5Jkst
|
||||
Hzm2V2Uuc11FGQ47AU3wlMkWk5OCURgOQWoZnxYlAhy2OB8MnAQku0ZAWSwjeHEW
|
||||
vZu+XQFVFMs23FVb/dD5eB7eJSCNKSugzhHgs6nNj5MreHU+3cmJDTJThwBU+kY1
|
||||
QZGe8TUH8QKBgQCBFBVxGCy5yik98/Vrq+9v0PhVvZ1jxFlynl72tU7WC8Xef4TA
|
||||
8PfmXtRJjSvM61nVcAsIn85uIf0N/eKOdL5AW0bxC1YOKYseQgd2OGPj3CDAAk81
|
||||
3WFw/FfIlolzDLbtM9X9A3ZDdZccrLxsW6r9ZHqSN9t6DKwuTS3lzoTWHwKBgBdd
|
||||
HzeQBIa2J6UUv5n0OJ7rP79WpRcgSB/Cls720L638pOHkWOgEKAhbM1JhUIA9Bng
|
||||
2G6wgzLQX72PNR8PS3Fhza0MjiKRKoGowaCLX/e3HPeSyDmqyKA53S7xIDVXTHh3
|
||||
ICTQGTo/EOZAH0/HU8PXGD43FPPoAs6JqWsMINaRAoGAJA7PlrCzd4rbm0IOFqj+
|
||||
rsF16/NqS3GN34j74JWvTxkDew7sa2hmsndZAVsn+6l7PT3pxzRiq0lDFt8NiciO
|
||||
oc4dTRcvKFQMcfClYlE9/PckFKZpCl/XDfNirwEJilTY4E5kLWG1Jsrf7k5F/Q99
|
||||
AY3pNzVB+L03PIBLjvAdBXI=
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
|
||||
UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
|
||||
dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
|
||||
MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
|
||||
dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
|
||||
AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
|
||||
BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
|
||||
cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
|
||||
AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
|
||||
MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
|
||||
aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
|
||||
ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
|
||||
IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
|
||||
MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
|
||||
A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
|
||||
7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
|
||||
1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,20 @@
|
||||
欢迎使用微信支付!
|
||||
微信支付API共四份(证书pkcs12格式、证书pem格式、证书密钥pem格式、CA证书),为接口中强制要求时需携带的证书文件。
|
||||
证书属于敏感信息,请妥善保管不要泄露和被他人复制。
|
||||
不同开发语言下的证书格式不同,以下为说明指引:
|
||||
证书pkcs12格式(apiclient_cert.p12)
|
||||
包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
|
||||
部分安全性要求较高的API需要使用该证书来确认您的调用身份
|
||||
windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户ID(如:10010000)
|
||||
证书pem格式(apiclient_cert.pem)
|
||||
从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
|
||||
证书密钥pem格式(apiclient_key.pem)
|
||||
从apiclient_cert.p12中导出密钥部分的文件,为pem格式
|
||||
部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
|
||||
您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
|
||||
CA证书(rootca.pem)
|
||||
微信支付api服务器上也部署了证明微信支付身份的服务器证书,您在使用api进行调用时也需要验证所调用服务器及域名的真实性
|
||||
该文件为签署微信支付证书的权威机构的根证书,可以用来验证微信支付服务器证书的真实性
|
||||
某些环境和工具已经内置了若干权威机构的根证书,无需引用该证书也可以正常进行验证,这里提供给您在未内置所必须根证书的环境中载入使用
|
||||
@@ -0,0 +1 @@
|
||||
[{"game_id":"test","scheme":"http","address":"120.26.52.206","port":53091},{"game_id":"8x4l0rGjf026f60c48h0mbUAhK5vV16f","scheme":"http","address":"121.43.232.182","port":56003},{"game_id":"a52y0ajd106pKU1KIvF1zRii8h1gRem5","scheme":"http","address":"121.43.232.182","port":56005},{"game_id":"etuj0pYtB0QIaW3wnNX0Se9fcGrbSIjD","scheme":"http","address":"121.43.232.182","port":56007},{"game_id":"FDtj0pGhT0Evjd3efAS5wkIlamiTh2oa","scheme":"http","address":"121.43.232.182","port":56009},{"game_id":"TLW003EQ50asiD0bpq29aejKas3PqYBg","scheme":"http","address":"121.43.232.182","port":56015},{"game_id":"kanU0UByc0aGPq1pjyA6Fs0T9cyVkW0r","scheme":"http","address":"120.55.87.169","port":56017},{"game_id":"uQWK0mQjG0CZOe38ofz1AJ2b3k3Vl6WJ","scheme":"http","address":"120.55.87.169","port":56019},{"game_id":"tKez0auYs0HNjN3KLTo4Eoz3y7sp767Q","scheme":"http","address":"120.55.87.169","port":56023},{"game_id":"sJgp0FArn0olVc3yitp3xThV036fG7n0","scheme":"http","address":"120.55.87.169","port":56025},{"game_id":"jLua0xiBg0GwuH1eeFs5dK8u2H9ya8UI","scheme":"http","address":"120.55.87.169","port":56027},{"game_id":"yDkn0jIqh0PbgY3dkpy8MghHNkrHS2de","scheme":"http","address":"120.55.87.169","port":56047},{"game_id":"dfSq0zqyi0aBKv2auia8fJHrtJuPy7x1","scheme":"http","address":"120.26.95.55","port":56031},{"game_id":"ociz0alQk0xkIW2dMSF7eigb6AUNbNF9","scheme":"http","address":"120.26.95.55","port":56033},{"game_id":"qwjG0uNfT0wstn2uAiS4YbjiRud1v6WO","scheme":"http","address":"120.26.95.55","port":56035},{"game_id":"KenZ0FzAq0prkJ3iexc7rZ2tpzjOPk6x","scheme":"http","address":"120.26.95.55","port":56037},{"game_id":"tR8r0H4hj0V6gY1j45533g00RxG1Uc28","scheme":"http","address":"120.26.95.55","port":56039},{"game_id":"RxqG0uYoa0csAt4lwvx0NWygTpzj2b0d","scheme":"http","address":"120.26.95.55","port":56041},{"game_id":"Dlmh0USmi0dqkN4uKbW4xsxClO48uoky","scheme":"http","address":"120.26.95.55","port":56045},{"game_id":"seAz0gtHt0boIZ4NoCw3trpKge64JT0v","scheme":"http","address":"120.26.95.55","port":56049},{"game_id":"JUfj0aCSs0bLYh4cmvs5sksepOebabe4","scheme":"http","address":"\"120.55.87.169","port":56051},{"game_id":"itnu0SfER0aTwk3pdJF9zgkiqvhfJYdg","scheme":"http","address":"120.55.87.169","port":56053},{"game_id":"uvkC0AiwJ0fGst5nFua4utuPsfBvzFPb","scheme":"http","address":"120.26.95.55","port":56055},{"game_id":"rZDp0wfvC0ZaPT5iLqh2itGFsnJaDvzc","scheme":"http","address":"120.26.95.55","port":56057},{"game_id":"jzWe0kzmN0tAcZ5MLks3rFWcxNecogyu","scheme":"http","address":"120.26.95.55","port":56059}]
|
||||
276
codes/agent/game/dlweb/api/lib/1.0/config/game.config.php
Normal file
276
codes/agent/game/dlweb/api/lib/1.0/config/game.config.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: bahamut
|
||||
* Date: 2018/6/13
|
||||
* Time: 9:52
|
||||
*/
|
||||
|
||||
|
||||
const GAME_ID_TEST = 'test'; /// 测试环境下的游戏id,不用更改。
|
||||
|
||||
$https =
|
||||
(isset($_SERVER['REQUEST_SCHEME']) && strcasecmp($_SERVER['REQUEST_SCHEME'], 'https') == 0) ||
|
||||
(isset($_SERVER['HTTPS']) && (strcasecmp($_SERVER['HTTPS'], 'on') == 0 || strcasecmp($_SERVER['HTTPS'], '1') == 0));
|
||||
if ($https)
|
||||
$scheme = 'https';
|
||||
else
|
||||
$scheme = 'http';
|
||||
|
||||
/// 游戏接口服务器列表
|
||||
return array(
|
||||
/// 测试 8x4l0rGjf026f60c48h0mbUAhK5vV16f 120.26.52.206:53091
|
||||
array(
|
||||
'game_id' => GAME_ID_TEST, /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.52.206', /// 服务器域名、地址
|
||||
'port' => 53091, /// 服务器端口
|
||||
),
|
||||
|
||||
/// ====================================================================================================================
|
||||
|
||||
/// 打十 8x4l0rGjf026f60c48h0mbUAhK5vV16f 121.43.232.182:56003
|
||||
array(
|
||||
'game_id' => '8x4l0rGjf026f60c48h0mbUAhK5vV16f', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56003, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 三个老K a52y0ajd106pKU1KIvF1zRii8h1gRem5 121.43.232.182:56005
|
||||
array(
|
||||
'game_id' => 'a52y0ajd106pKU1KIvF1zRii8h1gRem5', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56005, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 跑得快 etuj0pYtB0QIaW3wnNX0Se9fcGrbSIjD 121.43.232.182:56007
|
||||
array(
|
||||
'game_id' => 'etuj0pYtB0QIaW3wnNX0Se9fcGrbSIjD', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56007, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 斗地主 FDtj0pGhT0Evjd3efAS5wkIlamiTh2oa 121.43.232.182:56009
|
||||
array(
|
||||
'game_id' => 'FDtj0pGhT0Evjd3efAS5wkIlamiTh2oa', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56009, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 找朋友 TLW003EQ50asiD0bpq29aejKas3PqYBg 121.43.232.182:56015
|
||||
array(
|
||||
'game_id' => 'TLW003EQ50asiD0bpq29aejKas3PqYBg', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56015, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 冲关麻将 kanU0UByc0aGPq1pjyA6Fs0T9cyVkW0r 120.55.87.169:56017
|
||||
array(
|
||||
'game_id' => 'kanU0UByc0aGPq1pjyA6Fs0T9cyVkW0r', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56017, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 干瞪眼 uQWK0mQjG0CZOe38ofz1AJ2b3k3Vl6WJ 120.55.87.169:56019
|
||||
array(
|
||||
'game_id' => 'uQWK0mQjG0CZOe38ofz1AJ2b3k3Vl6WJ', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56019, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 三副牌 tKez0auYs0HNjN3KLTo4Eoz3y7sp767Q 120.55.87.169:56023
|
||||
array(
|
||||
'game_id' => 'tKez0auYs0HNjN3KLTo4Eoz3y7sp767Q', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56023, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 关牌 sJgp0FArn0olVc3yitp3xThV036fG7n0 120.55.87.169:56025
|
||||
array(
|
||||
'game_id' => 'sJgp0FArn0olVc3yitp3xThV036fG7n0', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56025, /// 服务器端口
|
||||
),
|
||||
|
||||
/// K105 jLua0xiBg0GwuH1eeFs5dK8u2H9ya8UI 120.55.87.169:56027
|
||||
array(
|
||||
'game_id' => 'jLua0xiBg0GwuH1eeFs5dK8u2H9ya8UI', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56027, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 打大A yDkn0jIqh0PbgY3dkpy8MghHNkrHS2de 120.55.87.169:56047
|
||||
array(
|
||||
'game_id' => 'yDkn0jIqh0PbgY3dkpy8MghHNkrHS2de', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56047, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 东乡裤筒 dfSq0zqyi0aBKv2auia8fJHrtJuPy7x1 120.26.95.55:56031
|
||||
array(
|
||||
'game_id' => 'dfSq0zqyi0aBKv2auia8fJHrtJuPy7x1', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56031, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 东乡翻天 ociz0alQk0xkIW2dMSF7eigb6AUNbNF9 120.26.95.55:56033
|
||||
array(
|
||||
'game_id' => 'ociz0alQk0xkIW2dMSF7eigb6AUNbNF9', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56033, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 长沙麻将 qwjG0uNfT0wstn2uAiS4YbjiRud1v6WO 120.26.95.55:56035
|
||||
array(
|
||||
'game_id' => 'qwjG0uNfT0wstn2uAiS4YbjiRud1v6WO', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56035, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 红中麻将 KenZ0FzAq0prkJ3iexc7rZ2tpzjOPk6x 120.26.95.55:56037
|
||||
array(
|
||||
'game_id' => 'KenZ0FzAq0prkJ3iexc7rZ2tpzjOPk6x', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56037, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 抚州麻将 tR8r0H4hj0V6gY1j45533g00RxG1Uc28 120.26.95.55:56039
|
||||
array(
|
||||
'game_id' => 'tR8r0H4hj0V6gY1j45533g00RxG1Uc28', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56039, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 万年麻将 RxqG0uYoa0csAt4lwvx0NWygTpzj2b0d 120.26.95.55:56041
|
||||
array(
|
||||
'game_id' => 'RxqG0uYoa0csAt4lwvx0NWygTpzj2b0d', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56041, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 龙岩麻将 Dlmh0USmi0dqkN4uKbW4xsxClO48uoky 120.26.95.55:56045
|
||||
array(
|
||||
'game_id' => 'Dlmh0USmi0dqkN4uKbW4xsxClO48uoky', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56045, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 内蒙麻将 seAz0gtHt0boIZ4NoCw3trpKge64JT0v 120.26.95.55:56049
|
||||
array(
|
||||
'game_id' => 'seAz0gtHt0boIZ4NoCw3trpKge64JT0v', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56049, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 打卡 JUfj0aCSs0bLYh4cmvs5sksepOebabe4 "120.55.87.169:56051
|
||||
array(
|
||||
'game_id' => 'JUfj0aCSs0bLYh4cmvs5sksepOebabe4', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '"120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56051, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 十三水 itnu0SfER0aTwk3pdJF9zgkiqvhfJYdg 120.55.87.169:56053
|
||||
array(
|
||||
'game_id' => 'itnu0SfER0aTwk3pdJF9zgkiqvhfJYdg', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56053, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 断卡勾 uvkC0AiwJ0fGst5nFua4utuPsfBvzFPb 120.26.95.55:56055
|
||||
array(
|
||||
'game_id' => 'uvkC0AiwJ0fGst5nFua4utuPsfBvzFPb', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56055, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 进贤麻将 rZDp0wfvC0ZaPT5iLqh2itGFsnJaDvzc 120.26.95.55:56057
|
||||
array(
|
||||
'game_id' => 'rZDp0wfvC0ZaPT5iLqh2itGFsnJaDvzc', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56057, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 江山麻将 jzWe0kzmN0tAcZ5MLks3rFWcxNecogyu 120.26.95.55:56059
|
||||
array(
|
||||
'game_id' => 'jzWe0kzmN0tAcZ5MLks3rFWcxNecogyu', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56059, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 大乐透 Btke0urRy0cvPd5CIvD5yfhYhKhdSdex 121.43.232.182:56061
|
||||
array(
|
||||
'game_id' => 'Btke0urRy0cvPd5CIvD5yfhYhKhdSdex', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56061, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 大厅 G2hw0ubng0zcoI0r4mx3H2yr4GejidwO 121.43.232.182:56063
|
||||
array(
|
||||
'game_id' => 'G2hw0ubng0zcoI0r4mx3H2yr4GejidwO', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56063, /// 服务器端口
|
||||
),
|
||||
|
||||
/// 过炸 dQyb0dvzz0afdj65hsb08QjMhzt94E1v 121.43.232.182:56065
|
||||
array(
|
||||
'game_id' => 'dQyb0dvzz0afdj65hsb08QjMhzt94E1v', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '121.43.232.182', /// 服务器域名、地址
|
||||
'port' => 56065, /// 服务器端口
|
||||
),
|
||||
/// 南昌麻将 hUNp0fnus0EtZx61IsB1jo7w6vPekov1 120.26.95.55:56067
|
||||
array(
|
||||
'game_id' => 'hUNp0fnus0EtZx61IsB1jo7w6vPekov1', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56067, /// 服务器端口
|
||||
),
|
||||
/// 争上游 sZrs0oiw40jhs66bmpf356Z6T6gvFUyd 120.55.87.169:56069
|
||||
array(
|
||||
'game_id' => 'sZrs0oiw40jhs66bmpf356Z6T6gvFUyd', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56069, /// 服务器端口
|
||||
),
|
||||
/// 九点半 pW0b02dlT0M8mr60vDs4Gstk5OrZo9aB 120.55.87.169:56071
|
||||
array(
|
||||
'game_id' => 'pW0b02dlT0M8mr60vDs4Gstk5OrZo9aB', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.55.87.169', /// 服务器域名、地址
|
||||
'port' => 56071, /// 服务器端口
|
||||
),
|
||||
/// 天全麻将 k3i80fjgK0b99N6067f9vdzj029kQ167 120.26.95.55:56073
|
||||
array(
|
||||
'game_id' => 'k3i80fjgK0b99N6067f9vdzj029kQ167', /// 游戏编号
|
||||
'scheme' => $scheme, /// 请求类型
|
||||
'address' => '120.26.95.55', /// 服务器域名、地址
|
||||
'port' => 56073, /// 服务器端口
|
||||
),
|
||||
|
||||
);
|
||||
15
codes/agent/game/dlweb/api/lib/1.0/core/Action.php
Normal file
15
codes/agent/game/dlweb/api/lib/1.0/core/Action.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2017/11/14
|
||||
* Time: 17:34
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
|
||||
class Action
|
||||
{
|
||||
|
||||
}
|
||||
119
codes/agent/game/dlweb/api/lib/1.0/core/Model.php
Normal file
119
codes/agent/game/dlweb/api/lib/1.0/core/Model.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2017/11/14
|
||||
* Time: 17:34
|
||||
*/
|
||||
|
||||
namespace core;
|
||||
|
||||
|
||||
class Model
|
||||
{
|
||||
/**
|
||||
* 数据查询实例
|
||||
* @var null
|
||||
*/
|
||||
public static $Db = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if(!self::$Db)
|
||||
self::$Db = new \BaseMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
* @param $data
|
||||
* @param string $tmp
|
||||
*/
|
||||
public static function log($data, $tmp = '')
|
||||
{
|
||||
$str = date('H:m:s').' => '. $tmp .': ';
|
||||
if(is_array($data))
|
||||
$str .= json_encode($data);
|
||||
else
|
||||
$str .= $data;
|
||||
file_put_contents('debug/'.date('Y-m-d').'.txt', $str . PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询方法,返回单条数据
|
||||
* @param $sql
|
||||
* @param array $arr
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function query($sql, $arr = [])
|
||||
{
|
||||
|
||||
$result = self::$Db->PDO_Request($sql, $arr);
|
||||
|
||||
if(!self::$Db->PDO_IsDone())
|
||||
throw new \Exception(self::$Db->GetErrorInfo());
|
||||
|
||||
if(isset($result[0]))
|
||||
return $result[0];
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询方法,返回多条数据
|
||||
* @param $sql
|
||||
* @param $arr
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function queryAll($sql, $arr = [])
|
||||
{
|
||||
|
||||
$result = self::$Db->PDO_Request($sql, $arr);
|
||||
|
||||
if(!self::$Db->PDO_IsDone())
|
||||
throw new \Exception(self::$Db->GetErrorInfo());
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 只执行sql语句,不反回结果
|
||||
* @param $sql
|
||||
* @param array $arr
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function execute($sql, $arr = [])
|
||||
{
|
||||
$ret = self::$Db->PDO_Execute($sql, $arr);
|
||||
|
||||
if(!$ret || !self::$Db->PDO_IsDone())
|
||||
throw new \Exception(self::$Db->GetErrorInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启事务
|
||||
*/
|
||||
public static function beginTransaction()
|
||||
{
|
||||
self::$Db->PDO_BeginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交一个事务
|
||||
*/
|
||||
public static function commit()
|
||||
{
|
||||
self::$Db->PDO_Commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚一个事务
|
||||
*/
|
||||
public static function rollBack()
|
||||
{
|
||||
self::$Db->PDO_Rollback();
|
||||
}
|
||||
}
|
||||
141
codes/agent/game/dlweb/api/lib/1.0/core/Tangjian.php
Normal file
141
codes/agent/game/dlweb/api/lib/1.0/core/Tangjian.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Tangjian
|
||||
{
|
||||
/**
|
||||
* 数据查询实例
|
||||
* @var null
|
||||
*/
|
||||
public static $Db = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
spl_autoload_register('self::loadByNamespace');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据命名空间加载文件
|
||||
* @param string $name
|
||||
* @return boolean
|
||||
*/
|
||||
public static function loadByNamespace($name)
|
||||
{
|
||||
// 相对路径
|
||||
$class_path = str_replace('\\', DIRECTORY_SEPARATOR, $name);
|
||||
|
||||
$class_file = dirname(__DIR__) . DIRECTORY_SEPARATOR . $class_path . '.php';
|
||||
|
||||
// 找到文件
|
||||
if (is_file($class_file)) {
|
||||
// 加载
|
||||
require_once($class_file);
|
||||
if (class_exists($name, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
* @param $data
|
||||
* @param string $tmp
|
||||
*/
|
||||
public static function log($data, $tmp = '')
|
||||
{
|
||||
$str = date('H:m:s').' => '. $tmp .': ';
|
||||
if(is_array($data))
|
||||
$str .= json_encode($data);
|
||||
else
|
||||
$str .= $data;
|
||||
file_put_contents('debug/'.date('Y-m-d').'.txt', $str . PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于调试
|
||||
* @param $tmp
|
||||
*/
|
||||
public static function debug($tmp)
|
||||
{
|
||||
echo '<pre>';
|
||||
var_dump($tmp);
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验数据
|
||||
* R => 必要的数据(不能为空)
|
||||
* r => 必要的数据(可以为空)
|
||||
* 数字类型 => 没有传递参数默认赋值
|
||||
* 字符串 => 没有传递参数默认赋值
|
||||
* @param $params
|
||||
* @param $rule
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function checkParams(&$params, $rule)
|
||||
{
|
||||
$biz = $params->biz_content;
|
||||
$tmp = null;
|
||||
$res = [];
|
||||
foreach ($rule as $v) {
|
||||
$tmp = explode('/', $v);
|
||||
if($tmp[1] === 'R')
|
||||
{
|
||||
if(!empty($biz[$tmp[0]])) {
|
||||
$res[$tmp[0]] = $biz[$tmp[0]];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Exception("请上传必要的数据({$tmp[0]})", 1001);
|
||||
}
|
||||
elseif ($tmp[1] === 'r')
|
||||
{
|
||||
if(isset($biz[$tmp[0]])) {
|
||||
$res[$tmp[0]] = $biz[$tmp[0]];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Exception("请上传必要的数据({$tmp[0]})", 1002);
|
||||
}
|
||||
elseif (is_numeric($tmp[1]))
|
||||
{
|
||||
$res[$tmp[0]] = (isset($biz[$tmp[0]]) && is_numeric($biz[$tmp[0]])) ? intval($biz[$tmp[0]]) : intval($tmp[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$res[$tmp[0]] = isset($biz[$tmp[0]]) ? strval($biz[$tmp[0]]) : strval($tmp[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询方法,返回单条数据
|
||||
* @param $sql
|
||||
* @param array $arr
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function query($sql, $arr = [])
|
||||
{
|
||||
if(!self::$Db)
|
||||
self::$Db = new \BaseMethod();
|
||||
|
||||
$result = self::$Db->PDO_Request($sql, $arr);
|
||||
|
||||
if(!self::$Db->PDO_IsDone())
|
||||
throw new \Exception(self::$Db->GetErrorInfo());
|
||||
|
||||
if(isset($result[0]))
|
||||
return $result[0];
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
}
|
||||
2119
codes/agent/game/dlweb/api/lib/1.0/finance.php
Normal file
2119
codes/agent/game/dlweb/api/lib/1.0/finance.php
Normal file
File diff suppressed because it is too large
Load Diff
203
codes/agent/game/dlweb/api/lib/1.0/game.php
Normal file
203
codes/agent/game/dlweb/api/lib/1.0/game.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
|
||||
class game extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* @note 返回主数据库连接信息
|
||||
* @return ConnectParameter
|
||||
*/
|
||||
protected function GetMasterDatabaseConnectParameter()
|
||||
{
|
||||
if(!DEBUG_MODE) {
|
||||
//最好使用只读实例 战绩数据库
|
||||
//return new ConnectParameter('rr-bp1x2415jy37d8mu1o.mysql.rds.aliyuncs.com', 3306, 'game_db', 'games', 'Games2017@)!&', MASTER_PERSISTENT, MASTER_CHARSET);
|
||||
return new ConnectParameter('rm-bp1749tfxu2rpq670lo.mysql.rds.aliyuncs.com', 3306, 'grade_db', 'games', 'Games0791!!', MASTER_PERSISTENT, MASTER_CHARSET);
|
||||
}
|
||||
else
|
||||
return new ConnectParameter('rm-bp16sbf0l9cavp7h9o.mysql.rds.aliyuncs.com', 3306, 'youle_games', 'develop', 'develop123!@#', MASTER_PERSISTENT, MASTER_CHARSET);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 某一个玩家的金币变动记录
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function goldRecord($request, &$return)
|
||||
{
|
||||
$params = (array)$request->biz_content;
|
||||
|
||||
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
|
||||
if (empty($agentid))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$playerid = isset($params['playerid']) ? $params['playerid'] : '';
|
||||
if (empty($playerid))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$pageIndex = isset($params['page_index']) ? intval($params['page_index']) : 1;
|
||||
$pageSize = isset($params['page_size']) ? intval($params['page_size']) : 10;
|
||||
|
||||
// 分页数据
|
||||
$start = ($pageIndex-1) * $pageSize;
|
||||
|
||||
$cmd = /** @lang text */<<<EOL
|
||||
SELECT
|
||||
goac_agentid,
|
||||
goac_asetcount,
|
||||
goac_playerid,
|
||||
goac_grade,
|
||||
goac_rebatevalue,
|
||||
#goac_createtime,
|
||||
goac_time as goac_createtime,
|
||||
goac_time,
|
||||
goac_invitecode,
|
||||
goac_inviteid
|
||||
from
|
||||
gold_account
|
||||
where
|
||||
goac_isrobot = 0 and
|
||||
goac_rebateto = 0 and
|
||||
goac_agentid = ? and
|
||||
goac_playerid = ?
|
||||
order by idx desc
|
||||
limit
|
||||
?, ?
|
||||
EOL;
|
||||
|
||||
$res = $this->PDO_Request($cmd, $agentid, $playerid, $start, $pageSize);
|
||||
|
||||
$return->biz_content = (array)$res;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改需求
|
||||
1,推广员后台
|
||||
1)今日新增人数,茶水费
|
||||
2)昨日新增人数,茶水费
|
||||
3)近7日新增人数,茶水费
|
||||
4)近30日新增人数,茶水费
|
||||
5)按时间新增人数,茶水费
|
||||
|
||||
,总代理后台(查某个推广员如下属性)
|
||||
1)今日新增人数,茶水费
|
||||
2)昨日新增人数,茶水费
|
||||
3)近7日新增人数,茶水费
|
||||
4)近30日新增人数,茶水费
|
||||
5)按时间新增人数,茶水费
|
||||
这些数据放第一页菜单
|
||||
*/
|
||||
public function goldIncrease($request, &$return)
|
||||
{
|
||||
$params = $request->biz_content;
|
||||
|
||||
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
|
||||
$channelid = isset($params['channelid']) ? $params['channelid'] : '';
|
||||
$salesid = isset($params['salesid']) ? $params['salesid'] : '';
|
||||
$type = isset($params['type']) ? intval($params['type']) : 1;
|
||||
|
||||
if (empty($agentid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channelid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($salesid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if($type === 888) {
|
||||
$where = '';
|
||||
} else {
|
||||
$where = " and goac_invitecode={$salesid}";
|
||||
}
|
||||
|
||||
$sql = <<<EOL
|
||||
SELECT
|
||||
'今日' AS `NAME`,
|
||||
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
|
||||
FROM
|
||||
gold_account
|
||||
WHERE
|
||||
goac_agentid = '{$agentid}' and
|
||||
goac_isrobot = 0 and
|
||||
goac_rebateto = 0 and
|
||||
date_format(goac_time, '%Y-%m-%d') = curdate()
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'昨日' AS `NAME`,
|
||||
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
|
||||
FROM
|
||||
gold_account
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(goac_time) = 1
|
||||
) and
|
||||
goac_isrobot = 0 and
|
||||
goac_rebateto = 0 and
|
||||
goac_agentid = '{$agentid}'
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近7日' AS `NAME`,
|
||||
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
|
||||
FROM
|
||||
gold_account
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(goac_time) <= 7
|
||||
) and
|
||||
goac_isrobot = 0 and
|
||||
goac_rebateto = 0 and
|
||||
goac_agentid = '{$agentid}'
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近30日' AS `NAME`,
|
||||
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
|
||||
FROM
|
||||
gold_account
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(goac_time) <= 30
|
||||
) and
|
||||
goac_isrobot = 0 and
|
||||
goac_rebateto = 0 and
|
||||
goac_agentid = '{$agentid}'
|
||||
{$where};
|
||||
EOL;
|
||||
|
||||
$res = $this->PDO_Request($sql);
|
||||
if (!$this->PDO_isdone())
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content = $res;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
13
codes/agent/game/dlweb/api/lib/1.0/header.php
Normal file
13
codes/agent/game/dlweb/api/lib/1.0/header.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 通用头文件
|
||||
*/
|
||||
|
||||
// 数据库查询类
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
// 控制器基础类(父类)
|
||||
require_once __DIR__ . '/models/Base.php';
|
||||
// 封装后的数据库查询类
|
||||
require_once __DIR__ . '/models/Db.php';
|
||||
// 定义根路径
|
||||
define('APP_PATH', __DIR__);
|
||||
59
codes/agent/game/dlweb/api/lib/1.0/manage.php
Normal file
59
codes/agent/game/dlweb/api/lib/1.0/manage.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'BaseMethodHelper.php';
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'Tangjian.php';
|
||||
|
||||
class Manage extends Tangjian
|
||||
{
|
||||
/**
|
||||
* 获取公告
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function notice($request, &$return)
|
||||
{
|
||||
try {
|
||||
// type => 0-代理后台的公告 1-代理抽成的公告
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R', 'type/0'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getNotice($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理的银行账户信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function salesBankInfo($request, &$return)
|
||||
{
|
||||
try {
|
||||
// type => 0-代理后台的公告 1-代理抽成的公告
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R', 'salesid/R'
|
||||
));
|
||||
|
||||
$SalesUser = new \models\SalesUser();
|
||||
$result = $SalesUser->getSalesBankInfo($params);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
5882
codes/agent/game/dlweb/api/lib/1.0/model/agent.php
Normal file
5882
codes/agent/game/dlweb/api/lib/1.0/model/agent.php
Normal file
File diff suppressed because it is too large
Load Diff
3521
codes/agent/game/dlweb/api/lib/1.0/model/agent.php.bak
Normal file
3521
codes/agent/game/dlweb/api/lib/1.0/model/agent.php.bak
Normal file
File diff suppressed because it is too large
Load Diff
1321
codes/agent/game/dlweb/api/lib/1.0/model/card.php
Normal file
1321
codes/agent/game/dlweb/api/lib/1.0/model/card.php
Normal file
File diff suppressed because it is too large
Load Diff
2193
codes/agent/game/dlweb/api/lib/1.0/model/demand.php
Normal file
2193
codes/agent/game/dlweb/api/lib/1.0/model/demand.php
Normal file
File diff suppressed because it is too large
Load Diff
285
codes/agent/game/dlweb/api/lib/1.0/model/game.php
Normal file
285
codes/agent/game/dlweb/api/lib/1.0/model/game.php
Normal file
@@ -0,0 +1,285 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2017/7/3
|
||||
* Time: 21:36
|
||||
*/
|
||||
|
||||
class game extends BaseMethod
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取产品列表
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function productList($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data)) {
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if(empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = isset($request_data['type']) ? intval($request_data['type']) : '';
|
||||
if($type === '')
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$productType = isset($request_data['ptype']) ? intval($request_data['ptype']) : 0;
|
||||
|
||||
$pro_list = $this->PDO_Request('
|
||||
SELECT
|
||||
sapr_productid as productid, sapr_name as name, sapr_amount as amount, sapr_money as money,
|
||||
sapr_memo as memo
|
||||
FROM
|
||||
sales_product
|
||||
WHERE
|
||||
sapr_agentid = ? and sapr_type = ? and sapr_state = 0 and product_type = ?
|
||||
ORDER BY idx;', $agentID, $type, $productType);
|
||||
|
||||
if(!is_array($pro_list))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$outParam->biz_content = array('state' => 0, 'products' => $pro_list);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获公告列表
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function noticeList($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data)) {
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if(empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$db_data = $this->PDO_Request("
|
||||
SELECT
|
||||
sano_noticeid as noticeid, sano_title as title, sano_time as time
|
||||
FROM
|
||||
sales_notice
|
||||
WHERE
|
||||
sano_agentid = ? and (sano_begintime is null or now() >= sano_begintime)
|
||||
and (sano_endtime is null or now() <= sano_endtime);", $agentID);
|
||||
|
||||
if(!is_array($db_data))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$outParam->biz_content = array('list' => $db_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获公告详情
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function noticeDetail($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data)) {
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if(empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$noticeID = isset($request_data['noticeid']) ? $request_data['noticeid'] : '';
|
||||
if(empty($noticeID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_NOTICEIDERROR, ERRORINFO_NOTICEIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$db_data = $this->PDO_Request("
|
||||
SELECT
|
||||
sano_title as title, sano_time as time, sano_content as content
|
||||
FROM
|
||||
sales_notice
|
||||
WHERE
|
||||
sano_agentid = ? and sano_noticeid = ? ;", $agentID, $noticeID);
|
||||
|
||||
if(!is_array($db_data))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($db_data) < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$outParam->biz_content = array(
|
||||
'title' => isset($db_data[0]['title']) ? $db_data[0]['title'] : '',
|
||||
'time' => isset($db_data[0]['time']) ? $db_data[0]['time'] : '',
|
||||
'content' => isset($db_data[0]['content']) ? $db_data[0]['content'] : '',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏下载列表
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function downList($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data)) {
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if(empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$channelID = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
if(empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*$agent_data = $this->PDO_Request('
|
||||
SELECT
|
||||
html_buyroomcard
|
||||
FROM
|
||||
config_agent
|
||||
WHERE
|
||||
agent_id=?', $agentID);
|
||||
|
||||
if(!is_array($agent_data))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($agent_data) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTNOTEXISTERROR, ERRORINFO_AGENTNOTEXISTERROR);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
/*$maket_data = $this->PDO_Request('
|
||||
SELECT
|
||||
a.game_id, a.game_name, a.game_down_image, a.game_down_state, a.game_down_memo,
|
||||
b.ios_download, b.and_download,
|
||||
c.market_id, c.market_name, c.app_download, c.app_size
|
||||
FROM
|
||||
config_game a
|
||||
LEFT JOIN config_channel b ON a.game_id=b.game_id
|
||||
LEFT JOIN config_market c ON b.channel_id=c.channel_id
|
||||
WHERE
|
||||
a.agent_id=? AND b.channel_id=? ', $agentID, $channelID);*/
|
||||
|
||||
$maket_data = $this->PDO_Request('
|
||||
SELECT
|
||||
a.game_id, a.game_name as name, a.game_down_image as image, a.game_down_state as state, a.game_down_memo as memo,
|
||||
b.ios_download as ios_down, b.and_download as android_down, b.ios_market_id as ios_marketid, b.ios_app_size as ios_size, b.and_app_size as android_size
|
||||
FROM
|
||||
config_game a
|
||||
LEFT JOIN config_channel b ON a.game_id=b.game_id
|
||||
WHERE
|
||||
a.agent_id=? AND b.channel_id=? and b.and_download != ""', $agentID, $channelID);
|
||||
|
||||
if(!is_array($maket_data))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($maket_data) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTNOTEXISTERROR, ERRORINFO_AGENTNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
$data = array();
|
||||
|
||||
$data['name'] = $maket_data[0]['game_name'];
|
||||
$data['image'] = $maket_data[0]['game_down_image'];
|
||||
$data['state'] = $maket_data[0]['game_down_state'];
|
||||
$data['memo'] = $maket_data[0]['game_down_memo'];
|
||||
|
||||
foreach($maket_data as $item)
|
||||
{
|
||||
if($item['ios_download'] == $item['market_id'])
|
||||
{
|
||||
$data['ios_down'] = $item['app_download'];
|
||||
$data['ios_size'] = $item['app_size'];
|
||||
$data['ios_marketid'] = $item['market_id'];
|
||||
}
|
||||
|
||||
if($item['and_download'] == $item['market_id'])
|
||||
{
|
||||
$data['android_down'] = $item['app_download'];
|
||||
$data['android_size'] = $item['app_size'];
|
||||
}
|
||||
}
|
||||
*/
|
||||
$outParam->biz_content = array(
|
||||
//'html_buyroomcard' => isset($agent_data[0]['html_buyroomcard']) ? $agent_data[0]['html_buyroomcard'] : '',
|
||||
'list' => $maket_data
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
666
codes/agent/game/dlweb/api/lib/1.0/model/gift.php
Normal file
666
codes/agent/game/dlweb/api/lib/1.0/model/gift.php
Normal file
@@ -0,0 +1,666 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: bahamut
|
||||
* Date: 2018/6/6
|
||||
* Time: 9:11
|
||||
*/
|
||||
|
||||
class gift extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @note 创建礼包
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function newgift($request, $return)
|
||||
{
|
||||
$param = (array)@$request->biz_content;
|
||||
|
||||
$agent_id = @$param['agentid']; /// 代理编号
|
||||
$channel_id = @$param['channelid']; /// 渠道编号
|
||||
$sales_id = @$param['salesid']; /// 代理编号
|
||||
$type = @$param['type']; /// 类型(1:房卡;2:星星)
|
||||
$amount = @$param['amount']; /// 数量
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($sales_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->pdo_begintransaction();
|
||||
try
|
||||
{
|
||||
/// 查询代理信息
|
||||
$command = /** @lang text */'select user_id, saus_roomcard, saus_bean from sales_user where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
$sales_info = $this->pdo_request($command, $agent_id, $channel_id, $sales_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($sales_info))
|
||||
throw new Exception(ERRORINFO_SALESNOTEXISTERROR, ERRORCODE_SALESNOTEXISTERROR);
|
||||
else
|
||||
$sales_info = $sales_info[0];
|
||||
|
||||
/// 判断数量
|
||||
switch (intval($type))
|
||||
{
|
||||
case 1; /// 房卡
|
||||
$amount = intval($amount);
|
||||
if ($amount > $sales_info['saus_roomcard'])
|
||||
throw new Exception(ERRORINFO_ROOMCARDENOUGHERROR, ERRORCODE_ROOMCARDENOUGHERROR);
|
||||
|
||||
/// 修改账户
|
||||
$command = /** @lang text */'update sales_user set saus_roomcard = saus_roomcard - ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
/// 修改账户余额
|
||||
$ret = $this->pdo_execute($command, $amount, $agent_id, $channel_id, $sales_id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
/// 如果有统一账户,则需要修改统一账户余额
|
||||
if (!empty($sales_info['user_id']))
|
||||
{
|
||||
$command = /** @lang text */'update ct_user_account set card = card - ? where user_id = ?';
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2: /// 星星
|
||||
$amount = floatval($amount);
|
||||
if ($amount > $sales_info['saus_bean'])
|
||||
throw new Exception(ERRORINFO_ROOMCARDENOUGHERROR, ERRORCODE_ROOMCARDENOUGHERROR);
|
||||
|
||||
/// 修改账户
|
||||
$command = /** @lang text */'update sales_user set saus_bean = saus_bean - ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
/// 修改账户余额
|
||||
$ret = $this->pdo_execute($command, $amount, $agent_id, $channel_id, $sales_id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
/// 如果有统一账户,则需要修改统一账户余额
|
||||
if (!empty($sales_info['user_id']))
|
||||
{
|
||||
$command = /** @lang text */'update ct_user_account set currency = currency - ? where user_id = ?';
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
}
|
||||
|
||||
/// 加入流水记录
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into ct_gift_info
|
||||
(agent_id, channel_id, sales_id, type, amount, status, create_time)
|
||||
values
|
||||
(?, ?, ?, ?, ?, 0, unix_timestamp())
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $agent_id, $channel_id, $sales_id, $type, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
$return->biz_content = [
|
||||
'giftid' => $this->pdo_lastinsertid(),
|
||||
];
|
||||
|
||||
$this->pdo_commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception $Exception)
|
||||
{
|
||||
$this->pdo_rollback();
|
||||
$return->seterrors($Exception->getcode(), $Exception->getmessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @note 领取礼包
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function receivegift($request, $return)
|
||||
{
|
||||
$param = (array)$request->biz_content;
|
||||
|
||||
$gift_id = @$param['giftid']; /// 礼包编号
|
||||
$player_id = @$param['playerid']; /// 玩家编号
|
||||
|
||||
if (empty($gift_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_GIFTIDERROR, ERRORINFO_GIFTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($player_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->pdo_begintransaction();
|
||||
try
|
||||
{
|
||||
/// 查询礼包是否存在
|
||||
$command = /** @lang text */<<<EOL
|
||||
select
|
||||
id, agent_id, channel_id, sales_id, player_id,
|
||||
type, amount, status, create_time, receive_time, order_id
|
||||
from
|
||||
ct_gift_info
|
||||
where
|
||||
id = ?
|
||||
for update
|
||||
EOL;
|
||||
$gift_info = $this->pdo_request($command, $gift_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($gift_info))
|
||||
throw new Exception(ERRORINFO_GIFTNOTEXISTS, ERRORCODE_GIFTNOTEXISTS);
|
||||
else
|
||||
$gift_info = $gift_info[0];
|
||||
|
||||
/// 状态不正确
|
||||
if ($gift_info['status'] != 0)
|
||||
throw new Exception(ERRORINFO_GIFTNOTEXISTS, ERRORCODE_GIFTNOTEXISTS);
|
||||
|
||||
/// 查询代理信息,分开查询是因为做关联查询反而比分成两次查询慢
|
||||
$command = /** @lang text */'select saus_agentid, saus_channelid, saus_openid, saus_unionid, saus_power from sales_user where saus_agentid = ? and saus_channelid = ? and saus_salesid = ? and saus_status = 0';
|
||||
$sales_info = $this->pdo_request($command, $gift_info['agent_id'], $gift_info['channel_id'], $gift_info['sales_id']);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($sales_info))
|
||||
throw new Exception(ERRORINFO_SALESNOTEXISTERROR, ERRORCODE_SALESNOTEXISTERROR);
|
||||
else
|
||||
$sales_info = $sales_info[0];
|
||||
|
||||
/// 查询玩家信息
|
||||
$command = /** @lang text */'select play_invitecode from player where play_agentid = ? and play_channelid = ? and play_playerid = ? and play_status = 0';
|
||||
$player_info = $this->pdo_request($command, $gift_info['agent_id'], $gift_info['channel_id'], $player_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($player_info))
|
||||
throw new Exception(ERRORINFO_PLAYERNOTEXISTERROR, ERRORCODE_PLAYERNOTEXISTERROR);
|
||||
else
|
||||
$player_info = $player_info[0];
|
||||
|
||||
/// 判断权限
|
||||
switch (intval($sales_info['saus_power'][1]))
|
||||
{
|
||||
case 0: /// 无权限
|
||||
throw new Exception(ERRORINFO_NOPOWERERROR, ERRORCODE_NOPOWERERROR);
|
||||
break;
|
||||
|
||||
case 1: /// 需要判断是否绑定自己
|
||||
if ($player_info['play_invitecode'] != $gift_info['sales_id'])
|
||||
throw new Exception(ERRORINFO_ONLYBINDSELFERROR, ERRORCODE_ONLYBINDSELFERROR);
|
||||
break;
|
||||
|
||||
case 2: /// 可以给所有代理转卡
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(ERRORINFO_NOPOWERERROR, ERRORCODE_NOPOWERERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
/// 判断类型
|
||||
switch ($gift_info['type'])
|
||||
{
|
||||
case 1; /// 房卡
|
||||
$amount = intval($gift_info['amount']);
|
||||
|
||||
/// 新增订单
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into sales_sellbill
|
||||
(sase_agentid, channel_id, sase_openid, from_sales, sase_playerid, sase_amount, sase_selltime)
|
||||
values
|
||||
(?, ?, ?, ?, ?, ?, now())
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $sales_info['saus_agentid'], $sales_info['saus_channelid'], $sales_info['saus_openid'], $gift_info['sales_id'], $player_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
else
|
||||
$order_id = $this->pdo_lastinsertid();
|
||||
|
||||
/// 记录同步流水
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into ct_user_process_log
|
||||
(to_agent, to_channel, to_user, oper_type, oper_data, oper_time, is_process)
|
||||
values
|
||||
(?, ?, ?, 1, ?, unix_timestamp(), 0)
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $gift_info['agent_id'], $gift_info['channel_id'], $player_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
break;
|
||||
|
||||
case 2: /// 星星
|
||||
$amount = floatval($gift_info['amount']);
|
||||
|
||||
/// 新增订单
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into sales_sellbill_bean
|
||||
(ssbe_agentid, channel_id, ssbe_openid, from_sales, ssbe_playerid, ssbe_amount, ssbe_selltime)
|
||||
values
|
||||
(?, ?, ?, ?, ?, ?, now())
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $sales_info['saus_agentid'], $sales_info['saus_channelid'], $sales_info['saus_openid'], $gift_info['sales_id'], $player_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
else
|
||||
$order_id = $this->pdo_lastinsertid();
|
||||
|
||||
/// 记录同步流水
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into ct_user_process_log
|
||||
(to_agent, to_channel, to_user, oper_type, oper_data, oper_time, is_process)
|
||||
values
|
||||
(?, ?, ?, 11, ?, unix_timestamp(), 0)
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $gift_info['agent_id'], $gift_info['channel_id'], $player_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
}
|
||||
|
||||
/// 修改礼包状态
|
||||
$command = /** @lang text */'update ct_gift_info set player_id = ?, status = 1, receive_time = unix_timestamp(), order_id = ? where id = ?';
|
||||
$ret = $this->pdo_execute($command, $player_id, $order_id, $gift_id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
$this->pdo_commit();
|
||||
|
||||
$return->biz_content = [
|
||||
'amount' => $amount,
|
||||
'product_type' => $gift_info['type'],
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception $Exception)
|
||||
{
|
||||
$this->pdo_rollback();
|
||||
$return->seterrors($Exception->getcode(), $Exception->getmessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @note 领取礼包
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function querygift($request, $return)
|
||||
{
|
||||
/// method=agent.gift.querygift&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"a","channelid":"b","salesid":1,}&user_auth_token=xxxxxxxx&tag=tag&random_string=xxxxxx
|
||||
$param = (array)$request->biz_content;
|
||||
|
||||
$agent_id = @$param['agentid']; /// 代理编号
|
||||
$channel_id = @$param['channelid']; /// 渠道编号
|
||||
$sales_id = @$param['salesid']; /// 代理编号
|
||||
$page_index = @$param['pageindex']; /// 页序号(0开始)
|
||||
$page_size = @$param['pagesize']; /// 页大小
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($sales_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($page_index))
|
||||
$page_index = 0;
|
||||
if (empty($page_size))
|
||||
$page_size = 10;
|
||||
|
||||
$cmd = $this->NewMasterCommand();
|
||||
$ret = $cmd
|
||||
->select('id', 'agent_id', 'channel_id', 'sales_id', 'player_id', 'type', 'amount', 'status', 'create_time', 'receive_time', 'order_id')
|
||||
->from('ct_gift_info')
|
||||
->where('agent_id = ? and channel_id = ? and sales_id = ? and status = 0 and type in (1, 2)')
|
||||
->bindparameters($agent_id, $channel_id, $sales_id)
|
||||
->withpage($page_index, $page_size)
|
||||
->request();
|
||||
|
||||
if (!$cmd->getconnection()->isdone())
|
||||
{
|
||||
$return->seterrors($cmd->getconnection()->geterrorcode(), $cmd->getconnection()->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content = [
|
||||
'list' => $ret,
|
||||
'pageindex' => $page_index,
|
||||
'pagesize' => $page_size,
|
||||
'recordcount' => 0,
|
||||
];
|
||||
if (empty($ret))
|
||||
return true;
|
||||
|
||||
$ret = $cmd->request(/** @lang text */
|
||||
'select count(0) c from ct_gift_info where agent_id = ? and channel_id = ? and sales_id = ? and status = 0 and type in (1, 2)',
|
||||
$agent_id, $channel_id, $sales_id);
|
||||
if (!$cmd->getconnection()->isdone())
|
||||
{
|
||||
$return->seterrors($cmd->getconnection()->geterrorcode(), $cmd->getconnection()->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content['recordcount'] = $ret[0]['c'];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @note 创建充值卡
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function newrechargecard($request, $return)
|
||||
{
|
||||
$param = (array)@$request->biz_content;
|
||||
|
||||
$agent_id = @$param['agentid']; /// 代理编号
|
||||
$channel_id = @$param['channelid']; /// 渠道编号
|
||||
$type = @$param['type']; /// 类型(1:房卡;2:星星)
|
||||
$amount = @$param['amount']; /// 数量
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->pdo_begintransaction();
|
||||
try
|
||||
{
|
||||
/// 判断数量
|
||||
switch (intval($type))
|
||||
{
|
||||
case 1; /// 房卡
|
||||
$type = 3; /// 房卡-充值卡密
|
||||
do {
|
||||
$card_number = sprintf('%s%06d', date('YmdHis'), rand(1, 999999));
|
||||
$card_password = sprintf('%06d', rand(1, 999999));
|
||||
$ret = $this->pdo_request(/** @lang text */'select 1 from ct_gift_info where card_number = ?', $card_number);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
} while (!empty($ret));
|
||||
|
||||
break;
|
||||
|
||||
case 2: /// 星星
|
||||
$type = 4; /// 星星-充值卡密
|
||||
do {
|
||||
$card_number = sprintf('%s%06d', date('YmdHis'), rand(1, 999999));
|
||||
$card_password = sprintf('%06d', rand(1, 999999));
|
||||
$ret = $this->pdo_request(/** @lang text */'select 1 from ct_gift_info where card_number = ?', $card_number);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
} while (!empty($ret));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
}
|
||||
|
||||
/// 加入流水记录
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into ct_gift_info
|
||||
(agent_id, channel_id, sales_id, type, amount, status, create_time, card_number, card_password)
|
||||
values
|
||||
(?, ?, null, ?, ?, 0, unix_timestamp(), ?, ?)
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $agent_id, $channel_id, $type, $amount, $card_number, $card_password);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
$return->biz_content = [
|
||||
'card_number' => $card_number,
|
||||
'card_password' => $card_password,
|
||||
'card_type' => $type,
|
||||
'product_amount' => $amount,
|
||||
];
|
||||
|
||||
$this->pdo_commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception $Exception)
|
||||
{
|
||||
$this->pdo_rollback();
|
||||
$return->seterrors($Exception->getcode(), $Exception->getmessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @note 使用充值卡密
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function userechargecard($request, $return)
|
||||
{
|
||||
$param = (array)@$request->biz_content;
|
||||
|
||||
$card_number = @$param['cardnumber']; /// 卡号
|
||||
$card_password = @$param['cardpassword']; /// 密码
|
||||
$sales_id = @$param['salesid']; /// 代理编号
|
||||
//$player_id = @$param['playerid']; /// 玩家编号
|
||||
|
||||
if (empty($card_number))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CARDNUMBERERROR, ERRORINFO_CARDNUMBERERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmd = /** @lang text */'select id from ct_gift_info where card_number = ? and card_password = ?';
|
||||
$ret = $this->pdo_request($cmd, $card_number, $card_password);
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
elseif (empty($ret))
|
||||
{
|
||||
//$return->seterrors(ERRORCODE_CARDNUMBERNOTEXISTS, ERRORINFO_CARDNUMBERNOTEXISTS);
|
||||
$return->seterrors(ERRORCODE_CARDNUMBERERROR, ERRORINFO_CARDNUMBERERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = $ret[0]['id'];
|
||||
$this->pdo_begintransaction();
|
||||
try
|
||||
{
|
||||
/// 查询礼包是否存在
|
||||
$cmd = /** @lang text */<<<EOL
|
||||
select
|
||||
id, agent_id, channel_id, sales_id, player_id,
|
||||
type, amount, status, create_time, receive_time, order_id
|
||||
from
|
||||
ct_gift_info
|
||||
where
|
||||
id = ?
|
||||
for update
|
||||
EOL;
|
||||
$gift_info = $this->pdo_request($cmd, $id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($gift_info))
|
||||
throw new Exception(ERRORINFO_GIFTNOTEXISTS, ERRORCODE_GIFTNOTEXISTS);
|
||||
else
|
||||
$gift_info = $gift_info[0];
|
||||
|
||||
/// 状态不正确
|
||||
if ($gift_info['status'] != 0)
|
||||
throw new Exception(ERRORINFO_GIFTNOTEXISTS, ERRORCODE_GIFTNOTEXISTS);
|
||||
|
||||
/// 查询代理信息,分开查询是因为做关联查询反而比分成两次查询慢
|
||||
$command = /** @lang text */'select user_id, saus_agentid, saus_channelid, saus_openid, saus_unionid, saus_power from sales_user where saus_agentid = ? and saus_channelid = ? and saus_salesid = ? and saus_status = 0';
|
||||
$sales_info = $this->pdo_request($command, $gift_info['agent_id'], $gift_info['channel_id'], $sales_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
elseif (empty($sales_info))
|
||||
throw new Exception(ERRORINFO_SALESNOTEXISTERROR, ERRORCODE_SALESNOTEXISTERROR);
|
||||
else
|
||||
$sales_info = $sales_info[0];
|
||||
|
||||
/// 判断类型
|
||||
switch ($gift_info['type'])
|
||||
{
|
||||
case 3; /// 房卡-充值卡密
|
||||
$amount = intval($gift_info['amount']);
|
||||
|
||||
/// 新增订单
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into sales_transferbill
|
||||
(satr_agentid, channel_id, satr_openid, from_sales, satr_salesid, satr_amount, satr_transfertime)
|
||||
values
|
||||
(?, ?, ?, ?, ?, ?, now())
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $sales_info['saus_agentid'], $sales_info['saus_channelid'], 'system', 0, $sales_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
else
|
||||
$order_id = $this->pdo_lastinsertid();
|
||||
|
||||
/// 修改账户余额
|
||||
$command = /** @lang text */'update sales_user set saus_roomcard = saus_roomcard + ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
/// 修改账户余额
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['saus_agentid'], $sales_info['saus_channelid'], $sales_id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
/// 如果有统一账户,则需要修改统一账户余额
|
||||
if (!empty($sales_info['user_id']))
|
||||
{
|
||||
$command = /** @lang text */'update ct_user_account set card = card + ? where user_id = ?';
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4: /// 星星-充值卡密
|
||||
$amount = floatval($gift_info['amount']);
|
||||
|
||||
/// 新增订单
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into trans_star_record
|
||||
(agent_id, channel_id, union_id, open_id, send_id, get_id, type, amount, op_time)
|
||||
values
|
||||
(?, ?, ?, ?, 0, ?, 0, ?, now())
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($command, $sales_info['saus_agentid'], $sales_info['saus_channelid'], 'system', 'system', $sales_id, $amount);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
else
|
||||
$order_id = $this->pdo_lastinsertid();
|
||||
|
||||
/// 修改账户
|
||||
$command = /** @lang text */'update sales_user set saus_bean = saus_bean + ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
/// 修改账户余额
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['saus_agentid'], $sales_info['saus_channelid'], $sales_id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
/// 如果有统一账户,则需要修改统一账户余额
|
||||
if (!empty($sales_info['user_id']))
|
||||
{
|
||||
$command = /** @lang text */'update ct_user_account set currency = currency + ? where user_id = ?';
|
||||
$ret = $this->pdo_execute($command, $amount, $sales_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
}
|
||||
|
||||
/// 修改礼包状态
|
||||
$command = /** @lang text */'update ct_gift_info set sales_id = ?, status = 1, receive_time = unix_timestamp(), order_id = ? where id = ?';
|
||||
$ret = $this->pdo_execute($command, $sales_id, $order_id, $id);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo(), $this->geterrorcode());
|
||||
|
||||
$this->pdo_commit();
|
||||
|
||||
$return->biz_content = [
|
||||
'amount' => $amount,
|
||||
'product_type' => $gift_info['type'],
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception $Exception)
|
||||
{
|
||||
$this->pdo_rollback();
|
||||
$return->seterrors($Exception->getcode(), $Exception->getmessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
390
codes/agent/game/dlweb/api/lib/1.0/model/manage.php
Normal file
390
codes/agent/game/dlweb/api/lib/1.0/model/manage.php
Normal file
@@ -0,0 +1,390 @@
|
||||
<?php
|
||||
/******************************************************************************************
|
||||
* ================ summer 2017/11/6 Handel 管理部分业务 ====================== *
|
||||
*****************************************************************************************/
|
||||
|
||||
class manage extends BaseMethod
|
||||
{
|
||||
|
||||
##------------ 公告管理[curd]
|
||||
##------------[ct_agent_notice] ------------------------->
|
||||
|
||||
/**
|
||||
* 发布公告
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*/
|
||||
public function addAgentNotice($inParam, $outParam)
|
||||
{
|
||||
// 1、系统非空数据配置初始化
|
||||
$config = array(
|
||||
# 代理商id
|
||||
'agentID' => array(
|
||||
'name' => 'agentid',
|
||||
'errcode' => ERRORCODE_AGENTIDERROR,
|
||||
'errinfo' => ERRORINFO_AGENTIDERROR,
|
||||
),
|
||||
# 渠道商id
|
||||
'channelID' => array(
|
||||
'name' => 'channelid',
|
||||
'errcode' => ERRORCODE_CHANNELIDERROR,
|
||||
'errinfo' => ERRORINFO_CHANNELIDERROR,
|
||||
),
|
||||
# 个人代理id
|
||||
'salesID' => array(
|
||||
'name' => 'salesid',
|
||||
'errcode' => ERRORCODE_SALESIDERROR,
|
||||
'errinfo' => ERRORINFO_SALESIDERROR,
|
||||
),
|
||||
# 公告内容
|
||||
'noticeInfo' => array(
|
||||
'name' => 'content',
|
||||
'errcode' => 'H00001',
|
||||
'errinfo' => '公告内容不能为空',
|
||||
),
|
||||
);
|
||||
|
||||
// 2、数据处理后的结果集 异常标志err:true false
|
||||
$param = $this->inParamHandel($inParam, $outParam, $config);
|
||||
if (!$param)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证总代权限
|
||||
$auth = $this->checkAgentAuth($inParam, $outParam, $param['agentID'], $param['channelID'], $param['salesID']);
|
||||
if (!$auth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 通知入库
|
||||
$res = $this->PDO_Execute(
|
||||
'
|
||||
INSERT INTO
|
||||
ct_agent_notice(agent_id, channel_id, notice_info, create_time, status)
|
||||
VALUES (?, ?, ?, ?, ?)',
|
||||
$param['agentID'], $param['channelID'], $param['noticeInfo'], date('Y-m-d H:i:s', time()), 1
|
||||
);
|
||||
|
||||
if (!$res)
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* [改]修改公告内容 公告状态
|
||||
* author summer
|
||||
*/
|
||||
public function editAgentNotice($inParam, $outParam)
|
||||
{
|
||||
$config = array(
|
||||
# 代理商id
|
||||
'agentID' => array(
|
||||
'name' => 'agentid',
|
||||
'errcode' => ERRORCODE_AGENTIDERROR,
|
||||
'errinfo' => ERRORINFO_AGENTIDERROR,
|
||||
),
|
||||
# 渠道商id
|
||||
'channelID' => array(
|
||||
'name' => 'channelid',
|
||||
'errcode' => ERRORCODE_CHANNELIDERROR,
|
||||
'errinfo' => ERRORINFO_CHANNELIDERROR,
|
||||
),
|
||||
# 个人代理id
|
||||
'salesID' => array(
|
||||
'name' => 'salesid',
|
||||
'errcode' => ERRORCODE_SALESIDERROR,
|
||||
'errinfo' => ERRORINFO_SALESIDERROR,
|
||||
),
|
||||
# 操作记录id
|
||||
'id' => array(
|
||||
'name' => 'id',
|
||||
'errcode' => 'H00001',
|
||||
'errinfo' => 'id不能为空',
|
||||
)
|
||||
);
|
||||
// 2、数据处理后的结果集 异常标志err:true false
|
||||
$param = $this->inParamHandel($inParam, $outParam, $config);
|
||||
if (!$param)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3、权限验证
|
||||
$auth = $this->checkAgentAuth($inParam, $outParam, $param['agentID'], $param['channelID'], $param['salesID']);
|
||||
if (!$auth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4、业务逻辑部分
|
||||
#a.查看公告是否存在
|
||||
$item = $this->PDO_Request(
|
||||
'
|
||||
select
|
||||
*
|
||||
from
|
||||
ct_agent_notice
|
||||
where
|
||||
id = ?; ', $param['id']
|
||||
);
|
||||
if (!$item)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_COMMISSIONNOTEXISTERROR, ERRORINFO_COMMISSIONNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
// 传了几个改几个
|
||||
$status = isset($param['_params']['status']) ? $param['_params']['status'] : $item[0]['status']; // 修改状态
|
||||
$content = isset($param['_params']['content']) ? $param['_params']['content'] : $item[0]['notice_info']; // 内容
|
||||
// 更新公告
|
||||
$this->PDO_Execute(
|
||||
'
|
||||
update
|
||||
ct_agent_notice
|
||||
set
|
||||
notice_info = ?, status = ?
|
||||
where
|
||||
id = ?; ', $content, $status, $param['id']
|
||||
);
|
||||
|
||||
if (!$this->PDO_IsDone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* [查]查询公告 pc后台
|
||||
* author summer
|
||||
*/
|
||||
public function getAgentNotice($inParam, $outParam)
|
||||
{
|
||||
// 1、系统非空数据配置初始化
|
||||
$config = array(
|
||||
# 代理商id
|
||||
'agentID' => array(
|
||||
'name' => 'agentid',
|
||||
'errcode' => ERRORCODE_AGENTIDERROR,
|
||||
'errinfo' => ERRORINFO_AGENTIDERROR,
|
||||
),
|
||||
# 渠道商id
|
||||
'channelID' => array(
|
||||
'name' => 'channelid',
|
||||
'errcode' => ERRORCODE_CHANNELIDERROR,
|
||||
'errinfo' => ERRORINFO_CHANNELIDERROR,
|
||||
),
|
||||
# 个人代理id
|
||||
'salesID' => array(
|
||||
'name' => 'salesid',
|
||||
'errcode' => ERRORCODE_SALESIDERROR,
|
||||
'errinfo' => ERRORINFO_SALESIDERROR,
|
||||
),
|
||||
);
|
||||
|
||||
// 2、数据处理后的结果集 异常标志err:true false
|
||||
$param = $this->inParamHandel($inParam, $outParam, $config);
|
||||
if (!$param)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//3.1 可选参数获取
|
||||
$beginTime = empty($param['_params']['begintime']) ? false : $param['_params']['begintime']; // 查询开始时间
|
||||
$endTime = empty($param['_params']['endtime']) ? false : $param['_params']['endtime']; // 查询结束时间
|
||||
|
||||
$status = empty($param['_params']['status']) ? 5 : $param['_params']['status']; // 查询状态
|
||||
switch ($status)
|
||||
{
|
||||
// 当前状态(0: 关闭;1: 开启)
|
||||
case '0':
|
||||
$where_status = ' AND status = 0';
|
||||
break;
|
||||
|
||||
case '1':
|
||||
$where_status = ' AND status = 1';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$where_status = '';
|
||||
break;
|
||||
}
|
||||
|
||||
$keyword = empty($param['_params']['keyword']) ? false : $param['_params']['keyword']; // 查询关键字
|
||||
if ($keyword)
|
||||
{
|
||||
$where_keyword = ' AND notice_info like "%' . trim($keyword) . '%"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_keyword = '';
|
||||
}
|
||||
|
||||
# 分页信息
|
||||
$page_index = empty($param['_params']['page_index']) ? 1 : intval($param['_params']['page_index']); // 当前页
|
||||
$page_size = empty($param['_params']['page_size']) ? 10 : intval($param['_params']['page_size']); // 单页容量
|
||||
$start = ($page_index - 1) * $page_size;
|
||||
$strPage = '';
|
||||
if (!empty($page_index))
|
||||
{
|
||||
$strPage .= " LIMIT {$start},{$page_size} ";
|
||||
}
|
||||
|
||||
if ($beginTime)
|
||||
{
|
||||
$where_begin = ' AND create_time >= "' . $beginTime . ' 00:00:00"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_begin = '';
|
||||
}
|
||||
|
||||
if ($endTime)
|
||||
{
|
||||
$where_end = ' AND create_time <= "' . $endTime . ' 23:59:59"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_end = '';
|
||||
}
|
||||
|
||||
$items = $this->PDO_Request(
|
||||
'
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ct_agent_notice
|
||||
WHERE
|
||||
agent_id = ? AND channel_id = ? AND status != -1' . $where_begin . $where_end . $where_keyword . $where_status . '
|
||||
ORDER BY
|
||||
create_time desc ' . $strPage . ';', $param['agentID'], $param['channelID']
|
||||
);
|
||||
|
||||
if (!is_array($items))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
# 分页计算
|
||||
$dbData = $this->PDO_Request(
|
||||
'
|
||||
SELECT
|
||||
count(1) num
|
||||
FROM
|
||||
ct_agent_notice
|
||||
WHERE
|
||||
agent_id = ? AND channel_id = ? AND status != -1' . $where_begin . $where_end . $where_keyword . $where_status . ';',
|
||||
$param['agentID'], $param['channelID']
|
||||
);
|
||||
|
||||
if (!is_array($dbData) || count($dbData) < 1)
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
$data_count = intval($dbData[0]['num']);
|
||||
$page_count = $data_count / $page_size + 1; // 总页数
|
||||
|
||||
|
||||
// 5、数据返回部分
|
||||
$outParam->biz_content = array(
|
||||
'data' => $items,
|
||||
'page_index' => $page_index,
|
||||
'page_size' => $page_size,
|
||||
'page_count' => intval($page_count),
|
||||
'data_count' => $data_count,
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
##------------ 工具方法[curd]
|
||||
##------------[summer 2017/11/6 Handel] ----------------------->
|
||||
/**
|
||||
* 输入参数标准化处理
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @param array $config 待处理变量配置文件
|
||||
*
|
||||
* @return array data
|
||||
*
|
||||
* author:summer 2017/11/6
|
||||
*/
|
||||
public function inParamHandel($inParam, $outParam, $config)
|
||||
{
|
||||
foreach ($config as $k => $v)
|
||||
{
|
||||
// 1、全局校验
|
||||
$data['_params'] = $request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2、单元校验
|
||||
$data[$k] = isset($request_data[$v['name']]) ? $request_data[$v['name']] : '';
|
||||
if (empty($data[$k]))
|
||||
{
|
||||
$outParam->SetErrors($v['errcode'], $v['errinfo']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 3、返回处理后的数据
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理权限认证
|
||||
* @param RequestParameter $agentid 代理商id
|
||||
* @param RequestParameter $channelid 渠道商id
|
||||
* @param RequestParameter $salesid 代理人id
|
||||
*
|
||||
* @return array data
|
||||
*
|
||||
* author:summer 2017/11/6
|
||||
*/
|
||||
public function checkAgentAuth($inParam, $outParam, $agentID, $channelID, $salesID)
|
||||
{
|
||||
//只有总代理才有权限
|
||||
$dbSalesInfo = $this->PDO_Request(
|
||||
'
|
||||
SELECT idx, global_power
|
||||
FROM sales_user
|
||||
WHERE saus_agentid=? AND saus_channelid=? AND saus_salesid=?', $agentID, $channelID, $salesID
|
||||
);
|
||||
|
||||
if (!is_array($dbSalesInfo))
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
// 代理不存在
|
||||
if (count($dbSalesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 不是总代理,没有权限
|
||||
if (intval($dbSalesInfo[0]['global_power']) != 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_NOPOWERERROR, ERRORINFO_NOPOWERERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
4755
codes/agent/game/dlweb/api/lib/1.0/model/order.php
Normal file
4755
codes/agent/game/dlweb/api/lib/1.0/model/order.php
Normal file
File diff suppressed because it is too large
Load Diff
1400
codes/agent/game/dlweb/api/lib/1.0/model/order1.php
Normal file
1400
codes/agent/game/dlweb/api/lib/1.0/model/order1.php
Normal file
File diff suppressed because it is too large
Load Diff
712
codes/agent/game/dlweb/api/lib/1.0/model/player.php
Normal file
712
codes/agent/game/dlweb/api/lib/1.0/model/player.php
Normal file
@@ -0,0 +1,712 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: abcdefg
|
||||
* Date: 2017/11/27
|
||||
* Time: 15:38
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/config/game_config.inc.php';
|
||||
require_once dirname(dirname(dirname(__DIR__))) . '/public/usefull.php';
|
||||
|
||||
|
||||
class auth_item extends ToolBase
|
||||
{
|
||||
/** @var string $name */
|
||||
public $name = '';
|
||||
|
||||
/// 允许使用的账户类型(1: 三方购买房卡; 2: 三方购买金币; 101: 三方转账房卡; 102: 三方转账金币;)
|
||||
/** @var array $account_type */
|
||||
public $account_type = [];
|
||||
|
||||
/// 允许使用的登录类型(1: 玩家; 2: 代理;)
|
||||
/** @var array $login_type */
|
||||
public $login_type = [];
|
||||
|
||||
public function verify_account_type($account_type)
|
||||
{
|
||||
return in_array($account_type, $this->account_type);
|
||||
}
|
||||
|
||||
public function verify_login_type($login_type)
|
||||
{
|
||||
return in_array($login_type, $this->login_type);
|
||||
}
|
||||
}
|
||||
|
||||
class auth_list
|
||||
{
|
||||
/** @var array $items */
|
||||
public $items;
|
||||
|
||||
public function __construct($list)
|
||||
{
|
||||
$this->items = array();
|
||||
|
||||
if (is_object($list))
|
||||
$list = (array)$list;
|
||||
|
||||
if (is_array($list)) {
|
||||
foreach ($list as $item) {
|
||||
array_push($this->items, new auth_item($item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function search($name)
|
||||
{
|
||||
/** @var auth_item $item */
|
||||
foreach($this->items as $item) {
|
||||
if (0 == strcasecmp($item->name, $name))
|
||||
return $item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class game_item extends ToolBase
|
||||
{
|
||||
public $game_id;
|
||||
public $scheme = 'http';
|
||||
public $address;
|
||||
public $port;
|
||||
|
||||
public function get_address($param = null, $needencode = true)
|
||||
{
|
||||
if (empty($this->scheme)) {
|
||||
$is_https =
|
||||
(isset($_SERVER['REQUEST_SCHEME']) && strcasecmp($_SERVER['REQUEST_SCHEME'], 'https') == 0) ||
|
||||
(isset($_SERVER['HTTPS']) && (strcasecmp($_SERVER['HTTPS'], 'on') == 0 || strcasecmp($_SERVER['HTTPS'], '1') == 0));
|
||||
|
||||
$this->scheme = $is_https ? 'https' : 'http';
|
||||
}
|
||||
|
||||
if (empty($this->port)) {
|
||||
if (0 == strcasecmp('https', $this->scheme))
|
||||
$this->port = 443;
|
||||
else
|
||||
$this->port = 80;
|
||||
}
|
||||
|
||||
if (0 == strcasecmp('https', $this->scheme))
|
||||
$result = 'https://' . $this->address . (443 == $this->port ? '' : ':' . $this->port) . '/index.html';
|
||||
else
|
||||
$result = 'http://' . $this->address . (80 == $this->port ? '' : ':' . $this->port) . '/index.html';
|
||||
|
||||
if (empty($param))
|
||||
return $result;
|
||||
|
||||
if (is_object($param))
|
||||
$param = (array)$param;
|
||||
|
||||
if ($needencode) {
|
||||
if (is_array($param)) {
|
||||
$data = array();
|
||||
foreach ($param as $key => $value) {
|
||||
array_push($data, rawurlencode($key) . '=' . rawurlencode($value));
|
||||
}
|
||||
$result .= '?' . implode('&', $data);
|
||||
} else {
|
||||
$result .= '?' . rawurlencode($param);
|
||||
}
|
||||
} else {
|
||||
if (is_array($param)) {
|
||||
$data = array();
|
||||
foreach ($param as $key => $value) {
|
||||
array_push($data, $key . '=' . $value);
|
||||
}
|
||||
$result .= '?' . implode('&', $data);
|
||||
} else {
|
||||
$result .= '?' . $param;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class game_list
|
||||
{
|
||||
/** @var array of game_item */
|
||||
public $items;
|
||||
|
||||
public function __construct($list)
|
||||
{
|
||||
$this->items = array();
|
||||
|
||||
if (is_object($list))
|
||||
$list = (array)$list;
|
||||
|
||||
if (is_array($list)) {
|
||||
foreach ($list as $item) {
|
||||
array_push($this->items, new game_item($item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function search($game_id)
|
||||
{
|
||||
/** @var game_item $item */
|
||||
foreach($this->items as $item) {
|
||||
if (0 == strcasecmp($item->game_id, $game_id))
|
||||
return $item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class player extends BaseMethod
|
||||
{
|
||||
const SCHEME_HTTP = 'http';
|
||||
const SCHEME_HTTPS = 'https';
|
||||
const GAME_ID_TEST = 'test'; /// 测试环境下的游戏id,不用更改。
|
||||
|
||||
/// 有效的来源标志
|
||||
const AUTH_SIGN = [
|
||||
/// 游戏跳转的标志
|
||||
[
|
||||
'name' => 'WHITELOGIN', /// 标志标识
|
||||
'account_type' => [], /// 允许使用的账户类型
|
||||
'login_type' => [2], /// 允许使用的登录类型
|
||||
],
|
||||
|
||||
/// 黄超的标志
|
||||
[
|
||||
'name' => 'GAMEPAY', /// 标志标识
|
||||
'account_type' => [1, 2, ], /// 允许使用的账户类型
|
||||
'login_type' => [1], /// 允许使用的登录类型
|
||||
],
|
||||
|
||||
/// 第一个三方游戏来源
|
||||
[
|
||||
'name' => 'TG9000000001', /// 标志标识
|
||||
'account_type' => [101, 102, ], /// 允许使用的账户类型
|
||||
'login_type' => [1], /// 允许使用的登录类型
|
||||
],
|
||||
];
|
||||
|
||||
/** @var auth_list $auth_list */
|
||||
private $auth_list;
|
||||
/** @var game_list $game_list */
|
||||
private $game_list;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->auth_list = new auth_list(self::AUTH_SIGN);
|
||||
if (file_exists(dirname(__DIR__) . '/config/game.config.json')) {
|
||||
$str = file_get_contents(dirname(__DIR__) . '/config/game.config.json');
|
||||
$obj = JsonStringToJsonObject($str);
|
||||
if (is_null($obj)) {
|
||||
$obj = include dirname(__DIR__) . '/config/game.config.php';
|
||||
}
|
||||
$this->game_list = new game_list($obj);
|
||||
} else {
|
||||
$this->game_list = new game_list(include dirname(__DIR__) . '/config/game.config.php');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
* { "agentid": "a", "channelid": "b", "openid": "c", "unionid": "d", "nickname": "eee", "avatar": "dd", "sex": 0, "province": "jx", "city": "nc" }
|
||||
*/
|
||||
public function login($request, $return)
|
||||
{
|
||||
$param = (array)@$request->biz_content;
|
||||
if (!is_array($param))
|
||||
{
|
||||
//参数格式错误
|
||||
$return->seterrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agent_id = empty(@$param['agentid']) ? '' : $param['agentid']; /// 代理
|
||||
$channel_id = empty(@$param['channelid']) ? '' : $param['channelid']; /// 渠道
|
||||
//$game_id = empty(@$param['gameid']) ? '' : $param['gameid']; /// 游戏id
|
||||
$player_id = empty(@$param['playerid']) ? '' : $param['playerid']; /// 用户id
|
||||
$open_id = empty(@$param['openid']) ? '' : $param['openid']; /// openid
|
||||
$union_id = empty(@$param['unionid']) ? '' : $param['unionid']; /// unionid
|
||||
//$nick_name = empty(@$param['nickname']) ? '' : $param['nickname']; /// 昵称
|
||||
//$avatar = empty(@$param['avatar']) ? '' : $param['avatar']; /// 头像
|
||||
$from_sign = mb_strtoupper(empty(@$param['fromsign']) ? '' : $param['fromsign'], USEDCHARSET); /// 来源标志
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($player_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断来源
|
||||
$auth = $this->auth_list->search($from_sign);
|
||||
if (!$auth)
|
||||
{
|
||||
$return->seterrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'source sign'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$cmd = $this->NewServantCommand())
|
||||
$cmd = $this->NewMasterCommand();
|
||||
|
||||
if ($auth->verify_login_type(1)) /// 允许获取玩家信息
|
||||
{
|
||||
if (!empty($union_id))
|
||||
{
|
||||
$ret = $cmd
|
||||
->select('idx', 'play_playerid', 'play_nickname', 'play_avatar', 'play_sex', 'play_roomcard', 'play_bean', 'play_invitecode', 'play_openid', 'play_unionid')
|
||||
->from('player')
|
||||
->where([
|
||||
'play_agentid' => $agent_id,
|
||||
'play_channelid' => $channel_id,
|
||||
'play_unionid' => $union_id,
|
||||
'play_playerid' => $player_id,
|
||||
])
|
||||
->request();
|
||||
}
|
||||
elseif (!empty($open_id))
|
||||
{
|
||||
$ret = $cmd
|
||||
->select('idx', 'play_playerid', 'play_nickname', 'play_avatar', 'play_sex', 'play_roomcard', 'play_bean', 'play_invitecode', 'play_openid', 'play_unionid')
|
||||
->from('player')
|
||||
->where([
|
||||
'play_agentid' => $agent_id,
|
||||
'play_channelid' => $channel_id,
|
||||
'play_openid' => $open_id,
|
||||
'play_playerid' => $player_id,
|
||||
])
|
||||
->request();
|
||||
}
|
||||
else
|
||||
{
|
||||
$return->seterrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'player information'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
elseif (empty($ret))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERNOTEXISTERROR, ERRORINFO_PLAYERNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
$player = $ret[0];
|
||||
|
||||
/// 请求玩家
|
||||
$playerData = array(
|
||||
'app' => 'youle',
|
||||
'route' => 'agent',
|
||||
'rpc' => 'query_player2',
|
||||
'data' => array(
|
||||
'agentid' => $agent_id,
|
||||
'playerid' => $player_id,
|
||||
),
|
||||
);
|
||||
|
||||
$json_data = json_encode($playerData);
|
||||
$dd_ret = file_get_contents(REQUEST_USER_INFO . '?' . $json_data);
|
||||
/// 请求数据出错
|
||||
if (!$dd_ret)
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_NODATAERROR, ERRORINFO_NODATAERROR);
|
||||
return false;
|
||||
}
|
||||
$playerInfo = json_decode($dd_ret, true);
|
||||
|
||||
$player['play_nickname'] = usefull::getInstance()->check_name($playerInfo['data']['nickname']);
|
||||
$player['play_avatar'] = isset($playerInfo['data']['avatar']) ? $playerInfo['data']['avatar'] : '';
|
||||
$player['play_roomcard'] = isset($playerInfo['data']['roomcard']) ? $playerInfo['data']['roomcard'] : '';
|
||||
$player['play_bean'] = isset($playerInfo['data']['bean']) ? $playerInfo['data']['bean'] : '';
|
||||
|
||||
$ret = $this->pdo_execute(/** @lang text */'update player set play_nickname=?, play_avatar=?, play_sex=?, play_roomcard=?, play_bean=? where idx=?',
|
||||
$player['play_nickname'], $player['play_avatar'], isset($playerInfo['data']['sex']) ? $playerInfo['data']['sex'] : '',
|
||||
$player['play_roomcard'], $player['play_bean'], $player['idx']);
|
||||
|
||||
if (!$ret)
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 记录登录流水
|
||||
$ret = $this->pdo_execute(/** @lang text */ 'insert into ct_player_login_info(agent_id,channel_id,player_id,login_time,from_sign) values(?,?,?,now(),?)',
|
||||
$agent_id, $channel_id, $player_id, $from_sign);
|
||||
if (!$ret)
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (strcmp($ret['play_playerid'], $player_id)) /// id不匹配
|
||||
// {
|
||||
// $return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /// 更新昵称和头像
|
||||
// $ret = $cmd
|
||||
// ->update('player')
|
||||
// ->fields('play_nickname', 'play_avatar')
|
||||
// ->values($nick_name, $avatar)
|
||||
// ->where(array('idx' => $player['idx']))
|
||||
// ->execute();
|
||||
// if (!$ret)
|
||||
// {
|
||||
// $return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
// return false;
|
||||
// }
|
||||
|
||||
$player_info = array(
|
||||
'playerid' => $player_id, /// id
|
||||
'openid' => $player['play_openid'], /// openid
|
||||
'unionid' => $player['play_unionid'], /// unionid
|
||||
'nickname' => $player['play_nickname'], /// 昵称
|
||||
'avatar' => $player['play_avatar'], /// 头像
|
||||
'sex' => $player['play_sex'], /// 性别
|
||||
'card' => empty($player['play_roomcard']) ? 0 : $player['play_roomcard'], /// 房卡数
|
||||
'gold' => empty($player['play_bean']) ? 0 : $player['play_bean'], /// 金币数
|
||||
'invitecode' => empty($player['play_invitecode']) ? '' : $player['play_invitecode'], /// 邀请码
|
||||
);
|
||||
}
|
||||
else
|
||||
$player_info = [];
|
||||
|
||||
if ($auth->verify_login_type(2)) /// 允许获取代理信息
|
||||
{
|
||||
$fields = [
|
||||
'idx', 'saus_agentid', 'saus_channelid', 'saus_openid', 'saus_unionid',
|
||||
'saus_salesman', 'saus_salesid', 'saus_level', 'saus_salestype', 'saus_roomcard',
|
||||
'saus_bean', 'saus_power', 'saus_invitecode', 'saus_pushmoney1', 'saus_pushmoney2', 'saus_status',
|
||||
'password', 'global_power', 'saus_tel', 'saus_wechat', 'is_send_star', 'saus_nickname', 'saus_avatar', 'saus_sex',
|
||||
'saus_province', 'saus_city', 'user_id', 'player_id', 'is_vip'
|
||||
];
|
||||
if (!empty($union_id))
|
||||
{
|
||||
$ret = $cmd
|
||||
->select($fields)
|
||||
->from('sales_user')
|
||||
->where(['saus_agentid' => $agent_id, 'saus_channelid' => $channel_id, 'saus_unionid' => $union_id, 'player_id' => $player_id, ])
|
||||
->request();
|
||||
}
|
||||
elseif (!empty($open_id))
|
||||
{
|
||||
$ret = $cmd
|
||||
->select($fields)
|
||||
->from('sales_user')
|
||||
->where(['saus_agentid' => $agent_id, 'saus_channelid' => $channel_id, 'saus_openid' => $open_id, 'player_id' => $player_id, ])
|
||||
->request();
|
||||
}
|
||||
else
|
||||
{
|
||||
$return->seterrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'player information'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
elseif (empty($ret))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERNOTEXISTERROR, ERRORINFO_PLAYERNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
$sales = $ret[0];
|
||||
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP']))
|
||||
$address = $_SERVER['HTTP_CLIENT_IP'];
|
||||
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||
$address = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
elseif (isset($_SERVER['REMOTE_ADDR']))
|
||||
$address = $_SERVER['REMOTE_ADDR'];
|
||||
else
|
||||
$address = null;
|
||||
|
||||
/// 记录登录流水
|
||||
$ret = $cmd
|
||||
->insert('ct_sales_login_log')
|
||||
->fields('agent_id', 'channel_id', 'sales_id', 'login_type', 'login_time', 'login_addr', 'login_status')
|
||||
->values($agent_id, $channel_id, $sales['saus_salesid'], 2, date('Y-m-d H:i:s'), $address, 0)
|
||||
->execute();
|
||||
if (!$ret)
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 返回用户信息
|
||||
$sales_info = array(
|
||||
'idx' => isset($sales['idx']) ? $sales['idx'] : '', /// 代理
|
||||
'agentid' => isset($sales['saus_agentid']) ? $sales['saus_agentid'] : '', /// 代理
|
||||
'channelid' => isset($sales['saus_channelid']) ? $sales['saus_channelid'] : '', /// 渠道
|
||||
'openid' => isset($sales['saus_openid']) ? $sales['saus_openid'] : '', /// openid
|
||||
'unionid' => isset($sales['saus_unionid']) ? $sales['saus_unionid'] : '', /// unionid
|
||||
'nickname' => isset($sales['saus_nickname']) ? $sales['saus_nickname'] : '', /// 昵称
|
||||
'headimgurl' => isset($sales['saus_avatar']) ? $sales['saus_avatar'] : '', /// 头像
|
||||
'sex' => isset($sales['saus_sex']) ? $sales['saus_sex'] : '', /// 性别
|
||||
'province' => isset($sales['saus_province']) ? $sales['saus_province'] : '', /// 省
|
||||
'city' => isset($sales['saus_city']) ? $sales['saus_city'] : '', /// 市
|
||||
'salesman' => empty($sales['saus_salesman']) ? 0 : intval($sales['saus_salesman']), /// 是否代理
|
||||
'salesid' => isset($sales['saus_salesid']) ? $sales['saus_salesid'] : '', /// 代理编号
|
||||
'level' => isset($sales['saus_level']) ? $sales['saus_level'] : '', /// 代理等级
|
||||
'salestype' => isset($sales['saus_salestype']) ? $sales['saus_salestype'] : '', /// 代理类型
|
||||
'roomcard' => isset($sales['saus_roomcard']) ? $sales['saus_roomcard'] : '', /// 账户房卡数
|
||||
'bean' => isset($sales['saus_bean']) ? $sales['saus_bean'] : '', /// 账户金币数
|
||||
'salespower' => isset($sales['saus_power']) ? $sales['saus_power'] : '', /// 代理权限
|
||||
'agentmode' => '', /// 分享模式
|
||||
//'pushmoney' => intval($sales['saus_pushmoney1']) + intval($sales['saus_pushmoney2']), /// 提成金额
|
||||
'sausstatus' => isset($sales['saus_status']) ? $sales['saus_status'] : '', /// 当前状态
|
||||
'html_applysales' => '', /// 成为代理的方式
|
||||
'global_power' => isset($sales['global_power']) ? intval($sales['global_power']) : 0, /// 是否总代
|
||||
'tel' => isset($sales['saus_tel']) ? $sales['saus_tel'] : '', /// 电话号码
|
||||
'wechat' => isset($sales['saus_wechat']) ? $sales['saus_wechat'] : '', /// 微信号码
|
||||
'user_id' => empty(@$sales['user_id']) ? '' : $sales['user_id'], /// 统一账户编号
|
||||
'is_bind' => empty($sales['saus_tel']) ? 0 : (0 == $sales['is_send_star'] ? 0 : 1), /// 是否绑定
|
||||
'logintype' => 11, /// 自动登录
|
||||
'player_id' => isset($sales['player_id']) ? $sales['player_id'] : '',
|
||||
'is_vip' => $sales['is_vip'],
|
||||
);
|
||||
}
|
||||
else
|
||||
$sales_info = [];
|
||||
|
||||
$return->biz_content = [];
|
||||
foreach ($player_info as $k => $v) {
|
||||
$return->biz_content[$k] = $v;
|
||||
}
|
||||
foreach ($sales_info as $k => $v) {
|
||||
$return->biz_content[$k] = $v;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
* { "agentid": "a", "channelid": "b", "openid": "c", "unionid": "d", "nickname": "eee", "avatar": "dd", "sex": 0, "province": "jx", "city": "nc" }
|
||||
*/
|
||||
public function change_account($request, $return)
|
||||
{
|
||||
$param = (array)@$request->biz_content;
|
||||
if (!is_array($param))
|
||||
{
|
||||
/// 参数格式错误
|
||||
$return->seterrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agent_id = empty(@$param['agentid']) ? '' : $param['agentid']; /// 代理
|
||||
$channel_id = empty(@$param['channelid']) ? '' : $param['channelid']; /// 渠道
|
||||
$game_id = empty(@$param['gameid']) ? '' : $param['gameid']; /// 游戏id
|
||||
$player_id = empty(@$param['playerid']) ? '' : $param['playerid']; /// 用户id
|
||||
$change_type = intval(empty(@$param['changetype']) ? 0 : $param['changetype']); /// 类型(1:购买房卡;2:购买金币;101:三方转账房卡;102:三方转账金币;)
|
||||
$change_amount = floatval(empty(@$param['changeamount']) ? 0 : $param['changeamount']); /// 变更数量
|
||||
$transaction_id = @$param['transactionid']; /// 订单号
|
||||
$pay_fee = intval(empty(@$param['payfee']) ? 0 : $param['payfee']); /// 支付金额(分)
|
||||
$from_sign = mb_strtoupper(empty(@$param['fromsign']) ? '' : $param['fromsign'], USEDCHARSET); /// 来源标志
|
||||
$remark = @$param['remark']; /// 备注
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($player_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($change_type))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断来源
|
||||
$auth = $this->auth_list->search($from_sign);
|
||||
if (!$auth)
|
||||
{
|
||||
$return->seterrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'source sign'));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断类型
|
||||
if (!$auth->verify_account_type($change_type))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_TYPEERROR, ERRORINFO_TYPEERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (in_array($change_type, [1, 2])) /// 三方购买房卡、金币
|
||||
{
|
||||
if (empty($pay_fee))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_ORDERMONEYERROR, ERRORINFO_ORDERMONEYERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($transaction_id))
|
||||
{
|
||||
$return->seterrors(ERRORCODE_ORDERIDERROR, ERRORINFO_ORDERIDERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->pdo_begintransaction();
|
||||
try {
|
||||
/// 校验账户
|
||||
$cmd = /** @lang text */'select play_roomcard, play_bean from player a where play_agentid = ? and play_channelid = ? and play_playerid = ?';
|
||||
$ret = $this->pdo_request($cmd, $agent_id, $channel_id, $player_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo() . '(' . __LINE__ . ')', $this->geterrorcode());
|
||||
elseif (empty($ret))
|
||||
throw new Exception(ERRORINFO_PLAYER_NOT_EXISTS, ERRORCODE_PLAYER_NOT_EXISTS);
|
||||
|
||||
switch ($change_type) {
|
||||
case 1: /// 三方购买房卡
|
||||
$account = $ret[0]['play_roomcard'] + $change_amount;
|
||||
if ($ret[0]['play_roomcard'] + $change_amount < 0)
|
||||
throw new Exception(ERRORINFO_AMOUNTERROR, ERRORCODE_AMOUNTERROR);
|
||||
|
||||
$oper_type = 1;
|
||||
|
||||
break;
|
||||
|
||||
case 2: /// 三方购买金币
|
||||
$account = $ret[0]['play_bean'] + $change_amount;
|
||||
if ($ret[0]['play_bean'] + $change_amount < 0)
|
||||
throw new Exception(ERRORINFO_AMOUNTERROR, ERRORCODE_AMOUNTERROR);
|
||||
|
||||
$oper_type = 11;
|
||||
|
||||
break;
|
||||
|
||||
case 101: /// 三方转账房卡
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORCODE_TYPEERROR);
|
||||
$account = $ret[0]['play_roomcard'] + $change_amount;
|
||||
if ($ret[0]['play_roomcard'] + $change_amount < 0)
|
||||
throw new Exception(ERRORINFO_AMOUNTERROR, ERRORCODE_AMOUNTERROR);
|
||||
|
||||
$oper_type = 1;
|
||||
break;
|
||||
|
||||
case 102: /// 三方转账星星
|
||||
$account = $ret[0]['play_bean'] + $change_amount;
|
||||
if ($ret[0]['play_bean'] + $change_amount < 0)
|
||||
throw new Exception(ERRORINFO_AMOUNTERROR, ERRORCODE_AMOUNTERROR);
|
||||
|
||||
$oper_type = 11;
|
||||
break;
|
||||
|
||||
default: /// 其他
|
||||
throw new Exception(ERRORINFO_TYPEERROR, ERRORCODE_TYPEERROR);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($game_id) && 102 == $change_type) {
|
||||
if (DEBUG_MODE) {
|
||||
$game_info = $this->game_list->search(self::GAME_ID_TEST);
|
||||
} else {
|
||||
$game_info = $this->game_list->search($game_id);
|
||||
}
|
||||
} else
|
||||
$game_info = null;
|
||||
|
||||
/// 没有传入游戏id则写入日志表
|
||||
if (empty($game_info)) {
|
||||
/// 记录同步流水
|
||||
$cmd = /** @lang text */<<<EOL
|
||||
insert into ct_user_process_log
|
||||
(to_agent, to_channel, to_user, oper_type, oper_data, oper_time, is_process)
|
||||
values
|
||||
(?, ?, ?, ?, ?, ?, 0)
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($cmd, $agent_id, $channel_id, $player_id, $oper_type, $change_amount, time());
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo() . '(' . __LINE__ . ')', $this->geterrorcode());
|
||||
|
||||
$log_id = $this->pdo_lastinsertid();
|
||||
} else {
|
||||
$data = array(
|
||||
'app' => 'youle',
|
||||
'route' => 'agent',
|
||||
'rpc' => 0 > $change_amount ? 'coin_sub' : 'coin_add', /// 减少、增加
|
||||
'data' => array(
|
||||
'agentid' => $agent_id,
|
||||
'playerid' => $player_id,
|
||||
'change' => abs($change_amount),
|
||||
),
|
||||
);
|
||||
$result = file_get_contents($game_info->get_address(JsonObjectToJsonString($data), false));
|
||||
$result = JsonStringToJsonObject(rawurldecode($result));
|
||||
if (0 == $result->data->result) /// 成功
|
||||
$account = $result->data->bean;
|
||||
else /// 失败
|
||||
throw new Exception($result->data->error, ERRORCODE_UNKNOWN);
|
||||
|
||||
$log_id = 0;
|
||||
}
|
||||
|
||||
/// 记录购买流水
|
||||
$cmd = /** @lang text */<<<EOL
|
||||
insert into ct_pay_for_third
|
||||
(agent_id, channel_id, player_id, transaction_id, fee, type, amount, create_time, from_sign, log_id, remark)
|
||||
values
|
||||
(?, ?, ?, ?, ?, ?, ?, now(), ?, ?, ?)
|
||||
EOL;
|
||||
$ret = $this->pdo_execute($cmd, $agent_id, $channel_id, $player_id, $transaction_id, $pay_fee, $change_type, $change_amount, $from_sign, $log_id, $remark);
|
||||
if (!$ret)
|
||||
throw new Exception($this->geterrorinfo() . '(' . __LINE__ . ')', $this->geterrorcode());
|
||||
|
||||
$this->pdo_commit();
|
||||
|
||||
$return->biz_content = array(
|
||||
'agentid' => $agent_id,
|
||||
'channelid' => $channel_id,
|
||||
'playerid' => $player_id,
|
||||
'account' => $account,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
catch(Exception $Exception)
|
||||
{
|
||||
$this->pdo_rollback();
|
||||
$return->seterrors($Exception->getcode(), $Exception->getmessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
1346
codes/agent/game/dlweb/api/lib/1.0/model/report.php
Normal file
1346
codes/agent/game/dlweb/api/lib/1.0/model/report.php
Normal file
File diff suppressed because it is too large
Load Diff
2841
codes/agent/game/dlweb/api/lib/1.0/model/settle.php
Normal file
2841
codes/agent/game/dlweb/api/lib/1.0/model/settle.php
Normal file
File diff suppressed because it is too large
Load Diff
2623
codes/agent/game/dlweb/api/lib/1.0/model/user.php
Normal file
2623
codes/agent/game/dlweb/api/lib/1.0/model/user.php
Normal file
File diff suppressed because it is too large
Load Diff
608
codes/agent/game/dlweb/api/lib/1.0/models/Agent.php
Normal file
608
codes/agent/game/dlweb/api/lib/1.0/models/Agent.php
Normal file
@@ -0,0 +1,608 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2017/11/14
|
||||
* Time: 11:30
|
||||
*/
|
||||
|
||||
namespace models;
|
||||
|
||||
|
||||
class Agent extends \core\Model
|
||||
{
|
||||
|
||||
/**
|
||||
* 添加新代理商
|
||||
* @param $params
|
||||
*/
|
||||
public function addAgent(&$params)
|
||||
{
|
||||
$sql = 'insert into ct_agent_list (agent_id, nickname, max_sales_id, default_sales_power) VALUES (?,?,?,?)';
|
||||
$this->execute($sql, [$params['agentid'], $params['name'], 10000000, $params['power']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新渠道,并添加相应的产品
|
||||
* @param $p
|
||||
*/
|
||||
public function addChannel(&$p)
|
||||
{
|
||||
$sql = 'insert into ct_channel_list (
|
||||
agent_id, channel_id, nickname, logo, qq,
|
||||
is_show_recharge_star, recharge_roomcard_to_sales,
|
||||
wechat, app_id, devkey, market_id, app_id_pay,
|
||||
devkey_pay, market_id_pay, is_open, parent_agent_id, become_sales_mode,
|
||||
invitation_model, buy_card_mode, is_check_phone)
|
||||
VALUES (
|
||||
?,?,?,?,?,
|
||||
?,?,
|
||||
?,?,?,?,?,
|
||||
?,?,?,?,?,
|
||||
?,?,0
|
||||
)';
|
||||
$this->execute($sql, [
|
||||
$p['agentid'], $p['channelid'], $p['name'], $p['logo'], $p['qq'],
|
||||
$p['is_show_recharge_star'], $p['recharge_roomcard_to_sales'],
|
||||
$p['wechat'], '14966338932488', '14966329712475', 'ylhdyx', '14966338932488',
|
||||
'14966329712475', 'ylhdyx', $p['is_open'], $p['parentid'], $p['become_sales_mode'],
|
||||
$p['invitation_model'], $p['buy_card_mode']
|
||||
]);
|
||||
|
||||
// 添加产品
|
||||
$agent_id = $p['agentid'];
|
||||
$sql = <<<EOL
|
||||
# 玩家购房卡
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+1), '0', '5张F卡', '5', '15.00', '', '0', '0');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+2), '0', '10张F卡', '10', '30.00', '', '0', '0');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+3), '0', '80张F卡', '80', '208.00', '', '0', '0');
|
||||
# 代理购房卡
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+4), '1', '1张F卡', '1', '10.00', '', '0', '0');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+5), '1', '1张F卡', '1', '10.00', '', '0', '0');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+6), '1', '1张F卡', '1', '10.00', '', '0', '0');
|
||||
# 玩家购星星
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+7), '0', '一万个星星', '10000', '105.00', '', '1', '1');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+8), '0', '五万个星星', '50000', '525.00', '', '1', '1');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+9), '0', '十万个星星', '100000', '1050.00', '', '1', '1');
|
||||
# 代理购星星
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+10), '1', '一万个星星', '10000', '105.00', '', '1', '1');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+11), '1', '五万个星星', '50000', '525.00', '', '1', '1');
|
||||
INSERT INTO `sales_product` (`sapr_agentid`, `sapr_productid`, `sapr_type`, `sapr_name`, `sapr_amount`, `sapr_money`, `sapr_memo`, `sapr_state`, `product_type`) VALUES ('{$agent_id}', MD5(unix_timestamp(now())+12), '1', '十万个星星', '100000', '1050.00', '', '1', '1');
|
||||
EOL;
|
||||
$this->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加游戏
|
||||
* @param $p
|
||||
*/
|
||||
public function addGame(&$p)
|
||||
{
|
||||
$sql = 'insert into ct_game_list (
|
||||
channel_id, game_id, game_name, logo, description,
|
||||
ios_download_url, ios_market_type, ios_app_size, android_download_url, android_app_size,
|
||||
is_open
|
||||
) VALUES (
|
||||
?,?,?,?,?,
|
||||
?,?,?,?,?,
|
||||
?
|
||||
);';
|
||||
$this->execute($sql, [
|
||||
$p['channelid'], $p['gameid'], $p['gamename'], $p['logo'], $p['description'],
|
||||
$p['ios_download_url'], $p['ios_market_type'], $p['ios_app_size'], $p['android_download_url'], $p['android_app_size'],
|
||||
$p['is_open']
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代理商信息
|
||||
* @param $p
|
||||
*/
|
||||
public function setAgentInfo(&$p)
|
||||
{
|
||||
$sql = 'update ct_agent_list set
|
||||
agent_id=?, nickname=?, default_sales_power=? where id=?;
|
||||
';
|
||||
$this->execute($sql, [
|
||||
$p['agentid'], $p['name'], $p['power'], $p['id']
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改渠道信息
|
||||
* @param $p
|
||||
*/
|
||||
public function setChannelInfo(&$p)
|
||||
{
|
||||
$sql = 'update ct_channel_list set
|
||||
agent_id=?, channel_id=?, nickname=?, logo=?, qq=?,
|
||||
is_show_recharge_star=?, recharge_roomcard_to_sales=?,
|
||||
wechat=?, is_open=?, parent_agent_id=?, become_sales_mode=?, invitation_model=?,
|
||||
buy_card_mode=?, share_title=?, share_desc=?, share_img=?, share_text=?, pay_desc=?, announcement=? where id=?;
|
||||
';
|
||||
$this->execute($sql, [
|
||||
$p['agentid'], $p['channelid'], $p['name'], $p['logo'], $p['qq'],
|
||||
$p['is_show_recharge_star'], $p['recharge_roomcard_to_sales'],
|
||||
$p['wechat'], $p['is_open'], $p['parentid'], $p['become_sales_mode'], $p['invitation_model'],
|
||||
$p['buy_card_mode'], $p['share_title'], $p['share_desc'], $p['share_img'], $p['share_text'], $p['pay_desc'],
|
||||
$p['announcement'], $p['id']
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改渠道信息
|
||||
* @param $p
|
||||
*/
|
||||
public function setGameInfo(&$p)
|
||||
{
|
||||
$sql = 'update ct_game_list set
|
||||
channel_id=?, game_id=?, game_name=?, logo=?,
|
||||
description=?, ios_download_url=?, ios_market_type=?, ios_app_size=?, android_download_url=?,
|
||||
android_app_size=?, is_open=? where id=?;
|
||||
';
|
||||
|
||||
$this->execute($sql, [
|
||||
$p['channelid'], $p['gameid'], $p['gamename'], $p['logo'],
|
||||
$p['description'], $p['ios_download_url'], $p['ios_market_type'], $p['ios_app_size'], $p['android_download_url'],
|
||||
$p['android_app_size'], $p['is_open'], $p['id']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取相关联的渠道列表
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function getChannelList(&$params)
|
||||
{
|
||||
// 获取所有开放的渠道
|
||||
if($params['agentid'] === 'all') {
|
||||
$sql = /** @lang text */
|
||||
'SELECT id, agent_id AS agentid, channel_id AS channelid, nickname AS name
|
||||
FROM ct_channel_list WHERE is_open = 1;';
|
||||
} else {
|
||||
$sql = /** @lang text */
|
||||
'SELECT id, agent_id AS agentid, channel_id AS channelid, nickname AS name
|
||||
FROM ct_channel_list WHERE parent_agent_id = ? AND is_open = 1;';
|
||||
}
|
||||
|
||||
$result = $this->queryAll($sql, [$params['agentid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有渠道
|
||||
* @return array
|
||||
*/
|
||||
public function getAllAgentList()
|
||||
{
|
||||
$sql = /** @lang text */'select id, agent_id as agentid, nickname as name, max_sales_id, default_sales_power
|
||||
from ct_agent_list;';
|
||||
$result = $this->queryAll($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有渠道
|
||||
* @return array
|
||||
*/
|
||||
public function getAllChannelList()
|
||||
{
|
||||
$sql = 'select id, agent_id as agentid, channel_id as channelid, nickname as name, parent_agent_id
|
||||
from ct_channel_list where is_open=1;';
|
||||
$result = $this->queryAll($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有游戏
|
||||
* @return array
|
||||
*/
|
||||
public function getAllGameList()
|
||||
{
|
||||
$sql = 'select id, channel_id as channelid, game_id as gameid, game_name as name
|
||||
from ct_game_list where is_open=1 order by channelid, id;';
|
||||
$result = $this->queryAll($sql);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取渠道配置信息,公共版
|
||||
* @param $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChannelConfig(&$params)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
id,
|
||||
agent_id,
|
||||
channel_id,
|
||||
nickname AS agentname,
|
||||
logo AS agentlogo,
|
||||
qq,
|
||||
wechat AS channelwechat,
|
||||
become_sales_mode AS html_applysales,
|
||||
invitation_model AS agentmode,
|
||||
buy_card_mode AS html_buyroomcard,
|
||||
recharge_roomcard_to_sales,
|
||||
request_star,
|
||||
is_check_phone,
|
||||
create_withdrawals_order_type,
|
||||
create_withdrawals_order_qcode,
|
||||
is_show_topsales_menu,
|
||||
is_show_recharge_star,
|
||||
share_title,
|
||||
share_desc,
|
||||
share_img,
|
||||
share_text,
|
||||
pay_desc,
|
||||
app_id AS youle_appid,
|
||||
devkey AS youle_devkey,
|
||||
market_id AS youle_busiid,
|
||||
app_id_pay AS youle_appid_pay,
|
||||
devkey_pay AS youle_devkey_pay,
|
||||
market_id_pay AS youle_busiid_pay
|
||||
FROM ct_channel_list WHERE agent_id = ? AND channel_id = ? AND is_open = 1;';
|
||||
$result = $this->query($sql, [$params['agentid'], $params['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取渠道配置信息,公共版
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChannelConfigById($id)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
id,
|
||||
agent_id,
|
||||
channel_id,
|
||||
nickname AS agentname,
|
||||
logo AS agentlogo,
|
||||
qq,
|
||||
wechat AS channelwechat,
|
||||
become_sales_mode AS html_applysales,
|
||||
invitation_model AS agentmode,
|
||||
buy_card_mode AS html_buyroomcard,
|
||||
recharge_roomcard_to_sales,
|
||||
request_star,
|
||||
share_title,
|
||||
share_desc,
|
||||
share_img,
|
||||
share_text,
|
||||
pay_desc,
|
||||
app_id AS youle_appid,
|
||||
devkey AS youle_devkey,
|
||||
market_id AS youle_busiid,
|
||||
app_id_pay AS youle_appid_pay,
|
||||
devkey_pay AS youle_devkey_pay,
|
||||
market_id_pay AS youle_busiid_pay
|
||||
FROM ct_channel_list WHERE id=? AND is_open = 1;';
|
||||
$result = $this->query($sql, [$id]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理商配置信息,管理员版
|
||||
* @param $p
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAgentInfo(&$p)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
agent_id as agentid,
|
||||
nickname as name,
|
||||
default_sales_power as power
|
||||
FROM ct_agent_list WHERE id=?;';
|
||||
$result = $this->query($sql, [$p['id']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取渠道配置信息,管理员版
|
||||
* @param $p
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChannelInfo(&$p)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
agent_id as agentid,
|
||||
channel_id as channelid,
|
||||
parent_agent_id as parentid,
|
||||
nickname AS name,
|
||||
logo,
|
||||
qq,
|
||||
wechat,
|
||||
is_show_recharge_star,
|
||||
recharge_roomcard_to_sales,
|
||||
become_sales_mode,
|
||||
invitation_model,
|
||||
buy_card_mode,
|
||||
request_star,
|
||||
share_title,
|
||||
share_desc,
|
||||
share_img,
|
||||
share_text,
|
||||
pay_desc,
|
||||
announcement,
|
||||
is_open
|
||||
FROM ct_channel_list WHERE id=?;';
|
||||
$result = $this->query($sql, [$p['id']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏配置信息,管理员版
|
||||
* @param $p
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGameInfo(&$p)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
channel_id as channelid,
|
||||
game_id as gameid,
|
||||
game_name as gamename,
|
||||
logo,
|
||||
description,
|
||||
ios_download_url,
|
||||
ios_market_type,
|
||||
ios_app_size,
|
||||
android_download_url,
|
||||
android_app_size,
|
||||
is_open
|
||||
FROM ct_game_list WHERE id=?;';
|
||||
$result = $this->query($sql, [$p['id']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取游戏下载列表
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function getGameList(&$params)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
game_id,
|
||||
game_name AS name,
|
||||
logo AS image,
|
||||
description AS memo,
|
||||
ios_download_url AS ios_down,
|
||||
ios_download_url_2 AS ios_down_2,
|
||||
ios_market_type AS ios_marketid,
|
||||
ios_app_size AS ios_size,
|
||||
android_download_url AS android_down,
|
||||
android_download_url_2 AS android_down_2,
|
||||
android_app_size AS android_size
|
||||
FROM ct_game_list WHERE channel_id = ? AND is_open = 1;';
|
||||
|
||||
$result = $this->queryAll($sql, [$params['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品列表
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
public function getProductList(&$params)
|
||||
{
|
||||
/**
|
||||
* sales_product 表
|
||||
* sapr_type => 0-针对个人玩家的产品 1-针对个人代理的产品
|
||||
* product_type => 0-房卡,1-星星,2-钻石
|
||||
* sapr_state => 0-启用 1-禁用
|
||||
* sort 排序(数值大的在前面)
|
||||
*/
|
||||
$sql = 'SELECT
|
||||
idx as productid, sapr_name as name, sapr_amount as amount, sapr_money as money,
|
||||
sapr_memo as memo, product_type, sapr_type as type, make_vip
|
||||
FROM
|
||||
sales_product
|
||||
WHERE
|
||||
sapr_agentid = ? and sapr_type = ? and product_type = ? and sapr_state = 0 and parent_id is null
|
||||
ORDER BY sort desc, idx;';
|
||||
|
||||
$result = $this->queryAll($sql, [$params['agentid'], $params['type'], $params['ptype']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定渠道所有商品
|
||||
* @param $agent_id
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getAllProductList($agent_id)
|
||||
{
|
||||
$sql = 'select * from sales_product where sapr_agentid=? order by product_type, sort desc';
|
||||
|
||||
return $this->queryAll($sql, [$agent_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个商品信息
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getProductInfo($id)
|
||||
{
|
||||
$sql = 'select * from sales_product where idx=?';
|
||||
return $this->query($sql, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品信息
|
||||
* @param $p
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setProductInfo($p)
|
||||
{
|
||||
if(empty($p['parent_id']))
|
||||
$parent_id = null;
|
||||
else
|
||||
$parent_id = $p['parent_id'];
|
||||
|
||||
$sql = 'update sales_product set sapr_agentid=?, sapr_type=?, sapr_name=?, sapr_amount=?, sapr_money=?, sapr_memo=?,
|
||||
sapr_state=?, product_type=?, parent_id=?, sort=?, make_vip=? where idx=?';
|
||||
|
||||
$this->execute($sql, [
|
||||
$p['sapr_agentid'], $p['sapr_type'],$p['sapr_name'],$p['sapr_amount'],$p['sapr_money'], $p['sapr_memo'],
|
||||
$p['sapr_state'],$p['product_type'],$parent_id,$p['sort'], $p['make_vip'],$p['idx']
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
* @param $p
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addProductInfo($p)
|
||||
{
|
||||
if(empty($p['parent_id']))
|
||||
$parent_id = null;
|
||||
else
|
||||
$parent_id = $p['parent_id'];
|
||||
|
||||
$sql = 'insert into sales_product (
|
||||
sapr_agentid, sapr_type, sapr_name, sapr_amount, sapr_money,
|
||||
sapr_memo, sapr_state, product_type, parent_id, sort,
|
||||
make_vip
|
||||
) values (
|
||||
?,?,?,?,?,
|
||||
?,?,?,?,?,
|
||||
?)';
|
||||
|
||||
$this->execute($sql, [
|
||||
$p['sapr_agentid'], $p['sapr_type'],$p['sapr_name'],$p['sapr_amount'],$p['sapr_money'], $p['sapr_memo'],
|
||||
$p['sapr_state'],$p['product_type'],$parent_id,$p['sort'], $p['make_vip']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用钻石兑换的商品
|
||||
* @param $params
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTransformProductList(&$params)
|
||||
{
|
||||
$sql = /** @lang text */<<<EOL
|
||||
select
|
||||
id, name, amount, diamond, type, remark
|
||||
from
|
||||
(
|
||||
select
|
||||
id, name, amount, diamond, type, remark, sort
|
||||
from
|
||||
ct_transform_product_info
|
||||
where
|
||||
agent_id = ? and channel_id = ? and enabled = 1 and is_preferential = 0
|
||||
|
||||
union all
|
||||
|
||||
select
|
||||
id, name, amount, diamond, type, remark, sort
|
||||
from
|
||||
ct_transform_product_info
|
||||
where
|
||||
agent_id = ? and channel_id = ? and enabled = 1 and is_preferential = 1 and
|
||||
date_format(now(), '%H:%i:%s') between preferential_start_time and preferential_end_time
|
||||
) t
|
||||
order by
|
||||
sort desc, id
|
||||
|
||||
EOL;
|
||||
|
||||
|
||||
// $sql = 'select
|
||||
// id, name, amount, diamond, type, remark
|
||||
// from
|
||||
// ct_transform_product_info
|
||||
// where
|
||||
// agent_id=? and channel_id=? and enabled=1
|
||||
// order by sort desc, id';
|
||||
//
|
||||
// $result = $this->queryAll($sql, [$params['agentid'], $params['channelid']]);
|
||||
|
||||
$result = $this->queryAll($sql, [$params['agentid'], $params['channelid'], $params['agentid'], $params['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公告
|
||||
* type => 0-代理后台的公告 1-代理抽成的公告
|
||||
* @param $p
|
||||
* @return array
|
||||
*/
|
||||
public function getNotice(&$p)
|
||||
{
|
||||
$sql = 'SELECT
|
||||
notice_info
|
||||
FROM
|
||||
ct_agent_notice
|
||||
WHERE
|
||||
(channel_id=1 or channel_id=?) and type=? and status=1;';
|
||||
|
||||
$result = $this->queryAll($sql, [$p['channelid'], $p['type']]);
|
||||
|
||||
return isset($result[0]) ? $result[0] : ['notice_info' => ''];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取茶水费配置
|
||||
* @param $p
|
||||
* @return array
|
||||
*/
|
||||
public function getAgentServiceConfig(&$p)
|
||||
{
|
||||
$sql = 'select * from ct_agent_service where agent_id=? and channel_id=?;';
|
||||
$result = $this->queryAll($sql, [$p['agentid'], $p['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个茶水费配置
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function getAgentServiceConfigSingle($id)
|
||||
{
|
||||
$sql = 'select * from ct_agent_service where id=?;';
|
||||
$result = $this->query($sql, [$id]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个茶水费配置
|
||||
* @param $p
|
||||
* @return array
|
||||
*/
|
||||
public function getAgentServiceConfigSave(&$p)
|
||||
{
|
||||
$sql = 'update ct_agent_service set min_value=?, max_value=?, `type`=?, `value`=? where id=?;';
|
||||
$this->execute($sql, [$p['min_value'], $p['max_value'], $p['type'], $p['value'], $p['id']]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
106
codes/agent/game/dlweb/api/lib/1.0/models/Base.php
Normal file
106
codes/agent/game/dlweb/api/lib/1.0/models/Base.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 控制器基类(父类)
|
||||
*/
|
||||
class Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
* @param $data
|
||||
* @param string $tmp
|
||||
*/
|
||||
public function log($data, $tmp = '')
|
||||
{
|
||||
$str = date('H:m:s').' => '. $tmp .': ';
|
||||
if(is_array($data))
|
||||
$str .= json_encode($data);
|
||||
else
|
||||
$str .= $data;
|
||||
file_put_contents('debug/'.date('Y-m-d').'.txt', $str . PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于调试
|
||||
* @param $tmp
|
||||
*/
|
||||
public function debug($tmp)
|
||||
{
|
||||
echo '<pre>';
|
||||
var_dump($tmp);
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验数据
|
||||
* R => 必要的数据(不能为空)
|
||||
* r => 必要的数据(可以为空)
|
||||
* 数字类型 => 没有传递参数默认赋值
|
||||
* 字符串 => 没有传递参数默认赋值
|
||||
* @param $params
|
||||
* @param $rule
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkParams(&$params, $rule)
|
||||
{
|
||||
$biz = $params->biz_content;
|
||||
$tmp = [];
|
||||
$res = [];
|
||||
foreach ($rule as $v) {
|
||||
$tmp = explode('/', $v);
|
||||
|
||||
switch ($tmp[1])
|
||||
{
|
||||
// 不能为空
|
||||
case 'R':
|
||||
if(!empty($biz[$tmp[0]])) {
|
||||
$res[$tmp[0]] = $biz[$tmp[0]];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Exception("请上传必要的数据({$tmp[0]})", 1001);
|
||||
|
||||
break;
|
||||
// 必须上传
|
||||
case 'r':
|
||||
if(isset($biz[$tmp[0]])) {
|
||||
$res[$tmp[0]] = $biz[$tmp[0]];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Exception("请上传必要的数据({$tmp[0]})", 1002);
|
||||
|
||||
break;
|
||||
// 数字
|
||||
case 'd':
|
||||
$res[$tmp[0]] = (isset($biz[$tmp[0]]) && is_numeric($biz[$tmp[0]])) ? intval($biz[$tmp[0]]) : intval($tmp[1]);
|
||||
|
||||
break;
|
||||
|
||||
// 字符串
|
||||
case 's':
|
||||
$res[$tmp[0]] = isset($biz[$tmp[0]]) ? strval($biz[$tmp[0]]) : strval($tmp[1]);
|
||||
|
||||
break;
|
||||
|
||||
// 手机号
|
||||
case 'phone':
|
||||
if(!preg_match('/^1[3456789]{1}\d{9}$/', $biz[$tmp[0]])) {
|
||||
throw new Exception('请输入正确的手机号', 1003);
|
||||
}
|
||||
$res[$tmp[0]] = $biz[$tmp[0]];
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('未定义的格式', 1009);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
104
codes/agent/game/dlweb/api/lib/1.0/models/Db.php
Normal file
104
codes/agent/game/dlweb/api/lib/1.0/models/Db.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
class Db
|
||||
{
|
||||
/**
|
||||
* 数据查询实例
|
||||
* @var null
|
||||
*/
|
||||
public static $Db = null;
|
||||
|
||||
private static function _init()
|
||||
{
|
||||
if(!self::$Db)
|
||||
self::$Db = new BaseMethod();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询方法,返回单条数据
|
||||
* @param $sql
|
||||
* @param array $arr
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function query($sql, $arr = [])
|
||||
{
|
||||
self::_init();
|
||||
|
||||
$result = self::$Db->PDO_Request($sql, $arr);
|
||||
|
||||
if(!self::$Db->PDO_IsDone())
|
||||
throw new Exception(self::$Db->GetErrorInfo(), 101);
|
||||
|
||||
if(isset($result[0]))
|
||||
return $result[0];
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询方法,返回多条数据
|
||||
* @param $sql
|
||||
* @param $arr
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function queryAll($sql, $arr = [])
|
||||
{
|
||||
self::_init();
|
||||
|
||||
$result = self::$Db->PDO_Request($sql, $arr);
|
||||
|
||||
if(!self::$Db->PDO_IsDone())
|
||||
throw new Exception(self::$Db->GetErrorInfo(), 102);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 只执行sql语句,不反回结果
|
||||
* @param $sql
|
||||
* @param array $arr
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function execute($sql, $arr = [])
|
||||
{
|
||||
self::_init();
|
||||
|
||||
$ret = self::$Db->PDO_Execute($sql, $arr);
|
||||
|
||||
if(!$ret || !self::$Db->PDO_IsDone())
|
||||
throw new \Exception(self::$Db->GetErrorInfo(), 103);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启事务
|
||||
*/
|
||||
public static function beginTransaction()
|
||||
{
|
||||
self::_init();
|
||||
|
||||
self::$Db->PDO_BeginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交一个事务
|
||||
*/
|
||||
public static function commit()
|
||||
{
|
||||
self::$Db->PDO_Commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚一个事务
|
||||
*/
|
||||
public static function rollBack()
|
||||
{
|
||||
self::$Db->PDO_Rollback();
|
||||
}
|
||||
}
|
||||
24
codes/agent/game/dlweb/api/lib/1.0/models/SalesModel.php
Normal file
24
codes/agent/game/dlweb/api/lib/1.0/models/SalesModel.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
class SalesModel
|
||||
{
|
||||
/**
|
||||
* 手机号是否注册过
|
||||
* 已注册返回 true,否则 false
|
||||
*/
|
||||
public function isRegisterPhone($agent_id, $channel_id, $phone)
|
||||
{
|
||||
$sql = 'select * from sales_user where saus_agentid = ? AND saus_channelid = ? AND saus_tel = ?';
|
||||
$result = Db::query($sql, [$agent_id, $channel_id, $phone]);
|
||||
|
||||
if($result)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function sendPhoneCode()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
277
codes/agent/game/dlweb/api/lib/1.0/models/SalesUser.php
Normal file
277
codes/agent/game/dlweb/api/lib/1.0/models/SalesUser.php
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2017/11/14
|
||||
* Time: 11:30
|
||||
*/
|
||||
|
||||
namespace models;
|
||||
|
||||
|
||||
class SalesUser extends \core\Model
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询代理信息,管理员版
|
||||
* @param $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function querySalesInfo(&$params)
|
||||
{
|
||||
$sql = /** @lang text */'select
|
||||
saus_nickname as nickname,
|
||||
saus_parentid as parentid,
|
||||
saus_roomcard as roomcard,
|
||||
saus_bean as star,
|
||||
password,
|
||||
statistic_type,
|
||||
global_power,
|
||||
is_vip,
|
||||
announcement
|
||||
from sales_user where saus_salesid = ? and saus_agentid = ? and saus_channelid = ?;';
|
||||
$result = $this->query($sql, [$params['salesid'], $params['agentid'], $params['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置代理信息,管理员版
|
||||
* @param $p
|
||||
*/
|
||||
public function setSalesInfo(&$p)
|
||||
{
|
||||
// 兼容
|
||||
if(empty($p['parentid'])) $p['parentid'] = null;
|
||||
|
||||
$sql = /** @lang text */'update sales_user set saus_parentid = ?, global_power = ?, statistic_type = ?, is_vip=?, announcement=?
|
||||
where saus_salesid = ? and saus_agentid = ? and saus_channelid = ? LIMIT 1;';
|
||||
$this->execute($sql, [$p['parentid'], $p['global_power'], $p['statistic_type'], $p['is_vip'], $p['announcement'], $p['salesid'], $p['agentid'], $p['channelid']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员给玩家充值房卡或星星
|
||||
*/
|
||||
public function playerRecharge(&$p)
|
||||
{
|
||||
/*$sql = 'select play_roomcard as card, play_bean as star from player WHERE play_agentid = ? and play_channelid = ? and play_playerid = ? LIMIT 1;';
|
||||
$user_info = $this->query($sql, [$p['agentid'], $p['channelid'], $p['userid']]);*/
|
||||
// 通过游戏的接口获取实时的玩家信息
|
||||
$player_data = array(
|
||||
'app' => 'youle',
|
||||
'route' => 'agent',
|
||||
'rpc' => 'query_player2',
|
||||
'data' => array(
|
||||
'agentid' => $p['agentid'],
|
||||
'playerid' => $p['userid'],
|
||||
),
|
||||
);
|
||||
$player_info = file_get_contents(REQUEST_USER_INFO . '?' . json_encode($player_data));
|
||||
if(!$player_info) throw new \Exception('获取玩家信息错误', 1103);
|
||||
$player_info = json_decode($player_info, true);
|
||||
|
||||
$user_info = $player_info['data'];
|
||||
if(!isset($user_info['roomcard']) || !isset($user_info['bean']))
|
||||
throw new \Exception('获取玩家信息错误', 1100);
|
||||
|
||||
// 判断是房卡还是星星
|
||||
if($p['p_type'] === 1) {
|
||||
$before = $user_info['roomcard'];
|
||||
$sql = /** @lang text */'insert into ct_user_process_log(
|
||||
from_agent, from_channel, from_user, to_agent, to_channel,
|
||||
to_user, oper_type, oper_data, remark, oper_time,
|
||||
is_process)
|
||||
values (
|
||||
?, ?, ?, ?, ?,
|
||||
?, 2, ?, ?, ?,
|
||||
?);';
|
||||
} elseif($p['p_type'] === 2) {
|
||||
$before = $user_info['bean'];
|
||||
$sql = /** @lang text */'insert into ct_user_process_log(
|
||||
from_agent, from_channel, from_user, to_agent, to_channel,
|
||||
to_user, oper_type, oper_data, remark, oper_time,
|
||||
is_process)
|
||||
values (
|
||||
?, ?, ?, ?, ?,
|
||||
?, 12, ?, ?, ?,
|
||||
?);';
|
||||
} else {
|
||||
throw new \Exception('充值类型错误', 1101);
|
||||
}
|
||||
|
||||
|
||||
$this->beginTransaction();
|
||||
try {
|
||||
// 插入日志
|
||||
$this->query($sql, [
|
||||
$p['agentid'], $p['channelid'], $p['adminid'], $p['agentid'], $p['channelid'],
|
||||
$p['userid'], $p['amount'], '管理员充值', time(), 0
|
||||
]);
|
||||
|
||||
|
||||
$sql = /** @lang text */'insert into ct_manager_production_info (
|
||||
agent_id, channel_id, from_user, to_user, user_type, production_type,
|
||||
amount, before_update, after_update, oper_type, create_time, source_from,
|
||||
remark)
|
||||
values (
|
||||
?,?,1,?,?,?,
|
||||
?,?,?,1,now(),?,
|
||||
?);';
|
||||
$this->query($sql, [$p['agentid'], $p['channelid'], $p['userid'], $p['u_type'], $p['p_type'],
|
||||
$p['amount'], $before, ($before + $p['amount']), $p['adminid'], '管理员充值']);
|
||||
$this->commit();
|
||||
} catch (\Exception $e) {
|
||||
$this->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员给代理充值房卡或星星
|
||||
* @param $p
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function salesRecharge(&$p)
|
||||
{
|
||||
$sql = /** @lang text */'select user_id, saus_roomcard card, saus_bean bean, diamond from sales_user where saus_agentid = ? and saus_channelid = ? and saus_salesid = ?';
|
||||
$user_info = $this->query($sql, [$p['agentid'], $p['channelid'], $p['userid']]);
|
||||
if(empty($user_info))
|
||||
throw new \Exception('获取代理的信息错误', 1100);
|
||||
|
||||
$this->beginTransaction();
|
||||
try {
|
||||
/// 判断是房卡还是星星
|
||||
switch ($p['p_type']) {
|
||||
case 1:
|
||||
$before = $user_info['card'];
|
||||
// 校验数量
|
||||
if(($before + $p['amount']) < 0) throw new \Exception('数量不足', 1102);
|
||||
|
||||
$sql = /** @lang text */'update sales_user set saus_roomcard = saus_roomcard + ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ? limit 1;';
|
||||
$ret = self::$Db->pdo_execute($sql, $p['amount'], $p['agentid'], $p['channelid'], $p['userid']);
|
||||
if (!$ret)
|
||||
throw new \Exception(self::$Db->geterrorinfo(), self::$Db->geterrorcode());
|
||||
|
||||
if (!empty($user_info['user_id'])) {
|
||||
$sql = /** @lang text */'update ct_user_account set card = card + ? where user_id = ?';
|
||||
$ret = self::$Db->pdo_execute($sql, $p['amount'], $user_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new \Exception(self::$Db->geterrorinfo(), self::$Db->geterrorcode());
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$before = $user_info['bean'];
|
||||
// 校验数量
|
||||
if(($before + $p['amount']) < 0) throw new \Exception('数量不足', 1102);
|
||||
|
||||
$sql = /** @lang text */'update sales_user set saus_bean = saus_bean + ? where saus_agentid = ? and saus_channelid = ? and saus_salesid = ? limit 1;';
|
||||
$ret = self::$Db->pdo_execute($sql, $p['amount'], $p['agentid'], $p['channelid'], $p['userid']);
|
||||
if (!$ret)
|
||||
throw new \Exception(self::$Db->geterrorinfo(), self::$Db->geterrorcode());
|
||||
|
||||
if (!empty($user_info['user_id'])) {
|
||||
$sql = /** @lang text */'update ct_user_account set currency = currency + ? where user_id = ?';
|
||||
$ret = self::$Db->pdo_execute($sql, $p['amount'], $user_info['user_id']);
|
||||
if (!$ret)
|
||||
throw new \Exception(self::$Db->geterrorinfo(), self::$Db->geterrorcode());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \Exception('充值类型错误', 1101);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql = /** @lang text */<<<EOL
|
||||
insert into ct_manager_production_info (
|
||||
agent_id, channel_id, from_user, to_user, user_type, production_type,
|
||||
amount, before_update, after_update, oper_type, create_time, source_from,
|
||||
remark)
|
||||
values (
|
||||
?,?,1,?,?,?,
|
||||
?,?,?,1,now(),?,
|
||||
?)
|
||||
EOL;
|
||||
$this->query($sql, [$p['agentid'], $p['channelid'], $p['userid'], $p['u_type'], $p['p_type'],
|
||||
$p['amount'], $before, ($before + $p['amount']), $p['adminid'], '管理员充值']);
|
||||
$this->commit();
|
||||
} catch (\Exception $e) {
|
||||
$this->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理银行账户信息
|
||||
* @param $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSalesBankInfo(&$params)
|
||||
{
|
||||
$sql =/** @lang text */ 'select
|
||||
saus_realname,
|
||||
saus_wechat,
|
||||
saus_alipay,
|
||||
saus_kaihu_name,
|
||||
saus_kaihu_bank,
|
||||
saus_kaihu_zhihang,
|
||||
saus_kaihu_count
|
||||
from sales_user WHERE saus_salesid = ? and saus_agentid = ? and saus_channelid = ?;';
|
||||
$result = $this->query($sql, [$params['salesid'], $params['agentid'], $params['channelid']]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取玩家的上级
|
||||
* @param $p
|
||||
* @return array
|
||||
*/
|
||||
public function getPlayerParentInfo(&$p)
|
||||
{
|
||||
|
||||
$sql = 'select play_playerid, play_nickname, play_invitecode from player where play_agentid=? and play_channelid=? and play_playerid=?';
|
||||
$player = $this->query($sql, [$p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
|
||||
$sql = 'select saus_salesid, saus_nickname, saus_invitecode, saus_parentid, player_id from sales_user where saus_agentid=? and saus_channelid=? and player_id=?';
|
||||
$sales = $this->query($sql, [$p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
|
||||
return ['playerinfo' => $player, 'salesinfo' => $sales];
|
||||
}
|
||||
|
||||
public function setPlayerParent(&$p)
|
||||
{
|
||||
if(empty($p['parentid']))
|
||||
$p['parentid'] = null;
|
||||
|
||||
$this->beginTransaction();
|
||||
try {
|
||||
$sql = 'select idx from player where play_agentid=? and play_channelid=? and play_playerid=? limit 1';
|
||||
$res = $this->query($sql, [$p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
if(!$res)
|
||||
throw new \Exception('玩家表信息不存在', 1000);
|
||||
|
||||
$sql = 'select idx from sales_user where saus_agentid=? and saus_channelid=? and player_id=? limit 1';
|
||||
$res = $this->query($sql, [$p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
if(!$res)
|
||||
throw new \Exception('推广员表信息不存在', 1000);
|
||||
|
||||
$sql = 'update player set play_invitecode=? where play_agentid=? and play_channelid=? and play_playerid=? limit 1';
|
||||
$this->execute($sql, [$p['parentid'], $p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
|
||||
$sql = 'update sales_user set saus_invitecode=? where saus_agentid=? and saus_channelid=? and player_id=? limit 1';
|
||||
$this->execute($sql, [$p['parentid'], $p['agentid'], $p['channelid'], $p['playerid']]);
|
||||
|
||||
$this->commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
$this->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
31
codes/agent/game/dlweb/api/lib/1.0/models/Tools.php
Normal file
31
codes/agent/game/dlweb/api/lib/1.0/models/Tools.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once APP_PATH.'/sms.php';
|
||||
|
||||
class Tools
|
||||
{
|
||||
/**
|
||||
* 发送手机验证码
|
||||
* @param $phone
|
||||
* @param int $captcha
|
||||
* @param bool $is_debug
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendCaptcha($phone, $captcha = 0, $is_debug = false)
|
||||
{
|
||||
$rand_code = !empty($captcha) ? $captcha : rand(100000, 999999);
|
||||
// 是否是测试状态
|
||||
if(!$is_debug) {
|
||||
$sms = new sms();
|
||||
$result = $sms->_SendSms(7, array('code' => $rand_code, 'product' => '代理'), $phone);
|
||||
|
||||
if ( !is_null($result)) {
|
||||
throw new Exception('短信发送太频繁,请稍候再试', ERRORCODE_SMSSENDERROR);
|
||||
}
|
||||
}
|
||||
|
||||
return $rand_code;
|
||||
}
|
||||
|
||||
}
|
||||
77
codes/agent/game/dlweb/api/lib/1.0/open.php
Normal file
77
codes/agent/game/dlweb/api/lib/1.0/open.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: bahamut
|
||||
* Date: 2018/11/8
|
||||
* Time: 10:28
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/public/public_data.php';
|
||||
|
||||
|
||||
class data extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $Request
|
||||
* @param ReturnParameter $Return
|
||||
* @return bool
|
||||
*/
|
||||
public function GetSalesList($Request, &$Return)
|
||||
{
|
||||
$param = (array)$Request->biz_content;
|
||||
|
||||
$agent_id = @$param['agentid'];
|
||||
$channel_id = @$param['channelid'];
|
||||
$page_index = intval(@$param['pageindex']);
|
||||
$page_size = intval(@$param['pagesize']);
|
||||
$from_sign = @$param['from'];
|
||||
|
||||
if (strcasecmp($from_sign, 'games') != 0) {
|
||||
$Return->seterrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'source sign'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmd = $this->NewServantCommand();
|
||||
//select
|
||||
// a.saus_salesid, a.player_id, b.saus_salesid, b.player_id
|
||||
//from
|
||||
// sales_user a
|
||||
//left join
|
||||
// sales_user b
|
||||
//on
|
||||
// a.saus_agentid = b.saus_agentid and
|
||||
// a.saus_channelid = b.saus_channelid and
|
||||
// a.saus_parentid = b.saus_salesid
|
||||
//where
|
||||
// a.saus_agentid = '00bA05haB0d9ZC0fwGD09Q2OA30insbQ' and
|
||||
// a.saus_channelid = 'frdt0C1GG0t91P0McFo0rbA1he5yurbS';
|
||||
if (0 == $page_index || 0 == $page_size) {
|
||||
$Return->biz_content = $cmd
|
||||
->select(['sales_id' => 'a.saus_salesid', 'player_id' => 'a.player_id', 'parent_sales_id' => 'b.saus_salesid', 'parent_player_id' => 'b.player_id', ])
|
||||
->from(['a' => 'sales_user', ])
|
||||
->leftjoin(['b' => 'sales_user', ])
|
||||
->on('a.saus_agentid = b.saus_agentid and a.saus_channelid = b.saus_channelid and a.saus_parentid = b.saus_salesid')
|
||||
->where(['a.saus_agentid' => $agent_id, 'a.saus_channelid' => $channel_id, ])
|
||||
->request();
|
||||
} else {
|
||||
$Return->biz_content = $cmd
|
||||
->select(['sales_id' => 'a.saus_salesid', 'player_id' => 'a.player_id', 'parent_sales_id' => 'b.saus_salesid', 'parent_player_id' => 'b.player_id', ])
|
||||
->from(['a' => 'sales_user', ])
|
||||
->leftjoin(['b' => 'sales_user', ])
|
||||
->on('a.saus_agentid = b.saus_agentid and a.saus_channelid = b.saus_channelid and a.saus_parentid = b.saus_salesid')
|
||||
->where(['a.saus_agentid' => $agent_id, 'a.saus_channelid' => $channel_id, ])
|
||||
->withpage($page_index, $page_size)
|
||||
->request();
|
||||
}
|
||||
|
||||
if (!$this->pdo_isdone()) {
|
||||
$Return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
494
codes/agent/game/dlweb/api/lib/1.0/pay.php
Normal file
494
codes/agent/game/dlweb/api/lib/1.0/pay.php
Normal file
@@ -0,0 +1,494 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: abcdefg
|
||||
* Date: 2017/10/10
|
||||
* Time: 11:00
|
||||
*/
|
||||
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
|
||||
///require_once dirname(dirname(__DIR__)) . '/third/wxpay/lib/wxpay.data.php';
|
||||
|
||||
|
||||
/**
|
||||
* 数据对象基础类,该类中定义数据类最基本的行为,包括:
|
||||
* 计算/设置/获取签名、输出xml格式的参数、从xml读取数据对象等
|
||||
*/
|
||||
class WechatBaseData
|
||||
{
|
||||
protected $Values = array();
|
||||
protected $SignKey = '';
|
||||
|
||||
/**
|
||||
* 设置签名,详见签名生成算法
|
||||
* @param mixed $Parameters
|
||||
* @return string
|
||||
**/
|
||||
public function SetSign($Parameters = null)
|
||||
{
|
||||
if (is_null($Parameters))
|
||||
$Parameters = $this->Values;
|
||||
|
||||
$Sign = $this->MakeSign($Parameters);
|
||||
$this->Values['sign'] = $Sign;
|
||||
return $Sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签名,详见签名生成算法的值
|
||||
* @return mixed
|
||||
**/
|
||||
public function GetSign()
|
||||
{
|
||||
return $this->Values['sign'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断签名,详见签名生成算法是否存在
|
||||
* @return bool
|
||||
**/
|
||||
public function IsSignSet()
|
||||
{
|
||||
return array_key_exists('sign', $this->Values);
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出xml字符
|
||||
* @param mixed $Parameters
|
||||
* @return string
|
||||
**/
|
||||
public function ToXml($Parameters = null)
|
||||
{
|
||||
if (is_null($Parameters))
|
||||
$Parameters = $this->Values;
|
||||
|
||||
if (is_object($Parameters))
|
||||
$Parameters = (array)$Parameters;
|
||||
elseif (!is_array($Parameters))
|
||||
return '<xml></xml>';
|
||||
|
||||
$Result = '';
|
||||
foreach ($Parameters as $Key => $Value)
|
||||
{
|
||||
if (is_numeric($Value))
|
||||
$Result .= "<{$Key}>{$Value}</{$Key}>";
|
||||
elseif (is_object($Value) || is_array($Value))
|
||||
$Result .= "<{$Key}>" . $this->ToXml($Value) . "</{$Key}>";
|
||||
else
|
||||
$Result .= "<{$Key}><![CDATA[{$Value}]]></{$Key}>";
|
||||
}
|
||||
|
||||
return "<xml>{$Result}</xml>";
|
||||
}
|
||||
|
||||
/**
|
||||
* 将xml转为array
|
||||
* @param string $Parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function FromXml($Parameters)
|
||||
{
|
||||
if (!$Parameters)
|
||||
return null;
|
||||
|
||||
/// 将XML转为array
|
||||
/// 禁止引用外部xml实体
|
||||
libxml_disable_entity_loader(true);
|
||||
$this->Values = json_decode(json_encode(simplexml_load_string($Parameters, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
||||
return $this->Values;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化参数格式化成url参数
|
||||
* @param mixed $Parameters
|
||||
* @return string;
|
||||
*/
|
||||
public function ToUrlParams($Parameters = null)
|
||||
{
|
||||
if (is_null($Parameters))
|
||||
$Parameters = $this->Values;
|
||||
if (empty($Parameters))
|
||||
return '';
|
||||
|
||||
if (is_object($Parameters))
|
||||
$Parameters = (array)$Parameters;
|
||||
elseif (!is_array($Parameters))
|
||||
return $Parameters;
|
||||
|
||||
$Result = '';
|
||||
foreach ($Parameters as $Key => $Value)
|
||||
{
|
||||
if (is_object($Value) || is_array($Value))
|
||||
$Result .= $Key . '=' . $this->ToUrlParams($Value) . '&';
|
||||
elseif (strcasecmp($Key, 'sign') != 0 && strcasecmp($Value, '') != 0)
|
||||
$Result .= "{$Key}={$Value}&";
|
||||
}
|
||||
|
||||
return trim($Result, '&');
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
* @param mixed $Parameters
|
||||
* @return string 签名,本函数不覆盖sign成员变量,如要设置签名需要调用SetSign方法赋值
|
||||
*/
|
||||
public function MakeSign($Parameters = null)
|
||||
{
|
||||
if (is_null($Parameters))
|
||||
$Parameters = $this->Values;
|
||||
|
||||
if (is_object($Parameters))
|
||||
$Parameters = (array)$Parameters;
|
||||
elseif (!is_array($Parameters))
|
||||
return strtoupper(md5("{$Parameters}&key={$this->SignKey}"));
|
||||
|
||||
//签名步骤一:按字典序排序参数
|
||||
ksort($Parameters);
|
||||
$String = $this->ToUrlParams($Parameters);
|
||||
//签名步骤二:在string后加入KEY
|
||||
$String = "{$String}&key={$this->SignKey}";
|
||||
//签名步骤三:MD5加密
|
||||
$String = md5($String);
|
||||
//签名步骤四:所有字符转为大写
|
||||
$Result = strtoupper($String);
|
||||
return $Result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置的值
|
||||
*/
|
||||
public function GetValues()
|
||||
{
|
||||
return $this->Values;
|
||||
}
|
||||
|
||||
|
||||
public function GetSignKey()
|
||||
{
|
||||
return $this->SignKey;
|
||||
}
|
||||
|
||||
|
||||
public function SetSignKey($SignKey)
|
||||
{
|
||||
$this->SignKey = $SignKey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 红包数据对象
|
||||
class RedPackData extends WechatBaseData
|
||||
{
|
||||
public $RequestUrl = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack'; /// 请求URL
|
||||
/*
|
||||
nonce_str:随机字符串,不长于32位
|
||||
sign:签名,详见签名生成算法
|
||||
mch_billno:商户订单号(每个订单号必须唯一。取值范围:0~9,a~z,A~Z)接口根据商户订单号支持重入,如出现超时可再调用。
|
||||
mch_id:微信支付分配的商户号
|
||||
wxappid:微信分配的公众账号ID(企业号corpid即为此appId)。接口传入的所有appid应该为公众号的appid(在mp.weixin.qq.com申请的),不能为APP的appid(在open.weixin.qq.com申请的)。
|
||||
send_name:红包发送者名称
|
||||
re_openid:接受红包的用户,用户在wxappid下的openid
|
||||
total_amount:付款金额,单位分
|
||||
total_num:红包发放总人数
|
||||
wishing:红包祝福语
|
||||
client_ip:调用接口的机器Ip地址
|
||||
act_name:活动名称
|
||||
remark:备注信息
|
||||
scene_id:场景id,发放红包使用场景,红包金额大于200时必传(PRODUCT_1:商品促销、PRODUCT_2:抽奖、PRODUCT_3:虚拟物品兑奖、PRODUCT_4:企业内部福利、PRODUCT_5:渠道分润、PRODUCT_6:保险回馈、PRODUCT_7:彩票派奖、PRODUCT_8:税务刮奖)
|
||||
risk_info:活动信息(posttime:用户操作的时间戳,mobile:业务系统账号的手机号,国家代码-手机号。不需要+号,deviceid :mac 地址或者设备唯一标识,clientversion :用户操作的客户端版本;把值为非空的信息用key=value进行拼接,再进行urlencode,urlencode(posttime=xx& mobile =xx&deviceid=xx))
|
||||
consume_mch_id:资金授权商户号,服务商替特约商户发放时使用
|
||||
*/
|
||||
protected function SetValue($Key, $Value)
|
||||
{
|
||||
$this->Values[$Key] = $Value;
|
||||
}
|
||||
|
||||
/// 微信分配的公众账号ID(企业号corpid即为此appId)。接口传入的所有appid应该为公众号的appid(在mp.weixin.qq.com申请的),不能为APP的appid(在open.weixin.qq.com申请的)。
|
||||
public function SetAppId($app_id)
|
||||
{
|
||||
$this->SetValue('wxappid', $app_id);
|
||||
}
|
||||
|
||||
/// 微信支付分配的商户号
|
||||
public function SetMchId($mch_id)
|
||||
{
|
||||
$this->SetValue('mch_id', $mch_id);
|
||||
}
|
||||
|
||||
/// 商户订单号(每个订单号必须唯一。取值范围:0~9,a~z,A~Z)接口根据商户订单号支持重入,如出现超时可再调用。
|
||||
public function SetMchBillNo($mch_billno)
|
||||
{
|
||||
$this->SetValue('mch_billno', $mch_billno);
|
||||
}
|
||||
|
||||
/// 红包发送者名称
|
||||
public function SetSendName($send_name)
|
||||
{
|
||||
$this->SetValue('send_name', $send_name);
|
||||
}
|
||||
|
||||
/// 接受红包的用户,用户在wxappid下的openid
|
||||
public function SetOpenId($open_id)
|
||||
{
|
||||
$this->SetValue('re_openid', $open_id);
|
||||
}
|
||||
|
||||
/// 付款金额,单位分
|
||||
public function SetAmount($amount)
|
||||
{
|
||||
$this->SetValue('total_amount', $amount);
|
||||
}
|
||||
|
||||
/// 红包发放总人数
|
||||
public function SetNumber($number)
|
||||
{
|
||||
$this->SetValue('total_num', $number);
|
||||
}
|
||||
|
||||
/// 红包祝福语
|
||||
public function SetWishing($wishing)
|
||||
{
|
||||
$this->SetValue('wishing', $wishing);
|
||||
}
|
||||
|
||||
/// 调用接口的机器Ip地址
|
||||
public function SetClientIp($client_ip)
|
||||
{
|
||||
$this->SetValue('client_ip', $client_ip);
|
||||
}
|
||||
|
||||
/// 活动名称
|
||||
public function SetActiveName($act_name)
|
||||
{
|
||||
$this->SetValue('act_name', $act_name);
|
||||
}
|
||||
|
||||
/// 备注信息
|
||||
public function SetRemark($remark)
|
||||
{
|
||||
$this->SetValue('remark', $remark);
|
||||
}
|
||||
|
||||
/// 场景id,发放红包使用场景,红包金额大于200时必传(PRODUCT_1:商品促销、PRODUCT_2:抽奖、PRODUCT_3:虚拟物品兑奖、PRODUCT_4:企业内部福利、PRODUCT_5:渠道分润、PRODUCT_6:保险回馈、PRODUCT_7:彩票派奖、PRODUCT_8:税务刮奖)
|
||||
public function SetSceneId($scene_id)
|
||||
{
|
||||
$this->SetValue('scene_id', $scene_id);
|
||||
}
|
||||
|
||||
/// 活动信息(posttime:用户操作的时间戳,mobile:业务系统账号的手机号,国家代码-手机号。不需要+号,deviceid :mac 地址或者设备唯一标识,clientversion :用户操作的客户端版本;把值为非空的信息用key=value进行拼接,再进行urlencode,urlencode(posttime=xx& mobile =xx&deviceid=xx))
|
||||
public function SetRiskInfo($risk_info)
|
||||
{
|
||||
if (is_object($risk_info))
|
||||
$risk_info = (array)$risk_info;
|
||||
elseif(!is_array($risk_info))
|
||||
$this->SetValue('risk_info', $risk_info);
|
||||
|
||||
$risk_info = urlencode("posttime={$risk_info['posttime']}&mobile={$risk_info['mobile']}&deviceid={$risk_info['deviceid']}&clientversion={$risk_info['clientversion']}");
|
||||
$this->SetValue('risk_info', $risk_info);
|
||||
}
|
||||
|
||||
/// 资金授权商户号,服务商替特约商户发放时使用
|
||||
public function SetConsumeMchId($consume_mch_id)
|
||||
{
|
||||
$this->SetValue('consume_mch_id', $consume_mch_id);
|
||||
}
|
||||
|
||||
/// 随机字符串,不长于32位
|
||||
public function SetNonceString($nonce_str)
|
||||
{
|
||||
$this->SetValue('nonce_str', $nonce_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class wechat extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* @var RedPackData
|
||||
*/
|
||||
private $RedPackData;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $RequestErrorCode;
|
||||
|
||||
/**
|
||||
* 公钥
|
||||
*/
|
||||
private $PublicKey = '/cert/0000000000/apiclient_cert.pem';
|
||||
/**
|
||||
* 私钥
|
||||
*/
|
||||
private $PrivateKey = '/cert/0000000000/apiclient_key.pem';
|
||||
/**
|
||||
* ca证书
|
||||
*/
|
||||
private $RootCA = '/cert/0000000000/rootca.pem';
|
||||
|
||||
/**
|
||||
* wechat constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/// todo:
|
||||
parent::__construct();
|
||||
|
||||
$this->PublicKey = __DIR__ . '/cert/1399351902/apiclient_cert.pem';
|
||||
$this->PrivateKey = __DIR__ . '/cert/1399351902/apiclient_key.pem';
|
||||
$this->RootCA = __DIR__ . '/cert/1399351902/rootca.pem';
|
||||
|
||||
$this->RedPackData = new RedPackData();
|
||||
|
||||
/// 初始化红包设置信息
|
||||
//$this->RedPackData->SetSignKey('0t3xm3w1foyhcmhlux31mwrmybqh4cgd'); /// 支付key
|
||||
//$this->RedPackData->SetAppId('wxb534983dcd6d77c6'); /// 公众账号appid
|
||||
//$this->RedPackData->SetMchId('1345625501'); /// 商户号
|
||||
$this->RedPackData->SetSignKey('YSWDSJ20160620201606202016062020'); /// 支付key
|
||||
$this->RedPackData->SetAppId('wxfd77eb9fb989e822'); /// 公众账号appid
|
||||
$this->RedPackData->SetMchId('1399351902'); /// 商户号
|
||||
|
||||
$this->RedPackData->SetMchBillNo(''); /// 商户订单号
|
||||
$this->RedPackData->SetActiveName('test'); /// 活动名称
|
||||
$this->RedPackData->SetSendName('友乐互动游戏'); /// 商户名称
|
||||
$this->RedPackData->SetOpenId(''); /// 接受红包的用户,用户在wxappid下的openid
|
||||
$this->RedPackData->SetAmount(100); /// 付款金额,单位分
|
||||
$this->RedPackData->SetNumber(1); /// 发送红包总人数
|
||||
$this->RedPackData->SetWishing('test'); /// 红包祝福语
|
||||
$this->RedPackData->SetRemark('test'); /// 备注信息
|
||||
$this->RedPackData->SetNonceString($this->create_nonce_str(32)); /// 随机字符串,不长于32位
|
||||
$this->RedPackData->SetClientIp($_SERVER['SERVER_ADDR']); /// 客户端ip
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 产生随机字符串,不长于32位
|
||||
* @param int $length
|
||||
* @return string 产生的随机字符串
|
||||
*/
|
||||
public static function create_nonce_str($length = 32)
|
||||
{
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
$str = '';
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $Url 连接地址
|
||||
* @param string $Data 发送的数据
|
||||
* @param int $Second
|
||||
* @param array $Header
|
||||
* @return bool|mixed
|
||||
*/
|
||||
private function curl_post_ssl($Url, $Data, $Second = 30, $Header = array())
|
||||
{
|
||||
$ch = curl_init();
|
||||
/// 超时时间
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $Second);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
/// 这里设置代理,如果有的话
|
||||
/// curl_setopt($ch,CURLOPT_PROXY, '10.206.30.98');
|
||||
/// curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
|
||||
curl_setopt($ch, CURLOPT_URL, $Url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
/// 以下两种方式需选择一种
|
||||
/// 第一种方法,cert 与 key 分别属于两个.pem文件
|
||||
/// 默认格式为PEM,可以注释
|
||||
curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
|
||||
//curl_setopt($ch, CURLOPT_SSLCERT, getcwd() . $this->PublicKey);
|
||||
curl_setopt($ch, CURLOPT_SSLCERT, $this->PublicKey);
|
||||
/// 默认格式为PEM,可以注释
|
||||
curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
|
||||
//curl_setopt($ch, CURLOPT_SSLKEY, getcwd() . $this->PrivateKey);
|
||||
curl_setopt($ch, CURLOPT_SSLKEY, $this->PrivateKey);
|
||||
/// ca证书
|
||||
curl_setopt($ch, CURLOPT_CAINFO, $this->RootCA);
|
||||
/// 第二种方式,两个文件合成一个.pem文件
|
||||
///curl_setopt($ch, CURLOPT_SSLCERT, getcwd() . '/all.pem');
|
||||
if (count($Header) >= 1)
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $Header);
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $Data);
|
||||
$Result = curl_exec($ch);
|
||||
if ($Result)
|
||||
{
|
||||
$this->RequestErrorCode = 0;
|
||||
curl_close($ch);
|
||||
return $Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->RequestErrorCode = curl_errno($ch);
|
||||
//echo "call faild, errorCode: {$this->RequestErrorCode}\n\n\n\n";
|
||||
curl_close($ch);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $Request
|
||||
* @param ReturnParameter $Return
|
||||
* @return bool
|
||||
*/
|
||||
public function SendRedPack($Request, &$Return)
|
||||
{
|
||||
///https://proxytest.tscce.cn/api/Index.php?method=pay.wechat.SendRedPack&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"act_name":"活动名称","open_id":"ogLT2v3XvvB1aphibzHyL8On4_sk","fee":"100","wishing":"红包祝福语","remark":"备注信息"}&user_auth_token=xxxxxxxx
|
||||
$bill_no = date('YmdHis') . rand(1000, 9999); /// 订单号
|
||||
$act_name = @$Request->biz_content['act_name']; /// 活动名称
|
||||
$open_id = @$Request->biz_content['open_id']; /// 接受红包的用户,用户在wxappid下的openid /// ogLT2v3XvvB1aphibzHyL8On4_sk
|
||||
$fee = @$Request->biz_content['fee']; /// 付款金额,单位分
|
||||
$wishing = @$Request->biz_content['wishing']; /// 红包祝福语
|
||||
$remark = @$Request->biz_content['remark']; /// 备注信息
|
||||
|
||||
$this->RedPackData->SetMchBillNo($bill_no);
|
||||
$this->RedPackData->SetActiveName($act_name);
|
||||
$this->RedPackData->SetOpenId($open_id);
|
||||
$this->RedPackData->SetAmount($fee);
|
||||
$this->RedPackData->SetWishing($wishing);
|
||||
$this->RedPackData->SetRemark($remark);
|
||||
|
||||
$this->RedPackData->SetSign(); /// 签名
|
||||
|
||||
/// 发送数据
|
||||
$xml = $this->curl_post_ssl($this->RedPackData->RequestUrl, $this->RedPackData->ToXml());
|
||||
if (empty($xml))
|
||||
{
|
||||
$Return->SetErrors(ERRORCODE_WECHATERROR, "curl call faild! error code: {$this->RequestErrorCode}");
|
||||
return false;
|
||||
}
|
||||
|
||||
$res = (array)simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
if (empty($res))
|
||||
{
|
||||
$Return->SetErrors(ERRORCODE_WECHATERROR, $xml);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcasecmp('success', $res['return_code']) != 0)
|
||||
{
|
||||
$Return->SetErrors(ERRORCODE_WECHATERROR, $res['return_msg']);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcasecmp('success', $res['result_code']) != 0)
|
||||
{
|
||||
$Return->SetErrors(ERRORCODE_WECHATERROR, $res['err_code_des']);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
1706
codes/agent/game/dlweb/api/lib/1.0/report.php
Normal file
1706
codes/agent/game/dlweb/api/lib/1.0/report.php
Normal file
File diff suppressed because it is too large
Load Diff
1266
codes/agent/game/dlweb/api/lib/1.0/report.php - 副本.mine
Normal file
1266
codes/agent/game/dlweb/api/lib/1.0/report.php - 副本.mine
Normal file
File diff suppressed because it is too large
Load Diff
267
codes/agent/game/dlweb/api/lib/1.0/sales.php
Normal file
267
codes/agent/game/dlweb/api/lib/1.0/sales.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/header.php';
|
||||
|
||||
require_once __DIR__ . '/models/SalesModel.php';
|
||||
|
||||
class sales extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 代理注册
|
||||
* 用户通过手机号注册成为代理
|
||||
* @post agent_id
|
||||
* @post channel_id
|
||||
* @post phone 手机号
|
||||
* @post captcha 验证码
|
||||
*/
|
||||
public function register($request, &$return)
|
||||
{
|
||||
$params = $this->checkParams($request, [
|
||||
'agentid/R', 'channelid/R', 'phone/R', 'captcha/0'
|
||||
]);
|
||||
|
||||
$agent_id = $params['agentid'];
|
||||
$channel_id = $params['channelid'];
|
||||
$phone = $params['phone'];
|
||||
$captcha = $params['captcha'];
|
||||
|
||||
|
||||
// 判断手机号码是否正确
|
||||
if ( !preg_match('/^1[3456789]{1}\d{9}$/', $phone)) {
|
||||
throw new Exception('手机号不符合规则', 200);
|
||||
}
|
||||
|
||||
if ( !isset($_SESSION['rand_code'])) {
|
||||
throw new Exception('请先获取验证码', 200);
|
||||
}
|
||||
|
||||
if ($_SESSION['rand_code'] !== $captcha) {
|
||||
throw new Exception('验证码不正确', 200);
|
||||
}
|
||||
|
||||
|
||||
$SalesModel = new SalesModel();
|
||||
$flag = $SalesModel->isRegisterPhone($agent_id, $channel_id, $phone);
|
||||
if ($flag) {
|
||||
throw new Exception('该手机号已注册', 200);
|
||||
}
|
||||
|
||||
// 更新当前最大的代理id
|
||||
$sql = 'update ct_agent_list set max_sales_id = max_sales_id + floor(rand() * (12-6) + 6) where agent_id = ?';
|
||||
Db::execute($sql, [$agent_id]);
|
||||
|
||||
// 获取当前最大的代理id,默认权限
|
||||
$sql = 'select max_sales_id, default_sales_power from ct_agent_list where agent_id = ? LIMIT 1';
|
||||
$result = Db::query($sql, [$agent_id]);
|
||||
$max_sales_id = $result['max_sales_id'];
|
||||
$power = $result['default_sales_power'];
|
||||
|
||||
|
||||
// 插入记录
|
||||
$sql = 'INSERT INTO sales_user (
|
||||
saus_agentid, saus_channelid, saus_openid, saus_unionid, saus_firsttime,
|
||||
saus_salesid, saus_tel, saus_power, password, saus_salesman,
|
||||
saus_avatar, saus_nickname
|
||||
) VALUES (
|
||||
?,?,?,?,?,
|
||||
?,?,?,?,1,
|
||||
?,?
|
||||
);';
|
||||
|
||||
$now = date("Y-m-d H:i:s", time());
|
||||
$password = $max_sales_id . rand(1000, 9999);
|
||||
|
||||
$result = Db::execute($sql, [
|
||||
$agent_id, $channel_id, $phone, $phone, $now,
|
||||
$max_sales_id, $phone, $power, $password, '', '']);
|
||||
|
||||
// 清楚短信验证码
|
||||
unset($_SESSION['rand_code']);
|
||||
|
||||
$return->biz_content = '注册成功';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理登入
|
||||
*/
|
||||
public function login($request, $return)
|
||||
{
|
||||
$params = $this->checkParams($request, [
|
||||
'agentid/R', 'channelid/R', 'account/R', 'password/R'
|
||||
]);
|
||||
|
||||
$agent_id = $params['agentid'];
|
||||
$channel_id = $params['channelid'];
|
||||
$account = $params['account'];
|
||||
$password = $params['password'];
|
||||
|
||||
$sql = 'select saus_salesid, saus_nickname, saus_avatar,saus_roomcard, saus_bean from sales_user where saus_agentid = ? and saus_channelid and (saus_salesid = ? or saus_tel=?) and password=?;';
|
||||
$sales_info = Db::query($sql, [$agent_id, $channel_id, $account, $account, $password]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 手机号动态验证码登录
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loginByPhone($request, &$return)
|
||||
{
|
||||
$params = $this->checkParams($request, [
|
||||
'agentid/R', 'channelid/R', 'phone/phone', 'captcha/R'
|
||||
]);
|
||||
|
||||
$agent_id = $params['agentid'];
|
||||
$channel_id = $params['channelid'];
|
||||
$phone = $params['phone'];
|
||||
$captcha = $params['captcha'];
|
||||
|
||||
$ret = Db::query('select id from sales_sms_code where agent_id = ? and channnel_id = ? and phone = ? and code = ?', [$agent_id, $channel_id, $phone, $captcha]);
|
||||
if ( !$ret) {
|
||||
$return->setErrors(200, '未查询到验证码');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 通过session中的idx获取用户信息
|
||||
$command = <<<EOL
|
||||
select
|
||||
idx, saus_agentid, saus_channelid, saus_openid, saus_unionid, saus_salesman, saus_salesid, saus_level,
|
||||
saus_salestype, saus_roomcard, saus_bean, saus_power, saus_invitecode, saus_pushmoney1, saus_pushmoney2,
|
||||
saus_status, password, saus_nickname, saus_avatar, saus_sex, saus_province, saus_city, global_power,
|
||||
saus_tel, saus_wechat, is_send_star, user_id, player_id
|
||||
from
|
||||
sales_user
|
||||
where
|
||||
saus_agentid = ? and saus_channelid = ? and saus_tel = ?
|
||||
EOL;
|
||||
|
||||
$dbSaleInfo = Db::query($command, [$agent_id, $channel_id, $phone]);
|
||||
|
||||
if ( !$dbSaleInfo) {
|
||||
$return->setErrors(200, '未获取到用户信息');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($dbSaleInfo['saus_status'] != 0) {
|
||||
$return->setErrors(200, '对不起,你的账号已被账号冻结');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 记录登录日志 登录类型 0-微信登录 1-账号登录 2-手机号动态验证码登录
|
||||
$sql = 'insert into ct_sales_login_log (agent_id, channel_id, sales_id, login_type, login_time) values (?,?,?,?,now());';
|
||||
Db::execute($sql, [$agent_id, $channel_id, $dbSaleInfo['saus_salesid'], 2]);
|
||||
|
||||
// 更新最后一次的登录的时间
|
||||
$sql = 'update sales_user set saus_lasttime=now() where idx=?';
|
||||
Db::execute($sql, [$dbSaleInfo['idx']]);
|
||||
|
||||
|
||||
$return->biz_content = array(
|
||||
'idx' => $dbSaleInfo['idx'], /// 代理
|
||||
'agentid' => $dbSaleInfo['saus_agentid'], /// 代理
|
||||
'channelid' => $dbSaleInfo['saus_channelid'], /// 渠道
|
||||
'openid' => isset($dbSaleInfo['saus_openid']) ? $dbSaleInfo['saus_openid'] : '', /// openid
|
||||
'unionid' => isset($dbSaleInfo['saus_unionid']) ? $dbSaleInfo['saus_unionid'] : '', /// unionid
|
||||
'nickname' => isset($dbSaleInfo['saus_nickname']) ? $dbSaleInfo['saus_nickname'] : '', /// 昵称
|
||||
'headimgurl' => isset($dbSaleInfo['saus_avatar']) ? $dbSaleInfo['saus_avatar'] : '', /// 头像
|
||||
'sex' => isset($dbSaleInfo['saus_sex']) ? $dbSaleInfo['saus_sex'] : '', /// 性别
|
||||
'province' => isset($dbSaleInfo['saus_province']) ? $dbSaleInfo['saus_province'] : '', /// 省
|
||||
'city' => isset($dbSaleInfo['saus_city']) ? $dbSaleInfo['saus_city'] : '', /// 市
|
||||
'salesman' => empty($dbSaleInfo['saus_salesman']) ? 0 : intval($dbSaleInfo['saus_salesman']), /// 是否代理
|
||||
'salesid' => isset($dbSaleInfo['saus_salesid']) ? $dbSaleInfo['saus_salesid'] : '', /// 代理编号
|
||||
'level' => isset($dbSaleInfo['saus_level']) ? $dbSaleInfo['saus_level'] : '', /// 代理等级
|
||||
'salestype' => isset($dbSaleInfo['saus_salestype']) ? $dbSaleInfo['saus_salestype'] : '', /// 代理类型
|
||||
'roomcard' => isset($dbSaleInfo['saus_roomcard']) ? $dbSaleInfo['saus_roomcard'] : '', /// 账户房卡数
|
||||
'bean' => isset($dbSaleInfo['saus_bean']) ? $dbSaleInfo['saus_bean'] : '', /// 账户金币数
|
||||
'salespower' => isset($dbSaleInfo['saus_power']) ? $dbSaleInfo['saus_power'] : '', /// 代理权限
|
||||
'agentmode' => 0, /// 分享模式
|
||||
//'pushmoney' => intval($dbSaleInfo['saus_pushmoney1']) + intval($dbSaleInfo['saus_pushmoney2']), /// 提成金额
|
||||
'sausstatus' => isset($dbSaleInfo['saus_status']) ? $dbSaleInfo['saus_status'] : '', /// 当前状态
|
||||
'html_applysales' => isset($db_agent_info['html_applysales']) ? $db_agent_info['html_applysales'] : '', /// 成为代理的方式
|
||||
'global_power' => isset($dbSaleInfo['global_power']) ? intval($dbSaleInfo['global_power']) : 0, /// 是否总代
|
||||
'tel' => isset($dbSaleInfo['saus_tel']) ? $dbSaleInfo['saus_tel'] : '', /// 电话号码
|
||||
'wechat' => isset($dbSaleInfo['saus_wechat']) ? $dbSaleInfo['saus_wechat'] : '', /// 微信号码
|
||||
'ppp' => isset($dbSaleInfo['password']) ? $dbSaleInfo['password'] : '', /// 密码
|
||||
'user_id' => empty(@$dbSaleInfo['user_id']) ? '' : $dbSaleInfo['user_id'], /// 统一账户编号
|
||||
'is_bind' => empty($dbSaleInfo['saus_tel']) ? 0 : (0 == $dbSaleInfo['is_send_star'] ? 0 : 1), /// 是否绑定
|
||||
'logintype' => 2,
|
||||
'player_id' => isset($dbSaleInfo['player_id']) ? $dbSaleInfo['player_id'] : ''
|
||||
);
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送手机验证码,动态登录
|
||||
*/
|
||||
public function captchaLogin($request, &$return)
|
||||
{
|
||||
$params = $this->checkParams($request, [
|
||||
'agentid/R', 'channelid/R', 'phone/phone'
|
||||
]);
|
||||
|
||||
$agent_id = $params['agentid'];
|
||||
$channel_id = $params['channelid'];
|
||||
$phone = $params['phone'];
|
||||
|
||||
// 判断手机号是否绑定过账号
|
||||
$sql = 'select idx from sales_user where saus_agentid=? and saus_channelid=? and saus_tel=? and is_send_star=1;';
|
||||
$result = Db::query($sql, [$agent_id, $channel_id, $phone]);
|
||||
if ( !$result) {
|
||||
$return->setErrors(200, '该功能只支持已绑定手机的用户');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 发送验证码
|
||||
require_once '/models/Tools.php';
|
||||
$Tools = new Tools();
|
||||
$rand_code = $Tools->sendCaptcha($phone, 0, false);
|
||||
|
||||
$command = 'select id from sales_sms_code where agent_id = ? and channnel_id = ? and phone = ? and status = 0';
|
||||
$ret = Db::query($command, [$agent_id, $channel_id, $phone]);
|
||||
if (empty($ret)) {
|
||||
$command = 'insert into sales_sms_code(agent_id, channnel_id, phone, code, status, is_bind, create_time) values(?, ?, ?, ?, 0, 1, now());';
|
||||
Db::execute($command, [$agent_id, $channel_id, $phone, $rand_code]);
|
||||
} else {
|
||||
$command = 'update sales_sms_code set code = ? where id = ?';
|
||||
Db::execute($command, [$rand_code, $ret['id']]);
|
||||
}
|
||||
|
||||
// 验证码保存到session中
|
||||
//$_SESSION['rand_code'] = $rand_code;
|
||||
//$_SESSION['idx'] = $result['idx'];
|
||||
|
||||
$return->biz_content = $rand_code;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试方法
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function test($request, $return)
|
||||
{
|
||||
$params = $this->checkParams($request, [
|
||||
'agentid/R', 'channelid/R'
|
||||
]);
|
||||
|
||||
$data = DB::query('select * from sales_user LIMIT 1;');
|
||||
|
||||
$params['test'] = 'tangjian';
|
||||
$params['sales_info'] = $data;
|
||||
|
||||
$return->biz_content = $params;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
77
codes/agent/game/dlweb/api/lib/1.0/seriallog.php
Normal file
77
codes/agent/game/dlweb/api/lib/1.0/seriallog.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: abcdefg
|
||||
* Date: 2017/7/10
|
||||
* Time: 15:19
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
|
||||
|
||||
class changelog extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* @note 写入流水日志
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function writelog($request, &$return)
|
||||
{
|
||||
$type = isset($request->biz_content['type']) ? intval($request->biz_content['type']) : 0;
|
||||
$data = isset($request->biz_content['data']) ? (array)$request->biz_content['data'] : null;
|
||||
if (!is_array($data) || empty($data))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'data'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmd = $this->NewMasterCommand();
|
||||
$count = count($data);
|
||||
|
||||
$this->PDO_BeginTransaction();
|
||||
$source = '';
|
||||
for ($index = 0; $index < $count; $index++)
|
||||
{
|
||||
$item = $data[$index];
|
||||
|
||||
$source .= sprintf('select %s agentid, %s channelid, %s playerid, %d datatype, %d changeamount, %d changetime',
|
||||
//$source .= sprintf('select %s, %s, %s, %d, %d, %d',
|
||||
$cmd->GetIdentifiers($item['agentid'], true),
|
||||
$cmd->GetIdentifiers($item['channelid'], true),
|
||||
$cmd->GetIdentifiers($item['playerid'], true),
|
||||
$type,
|
||||
intval($item['amount']),
|
||||
intval($item['time'])
|
||||
);
|
||||
|
||||
if (($index > 0 && (0 == $index % 100)) || $index == $count - 1)
|
||||
{
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
$command = /** @lang text */ 'insert into ct_change_log(agentid, channelid, playerid, datatype, changeamount, changetime)' . PHP_EOL .
|
||||
'select agentid, channelid, playerid, datatype, changeamount, changetime from (' . PHP_EOL . $source . ') t';
|
||||
$this->PDO_Execute($command);
|
||||
|
||||
if (!$this->PDO_IsDone())
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
|
||||
$this->PDO_Rollback();
|
||||
return false;
|
||||
}
|
||||
$source = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$source .= PHP_EOL . 'union all' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$this->PDO_Commit();
|
||||
$return->biz_content = array('count' => count($data));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
834
codes/agent/game/dlweb/api/lib/1.0/sms.php
Normal file
834
codes/agent/game/dlweb/api/lib/1.0/sms.php
Normal file
@@ -0,0 +1,834 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: abcdefg
|
||||
* Date: 2017/10/9
|
||||
* Time: 11:37
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
//require_once dirname(dirname(__DIR__)) . '/third/taobao/topsdk.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/third/dysms/api_demo/smsdemo.php';
|
||||
|
||||
class sms extends BaseMethod
|
||||
{
|
||||
//会员名:tsys0606
|
||||
//密码:lili12881589
|
||||
//验证手机号码:黄会计 13807081266
|
||||
//https://dayu.aliyun.com/
|
||||
|
||||
|
||||
/// xc8589@sina.com
|
||||
/// tswl0791
|
||||
/// Access Key ID: wU1zLTU3k3W0olIt
|
||||
/// Access Key Secret: muQA0NFojzEqbyX81vfBHdTYcK7Pwk
|
||||
|
||||
const SMS_APPKEY = '24646920'; /// appkey
|
||||
const SMS_SECRETKEY = 'b61d3756d66a48a9316726833c677b2c'; /// secretkey
|
||||
//const SMS_SIGNNAME = '阿里大于测试专用'; /// 签名
|
||||
const SMS_SIGNNAME = '天盛网络';
|
||||
|
||||
const SMS_ACCESSKEYID = 'wU1zLTU3k3W0olIt';
|
||||
const SMS_ACCESSKEYSECRET = 'muQA0NFojzEqbyX81vfBHdTYcK7Pwk';
|
||||
/*
|
||||
const SMSINDEX_INFORMATION_CHANGED = 1; /// 信息变更验证码(验证码${code},您正在尝试变更${product}重要信息,请妥善保管账户信息。)
|
||||
const SMSINDEX_CHANGE_PASSWORD = 2; /// 修改密码验证码(验证码${code},您正在尝试修改${product}登录密码,请妥善保管账户信息。)
|
||||
const SMSINDEX_ACTIVITY_CONFIRMATION = 3; /// 活动确认验证码(验证码${code},您正在参加${product}的${item}活动,请确认系本人申请。)
|
||||
const SMSINDEX_USER_REGISTRATION = 4; /// 用户注册验证码(验证码${code},您正在注册成为${product}用户,感谢您的支持!)
|
||||
const SMSINDEX_LOGIN_EXCEPTION = 5; /// 登录异常验证码(验证码${code},您正尝试异地登录${product},若非本人操作,请勿泄露。)
|
||||
const SMSINDEX_LOGIN_CONFIRMATION = 6; /// 登录确认验证码(验证码${code},您正在登录${product},若非本人操作,请勿泄露。)
|
||||
const SMSINDEX_SMS_TEST = 7; /// 短信测试(尊敬的${customer},欢迎您使用阿里大鱼短信服务,阿里大鱼将为您提供便捷的通信服务!)
|
||||
const SMSINDEX_AUTHENTICATION = 8; /// 身份验证验证码(验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!)
|
||||
*/
|
||||
|
||||
const SMSINDEX_INFORMATION_CHANGED = 1; /// 信息变更验证码(验证码${code},您正在尝试变更重要信息,请妥善保管账户信息。)
|
||||
const SMSINDEX_CHANGE_PASSWORD = 2; /// 修改密码验证码(验证码${code},您正在尝试修改登录密码,请妥善保管账户信息。)
|
||||
const SMSINDEX_USER_REGISTRATION = 3; /// 用户注册验证码(验证码${code},您正在注册成为新用户,感谢您的支持!)
|
||||
const SMSINDEX_LOGIN_EXCEPTION = 4; /// 登录异常验证码(验证码${code},您正尝试异地登录,若非本人操作,请勿泄露。)
|
||||
const SMSINDEX_LOGIN_CONFIRMATION = 5; /// 登录确认验证码(验证码${code},您正在登录,若非本人操作,请勿泄露。)
|
||||
const SMSINDEX_SMS_TEST = 6; /// 短信测试(尊敬的${customer},欢迎您使用阿里云通信服务!)
|
||||
const SMSINDEX_AUTHENTICATION = 7; /// 身份验证验证码(验证码${code},您正在进行身份验证,打死不要告诉别人哦!)
|
||||
|
||||
private function GetSmsTemplateCode($Index)
|
||||
{
|
||||
switch ($Index)
|
||||
{
|
||||
/*
|
||||
case self::SMSINDEX_INFORMATION_CHANGED: /// 信息变更验证码(验证码${code},您正在尝试变更${product}重要信息,请妥善保管账户信息。)
|
||||
return 'SMS_70060714';
|
||||
case self::SMSINDEX_CHANGE_PASSWORD: /// 修改密码验证码(验证码${code},您正在尝试修改${product}登录密码,请妥善保管账户信息。)
|
||||
return 'SMS_70060715';
|
||||
case self::SMSINDEX_ACTIVITY_CONFIRMATION: /// 活动确认验证码(验证码${code},您正在参加${product}的${item}活动,请确认系本人申请。)
|
||||
return 'SMS_70060716';
|
||||
case self::SMSINDEX_USER_REGISTRATION: /// 用户注册验证码(验证码${code},您正在注册成为${product}用户,感谢您的支持!)
|
||||
return 'SMS_70060717';
|
||||
case self::SMSINDEX_LOGIN_EXCEPTION: /// 登录异常验证码(验证码${code},您正尝试异地登录${product},若非本人操作,请勿泄露。)
|
||||
return 'SMS_70060718';
|
||||
case self::SMSINDEX_LOGIN_CONFIRMATION: /// 登录确认验证码(验证码${code},您正在登录${product},若非本人操作,请勿泄露。)
|
||||
return 'SMS_70060719';
|
||||
case self::SMSINDEX_SMS_TEST: /// 短信测试(尊敬的${customer},欢迎您使用阿里大鱼短信服务,阿里大鱼将为您提供便捷的通信服务!)
|
||||
return 'SMS_70060720';
|
||||
case self::SMSINDEX_AUTHENTICATION: /// 身份验证验证码(验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!)
|
||||
return 'SMS_70060721';
|
||||
*/
|
||||
|
||||
case self::SMSINDEX_INFORMATION_CHANGED: /// 信息变更验证码(验证码${code},您正在尝试变更重要信息,请妥善保管账户信息。)
|
||||
return 'SMS_104940057';
|
||||
case self::SMSINDEX_CHANGE_PASSWORD: /// 修改密码验证码(验证码${code},您正在尝试修改登录密码,请妥善保管账户信息。)
|
||||
return 'SMS_104940058';
|
||||
case self::SMSINDEX_USER_REGISTRATION: /// 用户注册验证码(验证码${code},您正在注册成为新用户,感谢您的支持!)
|
||||
return 'SMS_104940059';
|
||||
case self::SMSINDEX_LOGIN_EXCEPTION: /// 登录异常验证码(验证码${code},您正尝试异地登录,若非本人操作,请勿泄露。)
|
||||
return 'SMS_104940060';
|
||||
case self::SMSINDEX_LOGIN_CONFIRMATION: /// 登录确认验证码(验证码${code},您正在登录,若非本人操作,请勿泄露。)
|
||||
return 'SMS_104940061';
|
||||
case self::SMSINDEX_SMS_TEST: /// 短信测试(尊敬的${customer},欢迎您使用阿里云通信服务!)
|
||||
return 'SMS_104940062';
|
||||
case self::SMSINDEX_AUTHENTICATION: /// 身份验证验证码(验证码${code},您正在进行身份验证,打死不要告诉别人哦!)
|
||||
return 'SMS_104940063';
|
||||
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
private function GetSmsTemplateParameter($Index, $Parameter)
|
||||
{
|
||||
if (!is_array($Parameter))
|
||||
$Parameter = (array)$Parameter;
|
||||
/*
|
||||
switch ($Index)
|
||||
{
|
||||
case self::SMSINDEX_INFORMATION_CHANGED: /// 信息变更验证码(验证码${code},您正在尝试变更${product}重要信息,请妥善保管账户信息。)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
case self::SMSINDEX_CHANGE_PASSWORD: /// 修改密码验证码(验证码${code},您正在尝试修改${product}登录密码,请妥善保管账户信息。)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
case self::SMSINDEX_ACTIVITY_CONFIRMATION: /// 活动确认验证码(验证码${code},您正在参加${product}的${item}活动,请确认系本人申请。)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}',item:'{$Parameter['item']}'}";
|
||||
case self::SMSINDEX_USER_REGISTRATION: /// 用户注册验证码(验证码${code},您正在注册成为${product}用户,感谢您的支持!)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
case self::SMSINDEX_LOGIN_EXCEPTION: /// 登录异常验证码(验证码${code},您正尝试异地登录${product},若非本人操作,请勿泄露。)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
case self::SMSINDEX_LOGIN_CONFIRMATION: /// 登录确认验证码(验证码${code},您正在登录${product},若非本人操作,请勿泄露。)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
case self::SMSINDEX_SMS_TEST: /// 短信测试(尊敬的${customer},欢迎您使用阿里大鱼短信服务,阿里大鱼将为您提供便捷的通信服务!)
|
||||
return "{customer:'{$Parameter['customer']}'}";
|
||||
case self::SMSINDEX_AUTHENTICATION: /// 身份验证验证码(验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!)
|
||||
return "{code:'{$Parameter['code']}',product:'{$Parameter['product']}'}";
|
||||
default:
|
||||
return 'unknown';
|
||||
}
|
||||
*/
|
||||
return JsonObjectToJsonString($Parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @note 发送短信(淘宝接口)
|
||||
* @param integer $SmsTemplateCodeIndex 模板序号
|
||||
* @param array $SmsTemplateParameter 短信参数
|
||||
* @param string $Telphone 电话号码
|
||||
* @return bool
|
||||
*/
|
||||
private function _SendMessage($SmsTemplateCodeIndex, $SmsTemplateParameter, $Telphone)
|
||||
{
|
||||
$Client = new TopClient(self::SMS_APPKEY, self::SMS_SECRETKEY);
|
||||
|
||||
$SmsRequest = new AlibabaAliqinFcSmsNumSendRequest();
|
||||
$SmsRequest->setExtend('');
|
||||
$SmsRequest->setSmsType('normal');
|
||||
$SmsRequest->setSmsFreeSignName(self::SMS_SIGNNAME);
|
||||
$SmsRequest->setSmsParam($this->GetSmsTemplateParameter($SmsTemplateCodeIndex, $SmsTemplateParameter));
|
||||
$SmsRequest->setRecNum($Telphone);
|
||||
$SmsRequest->setSmsTemplateCode($this->GetSmsTemplateCode($SmsTemplateCodeIndex));
|
||||
$SmsReturn = $Client->execute($SmsRequest)->result;
|
||||
|
||||
if (!empty($SmsReturn->success))
|
||||
{
|
||||
if (strcasecmp($SmsReturn->success, 'true') == 0)
|
||||
return null;
|
||||
elseif (!empty($SmsReturn->msg))
|
||||
return $SmsReturn->msg;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @note 发送短信(大于接口)
|
||||
* @param integer $SmsTemplateCodeIndex 模板序号
|
||||
* @param array $SmsTemplateParameter 短信参数
|
||||
* @param string $Telphone 电话号码
|
||||
* @return bool
|
||||
*/
|
||||
public function _SendSms($SmsTemplateCodeIndex, $SmsTemplateParameter, $Telphone)
|
||||
{
|
||||
$sms = new SmsDemo(self::SMS_ACCESSKEYID, self::SMS_ACCESSKEYSECRET, self::SMS_SIGNNAME);
|
||||
$ret = $sms->SendSms($this->GetSmsTemplateCode($SmsTemplateCodeIndex), $Telphone, $SmsTemplateParameter);
|
||||
|
||||
if (strcasecmp($ret->Code, 'ok') == 0)
|
||||
return null;
|
||||
else
|
||||
return $ret->Message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $Request
|
||||
* @param ReturnParameter $Return
|
||||
* @return bool
|
||||
*/
|
||||
public function Send($Request, &$Return)
|
||||
{
|
||||
$SmsTemplateCodeIndex = $Request->biz_content['index']; /// 模板序号
|
||||
$SmsTemplateParameter = $Request->biz_content['param']; /// 短信参数
|
||||
$Telphone = $Request->biz_content['phone']; /// 电话号码
|
||||
|
||||
//$Result = $this->_SendMessage($SmsTemplateCodeIndex, $SmsTemplateParameter, $Telphone);
|
||||
$Result = $this->_SendSms($SmsTemplateCodeIndex, $SmsTemplateParameter, $Telphone);
|
||||
if (is_null($Result))
|
||||
return true;
|
||||
|
||||
$Return->SetErrors(ERRORCODE_SMSSENDERROR, $Result);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送绑定短信验证码
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* method=sms.sms.sendBindCode&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"00bA05haB0d9ZC0fwGD09Q2OA30insbQ","channelid":"frdt0C1GG0t91P0McFo0rbA1he5yurbS","phone":"18170825201"}
|
||||
*/
|
||||
public function sendBindCode($inParam, $outParam)
|
||||
{
|
||||
//$outParam->seterrors(ERRORCODE_DISABLED, ERRORINFO_DISABLED);
|
||||
//return false;
|
||||
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
/// 参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agent_id = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
$channel_id = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
$sales_id = isset($request_data['salesid']) ? $request_data['salesid'] : ''; /// 代理号
|
||||
$phone = isset($request_data['phone']) ? $request_data['phone'] : ''; /// 手机号
|
||||
$is_bind = isset($request_data['isbind']) ? intval($request_data['isbind']) : 0; /// 是否绑定(0:解绑;1:绑定)
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($is_bind)
|
||||
{
|
||||
case 1: /// 解绑
|
||||
if (empty($sales_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断代理是否存在
|
||||
$salesInfo = $this->PDO_Request(/** @lang text */
|
||||
'select idx, saus_tel, is_send_star from sales_user where saus_agentid=? and saus_channelid=? and saus_salesid=?',
|
||||
$agent_id, $channel_id, $sales_id);
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
if (count($salesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($salesInfo[0]['is_send_star'] != 1 || empty($salesInfo[0]['saus_tel']))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_NOBINDEDTELERROR, ERRORINFO_NOBINDEDTELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$phone = $salesInfo[0]['saus_tel'];
|
||||
|
||||
break;
|
||||
|
||||
case 0: /// 绑定
|
||||
if (empty($phone))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELERROR, ERRORINFO_TELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断手机号码是否正确
|
||||
if (!preg_match('/^1[3456789]{1}\d{9}$/', $phone))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELERROR, ERRORINFO_TELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断代理是否存在
|
||||
$salesInfo = $this->PDO_Request(/** @lang text */
|
||||
'select idx, saus_tel, is_send_star from sales_user where saus_agentid=? and saus_channelid=? and saus_salesid=?',
|
||||
$agent_id, $channel_id, $sales_id);
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
if (count($salesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 该代理已绑定过手机并且手机号为同一个手机号
|
||||
if ($salesInfo[0]['is_send_star'] == 1 && !empty($salesInfo[0]['saus_tel']) && $phone == $salesInfo[0]['saus_tel'])
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_BINDEDTELERROR, ERRORINFO_BINDEDTELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/// 生成随机码
|
||||
$randCode = rand(100000, 999999);
|
||||
/// 发送短信
|
||||
$Result = $this->_SendSms(self::SMSINDEX_AUTHENTICATION, array('code' => $randCode, 'product' => '代理',), $phone);
|
||||
if (!is_null($Result))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SMSSENDERROR, '短信发送太频繁,请稍候再试');
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 记录数据库中
|
||||
$this->PDO_BeginTransaction();
|
||||
try
|
||||
{
|
||||
$ret = $this->PDO_Execute(/** @lang */
|
||||
'update sales_sms_code set status=1 where status=0 and agent_id=? and channnel_id=? and phone=?', $agent_id, $channel_id, $phone);
|
||||
if (!$ret || !$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo(), $this->GetErrorCode());
|
||||
|
||||
$ret = $this->PDO_Execute(/** @lang */
|
||||
'insert into sales_sms_code(agent_id, channnel_id, phone, code, status, is_bind, create_time) values(?, ?, ?, ?, 0, ?, now());',
|
||||
$agent_id, $channel_id, $phone, $randCode, $is_bind);
|
||||
|
||||
if (!$ret || !$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo(), $this->GetErrorCode());
|
||||
|
||||
$outParam->biz_content = array('code'=>$randCode);
|
||||
|
||||
$this->PDO_Commit();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->PDO_Rollback();
|
||||
$outParam->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定手机送星星
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* ?method=sms.sms.bindPhone&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"00bA05haB0d9ZC0fwGD09Q2OA30insbQ","channelid":"frdt0C1GG0t91P0McFo0rbA1he5yurbS","phone":"18170825201","salesid":203066,"msgcode":882940}
|
||||
*/
|
||||
public function bindPhone($inParam, $outParam)
|
||||
{
|
||||
/*$outParam->seterrors(ERRORCODE_DISABLED, ERRORINFO_DISABLED);
|
||||
return false;*/
|
||||
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
/// 参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agent_id = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
$channel_id = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
$sales_id = isset($request_data['salesid']) ? $request_data['salesid'] : '';
|
||||
$msg_code = isset($request_data['msgcode']) ? $request_data['msgcode'] : '';
|
||||
$phone = isset($request_data['phone']) ? $request_data['phone'] : '';
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($sales_id))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (strlen($msg_code) != 6)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_MSGLENGTHERROR, ERRORINFO_MSGLENGTHERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断代理是否存在
|
||||
$command =/** @lang text */<<<EOL
|
||||
select
|
||||
idx, user_id, saus_tel, is_send_star, saus_nickname,
|
||||
saus_avatar, saus_roomcard, saus_bean, player_id, diamond
|
||||
from
|
||||
sales_user
|
||||
where
|
||||
saus_agentid = ? and
|
||||
saus_channelid = ? and
|
||||
saus_salesid = ?
|
||||
EOL;
|
||||
$salesInfo = $this->PDO_Request($command, $agent_id, $channel_id, $sales_id);
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count($salesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$player_id = $salesInfo[0]['player_id'];
|
||||
|
||||
if ($salesInfo[0]['is_send_star'] == 1 && !empty($salesInfo[0]['saus_tel']))
|
||||
{
|
||||
/// 已经绑定了手机,解绑
|
||||
/// 判断短信验证码是否匹配
|
||||
$dbMsgData = $this->PDO_Request(/** @lang text */
|
||||
'select id, code from sales_sms_code where agent_id=? and channnel_id=? and phone=? and status=0',
|
||||
$agent_id, $channel_id, $phone);
|
||||
if (!is_array($dbMsgData) || count($dbMsgData) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_MSGNODATAERROR, ERRORINFO_MSGNODATAERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($dbMsgData[0]['code'] != $msg_code)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELMSGERROR, ERRORINFO_TELMSGERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->PDO_BeginTransaction();
|
||||
try
|
||||
{
|
||||
/// 如果存在账户信息,则需要修改账户信息
|
||||
if (!empty($salesInfo[0]['user_id']))
|
||||
{
|
||||
$this->pdo_execute(/** @lang text */
|
||||
'update ct_user_account set card = card - ?, currency = currency - ?, diamond = diamond - ? where user_id = ? and agent_id = ? and channel_id = ?',
|
||||
$salesInfo[0]['saus_roomcard'], $salesInfo[0]['saus_bean'], $salesInfo[0]['diamond'], $salesInfo[0]['user_id'], $agent_id, $channel_id);
|
||||
if (!$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo(), $this->GetErrorCode());
|
||||
}
|
||||
|
||||
/// 修改代理信息表,把绑定信息置空
|
||||
$ret = $this->PDO_Execute(/** @lang */
|
||||
'update sales_user set saus_tel = null, user_id = null where idx = ?',
|
||||
$salesInfo[0]['idx']);
|
||||
if (!$ret || !$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo(), $this->GetErrorCode());
|
||||
|
||||
/// 修改对应的校验码
|
||||
$ret = $this->PDO_Execute(/** @lang */'update sales_sms_code set status = 1, sales_id = ? where id = ?', $sales_id, $dbMsgData[0]['id']);
|
||||
if (!$ret || !$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo(), $this->GetErrorCode());
|
||||
|
||||
$this->PDO_Commit();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->PDO_Rollback();
|
||||
$outParam->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// 未绑定手机,进行验证码验证和绑定
|
||||
if (empty($phone))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELERROR, ERRORINFO_TELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断手机号码是否正确
|
||||
if (!preg_match('/^1[3456789]{1}\d{9}$/', $phone))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELERROR, ERRORINFO_TELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 判断短信验证码是否匹配
|
||||
$dbMsgData = $this->PDO_Request(/** @lang text */
|
||||
'select id, code from sales_sms_code where agent_id=? and channnel_id=? and phone=? and status=0',
|
||||
$agent_id, $channel_id, $phone);
|
||||
|
||||
if (!is_array($dbMsgData) || count($dbMsgData) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_MSGNODATAERROR, ERRORINFO_MSGNODATAERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($dbMsgData[0]['code'] != $msg_code)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TELMSGERROR, ERRORINFO_TELMSGERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 获取代理绑定手机后赠送的星星数
|
||||
$sendStarData = $this->PDO_Request(/** @lang text */
|
||||
'select idx, send_star_num from agent_channel where agch_agentid=? and agch_channelid=?',
|
||||
$agent_id, $channel_id);
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
$sendStarNum = count($sendStarData) > 0 ? intval($sendStarData[0]['send_star_num']) : 0;
|
||||
|
||||
$this->PDO_BeginTransaction();
|
||||
try
|
||||
{
|
||||
if (empty($salesInfo[0]['user_id']))
|
||||
{
|
||||
/// 判断是否存在该手机号对应的用户信息
|
||||
$user_info = $this->pdo_request(/** @lang text */'select id from ct_user_info where phone = ?', $phone);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
if (empty($user_info))
|
||||
{
|
||||
/// 不存在则新增
|
||||
$this->pdo_execute(/** @lang text */
|
||||
'insert into ct_user_info(name,phone,avatar,create_time) values (?,?,?,unix_timestamp())',
|
||||
$salesInfo[0]['saus_nickname'], $phone, $salesInfo[0]['saus_avatar']);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
$user_id = $this->PDO_LastInsertId();
|
||||
}
|
||||
else
|
||||
$user_id = $user_info[0]['id'];
|
||||
|
||||
/// 判断该用户信息下,该渠道对应是否存在账户信息
|
||||
$user_account = $this->pdo_request(/** @lang text */
|
||||
'select 1 from ct_user_account where user_id = ? and agent_id = ? and channel_id = ?',
|
||||
$user_id, $agent_id, $channel_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
if (empty($user_account)) /// 不存在则新增
|
||||
$this->pdo_execute(/** @lang text */
|
||||
'insert into ct_user_account(user_id, agent_id, channel_id, card, currency, diamond, enabled, create_time) values (?,?,?,?,?,?,1,unix_timestamp())',
|
||||
$user_id, $agent_id, $channel_id, $salesInfo[0]['saus_roomcard'], $salesInfo[0]['saus_bean'], $salesInfo[0]['diamond']);
|
||||
else /// 存在则修改账户余额
|
||||
$this->pdo_execute(/** @lang text */
|
||||
'update ct_user_account set enabled = 1, card = card + ?, currency = currency + ?, diamond = diamond + ? where user_id = ? and agent_id = ? and channel_id = ?',
|
||||
$salesInfo[0]['saus_roomcard'], $salesInfo[0]['saus_bean'], $salesInfo[0]['diamond'], $user_id, $agent_id, $channel_id);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
}
|
||||
else
|
||||
$user_id = $salesInfo[0]['user_id'];
|
||||
|
||||
/// 查询已绑定到该手机的账号余额
|
||||
$ret = $this->pdo_request(/** @lang text */
|
||||
'select sum(saus_roomcard) card, sum(saus_bean) bean from sales_user where saus_agentid = ? and saus_channelid = ? and saus_tel = ?',
|
||||
$agent_id, $channel_id, $phone
|
||||
);
|
||||
if (!$ret || !$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo() . '(' . __LINE__ . ')', $this->geterrorcode());
|
||||
|
||||
$card = intval(@$ret[0]['card']);
|
||||
$bean = floatval(@$ret[0]['bean']);
|
||||
$diamond = intval(@$ret[0]['diamond']);
|
||||
|
||||
/// 解绑以前绑定的账号
|
||||
$command = /** @lang text */'select count(0) c from sales_user where saus_agentid = ? and saus_channelid = ? and saus_tel = ?';
|
||||
$ret = $this->pdo_request($command, $agent_id, $channel_id, $phone);
|
||||
if (!$this->pdo_isdone())
|
||||
throw new Exception($this->geterrorinfo() . '(' . __LINE__ . ')', $this->geterrorcode());
|
||||
if (0 != intval($ret[0]['c'])) {
|
||||
///=====================================================================================================================
|
||||
/// 新增转卡记录
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into sales_transferbill(satr_agentid, channel_id, satr_openid, from_sales, satr_salesid, satr_amount, satr_transfertime)
|
||||
select saus_agentid, saus_channelid, saus_openid, saus_salesid, ?, saus_roomcard, now()
|
||||
from sales_user
|
||||
where saus_agentid = ? and saus_channelid = ? and saus_tel = ? and saus_roomcard > 0
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $sales_id, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 新增转星星记录
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into trans_star_record(agent_id, channel_id, union_id, open_id, send_id, get_id, type, amount, op_time)
|
||||
select saus_agentid, saus_channelid, saus_unionid, saus_openid, saus_salesid, ?, 0, saus_bean, now()
|
||||
from sales_user
|
||||
where saus_agentid = ? and saus_channelid = ? and saus_tel = ? and saus_bean > 0
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $sales_id, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 新增转移钻石的记录
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into trans_diamond_record(agent_id, channel_id, `from`, `to`, amount, oper_time)
|
||||
select saus_agentid, saus_channelid, saus_salesid, ?, diamond, unix_timestamp()
|
||||
from sales_user
|
||||
where saus_agentid = ? and saus_channelid = ? and saus_tel = ? and diamond > 0
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $sales_id, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 记录日志
|
||||
$command = /** @lang text */<<<EOL
|
||||
insert into ct_user_process_log(
|
||||
from_agent, from_channel, from_user, to_agent, to_channel, to_user, oper_type, oper_data, remark, oper_time, is_process)
|
||||
select
|
||||
saus_agentid, saus_channelid, saus_salesid, ?, ?, ?, 112, concat('\{"from":"', ifnull(player_id, 0), '", "to":"{$player_id}"\}'), 'from_xxx为原代理信息,to_xxx为新代理信息, oper_data中from为源玩家编号,to为新玩家编号', unix_timestamp(), 0
|
||||
from
|
||||
sales_user
|
||||
where
|
||||
saus_agentid = ? and saus_channelid = ? and saus_tel = ? and is_send_star=1
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $agent_id, $channel_id, $sales_id, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 迁移原账户的绑定关系
|
||||
$command = /** @lang text */<<<EOL
|
||||
update
|
||||
sales_user
|
||||
set
|
||||
saus_parentid = ?
|
||||
where
|
||||
saus_parentid in
|
||||
(
|
||||
select
|
||||
sales_id
|
||||
from
|
||||
(
|
||||
select
|
||||
saus_salesid sales_id
|
||||
from
|
||||
sales_user
|
||||
where
|
||||
saus_agentid = ? and saus_channelid = ? and saus_tel = ?
|
||||
) t
|
||||
)
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $sales_id, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 清空原来绑定的代理账户并解绑
|
||||
$command = /** @lang text */<<<EOL
|
||||
update
|
||||
player a,
|
||||
sales_user b
|
||||
set
|
||||
a.phone = null
|
||||
where
|
||||
a.play_agentid = b.saus_agentid and
|
||||
a.play_channelid = b.saus_channelid and
|
||||
a.play_playerid = b.player_id and
|
||||
b.saus_agentid = ? and
|
||||
b.saus_channelid = ? and
|
||||
b.saus_tel = ?
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
$command = /** @lang text */'update sales_user set saus_roomcard = 0, saus_bean = 0, saus_tel = null, user_id = null where saus_agentid = ? and saus_channelid = ? and saus_tel = ?';
|
||||
if (!$this->pdo_execute($command, $agent_id, $channel_id, $phone))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
}
|
||||
|
||||
/// 判断是否赠送过星星
|
||||
if ($salesInfo[0]['is_send_star'] == 0)
|
||||
$bean += $sendStarNum;
|
||||
|
||||
/// 绑定手机
|
||||
$command = /** @lang text */<<<EOL
|
||||
update
|
||||
sales_user
|
||||
set
|
||||
saus_tel = ?,
|
||||
is_send_star = 1,
|
||||
saus_roomcard = saus_roomcard + ?,
|
||||
saus_bean = saus_bean + ?,
|
||||
diamond = diamond + ?,
|
||||
user_id = ?,
|
||||
saus_parentid =
|
||||
(
|
||||
select
|
||||
saus_parentid
|
||||
from
|
||||
(
|
||||
select
|
||||
saus_parentid
|
||||
from
|
||||
sales_user
|
||||
where
|
||||
saus_salesid != saus_parentid and saus_agentid = ? and saus_channelid = ? and saus_tel = ?
|
||||
) t
|
||||
limit 1
|
||||
)
|
||||
where
|
||||
idx = ?
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $phone, $card, $bean, $diamond, $user_id, $agent_id, $channel_id, $phone, $salesInfo[0]['idx']))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
/// 修改对应玩家信息
|
||||
$command = /** @lang text */<<<EOL
|
||||
update
|
||||
player a,
|
||||
sales_user b
|
||||
set
|
||||
a.phone = ?
|
||||
where
|
||||
a.play_agentid = b.saus_agentid and
|
||||
a.play_channelid = b.saus_channelid and
|
||||
a.play_playerid = b.player_id and
|
||||
b.idx = ?
|
||||
EOL;
|
||||
if (!$this->pdo_execute($command, $phone, $salesInfo[0]['idx']))
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
///=====================================================================================================================
|
||||
|
||||
/// 修改赠送记录
|
||||
$ret = $this->PDO_Execute(/** @lang text */'update sales_sms_code set status = 1, sales_id = ? where id=?', $sales_id, $dbMsgData[0]['id']);
|
||||
if (!$ret || !$this->PDO_IsDone())
|
||||
throw new Exception($this->GetErrorInfo() . '(' . __LINE__ . ')', $this->GetErrorCode());
|
||||
|
||||
$this->PDO_Commit();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->PDO_Rollback();
|
||||
$outParam->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前渠道下,指定手机绑定的账号列表
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
* ?method=sms.sms.bindPhone&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"00bA05haB0d9ZC0fwGD09Q2OA30insbQ","channelid":"frdt0C1GG0t91P0McFo0rbA1he5yurbS","phone":"18170825201","salesid":203066,"msgcode":882940}
|
||||
*/
|
||||
public function queryphone($request, $return)
|
||||
{
|
||||
$param = $request->biz_content;
|
||||
if (!is_array($param))
|
||||
{
|
||||
/// 参数格式错误
|
||||
$return->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agent_id = @$param['agentid'];
|
||||
$channel_id = @$param['channleid'];
|
||||
$phone = @$param['phone'];
|
||||
|
||||
if (empty($agent_id))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channel_id))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
/// 判断手机号码是否正确
|
||||
if (!preg_match('/^1[3456789]{1}\d{9}$/', $phone))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_TELERROR, ERRORINFO_TELERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmd = $this->NewServantCommand();
|
||||
$ret = $cmd
|
||||
->select('saus_salesid')
|
||||
->from('sales_user')
|
||||
->where(array('saus_agentid' => $agent_id, 'saus_channelid' => $channel_id, 'saus_tel' => $phone, 'is_send_star' => 1, ))
|
||||
->request();
|
||||
if (!$this->pdo_isdone())
|
||||
{
|
||||
$return->seterrors($this->geterrorcode(), $this->geterrorinfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content = array();
|
||||
foreach($ret as $k => $v)
|
||||
{
|
||||
array_push($return->biz_content, $v);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前渠道下,指定手机绑定的账号列表
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
* ?method=sms.sms.bindPhone&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"00bA05haB0d9ZC0fwGD09Q2OA30insbQ","channelid":"frdt0C1GG0t91P0McFo0rbA1he5yurbS","phone":"18170825201","salesid":203066,"msgcode":882940}
|
||||
*/
|
||||
public function send_sms($request, $return)
|
||||
{
|
||||
$param = $request->biz_content;
|
||||
$id = $param['id'];
|
||||
$code = rand(100000, 999999);
|
||||
$return->biz_content = array('id'=>$id, 'code' => $code, );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
882
codes/agent/game/dlweb/api/lib/1.0/statistics.php
Normal file
882
codes/agent/game/dlweb/api/lib/1.0/statistics.php
Normal file
@@ -0,0 +1,882 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: abcdefg
|
||||
* Date: 2017/7/10
|
||||
* Time: 9:29
|
||||
*/
|
||||
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
|
||||
class report extends BaseMethod
|
||||
{
|
||||
/// 全局比例
|
||||
private $global_rate = 1;
|
||||
/// 白名单比例
|
||||
private $whitelist_rate = 1;
|
||||
/// 白名单
|
||||
private $whitelist = array(
|
||||
'00bA05haB0d9ZC0fwGD09Q2OA30insbQfrdt0C1GG0t91P0McFo0rbA1he5yurbS' => array( /// 全国
|
||||
),
|
||||
'z9kh0TRia0hF3C1m4lt5kuSfH02HoBBtjh9H0sp7t0Lapg0hGbz1sAfa44sqA1yA' => array( /// 上饶
|
||||
),
|
||||
'wVcn0icGP0pgGK2hjBh0McJrOq2H92wXmdog06zrG0Grxp0AWNd1ipgtLCcmG0wm' => array( /// 休闲
|
||||
),
|
||||
'cRif0rNjh0Wfhm2q1XE1qJonKxHkndDxDjBx0ishk0Chps0Ypga1bdrfO6W5Nzwi' => array( /// (测试)
|
||||
),
|
||||
'BCmh0jkhw0dBHy2uXia8gkg3Av3gkrvxhpcL0Slbq0fFkj0xfuy1vej6nglPDfU1' => array( /// 武汉
|
||||
),
|
||||
'Cm2K0jK8e0tUl20gywl8iOkeKhSV4lSay2SK0h4df0rfGa0c9D17o589g7vXtw3L' => array( /// 海南
|
||||
),
|
||||
'bjdc0emtp0irtD2cKcA2MBAZxk1AJRiuXgjo0UzHy0keYw0vMrf1kwzZoku9mpUl' => array( /// 168游戏平台
|
||||
),
|
||||
'cjcH0Yrkq0EUfb2NvZu3pm7CG4y5fmo5RGsj0TiHx0Kmju0IUVo1dv6e9j6ZV39y' => array( /// 崇仁聚友棋牌
|
||||
),
|
||||
'veRa0qrBf0df2K1G4de2tgfmVxB2jxpvFtJf073aa0d6rI1xD8J1Y42fINTm0ziK' => array( /// 进贤
|
||||
),
|
||||
'hwky0lx17041Ss1TwnF3kSujL7cTlwbiursc0nZpf0acmj0ZU2m15X4T99GEmOoL' => array( /// 嘻哈
|
||||
),
|
||||
'lNVL0tHmk0Maod2Bz1Q7g11ptboai9URghYu0egkk0rNez0Awdb1u2ne0qa7VmGR' => array( /// 0598游戏
|
||||
),
|
||||
'fGex0vtan0czcx2KQsJ4HtQs997rmxygouEK0BeCc0nvHk0mxdY1HtddNcfo5ifm' => array( /// 有味棋牌
|
||||
),
|
||||
'Fyjd04w1k0hSsZ1y0pl8nbPSbfK8DslquGvv0gxJd0tT3g0d7Of1cso0sL6eVZzM' => array( /// 广东
|
||||
),
|
||||
'vPlg0pjcs0khhr3EtuB0ypFF20bi5Rc7iPuH0wAZf0gFBH0kggh1cmyfjkdv0dbq' => array( /// 陈默友乐大厅
|
||||
),
|
||||
'm57z0hFgA0rNlb1en0f9Xyb37tpHz6Crc4Wn0Qsku0Vlgs0g79y1Z1VHkHlEa9CU' => array( /// 凡凡
|
||||
),
|
||||
'UgUp0mzfs0uney3jira1nujd6mf8z9XtkhEh0nxja0kTad0YfPL1dGeR9dGwOHta' => array( /// 睿龙互动
|
||||
),
|
||||
'VJJb0dhkf0ioRS2jhsh6akhVt91QVkwtrskL0Dvmp0hEOJ0ihLd1Ynz03cGH0x9K' => array( /// 丰城星星剑邑娱乐
|
||||
),
|
||||
'uQgZ0uehf0greK3Ryjz2pEemhp37eddjtyug0dnjH0SLmu0rCuk1rdfGbpCR56c1' => array( /// 袋鼠娱乐
|
||||
),
|
||||
'nMjx0zLil0jouv3EJsq3URziCdu9jtnCnjgu0snwd0kA1h0dsys1yn5xwb72VMj2' => array( /// 萍乡
|
||||
),
|
||||
'ljke0uLyb0Kgdv3hqpt41oyyHfycudo7Qbhf0zTri0gkxF0zVxQ1zs8pX15v53c2' => array( /// 永盛在线游戏
|
||||
),
|
||||
'nkTs0yPsV0jepu2kqFL5LafiuyF8fvoAmGoU0pJNt0hjkD0jdgq1pqThbcd8SEus' => array( /// H5
|
||||
),
|
||||
'GsbU0eMWu0Lttw3fDSc5jd5Iez5L1iuwGGBh0ZsQB0aoop0duZb1YOknit8Em236' => array( /// 友乐东乡翻天
|
||||
),
|
||||
'Gwuq0ljKm0uowP3srkp7dfhBK7b4mmnxFdsA0ltAc0Jgik0ZDcc1HvLwGzhm16D0' => array( /// 广州聚友
|
||||
),
|
||||
'dTdK0QuCR0tcGw3Ucaf6yJg7CPL0lylxxuRv0pPyD0iYyb0nEmW1PmClud27cp5H' => array( /// 慈溪聚友
|
||||
),
|
||||
'nJkC0ppYG0pbfv3XvnJ8g02603ddtwvkcdhz0ysai0yeiw0jdlv1Gb9y3j495fql' => array( /// 花色棋牌
|
||||
),
|
||||
'styc0JLaY0nIeu3xMPn9Uvjus5945pNjPUXY0JmKC0YLUt0ifHt1crgiTkjVCQ9S' => array( /// 永新游戏
|
||||
),
|
||||
'JkMw0wkez0xIRo4bcQv0ukNhzwDsLEk8cRqi0cBey0PnGe0nbMW1RETRvhZ1Y9Bb' => array( /// 古田棋牌
|
||||
),
|
||||
'Brhz0sSkV0umvh4geNS1ngkpvlWxhggfUKpU0zjlF0xpYB0ujov1KQuopCjs04uf' => array( /// 康鹏娱乐
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @param ISQLCommand $command
|
||||
* @param string $mask
|
||||
* @param string $agentid
|
||||
* @param string $channelid
|
||||
* @param string $gameid
|
||||
* @param string $starttime
|
||||
* @param string $endtime
|
||||
* @return string|null
|
||||
*/
|
||||
private function format_command_line($command, $mask, $agentid, $channelid, $gameid, $starttime, $endtime)
|
||||
{
|
||||
if ($command instanceof ISQLCommand)
|
||||
{
|
||||
$mask = str_ireplace('%agentid%', $command->GetIdentifiers($agentid, true), $mask);
|
||||
$mask = str_ireplace('%channelid%', $command->GetIdentifiers($channelid, true), $mask);
|
||||
$mask = str_ireplace('%gameid%', $command->GetIdentifiers($gameid, true), $mask);
|
||||
$mask = str_ireplace('%starttime%', $command->GetIdentifiers($starttime, true), $mask);
|
||||
$mask = str_ireplace('%endtime%', $command->GetIdentifiers($endtime, true), $mask);
|
||||
}
|
||||
|
||||
return $mask;
|
||||
}
|
||||
|
||||
|
||||
private function sum_array($array)
|
||||
{
|
||||
$return = 0;
|
||||
|
||||
if (is_object($array))
|
||||
$array = (array)$array;
|
||||
|
||||
if (is_array($array))
|
||||
{
|
||||
foreach ($array as $item)
|
||||
{
|
||||
if (is_object($item) || is_array($item))
|
||||
$return += $this->sum_array($item);
|
||||
elseif (is_numeric($item))
|
||||
$return += intval($item);
|
||||
else
|
||||
$return += 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
private function extract_array($array)
|
||||
{
|
||||
$return = array();
|
||||
|
||||
if (is_object($array))
|
||||
$array = (array)$array;
|
||||
|
||||
if (is_array($array))
|
||||
{
|
||||
foreach ($array as $item)
|
||||
{
|
||||
if (is_object($item) || is_array($item))
|
||||
array_push($return, $this->extract_array($item));
|
||||
else
|
||||
array_push($return, $item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($return, $array);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @note 获取报表列表
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
// public function querybatch($request, &$return)
|
||||
// {
|
||||
// /// 代理
|
||||
// $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : '';
|
||||
// /// 渠道
|
||||
// $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : '';
|
||||
// /// 游戏
|
||||
// $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : '';
|
||||
// /// 是否需要默认数据(当天、昨天、当月)
|
||||
// $needdata = isset($request->biz_content['needdata']) ? $request->biz_content['needdata'] : 0;
|
||||
//
|
||||
// if (empty($agentid))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid'));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (empty($channelid))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid'));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// $cmd = $this->NewMasterCommand();
|
||||
//
|
||||
// /// 如果不需要数据则返回列表
|
||||
// if (0 == $needdata)
|
||||
// {
|
||||
// $return->biz_content = $cmd
|
||||
// ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption')
|
||||
// ->From('ct_report_info')
|
||||
// ->Where('(ifnull(agentid, \'\') = \'\' and ifnull(channelid, \'\') = \'\') or (agentid = ? and channelid = ?)')
|
||||
// ->BindParameters($agentid, $channelid)
|
||||
// ->Request();
|
||||
//
|
||||
// $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
// return $this->PDO_IsDone();
|
||||
// }
|
||||
//
|
||||
// /// 如果需要数据则需要多查询出脚本
|
||||
// $data = $cmd
|
||||
// ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption', 'commandline')
|
||||
// ->From('ct_report_info')
|
||||
// ->Where('(ifnull(agentid, \'\') = \'\' and ifnull(channelid, \'\') = \'\') or (agentid = ? and channelid = ?)')
|
||||
// ->BindParameters($agentid, $channelid)
|
||||
// ->Request();
|
||||
// if (!$this->PDO_IsDone())
|
||||
// {
|
||||
// $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// foreach ($data as &$item)
|
||||
// {
|
||||
// /// 取当前
|
||||
// $starttime = date('Y-m-d');
|
||||
// $endtime = date('Y-m-d');
|
||||
// $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime);
|
||||
// $item['today'] = $this->sum_array($this->PDO_Request($commandline));
|
||||
//
|
||||
// /// 取昨天
|
||||
// $starttime = date('Y-m-d', strtotime('-1 days'));
|
||||
// $endtime = date('Y-m-d', strtotime('-1 days'));
|
||||
// $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime);
|
||||
// $item['yesterday'] = $this->sum_array($this->PDO_Request($commandline));
|
||||
//
|
||||
// /// 取本月
|
||||
// $starttime = date('Y-m-') . '01';
|
||||
// $endtime = date('Y-m-') . '31';
|
||||
// $commandline = $this->format_command_line($cmd, $item['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime);
|
||||
// $item['currmonth'] = $this->sum_array($this->PDO_Request($commandline));
|
||||
//
|
||||
// if (empty($item['today']))
|
||||
// $item['today'] = 0;
|
||||
// if (empty($item['yesterday']))
|
||||
// $item['yesterday'] = 0;
|
||||
// if (empty($item['currmonth']))
|
||||
// $item['currmonth'] = 0;
|
||||
//
|
||||
// unset($item['commandline']);
|
||||
// }
|
||||
//
|
||||
// $return->biz_content = $data;
|
||||
// $return->SetErrors(ERRORCODE_SUCCESS, ERRORINFO_SUCCESS);
|
||||
// return true;
|
||||
// }
|
||||
public function querybatch($request, &$return)
|
||||
{
|
||||
/// 代理
|
||||
$agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : '';
|
||||
/// 渠道
|
||||
$channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : '';
|
||||
/// 游戏
|
||||
$gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : '';
|
||||
/// 是否需要默认数据(当天、昨天、当月)
|
||||
$needdata = isset($request->biz_content['needdata']) ? $request->biz_content['needdata'] : 0;
|
||||
/// 是否需要显示所有数据
|
||||
$alldata = isset($request->biz_content['alldata']) ? $request->biz_content['alldata'] : 0;
|
||||
/// 代理id
|
||||
$salesid = isset($request->biz_content['salesid']) ? $request->biz_content['salesid'] : 0;
|
||||
|
||||
if (empty($agentid)) {
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channelid)) {
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$group = 0 == intval($alldata) ? ' and ifnull(is_admin, 0) = 0' : '';
|
||||
$base_command = /** @lang text */ <<<EOL
|
||||
select
|
||||
a.agent_id, a.channel_id, a.report_id, a.report_name, a.report_caption, a.summary_type, a.command_line, a.is_mobile
|
||||
from
|
||||
(
|
||||
select
|
||||
b.agent_id agent_id, b.channel_id channel_id, a.report_id, a.report_name, a.report_caption, a.summary_type, a.command_line, a.is_mobile
|
||||
from
|
||||
ct_report_list a, ct_channel_list b
|
||||
where
|
||||
ifnull(a.agent_id, '') = '' and ifnull(a.channel_id, '') = ''{$group} and ifnull(a.is_enabled, 0) != 0
|
||||
) a
|
||||
left join
|
||||
(
|
||||
select
|
||||
agent_id, channel_id, report_id, report_name, report_caption, summary_type, command_line, is_mobile
|
||||
from
|
||||
ct_report_list
|
||||
where
|
||||
ifnull(agent_id, '') != '' and ifnull(channel_id, '') != ''{$group} and ifnull(is_enabled, 0) != 0
|
||||
) b
|
||||
on a.agent_id = b.agent_id and a.channel_id = b.channel_id and a.report_name = b.report_name
|
||||
where
|
||||
b.report_id is null
|
||||
|
||||
union all
|
||||
|
||||
select
|
||||
agent_id, channel_id, report_id, report_name, report_caption, summary_type, command_line, is_mobile
|
||||
from
|
||||
ct_report_list
|
||||
where
|
||||
ifnull(agent_id, '') != '' and ifnull(channel_id, '') != ''{$group} and ifnull(is_enabled, 0) != 0
|
||||
EOL;
|
||||
|
||||
$cmd = $this->NewMasterCommand();
|
||||
|
||||
if (0 == $needdata) {
|
||||
/// 如果不需要数据则返回列表
|
||||
$command_line = /** @lang text */ <<<EOL
|
||||
select
|
||||
agent_id, channel_id, report_id, report_name, report_caption
|
||||
from
|
||||
(
|
||||
{$base_command}
|
||||
) a
|
||||
where
|
||||
a.agent_id = ? and a.channel_id = ? and a.is_mobile != 0
|
||||
|
||||
EOL;
|
||||
|
||||
$return->biz_content = $cmd->request($command_line, $agentid, $channelid);
|
||||
} else {
|
||||
$rate = $this->global_rate * empty($this->whitelist[$agentid . $channelid][$salesid]) ? 1 : $this->whitelist_rate;
|
||||
|
||||
/// 如果需要数据则需要多查询出脚本
|
||||
$command_line = /** @lang text */ <<<EOL
|
||||
select
|
||||
a.agent_id, a.channel_id, b.sales_id, a.report_id, a.report_name, a.report_caption,
|
||||
#cast(sum(case when date_format(b.report_date, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d') then ifnull(b.report_data, 0) else 0 end) * {$rate} as decimal(18, 0)) today,
|
||||
cast(sum(case when date_format(b.report_date, '%Y-%m-%d') = date_format(date_sub(now(), interval 1 day), '%Y-%m-%d') then ifnull(b.report_data, 0) else 0 end) * {$rate} as decimal(18, 0)) yesterday,
|
||||
cast(
|
||||
case a.summary_type
|
||||
when 0 then sum(case when date_format(b.report_date, '%Y-%m') = date_format(now(), '%Y-%m') then ifnull(b.report_data, 0) else 0 end) # 累加
|
||||
when 1 then max(case when date_format(b.report_date, '%Y-%m') = date_format(now(), '%Y-%m') then ifnull(b.report_data, 0) else 0 end) # 最大
|
||||
when 2 then min(case when date_format(b.report_date, '%Y-%m') = date_format(now(), '%Y-%m') then ifnull(b.report_data, 0) else 0 end) # 最小
|
||||
when 3 then avg(case when date_format(b.report_date, '%Y-%m') = date_format(now(), '%Y-%m') then ifnull(b.report_data, 0) else 0 end) # 平均
|
||||
when 4 then (select ifnull(report_data, 0) from ct_report_info t where a.report_id = t.report_id and a.agent_id = t.agent_id and a.channel_id = t.channel_id and date_format(report_date, '%Y-%m') = date_format(now(), '%Y-%m') order by report_date asc limit 1) # 第一个值
|
||||
when 5 then (select ifnull(report_data, 0) from ct_report_info t where a.report_id = t.report_id and a.agent_id = t.agent_id and a.channel_id = t.channel_id and date_format(report_date, '%Y-%m') = date_format(now(), '%Y-%m') order by report_date desc limit 1) # 最后一个值
|
||||
else 0
|
||||
end * {$rate} as decimal(18, 0)) currmonth
|
||||
from
|
||||
(
|
||||
{$base_command}
|
||||
) a
|
||||
left join
|
||||
(
|
||||
select
|
||||
a.agent_id, a.channel_id, a.sales_id, a.report_id, a.report_date, a.report_data
|
||||
from
|
||||
ct_report_info a
|
||||
where
|
||||
ifnull(a.sales_id, 0) in (0, ?)
|
||||
) b on a.report_id = b.report_id and a.agent_id = b.agent_id and a.channel_id = b.channel_id
|
||||
where
|
||||
a.agent_id = ? and a.channel_id = ? and a.is_mobile != 0
|
||||
group by
|
||||
a.agent_id, a.channel_id, b.sales_id, a.report_id, a.report_name, a.report_caption
|
||||
order by
|
||||
a.report_id asc
|
||||
|
||||
EOL;
|
||||
|
||||
$return->biz_content = $cmd->request($command_line, $salesid, $agentid, $channelid);
|
||||
}
|
||||
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return $this->PDO_IsDone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @note 获取报表详情
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
// public function querydetail($request, &$return)
|
||||
// {
|
||||
// /// 代理
|
||||
// $agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : '';
|
||||
// /// 渠道
|
||||
// $channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : '';
|
||||
// /// 游戏
|
||||
// $gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : '';
|
||||
// /// 报表id
|
||||
// $reportid = isset($request->biz_content['reportid']) ? $request->biz_content['reportid'] : '';
|
||||
// /// 起始时间
|
||||
// $starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : '';
|
||||
// /// 终止时间
|
||||
// $endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : '';
|
||||
//
|
||||
//
|
||||
// if (empty($agentid))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid'));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (empty($channelid))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid'));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (empty($reportid))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'reportid'));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// $cmd = $this->NewMasterCommand();
|
||||
// $return->biz_content = $cmd
|
||||
// ->Select('reportid', 'reportname', 'agentid', 'channelid', 'reportcaption', 'commandline')
|
||||
// ->From('ct_report_info')
|
||||
// ->Where(array('reportid' => $reportid,))
|
||||
// ->Request();
|
||||
//
|
||||
// if (!$this->PDO_IsDone())
|
||||
// {
|
||||
// $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (empty($return->biz_content) || empty($return->biz_content[0]))
|
||||
// {
|
||||
// $return->SetErrors(ERRORCODE_NODATAERROR, ERRORINFO_NODATAERROR);
|
||||
// return false;
|
||||
// }
|
||||
// $return->biz_content = $return->biz_content[0];
|
||||
// $commandline = $this->format_command_line($cmd, $return->biz_content['commandline'], $agentid, $channelid, $gameid, $starttime, $endtime);
|
||||
// //$report = array_values((array)$this->PDO_Request(commandline));
|
||||
// $report = $this->PDO_Request($commandline);
|
||||
// while (is_array($report))
|
||||
// {
|
||||
// if (1 == count($report))
|
||||
// $report = current($report);
|
||||
// else
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// unset($return->biz_content['commandline']);
|
||||
// $return->biz_content['data'] = $this->extract_array($report);
|
||||
//
|
||||
// $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
// return $this->PDO_IsDone();
|
||||
// }
|
||||
public function querydetail($request, &$return)
|
||||
{
|
||||
/// 代理
|
||||
$agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : '';
|
||||
/// 渠道
|
||||
$channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : '';
|
||||
/// 游戏
|
||||
$gameid = isset($request->biz_content['gameid']) ? $request->biz_content['gameid'] : '';
|
||||
/// 代理id
|
||||
$salesid = isset($request->biz_content['salesid']) ? $request->biz_content['salesid'] : 0;
|
||||
/// 报表id
|
||||
$reportid = isset($request->biz_content['reportid']) ? $request->biz_content['reportid'] : '';
|
||||
/// 起始时间
|
||||
$starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : '';
|
||||
/// 终止时间
|
||||
$endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : '';
|
||||
|
||||
|
||||
if (empty($agentid)) {
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channelid)) {
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($reportid)) {
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'reportid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$rate = $this->global_rate * empty($this->whitelist[$agentid . $channelid][$salesid]) ? 1 : $this->whitelist_rate;
|
||||
|
||||
$cmd = $this->NewMasterCommand();
|
||||
|
||||
$command_line = /** @lang text */"select report_date, cast(report_data * {$rate} as decimal(18, 0)) report_data from ct_report_info where report_id = ? and agent_id = ? and channel_id = ? and ifnull(sales_id, 0) in (0, ?)";
|
||||
if (empty($starttime) && empty($endtime)) {
|
||||
$command_line .= ' order by report_date desc';
|
||||
$return->biz_content = $cmd->request($command_line, $reportid, $agentid, $channelid, $salesid);
|
||||
} else {
|
||||
$command_line .= ' and (report_date between ? and ?) order by report_date desc';
|
||||
$return->biz_content = $cmd->request($command_line, $reportid, $agentid, $channelid, $salesid, $starttime, $endtime);
|
||||
}
|
||||
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return $this->PDO_IsDone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @note 订单流水
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function querybillbatch($request, &$return)
|
||||
{
|
||||
/// 代理
|
||||
$agentid = isset($request->biz_content['agentid']) ? $request->biz_content['agentid'] : '';
|
||||
/// 渠道
|
||||
$channelid = isset($request->biz_content['channelid']) ? $request->biz_content['channelid'] : '';
|
||||
/// 起始时间
|
||||
$starttime = isset($request->biz_content['starttime']) ? $request->biz_content['starttime'] : '';
|
||||
/// 终止时间
|
||||
$endtime = isset($request->biz_content['endtime']) ? $request->biz_content['endtime'] : '';
|
||||
|
||||
$page_index = isset($request->biz_content['page_index']) ? intval($request->biz_content['page_index']) : 1;
|
||||
$page_size = isset($request->biz_content['page_size']) ? intval($request->biz_content['page_size']) : 50;
|
||||
|
||||
$start = ($page_index - 1) * $page_size ;
|
||||
$stop = $page_size;
|
||||
|
||||
if (empty($agentid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'agentid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($channelid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_PARAMETERNOTFOUND, sprintf(ERRORINFO_PARAMETERNOTFOUND, 'channelid'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// $command = <<<EOL
|
||||
//select
|
||||
// a.sabu_playername, #用户昵称
|
||||
// a.sabu_billcode, #订单号
|
||||
// a.sabu_amount, #房卡数
|
||||
// a.sabu_money, #订单金额
|
||||
// a.sabu_createtime, #下单时间
|
||||
// case ifnull(a.sabu_paystate, 0) when 0 then '未支付' when 1 then '已支付' else '未知' end sabu_paystate, #支付状态
|
||||
// a.sabu_paymoney, #支付金额
|
||||
// a.sabu_paytime, #支付时间
|
||||
// case ifnull(a.sabu_billtype, 0) when 0 then '个人玩家购卡' when 1 then '个人代理购卡' else '未知' end sabu_billtype, #订单类型
|
||||
// b1.agen_name agen_name1, #一级代理名
|
||||
// a.sabu_pushrate1, #一级代理提成比例
|
||||
// a.sabu_pushmoney1, #一级代理提成金额
|
||||
// b2.agen_name agen_name2, #二级代理名
|
||||
// a.sabu_pushrate2, #二级代理提成比例
|
||||
// a.sabu_pushmoney2, #二级代理提成金额
|
||||
// case ifnull(a.sabu_pushstate, 0) when 0 then '未提现' when 1 then '已提现' else '未知' end sabu_pushstate #提现状态
|
||||
//from
|
||||
// sales_buybill a
|
||||
//left join
|
||||
// agent b1
|
||||
//on
|
||||
// a.sabu_pushsalesid1 = b1.idx
|
||||
//left join
|
||||
// agent b2
|
||||
//on
|
||||
// a.sabu_pushsalesid2 = b2.idx
|
||||
//where
|
||||
// sabu_agentid = ? and
|
||||
// sabu_channelid = ? and
|
||||
// sabu_createtime between cast(? as datetime) and cast(? as datetime)
|
||||
//LIMIT ?, ?
|
||||
//EOL;
|
||||
$command = /** @lang text */<<<EOL
|
||||
select
|
||||
nick_name sabu_playername, #用户昵称
|
||||
order_id sabu_billcode, #订单号
|
||||
product_amount sabu_amount, #房卡数
|
||||
product_money sabu_money, #订单金额
|
||||
order_time sabu_createtime, #下单时间
|
||||
case ifnull(pay_status, 0) when 0 then '未支付' when 1 then '已支付' else '未知' end sabu_paystate, #支付状态
|
||||
pay_money sabu_paymoney, #支付金额
|
||||
pay_time sabu_paytime, #支付时间
|
||||
case ifnull(order_type, 0) when 0 then '个人玩家购卡' when 1 then '个人代理购卡' else '未知' end sabu_billtype #订单类型
|
||||
from
|
||||
ct_order_info a
|
||||
where
|
||||
agent_id = ? and
|
||||
channel_id = ? and
|
||||
order_time between unix_timestamp(?) and unix_timestamp(?)
|
||||
limit ?, ?
|
||||
EOL;
|
||||
|
||||
|
||||
$orderList = $this->PDO_Request($command, $agentid, $channelid, $starttime, $endtime, $start, $stop);
|
||||
if(!is_array($orderList))
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
// $dbCount = $this->PDO_Request(
|
||||
// /** @lang text */
|
||||
// '
|
||||
// select
|
||||
// a.sabu_playername
|
||||
// from
|
||||
// sales_buybill a left join
|
||||
// agent b1 on a.sabu_pushsalesid1 = b1.idx left join
|
||||
// agent b2 on a.sabu_pushsalesid2 = b2.idx
|
||||
// where
|
||||
// sabu_agentid = ? and sabu_channelid = ? and sabu_createtime between cast(? as datetime) and cast(? as datetime)',
|
||||
// $agentid, $channelid, $starttime, $endtime);
|
||||
// if(!is_array($dbCount))
|
||||
// {
|
||||
// $return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// $page_count = ceil(count($dbCount) / $page_size);
|
||||
|
||||
$command = /** @lang text */<<<EOL
|
||||
select
|
||||
count(0) c
|
||||
from
|
||||
ct_order_info
|
||||
where
|
||||
agent_id = ? and
|
||||
channel_id = ? and
|
||||
order_time between unix_timestamp(?) and unix_timestamp(?)
|
||||
EOL;
|
||||
$ret = $this->pdo_request($command, $agentid, $channelid, $starttime, $endtime);
|
||||
$page_count = intval(@$ret[0]['c']);
|
||||
|
||||
$return->biz_content = array(
|
||||
'list' => $orderList,
|
||||
'page_index' => $page_index,
|
||||
'page_size' => $page_size,
|
||||
'page_count' => $page_count
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1)今日新增人数,茶水费
|
||||
* 2)昨日新增人数,茶水费
|
||||
* 3)近7日新增人数,茶水费
|
||||
* 4)近30日新增人数,茶水费
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function increasePeople($request, &$return)
|
||||
{
|
||||
$params = $request->biz_content;
|
||||
|
||||
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
|
||||
$channelid = isset($params['channelid']) ? $params['channelid'] : '';
|
||||
$salesid = isset($params['salesid']) ? intval($params['salesid']) : '';
|
||||
$type = isset($params['type']) ? intval($params['type']) : 1;
|
||||
$day = isset($params['day']) ? intval($params['day']) : 0;
|
||||
|
||||
if (empty($agentid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channelid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($salesid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 888 表示总代理查询,否则就是查自己的下级
|
||||
if($type === 888) {
|
||||
$where = '';
|
||||
} else {
|
||||
$where = " and saus_invitecode={$salesid}";
|
||||
}
|
||||
|
||||
// 如果有传具体的天数
|
||||
if($day !== 0) {
|
||||
$sql = <<<EOL
|
||||
SELECT
|
||||
'近{$day}日' AS `NAME`,
|
||||
count(1) AS `VALUE`
|
||||
FROM
|
||||
sales_user
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(saus_firsttime) <= {$day}
|
||||
)
|
||||
AND saus_agentid = '{$agentid}'
|
||||
AND saus_channelid = '{$channelid}'
|
||||
{$where}
|
||||
EOL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = <<<EOL
|
||||
SELECT
|
||||
'今日' AS `NAME`,
|
||||
count(1) AS `VALUE`
|
||||
FROM
|
||||
sales_user
|
||||
WHERE
|
||||
saus_agentid = '{$agentid}'
|
||||
AND saus_channelid = '{$channelid}'
|
||||
AND date_format(saus_firsttime, '%Y-%m-%d') = curdate()
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'昨日' AS `NAME`,
|
||||
count(1) AS `VALUE`
|
||||
FROM
|
||||
sales_user
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(saus_firsttime) = 1
|
||||
)
|
||||
AND saus_agentid = '{$agentid}'
|
||||
AND saus_channelid = '{$channelid}'
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近7日' AS `NAME`,
|
||||
count(1) AS `VALUE`
|
||||
FROM
|
||||
sales_user
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(saus_firsttime) <= 7
|
||||
)
|
||||
AND saus_agentid = '{$agentid}'
|
||||
AND saus_channelid = '{$channelid}'
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近30日' AS `NAME`,
|
||||
count(1) AS `VALUE`
|
||||
FROM
|
||||
sales_user
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(saus_firsttime) <= 30
|
||||
)
|
||||
AND saus_agentid = '{$agentid}'
|
||||
AND saus_channelid = '{$channelid}'
|
||||
{$where}
|
||||
EOL;
|
||||
}
|
||||
|
||||
$res = $this->PDO_Request($sql);
|
||||
if (!$this->PDO_isdone())
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content = $res;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作类型 1:购买房卡;11:购买星星;
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function buy($request, &$return)
|
||||
{
|
||||
$params = $request->biz_content;
|
||||
|
||||
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
|
||||
$channelid = isset($params['channelid']) ? $params['channelid'] : '';
|
||||
$salesid = isset($params['salesid']) ? intval($params['salesid']) : '';
|
||||
$type = isset($params['type']) ? intval($params['type']) : 1;
|
||||
|
||||
if (empty($agentid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($channelid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
if (empty($salesid))
|
||||
{
|
||||
$return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 888 表示总代理查询,否则就是查自己的下级
|
||||
if($type === 888) {
|
||||
$where = '';
|
||||
} else {
|
||||
$where = " and parentid={$salesid}";
|
||||
}
|
||||
|
||||
|
||||
$sql = <<<EOL
|
||||
SELECT
|
||||
'今日' AS `NAME`,
|
||||
ifnull(sum(money), 0) AS `VALUE`
|
||||
FROM
|
||||
ct_user_process_log
|
||||
WHERE
|
||||
to_agent = '{$agentid}'
|
||||
AND to_channel = '{$channelid}'
|
||||
AND oper_type in (1,11)
|
||||
AND date_format(FROM_UNIXTIME(oper_time), '%Y-%m-%d') = curdate()
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'昨日' AS `NAME`,
|
||||
ifnull(sum(money), 0) AS `VALUE`
|
||||
FROM
|
||||
ct_user_process_log
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(FROM_UNIXTIME(oper_time)) = 1
|
||||
)
|
||||
AND to_agent = '{$agentid}'
|
||||
AND to_channel = '{$channelid}'
|
||||
AND oper_type in (1,11)
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近7日' AS `NAME`,
|
||||
ifnull(sum(money), 0) AS `VALUE`
|
||||
FROM
|
||||
ct_user_process_log
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(FROM_UNIXTIME(oper_time)) <= 7
|
||||
)
|
||||
AND to_agent = '{$agentid}'
|
||||
AND to_channel = '{$channelid}'
|
||||
AND oper_type in (1,11)
|
||||
{$where}
|
||||
union
|
||||
|
||||
SELECT
|
||||
'近30日' AS `NAME`,
|
||||
ifnull(sum(money), 0) AS `VALUE`
|
||||
FROM
|
||||
ct_user_process_log
|
||||
WHERE
|
||||
(
|
||||
TO_DAYS(now()) - TO_DAYS(FROM_UNIXTIME(oper_time)) <= 30
|
||||
)
|
||||
AND to_agent = '{$agentid}'
|
||||
AND to_channel = '{$channelid}'
|
||||
AND oper_type in (1,11)
|
||||
{$where}
|
||||
EOL;
|
||||
|
||||
|
||||
$res = $this->PDO_Request($sql);
|
||||
if (!$this->PDO_isdone())
|
||||
{
|
||||
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$return->biz_content = $res;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
531
codes/agent/game/dlweb/api/lib/1.0/test.php
Normal file
531
codes/agent/game/dlweb/api/lib/1.0/test.php
Normal file
@@ -0,0 +1,531 @@
|
||||
<?php
|
||||
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
|
||||
require_once dirname(dirname(__DIR__)) . '/public/public_data.php';
|
||||
|
||||
class test extends BaseMethod
|
||||
{
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function test_1($request, &$return)
|
||||
{
|
||||
//echo ($this->GetMasterDatabase()->Quote(JsonObjectToJsonString($request)));
|
||||
$return->biz_content = ['ok'];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function test_2($request, &$return)
|
||||
{
|
||||
$return->biz_content = $request->biz_content;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
*/
|
||||
public function read_game_config($inParam, $outParam)
|
||||
{
|
||||
//http://localhost/project/daili/api/Index.php?method=test.test.read_game_config&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={%22a%22:%22a%22,%22b%22:%22b%22}
|
||||
$game_config = publicData::getInstance()->getConfig();
|
||||
$game_config = trim($game_config, "\xEF\xBB\xBF");
|
||||
$array_config = json_decode($game_config, true);
|
||||
|
||||
if(!is_array($array_config))
|
||||
{
|
||||
die('配置信息不是json格式');
|
||||
}
|
||||
|
||||
$this->PDO_Execute('
|
||||
truncate table config_agent;
|
||||
truncate table config_game;
|
||||
truncate table config_channel;
|
||||
truncate table config_market;
|
||||
');
|
||||
|
||||
$agent_list = $array_config['agentlist'];
|
||||
foreach($agent_list as $item)
|
||||
{
|
||||
$agent_data = array(
|
||||
isset($item['agentid']) ? $item['agentid'] : '',
|
||||
isset($item['agentname']) ? $item['agentname'] : '',
|
||||
isset($item['html_buyroomcard']) ? $item['html_buyroomcard'] : '',
|
||||
isset($item['html_applysales']) ? $item['html_applysales'] : '',
|
||||
isset($item['agentmode']) ? intval($item['agentmode']) : 0,
|
||||
isset($item['sale_qq']) ? $item['sale_qq'] : '',
|
||||
isset($item['sale_wechat']) ? $item['sale_wechat'] : '',
|
||||
isset($item['sale_tel']) ? $item['sale_tel'] : '',
|
||||
isset($item['relagentid']) ? $item['relagentid'] : '',
|
||||
isset($item['logimage2']) ? $item['logimage2'] : '',
|
||||
isset($item['gamelist'][0]['channellist'][0]['channelid']) ? $item['gamelist'][0]['channellist'][0]['channelid'] : '',
|
||||
);
|
||||
$ret = $this->PDO_Execute('
|
||||
insert into
|
||||
config_agent(agent_id,agent_name,html_buyroomcard,html_applysales,agent_mode,sale_qq,sale_wechat,sale_tel,rel_agent_id, logo, channel_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||
', $agent_data);
|
||||
|
||||
if(!$ret)
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$game_list = $item['gamelist'];
|
||||
foreach($game_list as $one_game)
|
||||
{
|
||||
$game_data = array(
|
||||
isset($item['agentid']) ? $item['agentid'] : '',
|
||||
isset($one_game['gameid']) ? $one_game['gameid'] : '',
|
||||
isset($one_game['gamename']) ? $one_game['gamename'] : '',
|
||||
isset($one_game['game_down_image']) ? $one_game['game_down_image'] : '',
|
||||
isset($one_game['game_down_state']) ? intval($one_game['game_down_state']) : 0,
|
||||
isset($one_game['game_down_memo']) ? $one_game['game_down_memo'] : '',
|
||||
);
|
||||
|
||||
$ret = $this->PDO_Execute('
|
||||
insert into
|
||||
config_game(agent_id,game_id, game_name, game_down_image, game_down_state,game_down_memo)
|
||||
values(?, ?, ?, ?, ?, ?)', $game_data);
|
||||
|
||||
if(!$ret)
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$channelList = $one_game['channellist'];
|
||||
foreach($channelList as $oneChannel)
|
||||
{
|
||||
$marketList = $oneChannel['marketlist'];
|
||||
foreach($marketList as $one_market)
|
||||
{
|
||||
/*$marketData = array(
|
||||
isset($item['agentid']) ? $item['agentid'] : '',
|
||||
isset($one_game['gameid']) ? $one_game['gameid'] : '',
|
||||
isset($oneChannel['channelid']) ? $oneChannel['channelid'] : '',
|
||||
isset($oneChannel['channelname']) ? $oneChannel['channelname'] : '',
|
||||
isset($one_market['marketid']) ? $one_market['marketid'] : '',
|
||||
isset($one_market['marketname']) ? $one_market['marketname'] : '',
|
||||
isset($one_market['app_download']) ? $one_market['app_download'] : '',
|
||||
isset($one_market['app_size']) ? $one_market['app_size'] : '',
|
||||
);*/
|
||||
|
||||
if($oneChannel['ios_defdownload_marketid'] == $one_market['marketid'])
|
||||
{
|
||||
$ios_down = $one_market['app_download'];
|
||||
$ios_app_size = $one_market['app_size'];
|
||||
}
|
||||
|
||||
if($oneChannel['and_defdownload_marketid'] == $one_market['marketid'])
|
||||
{
|
||||
$and_down = $one_market['app_download'];
|
||||
$and_app_size = $one_market['app_size'];
|
||||
}
|
||||
}
|
||||
|
||||
$channelData = array(
|
||||
isset($item['agentid']) ? $item['agentid'] : '',
|
||||
isset($one_game['gameid']) ? $one_game['gameid'] : '',
|
||||
isset($oneChannel['channelid']) ? $oneChannel['channelid'] : '',
|
||||
isset($oneChannel['channelname']) ? $oneChannel['channelname'] : '',
|
||||
isset($ios_down) ? $ios_down : '',
|
||||
isset($oneChannel['ios_defdownload_marketid']) ? $oneChannel['ios_defdownload_marketid'] : '',
|
||||
isset($ios_app_size) ? $ios_app_size : 0,
|
||||
isset($and_down) ? $and_down : '',
|
||||
isset($and_app_size) ? $and_app_size : 0,
|
||||
isset($oneChannel['service_wechat']) ? $oneChannel['service_wechat'] : '',
|
||||
isset($oneChannel['service_qq']) ? $oneChannel['service_qq'] : '',
|
||||
);
|
||||
|
||||
$ret = $this->PDO_Execute('
|
||||
insert into
|
||||
config_channel(agent_id, game_id, channel_id, channel_name, ios_download, ios_market_id, ios_app_size, and_download, and_app_size, wechat, qq)
|
||||
values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
', $channelData);
|
||||
|
||||
if(!$ret)
|
||||
{
|
||||
$outParam->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询个人信息
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* method=test.test.salesInfo&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={}
|
||||
*/
|
||||
public function salesInfo($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$salesInfo = $this->GetHelper()->PDO_Request(/** @lang */'
|
||||
SELECT
|
||||
agent_id, channel_id, open_id, union_id, nick_name, avatar, sex, sales_man, sales_id as salesid, parent_id,
|
||||
room_card as roomcard, bean, credit, power, global_status
|
||||
FROM
|
||||
test_sales_user
|
||||
WHERE
|
||||
id=?;', 1);
|
||||
|
||||
if(!is_array($salesInfo))
|
||||
{
|
||||
$outParam->SetErrors($this->GetHelper()->GetErrorCode(), $this->GetHelper()->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($salesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$outParam->biz_content = $salesInfo[0];
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增房卡、星星或积分
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* method=test.test.addInfo&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"1","channelid":"1","salesid":"100001","roomcard":10,"bean":10,"credit":10}
|
||||
*/
|
||||
public function addInfo($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if (empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$channelID = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
if (empty($channelID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
//操作人id
|
||||
$salesID = isset($request_data['salesid']) ? $request_data['salesid'] : '';
|
||||
if (empty($salesID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$roomCard = isset($request_data['roomcard']) ? intval($request_data['roomcard']) : 0;
|
||||
$bean = isset($request_data['bean']) ? intval($request_data['bean']) : 0;
|
||||
$credit = isset($request_data['credit']) ? intval($request_data['credit']) : 0;
|
||||
|
||||
$createTime = isset($request_data['createtime']) ? $request_data['createtime'] : '';
|
||||
if (empty($createTime))
|
||||
{
|
||||
$createTime = date('Y-m-d H:i:s', time());
|
||||
}
|
||||
else
|
||||
{
|
||||
$addTime = strtotime($createTime);
|
||||
if(!$addTime)
|
||||
{
|
||||
$createTime = date('Y-m-d H:i:s', time());
|
||||
}
|
||||
else
|
||||
{
|
||||
$createTime = date('Y-m-d H:i:s', $addTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$salesInfo = $this->GetHelper()->PDO_Request(/** @lang */'
|
||||
SELECT
|
||||
id, open_id, union_id, nick_name, avatar, sex, sales_man, parent_id,
|
||||
room_card, bean, credit, power, global_status
|
||||
FROM
|
||||
test_sales_user
|
||||
WHERE
|
||||
agent_id=? AND channel_id=? AND sales_id=?;', $agentID, $channelID, $salesID);
|
||||
|
||||
if(!is_array($salesInfo))
|
||||
{
|
||||
$outParam->SetErrors($this->GetHelper()->GetErrorCode(), $this->GetHelper()->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($salesInfo) < 1)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESNOTEXISTERROR, ERRORINFO_SALESNOTEXISTERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->GetHelper()->PDO_BeginTransaction();
|
||||
try
|
||||
{
|
||||
$ret = $this->GetHelper()->PDO_Execute(/** @lang */'
|
||||
INSERT INTO test_sales_order(agent_id, channel_id, sales_id, room_card, bean, credit, create_time)
|
||||
VALUES(?, ?, ?, ?, ?, ?, ?);', $agentID, $channelID, $salesID, $roomCard, $bean, $credit, $createTime);
|
||||
|
||||
if (!$ret || !$this->GetHelper()->PDO_IsDone())
|
||||
{
|
||||
throw new Exception($this->GetHelper()->GetErrorInfo(), $this->GetHelper()->GetErrorCode());
|
||||
}
|
||||
|
||||
$ret = $this->GetHelper()->PDO_Execute(/** @lang */'
|
||||
UPDATE
|
||||
test_sales_user
|
||||
SET
|
||||
room_card=room_card+?, bean=bean+?, credit=credit+?
|
||||
WHERE
|
||||
id=?;', $roomCard, $bean, $credit, $salesInfo[0]['id']);
|
||||
|
||||
if (!$ret || !$this->GetHelper()->PDO_IsDone())
|
||||
{
|
||||
throw new Exception($this->GetHelper()->GetErrorInfo(), $this->GetHelper()->GetErrorCode());
|
||||
}
|
||||
$this->GetHelper()->PDO_Commit();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->GetHelper()->PDO_Rollback();
|
||||
$outParam->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询添加房卡星星记录
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* method=test.test.addRecord&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"1","channelid":"1","salesid":"100001","begintime":"2017-09-09","endtime":"2017-09-29","page_index":1}
|
||||
*/
|
||||
public function addRecord($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if (empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$channelID = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
if (empty($channelID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
//操作人id
|
||||
$salesID = isset($request_data['salesid']) ? $request_data['salesid'] : '';
|
||||
if (empty($salesID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$page_count=1;
|
||||
$str_time = '';
|
||||
|
||||
$beginTime = isset($request_data['begintime']) ? $request_data['begintime'] : '';
|
||||
$endTime = isset($request_data['endtime']) ? $request_data['endtime'] : '';
|
||||
|
||||
$page_index = empty($request_data['page_index']) ? 1 : intval($request_data['page_index']);
|
||||
$page_size = empty($request_data['page_size']) ? 10 : intval($request_data['page_size']);
|
||||
|
||||
$start = ($page_index - 1) * $page_size;
|
||||
|
||||
$strPage = '';
|
||||
if (!empty($request_data['page_index']))
|
||||
{
|
||||
$strPage .= " LIMIT {$start},{$page_size} ";
|
||||
}
|
||||
|
||||
$array_param = array($agentID, $channelID, $salesID);
|
||||
if (!empty($beginTime))
|
||||
{
|
||||
$str_time .= ' and create_time >= ? ';
|
||||
$array_param[] = $beginTime;
|
||||
}
|
||||
|
||||
if (!empty($endTime))
|
||||
{
|
||||
$str_time .= ' and create_time <= ? ';
|
||||
$array_param[] = $endTime;
|
||||
}
|
||||
|
||||
if (!empty($beginTime) && !empty($endTime) && $beginTime > $endTime)
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_TIMEERROR, ERRORINFO_TIMEERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$recordList = $this->GetHelper()->PDO_Request(/** @lang */"
|
||||
SELECT
|
||||
id, sales_id, room_card, bean, credit, create_time
|
||||
FROM
|
||||
test_sales_order
|
||||
WHERE
|
||||
status=0 AND agent_id=? AND channel_id=? AND sales_id=? {$str_time}
|
||||
ORDER BY id DESC {$strPage};", $array_param);
|
||||
|
||||
if (!is_array($recordList))
|
||||
{
|
||||
$outParam->SetErrors($this->GetHelper()->GetErrorCode(), $this->GetHelper()->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($request_data['page_index']))
|
||||
{
|
||||
$dbCount = $this->GetHelper()->PDO_Request(/** @lang */"
|
||||
SELECT
|
||||
count(1) num
|
||||
FROM
|
||||
test_sales_order
|
||||
WHERE
|
||||
status=0 AND agent_id=? AND channel_id=? AND sales_id=? {$str_time}", $array_param);
|
||||
|
||||
if (!is_array($dbCount) || count($dbCount) < 1)
|
||||
{
|
||||
$outParam->SetErrors($this->GetHelper()->GetErrorCode(), $this->GetHelper()->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
$page_count = intval($dbCount[0]['num']) / $page_size + 1;
|
||||
}
|
||||
|
||||
|
||||
$outParam->biz_content = array(
|
||||
'record' => $recordList,
|
||||
'page_index' => $page_index,
|
||||
'page_size' => $page_size,
|
||||
'page_count' => intval($page_count),
|
||||
);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除添加房卡星星记录
|
||||
* 被请求方法示例:参数固定为RequestParameter和ReturnParameter对象,返回值固定为true(成功)和false(失败)
|
||||
* @param RequestParameter $inParam
|
||||
* @param ReturnParameter $outParam
|
||||
* @return bool
|
||||
* method=test.test.deleteRecord&format=json&charset=utf-8×tamp=1&version=1.0&biz_content={"agentid":"1","channelid":"1","salesid":"100001","recordid":"3"}
|
||||
*/
|
||||
public function deleteRecord($inParam, $outParam)
|
||||
{
|
||||
$request_data = isset($inParam->biz_content) ? $inParam->biz_content : '';
|
||||
if (!is_array($request_data))
|
||||
{
|
||||
//参数格式错误
|
||||
$outParam->SetErrors(ERRORCODE_INPARAMERROR, ERRORINFO_INPARAMERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$agentID = isset($request_data['agentid']) ? $request_data['agentid'] : '';
|
||||
if (empty($agentID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$channelID = isset($request_data['channelid']) ? $request_data['channelid'] : '';
|
||||
if (empty($channelID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
//操作人id
|
||||
$salesID = isset($request_data['salesid']) ? $request_data['salesid'] : '';
|
||||
if (empty($salesID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
//要删除的记录id
|
||||
$recordID = isset($request_data['recordid']) ? $request_data['recordid'] : '';
|
||||
if (empty($recordID))
|
||||
{
|
||||
$outParam->SetErrors(ERRORCODE_ORDERIDERROR, ERRORINFO_ORDERIDERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->GetHelper()->PDO_Execute(/** @lang */'
|
||||
UPDATE
|
||||
test_sales_order
|
||||
SET
|
||||
status=1
|
||||
WHERE
|
||||
id=? AND sales_id=?;', $recordID, $salesID);
|
||||
|
||||
if (!$this->GetHelper()->PDO_IsDone())
|
||||
{
|
||||
$outParam->SetErrors($this->GetHelper()->GetErrorCode(), $this->GetHelper()->GetErrorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
184
codes/agent/game/dlweb/api/lib/1.0/youle.php
Normal file
184
codes/agent/game/dlweb/api/lib/1.0/youle.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'BaseMethodHelper.php';
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'Tangjian.php';
|
||||
|
||||
class Youle extends Tangjian
|
||||
{
|
||||
/**
|
||||
* 记录web页面发来的错误信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function webLog($request, &$return)
|
||||
{
|
||||
$this->log($request->biz_content, 'webLog');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 渠道列表
|
||||
* @param RequestParameter $request
|
||||
* @param ReturnParameter $return
|
||||
* @return bool
|
||||
*/
|
||||
public function channelList($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getChannelList($params);
|
||||
|
||||
if ( !$result) throw new Exception('没有该渠道', 2001);
|
||||
|
||||
$return->biz_content = ['list' => $result];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道配置信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function channelConfig($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getChannelConfig($params);
|
||||
|
||||
if ( !$result) throw new Exception('没有该渠道', 2002);
|
||||
|
||||
//$Config = new \models\Config();
|
||||
|
||||
//$return->biz_content = array_merge($result, $Config->agentConfig($result['id']));
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键id获取渠道信息
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function channelConfigById($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'id/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getChannelConfigById($params['id']);
|
||||
|
||||
if ( !$result) throw new Exception('没有该渠道', 2002);
|
||||
|
||||
$return->biz_content = $result;
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏下载列表
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function gameList($request, &$return)
|
||||
{
|
||||
try {
|
||||
$params = $this->checkParams($request, array(
|
||||
'channelid/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getGameList($params);
|
||||
|
||||
$return->biz_content = ['list' => $result];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 产品列表
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function productList($request, &$return)
|
||||
{
|
||||
try {
|
||||
// type: 0-玩家 1-代理 ptype: 0-房卡 1-星星
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'type/0', 'ptype/0'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getProductList($params);
|
||||
|
||||
$return->biz_content = ['products' => $result];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 可用钻石兑换的产品列表
|
||||
* @param $request
|
||||
* @param $return
|
||||
* @return bool
|
||||
*/
|
||||
public function transformProductList($request, &$return)
|
||||
{
|
||||
try {
|
||||
// type: 0-玩家 1-代理 ptype: 0-房卡 1-星星
|
||||
$params = $this->checkParams($request, array(
|
||||
'agentid/R', 'channelid/R'
|
||||
));
|
||||
|
||||
$Agent = new \models\Agent();
|
||||
$result = $Agent->getTransformProductList($params);
|
||||
|
||||
$return->biz_content = ['products' => $result];
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$return->SetErrors($e->getCode(), $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user