加一些日志
This commit is contained in:
parent
335de3109a
commit
2c0bb0087e
@ -2,6 +2,7 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -24,6 +25,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
|
||||
code = this.ReadMailCheck(session, req) // check
|
||||
if code != pb.ErrorCode_Success {
|
||||
log.Debugf("read mail failed%d", code)
|
||||
return
|
||||
}
|
||||
mail, err = this.module.modelMail.Mail_ReadOneMail(req.ObjID)
|
||||
@ -31,6 +33,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
log.Debugf("read mail %v", mail)
|
||||
mail.Check = true
|
||||
session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail})
|
||||
return
|
||||
|
@ -1,16 +1,21 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/pb"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
var db *DB
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
imgo, err := mgo.NewSys(mgo.SetMongodbUrl("mongodb://admin:123456@10.0.0.9:27018"), mgo.SetMongodbDatabase("dreamfactory"))
|
||||
imgo, err := mgo.NewSys(mgo.SetMongodbUrl("mongodb://10.0.0.9:10013"), mgo.SetMongodbDatabase("dreamfactory"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -20,3 +25,15 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
defer os.Exit(m.Run())
|
||||
}
|
||||
func TestMail(t *testing.T) {
|
||||
mail := &pb.DBMailData{}
|
||||
err := db.mgo.FindOneAndUpdate(
|
||||
"mail",
|
||||
bson.M{"_id": "62e784aa78d6d7bf12fb1f0e"},
|
||||
bson.M{"$set": bson.M{
|
||||
"check": true,
|
||||
}},
|
||||
options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After),
|
||||
).Decode(&mail)
|
||||
fmt.Printf("%v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user