更新扩展字段信息

pull/23/head
陶士涵 4 years ago
parent 4289b49939
commit f79186716e

@ -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)
} }

@ -382,6 +382,7 @@ var app=new Vue({
//_this.visitor.visitor_id=r.visitor_id; //_this.visitor.visitor_id=r.visitor_id;
_this.chatTitle="#"+r.id+"|"+r.name; _this.chatTitle="#"+r.id+"|"+r.name;
_this.chatTitleType="success"; _this.chatTitleType="success";
_this.visitorExtra=[];
if(r.extra!=""){ if(r.extra!=""){
var extra=JSON.parse(b64ToUtf8(r.extra)); var extra=JSON.parse(b64ToUtf8(r.extra));
for(var key in extra){ for(var key in extra){

Loading…
Cancel
Save