Files
youlegames/codes/agent/game/dlweb/api/lib/1.0/youle.php
2026-03-15 01:27:05 +08:00

184 lines
4.4 KiB
PHP

<?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;
}
}
}