コード例 #1
0
        /// <summary>
        ///     私有 获取 游戏信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <GetGameInfoResponse> _GetGameInfoResponseAsync(GetGameInfoRequest request)
        {
            var dbResult = await DalActivity.GetActivityByTypeId(GameVersion);

            return(new GetGameInfoResponse
            {
                ActivityName = dbResult.ActivityName,
                StartTime = dbResult.StartTime,
                EndTime = dbResult.EndTime,
                GameRuleText = dbResult.GameRuleText,
                SupportRuleText = dbResult.SupportRuleText
            });
        }
コード例 #2
0
        /// <summary>
        ///     更新游戏信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <UpdateGameInfoResponse> UpdateGameInfoAsync(UpdateGameInfoRequest request)
        {
            try
            {
                var dbResult = await DalActivity.GetActivityByTypeId(GameVersion);

                using (var dbHelper = DbHelper.CreateDbHelper())
                {
                    dbResult.StartTime = request.StartTime;
                    dbResult.EndTime   = request.EndTime;
                    await DalActivity.UpdateActivtyAsync(dbHelper, dbResult);
                }

                return(new UpdateGameInfoResponse());
            }
            catch (Exception e)
            {
                Logger.Error(
                    $"{ManagerName} -> UpdateGameInfoAsync -> {JsonConvert.SerializeObject(request)} ",
                    e.InnerException ?? e);
                throw;
            }
        }