diff --git a/app/svc/im/svc_customer_service.go b/app/svc/im/svc_customer_service.go index 4deb64e..86bccd0 100644 --- a/app/svc/im/svc_customer_service.go +++ b/app/svc/im/svc_customer_service.go @@ -4,11 +4,24 @@ import ( "applet/app/db" "applet/app/db/im/model" md "applet/app/md/im" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "errors" "time" ) func PageCustomerService(req md.PageCustomerServiceReq) (err error, resp md.PageCustomerServiceResp) { + var userId int64 + if req.Phone != "" { + userDb := implement.NewUserDb(db.Db) + user, err := userDb.UserGetOneByParams(map[string]interface{}{ + "phone": req.Phone, + }) + if err != nil { + return err, md.PageCustomerServiceResp{} + } + userId = user.Id + } + sess := db.DbIm.Where("1=1") if req.Memo != "" { sess.And("memo LIKE ?", "%"+req.Memo+"%") @@ -16,9 +29,10 @@ func PageCustomerService(req md.PageCustomerServiceReq) (err error, resp md.Page if req.State != 0 { sess.And("state = ?", req.State) } - if req.Phone != "" { - sess.And("phone = ?", req.Phone) + if userId != 0 { + sess.And("uid = ?", userId) } + var mm []*model.CustomerService resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Asc("id").FindAndCount(&mm) if err != nil { diff --git a/app/svc/im/svc_emoticon.go b/app/svc/im/svc_emoticon.go index 3218211..fd71950 100644 --- a/app/svc/im/svc_emoticon.go +++ b/app/svc/im/svc_emoticon.go @@ -64,7 +64,7 @@ func SetEmoticonState(req md.SetEmoticonStateReq) (err error) { if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.State = req.State @@ -81,7 +81,7 @@ func UpdateEmoticon(req md.UpdateEmoticonReq) (err error) { if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.Name = req.Name