|
@@ -1,13 +1,14 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
- quitl "app.yhyue.com/moapp/jybase/common"
|
|
|
- util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
|
|
|
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
"database/sql"
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"time"
|
|
|
+
|
|
|
+ quitl "app.yhyue.com/moapp/jybase/common"
|
|
|
+ util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
|
|
|
+ "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
)
|
|
|
|
|
|
type MessaggeService struct{}
|
|
@@ -394,14 +395,14 @@ func (m *MessaggeService) SaveAutoReplyMsg(userType, entId, entUserId, userId in
|
|
|
messageId := util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message (appid,content,item,type,create_time,create_person) values (?,?,?,?,?,?)`, appId, content, 8, 1, nowFormat, "admin")
|
|
|
sessionId := util.Mysql.InsertBySqlByTx(tx, `insert into socialize_chat_session (appid,type,ent_id,customer_service_id,customer_service_name,user_id,start_time,end_time) values (?,?,?,?,?,?,?,?)`, appId, 1, entId, entUserId, entUserName, userId, nowFormat, nowFormat)
|
|
|
ok := false
|
|
|
- if userType == 1 {
|
|
|
- if util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, sessionId, 1, nowFormat) > 0 {
|
|
|
- ok = true
|
|
|
- }
|
|
|
+ if userType == 0 {
|
|
|
+ ok1 := util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, sessionId, 1, nowFormat) > 0
|
|
|
+ ok2 := util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, userId, 2, nowFormat) > 0
|
|
|
+ ok = ok1 && ok2
|
|
|
+ } else if userType == 1 {
|
|
|
+ ok = util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, sessionId, 1, nowFormat) > 0
|
|
|
} else if userType == 2 {
|
|
|
- if util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, userId, 2, nowFormat) > 0 {
|
|
|
- ok = true
|
|
|
- }
|
|
|
+ ok = util.Mysql.InsertBySqlByTx(tx, `insert into socialize_message_mailbox (appid,messag_id,type,send_user_id,send_user_type,receive_user_id,receive_user_type,own_id,own_type,create_time) values (?,?,?,?,?,?,?,?,?,?)`, appId, messageId, 7, sessionId, 1, userId, 2, userId, 2, nowFormat) > 0
|
|
|
}
|
|
|
return messageId > 0 && sessionId > 0 && ok
|
|
|
})
|