Commit f485a21a authored by chenweijian's avatar chenweijian

cp

parent 0f6ba56f
......@@ -56,9 +56,16 @@ type CpCancel struct {
// 发送私信(解除)
type CpCancelMessage struct {
Identifier string `json:"identifier"`
Msg string `json:"msg"`
Sender *user_m.UserTiny `json:"sender"`
}
// 发送私信-撤销解除、接受解除
type CpDealCancelMessage struct {
Identifier string `json:"identifier"`
Msg string `json:"msg"`
Status uint8 `json:"status"` //1.发起解除2.撤销解除3.接受解除
Status uint8 `json:"status"` //1.撤销解除2.接受解除
}
type Cp struct {
......
......@@ -142,11 +142,11 @@ func CancelCpRelation(myCtx *mycontext.MyContext, myUserId uint64, externalId, l
model.Log.Errorf("CancelCpRelation myUserId:%d, err:%v", myUserId, err)
return err
}
// 发送私信
// 发送私信-发起解除
data, _ := json.Marshal(cp_m.CpCancelMessage{
Identifier: "CpCancelMessage",
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 {
model.Log.Errorf("CancelCpRelation BatchSendCustomMsg fail:%v", err)
......
......@@ -294,10 +294,10 @@ func ReplyCpCancel(c *gin.Context) (*mycontext.MyContext, error) {
var msgData []byte
if optType == 1 { // 撤销解除
// 私信
msgData, _ = json.Marshal(cp_m.CpCancelMessage{
Identifier: "CpCancelMessage",
msgData, _ = json.Marshal(cp_m.CpDealCancelMessage{
Identifier: "CpDealCancelMessage",
Msg: fmt.Sprintf("%s withdrew my application to lift CP", myUser.Nick),
Status: 2,
Status: 1,
})
} else { // 接受解除
// 删除cp关系表的记录
......@@ -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)
return err
}
// 私信
msgData, _ = json.Marshal(cp_m.CpCancelMessage{
Identifier: "CpCancelMessage",
// 私信-接受解除
msgData, _ = json.Marshal(cp_m.CpDealCancelMessage{
Identifier: "CpDealCancelMessage",
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 {
......
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