コード例 #1
0
ファイル: TreeController.go プロジェクト: 8090boy/kbcms
func (d *TreeController) Delete(w rest.ResponseWriter, req *rest.Request) {
	data := new(model.Tree)
	err := data.Del(req.PathParam("id"))
	if err != nil {
		w.WriteJson(0)
		return
	}
	// TODO: 将extend中dataId的数据删除
	w.WriteJson(1)
}
コード例 #2
0
ファイル: TreeController.go プロジェクト: 8090boy/kbcms
func (d *TreeController) DeleteAll(idStr string) {
	idStr = strings.Replace(idStr, "|", ".", -1)
	idStr = strings.Replace(idStr, ";", ".", -1)
	idStr = strings.Replace(idStr, ";", ".", -1)
	idStr = strings.Replace(idStr, ",", ".", -1)
	idStr = strings.Replace(idStr, ",", ".", -1)
	ids := strings.Split(idStr, ".")
	//
	data := new(model.Tree)
	fail := make([]string, len(ids), len(ids))
	for i := 0; i < len(ids); i++ {
		if ids[i] != "" {
			err := data.Del(ids[i])
			if err != nil {
				fail[i] = ids[i]
			}
		}
	}
	fmt.Println("--Delete %v--fail--%v----", data, fail)

}