Пример #1
0
        public bool StoryContribute(MsgInformationEx MsgDTO, object[] param)
        {
            var info = WaiterSvc.WaitForInformation(MsgDTO, "请上传图片!",
                                                    information => information.FromGroup == MsgDTO.FromGroup && information.FromQQ == MsgDTO.FromQQ &&
                                                    !string.IsNullOrEmpty(Utility.ParsePicGuid(information.Msg)), 10);

            if (info == null)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return(false);
            }

            var bindai = BindAiSvc[MsgDTO.BindAi];

            var picGuid    = Utility.ParsePicGuid(info.Msg);
            var imageCache = Utility.ReadImageCacheInfo(picGuid, bindai.ImagePath);

            if (imageCache == null)
            {
                MsgSender.PushMsg(MsgDTO, "文件缓存读取失败!");
                return(false);
            }

            var fileName = $"MiniStory{DateTime.Now:yyyyMMddHHmmss}.{imageCache.type}";

            if (!Utility.DownloadImage(imageCache.url, CachePath + fileName))
            {
                MsgSender.PushMsg(MsgDTO, "图片下载失败,请稍后再试!");
                return(false);
            }
            ArknightsMiniStoryRecord.Insert(fileName);

            MsgSender.PushMsg(MsgDTO, "保存成功!");
            return(true);
        }
Пример #2
0
        public bool MiniStory(MsgInformationEx MsgDTO, object[] param)
        {
            var rec = ArknightsMiniStoryRecord.GetLast();

            var msg = $"【No.{rec.No}】\r\n{CodeApi.Code_Image_Relational(CachePath + rec.Path)}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
Пример #3
0
        public bool MiniStoryIndex(MsgInformationEx MsgDTO, object[] param)
        {
            var no  = (int)(long)param[0];
            var rec = ArknightsMiniStoryRecord.Get(no);

            if (rec == null)
            {
                MsgSender.PushMsg(MsgDTO, "未找到相应的期号!");
                return(false);
            }

            var msg = $"【No.{rec.No}】\r\n{CodeApi.Code_Image_Relational(CachePath + rec.Path)}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
Пример #4
0
        public static void Insert(string Path)
        {
            var lastestNoRec = GlobalVarRecord.Get("ArknightsMiniStoryNo");

            if (string.IsNullOrEmpty(lastestNoRec.Value))
            {
                lastestNoRec.Value = "0";
            }

            var lastNo    = int.Parse(lastestNoRec.Value);
            var newRecord = new ArknightsMiniStoryRecord()
            {
                No         = lastNo + 1,
                Path       = Path,
                UpdateTime = DateTime.Now
            };

            MongoService <ArknightsMiniStoryRecord> .Insert(newRecord);

            lastestNoRec.Value = newRecord.No.ToString();
            lastestNoRec.Update();
        }