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