Ejemplo n.º 1
0
        /// <summary>
        /// 获取日志集和主题id,保存备用
        /// </summary>
        /// <param name="logsetName"></param>
        /// <returns></returns>
        private async Task SetLogsetId(string logsetName)
        {
            var logsets = await LogSet.GetListAsync();

            var logset = logsets.FirstOrDefault(ls => ls.logset_name == logsetName);

            if (logset == null)
            {
                logsetid = await LogSet.CreateAsync(new LogSet(logsetName, _settings.Period));

                logset = LogSet.GetAsync(logsetid).Result;
            }
            else
            {
                logsetid = logset.logset_id;
            }
            //查找日志主题
            var logTopics = await LogTopic.GetListAsync(logsetid);

            var logtopic = logTopics.FirstOrDefault(lt => lt.topic_name == _settings.LogTopicName);

            if (logtopic == null)
            {
                logTopicid = await LogTopic.CreateAsync(new LogTopic(logsetid, _settings.LogTopicName));
            }
            else
            {
                logTopicid = logtopic.topic_id;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 创建日志主题
 /// </summary>
 /// <param name="logTopic">日志主题对象</param>
 /// <returns>日志主题id</returns>
 public static async Task <string> CreateAsync(LogTopic logTopic)
 {
     return((await ClsClient.Client.CreateAsync("topic", logTopic)).topic_id);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新日志主题
 /// </summary>
 /// <param name="logtopic">日志主题对象</param>
 /// <returns>Null</returns>
 public static async Task UpdateAsync(LogTopic logTopic)
 {
     await ClsClient.Client.UpdateAsync("topic", logTopic);
 }