285 lines
9.3 KiB
PHP
285 lines
9.3 KiB
PHP
<?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;
|
||
}
|
||
|
||
} |