123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- /**
- * Channel.php UTF-8
- * Channel信息
- *
- * @date : 2018/1/19 15:27
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\controller\request;
- use ads\Agent;
- use huo\logic\agent\AgentGameLogic;
- class Channel {
- private $ch = ''; /* 渠道编号 */
- private $sub_ch = ''; /* 子渠道编号 */
- private $agent_id = 0;
- private $agent_game = '';
- public function __construct($data = []) {
- if (!empty($data)) {
- $this->setData($data);
- }
- }
- /**
- * 设置数据
- *
- * @param array $data
- */
- public function setData($data = []) {
- if (empty($data)) {
- return;
- }
- $this->setAgentId(get_val($data, 'ch'));
- /*解析传入的agent_game*/
- $_agent_game = get_val($data, 'sub_ch');
- $_agent_game_id = (new Agent())->getIdByCode($_agent_game); //解析成功返回agent_game_id 解析不成功返回0
- if (!empty($_agent_game_id)) { //成功获取agent_game
- $_agent_game = (new AgentGameLogic())->getAgentGameById($_agent_game_id);
- }
- $this->setAgentGame($_agent_game);
- }
- /**
- * @return string
- */
- public function getCh() {
- return $this->ch;
- }
- /**
- * @param string $ch
- */
- public function setCh($ch) {
- $this->ch = $ch;
- }
- /**
- * @return string
- */
- public function getSubCh() {
- return $this->sub_ch;
- }
- /**
- * @param string $sub_ch
- */
- public function setSubCh($sub_ch) {
- $this->sub_ch = $sub_ch;
- }
- /**
- * @return int
- */
- public function getAgentId() {
- return $this->agent_id;
- }
- /**
- * @param int $agent_id
- */
- public function setAgentId($agent_id) {
- $this->agent_id = $agent_id;
- }
- /**
- * @return string
- */
- public function getAgentGame() {
- return $this->agent_game;
- }
- /**
- * @param string $agent_game
- */
- public function setAgentGame($agent_game) {
- $this->agent_game = $agent_game;
- }
- public function toArray() {
- // TODO: wuyonghong 2018/4/24 添加Array
- return [];
- }
- }
|