* @version : HUOSDK 8.0 */ namespace huolib\queue\request; class Device extends Request { private $device_id = ''; /* 设备唯一号 安卓为ime */ private $mac = ''; /* 设备的mac */ 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 = ''; /* 用户代理 */ 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 array */ 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(), ]; return $_data; } /** * 校验参数合法性 */ public function check() { // TODO: wuyonghong 2018/5/30 校验设备参数合法性 return true; } /** * @return string */ public function getDeviceId() { return $this->device_id; } /** * @param string $device_id */ public function setDeviceId($device_id) { $this->device_id = $device_id; } /** * @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; } }