|
|
@@ -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 { |
|
|
|