Commit f485a21a authored by chenweijian's avatar chenweijian

cp

parent 0f6ba56f
...@@ -58,7 +58,14 @@ type CpCancel struct { ...@@ -58,7 +58,14 @@ type CpCancel struct {
type CpCancelMessage struct { type CpCancelMessage struct {
Identifier string `json:"identifier"` Identifier string `json:"identifier"`
Msg string `json:"msg"` Msg string `json:"msg"`
Status uint8 `json:"status"` //1.发起解除2.撤销解除3.接受解除 Sender *user_m.UserTiny `json:"sender"`
}
// 发送私信-撤销解除、接受解除
type CpDealCancelMessage struct {
Identifier string `json:"identifier"`
Msg string `json:"msg"`
Status uint8 `json:"status"` //1.撤销解除2.接受解除
} }
type Cp struct { type Cp struct {
......
...@@ -142,11 +142,11 @@ func CancelCpRelation(myCtx *mycontext.MyContext, myUserId uint64, externalId, l ...@@ -142,11 +142,11 @@ func CancelCpRelation(myCtx *mycontext.MyContext, myUserId uint64, externalId, l
model.Log.Errorf("CancelCpRelation myUserId:%d, err:%v", myUserId, err) model.Log.Errorf("CancelCpRelation myUserId:%d, err:%v", myUserId, err)
return err return err
} }
// 发送私信 // 发送私信-发起解除
data, _ := json.Marshal(cp_m.CpCancelMessage{ data, _ := json.Marshal(cp_m.CpCancelMessage{
Identifier: "CpCancelMessage", Identifier: "CpCancelMessage",
Msg: "I want to unbind the CP relationship", Msg: "I want to unbind the CP relationship",
Status: 1, Sender: user_m.ToUserTiny(user),
}) })
if err := tencentyun.BatchSendCustomMsg(model, 1, user.ExternalId, []string{userRec.ExternalId}, string(data), "cp解除"); err != nil { if err := tencentyun.BatchSendCustomMsg(model, 1, user.ExternalId, []string{userRec.ExternalId}, string(data), "cp解除"); err != nil {
model.Log.Errorf("CancelCpRelation BatchSendCustomMsg fail:%v", err) model.Log.Errorf("CancelCpRelation BatchSendCustomMsg fail:%v", err)
......
...@@ -294,10 +294,10 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -294,10 +294,10 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) {
var msgData []byte var msgData []byte
if optType == 1 { // 撤销解除 if optType == 1 { // 撤销解除
// 私信 // 私信
msgData, _ = json.Marshal(cp_m.CpCancelMessage{ msgData, _ = json.Marshal(cp_m.CpDealCancelMessage{
Identifier: "CpCancelMessage", Identifier: "CpDealCancelMessage",
Msg: fmt.Sprintf("%s withdrew my application to lift CP", myUser.Nick), Msg: fmt.Sprintf("%s withdrew my application to lift CP", myUser.Nick),
Status: 2, Status: 1,
}) })
} else { // 接受解除 } else { // 接受解除
// 删除cp关系表的记录 // 删除cp关系表的记录
...@@ -306,11 +306,11 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -306,11 +306,11 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) {
model.Log.Errorf("ReplyCpCancel myUser:%d, user2:%d, status:%d, err:%v", myUser.ID, user2.ID, updateStatus, err) model.Log.Errorf("ReplyCpCancel myUser:%d, user2:%d, status:%d, err:%v", myUser.ID, user2.ID, updateStatus, err)
return err return err
} }
// 私信 // 私信-接受解除
msgData, _ = json.Marshal(cp_m.CpCancelMessage{ msgData, _ = json.Marshal(cp_m.CpDealCancelMessage{
Identifier: "CpCancelMessage", Identifier: "CpDealCancelMessage",
Msg: "The CP relationship has been unbound, the CP value has been cleared, and the CP privilege has disappeared", Msg: "The CP relationship has been unbound, the CP value has been cleared, and the CP privilege has disappeared",
Status: 3, Status: 2,
}) })
} }
if err := tencentyun.BatchSendCustomMsg(model, 1, myUser.ExternalId, []string{user2.ExternalId}, string(msgData), "cp解除"); err != nil { if err := tencentyun.BatchSendCustomMsg(model, 1, myUser.ExternalId, []string{user2.ExternalId}, string(msgData), "cp解除"); err != nil {
......
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