mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-02 17:07:41 +08:00
优化:信息匹配上规则后再落 Msg 表
This commit is contained in:
parent
481f634230
commit
631e9950bd
@ -57,7 +57,7 @@ class HttpService : Service(), Server.ServerListener {
|
||||
.setMinTime(10000)//设置位置更新最小时间间隔(单位:毫秒); 默认间隔:10000毫秒,最小间隔:1000毫秒
|
||||
.setMinDistance(0)//设置位置更新最小距离(单位:米);默认距离:0米
|
||||
.setOnceLocation(false)//设置是否只定位一次,默认为 false,当设置为 true 时,则只定位一次后,会自动停止定位
|
||||
.setLastKnownLocation(true)//设置是否获取最后一次缓存的已知位置,默认为 true
|
||||
.setLastKnownLocation(false)//设置是否获取最后一次缓存的已知位置,默认为 true
|
||||
//设置定位配置参数
|
||||
locationClient.setLocationOption(locationOption)
|
||||
locationClient.startLocation()
|
||||
|
@ -80,13 +80,18 @@ class SendWorker(
|
||||
return@withContext Result.failure(workDataOf("send" to "failed"))
|
||||
}
|
||||
|
||||
val msg = Msg(0, msgInfo.type, msgInfo.from, msgInfo.content, msgInfo.simSlot, msgInfo.simInfo, msgInfo.subId)
|
||||
val msgId = Core.msg.insert(msg)
|
||||
|
||||
val ruleListMatched: MutableList<Rule> = mutableListOf()
|
||||
for (rule in ruleList) {
|
||||
Log.d("SendWorker", rule.toString())
|
||||
if (!rule.checkMsg(msgInfo)) continue
|
||||
if (rule.checkMsg(msgInfo)) ruleListMatched.add(rule)
|
||||
}
|
||||
if (ruleListMatched.isEmpty()) {
|
||||
return@withContext Result.failure(workDataOf("send" to "failed"))
|
||||
}
|
||||
|
||||
val msg = Msg(0, msgInfo.type, msgInfo.from, msgInfo.content, msgInfo.simSlot, msgInfo.simInfo, msgInfo.subId)
|
||||
val msgId = Core.msg.insert(msg)
|
||||
for (rule in ruleListMatched) {
|
||||
val sender = rule.senderList[0]
|
||||
val log = Logs(0, msgInfo.type, msgId, rule.id, sender.id)
|
||||
val logId = Core.logs.insert(log)
|
||||
|
Loading…
x
Reference in New Issue
Block a user