|
|
@ -18,7 +18,7 @@ func CreateVisitor(name, avator, sourceIp, toId, visitorId, refer, city, clientI
|
|
|
|
old := FindVisitorByVistorId(visitorId)
|
|
|
|
old := FindVisitorByVistorId(visitorId)
|
|
|
|
if old.Name != "" {
|
|
|
|
if old.Name != "" {
|
|
|
|
//更新状态上线
|
|
|
|
//更新状态上线
|
|
|
|
UpdateVisitor(visitorId, 1, clientIp, sourceIp, refer)
|
|
|
|
UpdateVisitor(visitorId, 1, clientIp, sourceIp, refer, extra)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v := &Visitor{
|
|
|
|
v := &Visitor{
|
|
|
@ -67,12 +67,13 @@ func UpdateVisitorStatus(visitorId string, status uint) {
|
|
|
|
visitor := Visitor{}
|
|
|
|
visitor := Visitor{}
|
|
|
|
DB.Model(&visitor).Where("visitor_id = ?", visitorId).Update("status", status)
|
|
|
|
DB.Model(&visitor).Where("visitor_id = ?", visitorId).Update("status", status)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func UpdateVisitor(visitorId string, status uint, clientIp string, sourceIp string, refer string) {
|
|
|
|
func UpdateVisitor(visitorId string, status uint, clientIp string, sourceIp string, refer, extra string) {
|
|
|
|
visitor := &Visitor{
|
|
|
|
visitor := &Visitor{
|
|
|
|
Status: status,
|
|
|
|
Status: status,
|
|
|
|
ClientIp: clientIp,
|
|
|
|
ClientIp: clientIp,
|
|
|
|
SourceIp: sourceIp,
|
|
|
|
SourceIp: sourceIp,
|
|
|
|
Refer: refer,
|
|
|
|
Refer: refer,
|
|
|
|
|
|
|
|
Extra: extra,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DB.Model(visitor).Where("visitor_id = ?", visitorId).Update(visitor)
|
|
|
|
DB.Model(visitor).Where("visitor_id = ?", visitorId).Update(visitor)
|
|
|
|
}
|
|
|
|
}
|
|
|
|