<?php
namespace DAO;
/**
 * User: liuyuzhen
 * Date: 2018/5/22
 * Time: 14:48
 * Description:
 */
class MemberDeviceInfoModel extends \DAO\AbstractModel{

    /**
     * 表名
     *
     * @var string
     */
    protected $_tableName = 'han_member_device_info';

    /**
     * 主键
     *
     * @var string
     */
    protected $_primaryKey = 'id';

    public function init(){
    }


    public function add($data){
        $this->setDb(\Our\DbNameConst::masterDBConnectName);
        $this->db->insert($this->_tableName)->rows($data);
        $res = $this->db->execute();
        return $res;
    }

    /**
     * 类实例
     */
    private static $_instance = null;

    /**
     * 获取类实例
     *
     */
    public static function getInstance($dbName=\Our\DbNameConst::salveDBConnectName) {
        if (!(self::$_instance instanceof self)) {
            self::$_instance = new self($dbName);
        }

        return self::$_instance;
    }

    public function del($where){
        $this->setDb(\Our\DbNameConst::masterDBConnectName);
        $result  = $this->db->delete($this->_tableName)->where($where)->execute();
        return $result;
    }
}