作者 yangfu

1.推送修改,推送设备信息存储

@@ -108,6 +108,7 @@ func UpdateDevice(header *protocol.RequestHeader, request *protocol.UpdateDevice @@ -108,6 +108,7 @@ func UpdateDevice(header *protocol.RequestHeader, request *protocol.UpdateDevice
108 rep, _ := repository.NewPushDeviceRepository(nil) 108 rep, _ := repository.NewPushDeviceRepository(nil)
109 if _, err = rep.FindOne(map[string]interface{}{"uid": request.Muid}); err != nil { 109 if _, err = rep.FindOne(map[string]interface{}{"uid": request.Muid}); err != nil {
110 if err == protocol.ERR_DB_NOT_FOUND { 110 if err == protocol.ERR_DB_NOT_FOUND {
  111 + err = nil
111 rep.Save(request) 112 rep.Save(request)
112 return 113 return
113 } 114 }
@@ -31,6 +31,7 @@ func (repository *PushDeviceRepository) FindOne(queryOptions map[string]interfac @@ -31,6 +31,7 @@ func (repository *PushDeviceRepository) FindOne(queryOptions map[string]interfac
31 qs := o.QueryTable(model.TableName()).Filter("uid", queryOptions["uid"]) 31 qs := o.QueryTable(model.TableName()).Filter("uid", queryOptions["uid"])
32 err := qs.One(model) 32 err := qs.One(model)
33 if err != nil { 33 if err != nil {
  34 + err = domain.ERR_DB_NOT_FOUND
34 return nil, err 35 return nil, err
35 } 36 }
36 return repository.transformBgormModelToDomainModel(model) 37 return repository.transformBgormModelToDomainModel(model)
@@ -54,7 +55,7 @@ func (repository *PushDeviceRepository) Find(queryOptions map[string]interface{} @@ -54,7 +55,7 @@ func (repository *PushDeviceRepository) Find(queryOptions map[string]interface{}
54 55
55 func (repository *PushDeviceRepository) UpdateDevice(uid int64, clientId, deviceToken string) error { 56 func (repository *PushDeviceRepository) UpdateDevice(uid int64, clientId, deviceToken string) error {
56 o := orm.NewOrm() 57 o := orm.NewOrm()
57 - _, err := o.Raw("UPDATE push_device_info SET client_id=?,device_token = ? where uid=?", clientId, deviceToken, uid).Exec() 58 + _, err := o.Raw("UPDATE push_device_info SET client_id=?,device_token = ?,update_at=now() where uid=?", clientId, deviceToken, uid).Exec()
58 if err != nil { 59 if err != nil {
59 return err 60 return err
60 } 61 }