# 发短信接口日志说明
## 日志存储数据库位置
- ip:192.168.70.136
- 端口:9999
- 数据库:ts_acl
- 模式:sqmdb_rpt
## 接口调用日志表(sms_record)
字段
| 说明
|
id |
id |
from_system |
来源系统,按照约定传固定值 如 tousuliucheng |
phone_numbers |
手机号列表 |
content |
短信内容文本 |
schedule_time |
定时发送,传空字符串或者省略表示即时发送 |
from_system |
来源系统,按照约定传固定值 如 tousuliucheng |
sms_type |
各系统自行定义的消息类型,仅用于记录 |
internal_id |
系统内编号,可以考虑群发使用相同编号 |
result |
提交短信网关响应结果 |
send_time |
发送时间 |
status |
是否发送到网关 |
login_names |
登录用户名 |
## 短信报告日志表(sms_report)
字段
| 说明
|
id |
id |
phone |
手机号 |
flow_id |
该命令所涉及的Submit或deliver命令的序列号 |
send_time |
发送时间 |
report_time |
收到报告时间 |
report_type |
Report命令类型
0:对先前一条Submit命令的状态报告
1:对先前一条前转Deliver命令的状态报告 |
state |
该命令所涉及的短消息的当前执行状态
0:发送成功
1:等待发送
2:发送失败 |
error_code |
当State=2时为错误码值,否则为0 |
## 使用示例
### 根据手机号查询
```sql
select
*
from
sqmdb_rpt.sms_record a
join sqmdb_rpt.sms_report b on
a.id = b.id
where
b.phone = '13231899751'
order by
a.send_time desc,
b.phone,
b.flow_id
```
### 根据短信内容模糊查询
```sql
select
*
from
sqmdb_rpt.sms_record a
join sqmdb_rpt.sms_report b on
a.id = b.id
where
a."content" like '%测试%'
order by
a.send_time desc,
b.phone,
b.flow_id
```
### 根据发送日期查询
```sql
select
*
from
sqmdb_rpt.sms_record a
join sqmdb_rpt.sms_report b on
a.id = b.id
where
a.send_time >= to_timestamp('2024-05-16', 'YYYY-MM-DD')
and a.send_time <= to_timestamp('2024-05-17', 'YYYY-MM-DD')
order by
a.send_time desc,
b.phone,
b.flow_id
```
### 根据发送时间段查询
```sql
select
*
from
sqmdb_rpt.sms_record a
join sqmdb_rpt.sms_report b on
a.id = b.id
where
a.send_time >= '2024-05-16 16:00:00'
and a.send_time <= '2024-05-16 17:00:00'
order by
a.send_time desc,
b.phone,
b.flow_id
```