77 lines
2.6 KiB
PHP
77 lines
2.6 KiB
PHP
<?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;
|
||
}
|
||
}
|
||
} |