| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 | <?php/** * Device.php UTF-8 * device信息 * * @date    : 2018/1/19 15:30 * * @license 这不是一个自由软件,未经授权不许任何使用和传播。 * @author  : wuyonghong <wyh@huosdk.com> * @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;    }}
 |