belongsTo('Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); } public static function increase($id = null, $key = null, $field = null) { if ($id) { return self::where("id", $id) ->where("starttime", "<=", time()) ->where("endtime", ">=", time()) ->setInc($field); } if ($key) { return self::where("key", $key) ->where("starttime", "<=", time()) ->where("endtime", ">=", time()) ->setInc($field); } return false; } public static function getChannel($id = null, $key = null) { if ($id) { return self::where("id", $id) ->where("starttime", "<=", time()) ->where("endtime", ">=", time()) ->find(); } if ($key) { return self::where("key", $key) ->where("starttime", "<=", time()) ->where("endtime", ">=", time()) ->find(); } return null; } }