123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <?php
- namespace huo\controller\request;
- use huolib\constant\GameConst;
- class Device {
- private $device_id = '';
- private $mac = '';
- private $ip = '';
- private $brand = '';
- private $model = '';
- private $os = '';
- private $os_version = '';
- private $screen = '';
- private $net = '';
- private $imsi = '';
- private $longitude = '';
- private $latitude = '';
- private $userua = '';
- private $open_cnt = 0;
- private $from = GameConst::GAME_ANDROID;
- private $from_device = '';
- private $device_type = '';
- public function __construct($data = []) {
- if (!empty($data)) {
- $this->setData($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'));
- }
-
- public function getDeviceId() {
- return $this->device_id;
- }
-
- public function setDeviceId($device_id) {
- $this->device_id = $device_id;
- }
-
- public function getMac() {
- return $this->mac;
- }
-
- public function setMac($mac) {
- $this->mac = $mac;
- }
-
- public function getIp() {
- return $this->ip;
- }
-
- public function setIp($ip) {
- $this->ip = $ip;
- }
-
- public function getBrand() {
- return $this->brand;
- }
-
- public function setBrand($brand) {
- $this->brand = $brand;
- }
-
- public function getModel() {
- return $this->model;
- }
-
- public function setModel($model) {
- $this->model = $model;
- }
-
- public function getOs() {
- return $this->os;
- }
-
- public function setOs($os) {
- $this->os = $os;
- }
-
- public function getOsVersion() {
- return $this->os_version;
- }
-
- public function setOsVersion($os_version) {
- $this->os_version = $os_version;
- }
-
- public function getScreen() {
- return $this->screen;
- }
-
- public function setScreen($screen) {
- $this->screen = $screen;
- }
-
- public function getNet() {
- return $this->net;
- }
-
- public function setNet($net) {
- $this->net = $net;
- }
-
- public function getImsi() {
- return $this->imsi;
- }
-
- public function setImsi($imsi) {
- $this->imsi = $imsi;
- }
-
- public function getLongitude() {
- return $this->longitude;
- }
-
- public function setLongitude($longitude) {
- $this->longitude = $longitude;
- }
-
- public function getLatitude() {
- return $this->latitude;
- }
-
- public function setLatitude($latitude) {
- $this->latitude = $latitude;
- }
-
- public function getUserua() {
- return $this->userua;
- }
-
- public function setUserua($userua) {
- $this->userua = $userua;
- }
-
- public function getOpenCnt() {
- return $this->open_cnt;
- }
-
- public function setOpenCnt($open_cnt) {
- $this->open_cnt = $open_cnt;
- }
-
- public function getFrom() {
- return $this->from;
- }
-
- public function setFrom($from) {
- $this->from = $from;
- }
-
- public function getFromDevice() {
- return $this->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;
- }
-
- public function getDeviceType() {
- return $this->device_type;
- }
-
- public function setDeviceType($device_type) {
- $this->device_type = $device_type;
- }
- }
|