示例#1
0
    public VipState GetVipState(uint level)
    {
        VipState state = null;

        vipStates.TryGetValue(level, out state);
        return(state);
    }
示例#2
0
    static int GetVipState(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        VipPrivilegeConfig obj = (VipPrivilegeConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "VipPrivilegeConfig");
        uint     arg0          = (uint)LuaScriptMgr.GetNumber(L, 2);
        VipState o             = obj.GetVipState(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
示例#3
0
    void ReadVipPrivilegeState()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name3);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name3);
            return;
        }


//      public class VipPrivilegeState
// {
//  public uint level;
//  public List<string> states = new List<string>();
// }

        vipStates.Clear();

        XmlDocument xmlDoc   = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_VIPPRIVILEGE_STATE, text);
        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes;

        foreach (XmlElement xe in nodelist)
        {
            XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN);
            if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH)
            {
                continue;
            }
            VipState state = new VipState();
            uint     level = 0;
            foreach (XmlElement xel in xe)
            {
                if (xel.Name == "VipLv")
                {
                    uint.TryParse(xel.InnerText, out level);
                    state.level = level;
                }
                else if (xel.Name.Contains("privilegestate"))
                {
                    state.states.Add(xel.InnerText);
                }
            }
            Debug.Log("level=" + level);
            vipStates.Add(level, state);
        }
    }
示例#4
0
    static int _CreateVipState(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            VipState obj = new VipState();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: VipState.New");
        }

        return(0);
    }
示例#5
0
    static int get_states(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        VipState obj = (VipState)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name states");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index states on a nil value");
            }
        }

        LuaScriptMgr.PushObject(L, obj.states);
        return(1);
    }
示例#6
0
    static int set_states(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        VipState obj = (VipState)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name states");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index states on a nil value");
            }
        }

        obj.states = (List <string>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <string>));
        return(0);
    }
示例#7
0
    static int set_level(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        VipState obj = (VipState)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name level");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index level on a nil value");
            }
        }

        obj.level = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
示例#8
0
        /// <summary>
        /// Updates user vip bank info
        /// </summary>
        /// <param name="vipInfoId"></param>
        /// <param name="orderId"></param>
        /// <param name="identifyImg"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="duration"></param>
        /// <param name="amount"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool UpdateUserVipInfo(int vipInfoId, string orderId, string identifyImg,
            DateTime? startTime, DateTime? endTime, int? duration, decimal? amount, VipState? state)
        {
            var conn = DBHelper.GetSqlConnection();
            bool result = false;

            try
            {
                conn.Open();
                UserVip vipInfo = new UserVip
                {
                    Id = vipInfoId,
                    OrderId = orderId,
                    IdentifyImg = identifyImg,
                    StartTime = startTime,
                    EndTime = endTime,
                    Duration = duration,
                    Amount = amount,
                    State = (int)state,
                    LastUpdatedTime = DateTime.Now
                };

                result = userDao.UpdateUserVipInfo(conn, vipInfo);
            }
            catch (Exception e)
            {
                LogService.Log("更新用户VIP信息失败--" + e.Message, e.ToString());
            }
            finally
            {
                conn.Close();
            }

            return result;
        }