83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace _2021_backend.Models
|
|
{
|
|
public enum SMSType
|
|
{
|
|
Accept,
|
|
Reject,
|
|
TimeSelect,
|
|
TimeSet,
|
|
Signed,
|
|
Reply,
|
|
Captcha,
|
|
}
|
|
public class SMS
|
|
{
|
|
public SMS()
|
|
{
|
|
Id = 0;
|
|
Tel = "";
|
|
Data = new List<string> { };
|
|
Type = SMSType.Accept;
|
|
Sender = "";
|
|
SendTime = DateTime.Now;
|
|
}
|
|
public SMS(SMSPartialDto dto, int host)
|
|
{
|
|
Id = 0;
|
|
Tel = dto.SubscriberNumber;
|
|
Host = host;
|
|
Sender = dto.SubscriberNumber.ToString();
|
|
Data = (new string[] { dto.ReplyContent }).ToList<string>();
|
|
Type = SMSType.Reply;
|
|
var tm = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddSeconds(dto.ReplyTime).ToLocalTime();
|
|
SendTime = tm;
|
|
}
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
public int Id { get; set; }
|
|
[Display(Name = "Host")]
|
|
public int Host { get; set; }
|
|
[Display(Name = "电话号码")]
|
|
public string Tel { get; set; }
|
|
|
|
[Display(Name = "短信内容")]
|
|
public List<string> Data { get; set; }
|
|
[Display(Name = "短信类型")]
|
|
public SMSType Type { get; set; }
|
|
[Display(Name = "发送者")]
|
|
public string Sender { get; set; }
|
|
[Display(Name = "发送时间")]
|
|
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
|
|
public DateTime SendTime { get; set; }
|
|
}
|
|
|
|
public class SMSResponseDto
|
|
{
|
|
public class error
|
|
{
|
|
public string Code;
|
|
public string Message;
|
|
}
|
|
public List<SMSPartialDto> PullSmsReplyStatusSet { get; set; }
|
|
public string RequestId { get; set; }
|
|
error Error { get; set; }
|
|
}
|
|
|
|
public class SMSPartialDto
|
|
{
|
|
public string CountryCode { get; set; }
|
|
public string ReplyContent { get; set; }
|
|
public string SubscriberNumber { get; set; }
|
|
public string ExtendCode { get; set; }
|
|
public ulong ReplyTime { get; set; }
|
|
public string PhoneNumber { get; set; }
|
|
public string SignName { get; set; }
|
|
}
|
|
}
|