func sendGlobalDataSetGrid(index int, rec string, row, col int, val interface{}) error { if !core.enableglobaldata { return fmt.Errorf("global data is disable, please enable `enableglobaldata`") } app := GetAppByName(core.globalHelper.dataCenter) if app == nil { return ErrAppNotFound } return app.Call(nil, "GlobalHelper.GlobalDataSetGrid", index, rec, row, col, datatype.NewAny(0, val)) }
func (gd *GlobalDataHelper) RecModify(self datatype.Entityer, rec datatype.Recorder, row, col int) { if !gd.isServer { return } v := gd.dataChange() for _, client := range gd.globalclients { if client.disable || client.status == STATUS_NONE { //没有开启 continue } app := GetAppById(client.appid) if app == nil { continue } val, _ := rec.Get(row, col) app.CallBack(nil, "GlobalHelper.GlobalDataRecModify", gd.OnDataChanged, self.GetIndex(), v, rec.GetName(), row, col, datatype.NewAny(0, val)) } }
//数据属性变动同步 func (gd *GlobalDataHelper) Update(self datatype.Entityer, index int16, value interface{}) { if !gd.isServer { return } v := gd.dataChange() for _, client := range gd.globalclients { if client.disable || client.status == STATUS_NONE { //没有开启 continue } app := GetAppById(client.appid) if app == nil { continue } app.CallBack(nil, "GlobalHelper.GlobalDataUpdate", gd.OnDataChanged, self.GetIndex(), v, index, datatype.NewAny(0, value)) } }