%% ---------------------------------------------------------------------------
%% @doc 合服公共函数

%% @author ming_up@foxmail.com
%% @since  2015-05-19
%% @deprecated lib_merge_server
%% ---------------------------------------------------------------------------
-module(lib_merge_server).
-compile(export_all).

-include("server_env.hrl").
-include("server_env.hrl").

%% PHP接口：合服完毕的时候执行的,必须在游戏线执行
set_time(UnixTime) ->
    Sql = io_lib:format(?SERVER_ENV_REPLACE, [UnixTime, ?SERVER_ENV_MERGETIME]),
    db:execute(Sql),
    ets:update_element(?SERVER_ENV, merge_time, {#server_env.value, UnixTime}),
    true.

%% 获取合服时间表
get_time() ->
    case ets:lookup(?SERVER_ENV, merge_time) of
        []  -> 0;
        [S] -> S#server_env.value
    end.
