* @version : HUOSDK 8.0 */ namespace huo\controller\request; use huolib\constant\GameConst; class Device { private $device_id = ''; /* 设备唯一号 安卓为ime */ private $mac = ''; /* 设备的mac 苹果为idfv */ private $ip = ''; /* 设备网络IP地址 */ private $brand = ''; /* 设备的品牌 */ private $model = ''; /* 机型 */ private $os = ''; /* 设备的平台(android、 */ private $os_version = ''; /* 操作系统版本 */ private $screen = ''; /* 分辨率 */ private $net = ''; /* 设备的联网方式 3G,4G */ private $imsi = ''; /* 设备的imsi */ private $longitude = ''; /* 经度 */ private $latitude = ''; /* 纬度 */ private $userua = ''; /* 用户代理 */ private $open_cnt = 0; /* 用户打开应用次数 */ private $from = GameConst::GAME_ANDROID; /* 打开应用来源 3 ANDROID、4 IOS、5 H5 */ private $from_device = ''; private $device_type = ''; public function __construct($data = []) { if (!empty($data)) { $this->setData($data); } } /** * 设置数据 * * @param array $data */ public function setData($data = []) { if (empty($data)) { return; } $this->setDeviceId(get_val($data, 'device_id')); $this->setMac(get_val($data, 'mac')); $this->setIp(get_val($data, 'ip')); $this->setBrand(get_val($data, 'brand')); $this->setModel(get_val($data, 'model')); $this->setOs(get_val($data, 'os')); $this->setOsVersion(get_val($data, 'os_version')); $this->setScreen(get_val($data, 'screen')); $this->setNet(get_val($data, 'net')); $this->setImsi(get_val($data, 'imsi')); $this->setLongitude(get_val($data, 'longitude')); $this->setLatitude(get_val($data, 'latitude')); $this->setUserua(get_val($data, 'userua')); } /** * @return string */ public function getDeviceId() { return $this->device_id; } /** * @param string $device_id */ public function setDeviceId($device_id) { $this->device_id = $device_id; } /** * 苹果为idfv * * @return string */ public function getMac() { return $this->mac; } /** * @param string $mac */ public function setMac($mac) { $this->mac = $mac; } /** * @return string */ public function getIp() { return $this->ip; } /** * @param string $ip */ public function setIp($ip) { $this->ip = $ip; } /** * @return string */ public function getBrand() { return $this->brand; } /** * @param string $brand */ public function setBrand($brand) { $this->brand = $brand; } /** * @return string */ public function getModel() { return $this->model; } /** * @param string $model */ public function setModel($model) { $this->model = $model; } /** * @return string */ public function getOs() { return $this->os; } /** * @param string $os */ public function setOs($os) { $this->os = $os; } /** * @return string */ public function getOsVersion() { return $this->os_version; } /** * @param string $os_version */ public function setOsVersion($os_version) { $this->os_version = $os_version; } /** * @return string */ public function getScreen() { return $this->screen; } /** * @param string $screen */ public function setScreen($screen) { $this->screen = $screen; } /** * @return string */ public function getNet() { return $this->net; } /** * @param string $net */ public function setNet($net) { $this->net = $net; } /** * @return string */ public function getImsi() { return $this->imsi; } /** * @param string $imsi */ public function setImsi($imsi) { $this->imsi = $imsi; } /** * @return string */ public function getLongitude() { return $this->longitude; } /** * @param string $longitude */ public function setLongitude($longitude) { $this->longitude = $longitude; } /** * @return string */ public function getLatitude() { return $this->latitude; } /** * @param string $latitude */ public function setLatitude($latitude) { $this->latitude = $latitude; } /** * @return string */ public function getUserua() { return $this->userua; } /** * @param string $userua */ public function setUserua($userua) { $this->userua = $userua; } /** * @return int */ public function getOpenCnt() { return $this->open_cnt; } /** * @param int $open_cnt */ public function setOpenCnt($open_cnt) { $this->open_cnt = $open_cnt; } /** * @return int */ public function getFrom() { return $this->from; } /** * @param int $from */ public function setFrom($from) { $this->from = $from; } /** * @return string */ public function getFromDevice() { return $this->from_device; } /** * @param string $from_device */ public function setFromDevice($from_device) { $this->from_device = $from_device; } public function toArray() { $_data = [ 'device_id' => $this->getDeviceId(), 'mac' => $this->getMac(), 'ip' => $this->getIp(), 'brand' => $this->getBrand(), 'model' => $this->getModel(), 'os' => $this->getOs(), 'os_version' => $this->getOsVersion(), 'screen' => $this->getScreen(), 'net' => $this->getNet(), 'imsi' => $this->getImsi(), 'longitude' => $this->getLongitude(), 'latitude' => $this->getLatitude(), 'userua' => $this->getUserua(), 'open_cnt' => $this->getOpenCnt(), 'from' => $this->getFrom(), 'from_device' => $this->getFromDevice(), ]; return $_data; } /** * @return string */ public function getDeviceType() { return $this->device_type; } /** * @param string $device_type */ public function setDeviceType($device_type) { $this->device_type = $device_type; } }