You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
package memory
|
|
|
|
import (
|
|
"yunyan/comm"
|
|
"yunyan/pb"
|
|
)
|
|
|
|
// Del 删除记忆项
|
|
// @Summary 删除记忆项
|
|
// @Description 批量删除拾忆条目(只能删自己的)
|
|
// @Tags Memory
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security BearerAuth
|
|
// @Param data body pb.MemoryDelReq true "请求数据"
|
|
// @Success 200 {object} comm.HttpResult{data=pb.MemoryDelResp} "响应数据"
|
|
// @Router /api/home/memory_del [post]
|
|
func (this *apiComp) Del(session comm.IUserSession, req *pb.MemoryDelReq) (resp *pb.MemoryDelResp, errdata *pb.ErrorData) {
|
|
uid, errdata := requireUID(session)
|
|
if errdata != nil {
|
|
return
|
|
}
|
|
ids := clampIDs(req.Ids)
|
|
if len(ids) == 0 {
|
|
resp = &pb.MemoryDelResp{}
|
|
return
|
|
}
|
|
// 删除条件里必须带 uid,只按 id 删等于任何人都能删别人的东西
|
|
n, err := this.module.model.delItems(uid, ids)
|
|
if err != nil {
|
|
this.module.Errorf("memory_del uid:%s err:%v", uid, err)
|
|
errdata = &pb.ErrorData{Code: pb.ErrorCode_DBError, Message: "删除失败"}
|
|
return
|
|
}
|
|
resp = &pb.MemoryDelResp{Affected: int32(n)}
|
|
return
|
|
}
|
|
|