Update API
This commit is contained in:
@@ -16,10 +16,9 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
public class ArArkCellGroupDinner : IAutoReplyCommand
|
||||
{
|
||||
|
||||
public ArArkCellGroupDinner(ChurchNetContext context,
|
||||
public ArArkCellGroupDinner(
|
||||
CellGroupLogic logic)
|
||||
{
|
||||
this._context = context;
|
||||
this.logic = logic;
|
||||
}
|
||||
private static readonly string[] COMMANDS = { "晚餐", "dinner" };
|
||||
@@ -28,57 +27,12 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
LineGroup.Ark,
|
||||
LineGroup.Chris,
|
||||
};
|
||||
private readonly ChurchNetContext _context;
|
||||
private readonly CellGroupLogic logic;
|
||||
|
||||
public string Description => "顯示方舟小組聚會晚餐";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<LineGroup> SupportGroups => GROUPS;
|
||||
public IEnumerable<string> ReplyMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder comments = new StringBuilder();
|
||||
sb.AppendLine("又到了令人期待的小組日~~~");
|
||||
var _event = _context.CellGroupRoutineEvents.Where(e => e.Time >= DateTime.Today)
|
||||
.Include(e => e.Attendees).FirstOrDefault();
|
||||
if (_event == null)
|
||||
{
|
||||
_event = new CellGroupRoutineEvent()
|
||||
{
|
||||
Id = Format.Get33BaseGuid(),
|
||||
Time = DateTimeHelper.GetNextWeekday(DateTime.Today, DayOfWeek.Friday).AddHours(19).AddMinutes(30),
|
||||
Address = "1881 Forest Dr., Azusa, CA 91702",
|
||||
Attendees = new List<CellGroupRoutineEventAttendee>()
|
||||
};
|
||||
_context.Add(_event);
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
sb.AppendLine($"{_event.Time.ToString("MM/dd HH:mm tt")} 開飯~");
|
||||
|
||||
sb.AppendLine("======= 晚宴清單 =======");
|
||||
foreach (var a in _event.Attendees)
|
||||
{
|
||||
sb.AppendLine($"{a.Name} - {string.Join(", ", a.PotluckItem.Split('|'))}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(a.Comment))
|
||||
{
|
||||
comments.AppendLine($"{a.Name}:{a.Comment}");
|
||||
}
|
||||
}
|
||||
|
||||
if (comments.Length > 0)
|
||||
{
|
||||
sb.AppendLine("========= 備註 =========");
|
||||
sb.Append(comments.ToString());
|
||||
}
|
||||
return new string[] { sb.ToString() };
|
||||
}
|
||||
}
|
||||
public IEnumerable<string> ReplyMessage => null;
|
||||
|
||||
public IEnumerable<ILineMessage> LineMessage
|
||||
{
|
||||
|
||||
@@ -231,7 +231,8 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
Size = FlexObjectSize.sm,
|
||||
Color = "#666666",
|
||||
Flex = 5
|
||||
Flex = 5,
|
||||
Wrap = true
|
||||
});
|
||||
comments.Add(commentLineBox);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user