package service import ( dao "dashoo.cn/micro/app/dao/proj" "fmt" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/util/gconv" "testing" ) func TestCreateSystemMessage(t *testing.T) { msg := g.MapStrStr{ "msgTitle": "ces", "msgContent": "

111111111

", "msgType": "20", "msgStatus": "10", "recvUserIds": "1,2,4", "sendType": "10,20,30", } if err := CreateSystemMessage(msg); err != nil { t.Errorf("CreateSystemMessage() error = %v", err) } } func TestCreateSystem(t *testing.T) { dd := dao.NewProjBusinessDynamicsDao("8b9ec443") data, err := dd.WhereLike("opn_type", "4%").WhereNotIn("bus_id", []int{114, 118, 176, 177, 190, 198, 301, 339, 346, 372, 443, 446, 457, 485, 486, 492, 506, 507, 524, 559, 612, 629}). Order("bus_id ASC, opn_date DESC").All() if err != nil { fmt.Println(err) } var id int var count int for _, v := range data { fmt.Println(*v) if v.OpnType == "41" && count == 0 { if id == 0 { id = v.Id } else { id = 0 } } count++ if v.OpnType == "40" && id != 0 && count == 2 { context := gconv.Map(v.OpnContent) _, err = dd.Data("remark", g.Map{"nboType": context["nboType"], "origNboType": context["origNboType"]}).WherePri(id).Update() if err != nil { fmt.Println(err) } id = 0 count = 0 } } }