Commit 573d7fa4 by Li Feifei

develop

parent d5cdb5f2
......@@ -54,7 +54,7 @@ func newMysqlClient() {
log.Println("db connect error => ", err)
return
}
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom))
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship))
MysqlClient = orm.NewOrm()
log.Println("MySQL connect success")
}
......@@ -25,3 +25,17 @@ type ImChatRoom struct {
Createtime string
Updatetime string
}
type ImUserRelationship struct {
Id int
Accid string
Faccid string
Type int
Msg string
Blacklist int
Mute int
Serverex string
Createtime string
Updatetime string
}
\ No newline at end of file
package helper
package im_chat_room
import (
"errors"
"im-microservice/helper"
"im-microservice/db"
"im-microservice/pb"
......@@ -22,7 +23,7 @@ const (
func AddChatRoom (addStruct *validator_struct.ChatRoomAddStruct) (int64, error) {
var chat db.ImChatRoom
now := GetNowTime()
now := helper.GetNowTime()
chat.Name = addStruct.Name
chat.Announcement = addStruct.Announcement
chat.Creator = addStruct.Creator
......@@ -48,7 +49,7 @@ func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error {
if len(orm_params) == 0 {
return errors.New("修改房间的参数为空")
}
orm_params["updatetime"] = GetNowTime()
orm_params["updatetime"] = helper.GetNowTime()
_, err := db.MysqlClient.QueryTable(chat_table_name).Filter(chat_room_id, update.RoomId).Update(orm_params)
return err
......@@ -101,7 +102,7 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{
return
}
// 获取查询条件聊天室的总数
offset, total_page := Paginate(ctn, 20, page)
offset, total_page := helper.Paginate(ctn, 20, page)
// 查询数据
var chat_rooms []db.ImChatRoom
......
package helper
package im_configure
import (
"errors"
......
package im_user_relationship
package im_user_relationship
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment