Beispiel #1
0
        public void Review(MsgInformationEx MsgDTO)
        {
            var record = MongoService <PicReviewRecord> .Get(p => p.Status == PicReviewStatus.Waiting).OrderBy(p => p.CreateTime).FirstOrDefault();

            if (record == null)
            {
                MsgSender.PushMsg(MsgDTO, "暂无待审核的图片!");
                return;
            }

            var msg = $"{CodeApi.Code_Image_Relational($"{CachePath}{record.PicName}")}\r\n";

            msg += $"来自 {GroupSettingSvc[record.GroupNum].Name} 的 {record.QQNum}\r\n";
            msg += $"用途:{record.Usage}\r\n";
            msg += "是否通过?";
            var option = WaiterSvc.WaitForOptions(MsgDTO.FromGroup, MsgDTO.FromQQ, msg, new[] { "通过", "不通过", "取消" }, MsgDTO.BindAi);

            if (option < 0 || option == 2)
            {
                MsgSender.PushMsg(MsgDTO, "操作取消!");
                return;
            }

            record.Status     = option == 0 ? PicReviewStatus.Passed : PicReviewStatus.Refused;
            record.ReviewTime = DateTime.Now;
            record.Update();

            ReviewCallBack[record.Usage](record);

            msg = record.Status == PicReviewStatus.Passed
                ? $"恭喜你,你在{record.CreateTime:yyyy-MM-dd HH:mm:ss}提交的用于{record.Usage}的图片审核通过!"
                : $"很遗憾,你在{record.CreateTime:yyyy-MM-dd HH:mm:ss}提交的用于{record.Usage}的图片未能审核通过!";
            MsgSender.PushMsg(record.GroupNum, record.QQNum, msg, GroupSettingSvc[record.GroupNum].BindAi);

            var picTempFile = new FileInfo($"{CachePath}{record.PicName}");

            picTempFile.Delete();

            var count = MongoService <PicReviewRecord> .Count(p => p.Status == PicReviewStatus.Waiting);

            MsgSender.PushMsg(MsgDTO, $"审核完毕!还有{count}张待审核的图片!");
        }
Beispiel #2
0
        public void AddReview(PicReviewRecord record)
        {
            var oldRec = MongoService <PicReviewRecord> .GetOnly(p => p.QQNum == record.QQNum && p.Usage == record.Usage && p.Status == PicReviewStatus.Waiting);

            if (oldRec == null)
            {
                record.Insert();
            }
            else
            {
                oldRec.PicName    = record.PicName;
                oldRec.CreateTime = record.CreateTime;
                oldRec.GroupNum   = record.GroupNum;
                oldRec.Update();
            }

            var count = MongoService <PicReviewRecord> .Count(p => p.Status == PicReviewStatus.Waiting);

            var msg = $"有新的待审核图片!\r\n来自 {GroupSettingSvc[record.GroupNum].Name} 的 {record.QQNum}\r\n当前剩余 {count} 张图片待审核!";

            MsgSender.PushMsg(0, Global.DeveloperNumber, msg, Global.DefaultConfig.MainAi);
        }
Beispiel #3
0
        public static long RecentCmdsCount(int hour)
        {
            var startTime = DateTime.Now.AddHours(-hour);

            return(MongoService <CmdRec> .Count(p => p.Time >= startTime));
        }
Beispiel #4
0
 public static int Pressure(string BindAi)
 {
     return((int)MongoService <RestrictRec> .Count(p => p.BindAi == BindAi));
 }
Beispiel #5
0
 public static bool IsLocked(long QQNum, string Cmd)
 {
     return(MongoService <CmdLockRec> .Count(p => p.QQNum == QQNum && p.Cmd == Cmd) > 0);
 }