public bool UpdateVisitedTimes(string StationSource, int ChannelId) { //查询DividedPercentStationVisitedLog 表中是否有记录 int count = Dal.selectVisitedLog(StationSource, ChannelId); //查询DividedPercentStation 表中是否有此记录 bool isExist = Dal.GetDividedPercentStationZDID(ChannelId, StationSource); //增加isExist判断逻辑 if (count == 1 && isExist) { //更新DividedPercentStationVisitedLog 的记录 Dal.UpdateVisitedLog(StationSource, ChannelId); } else if (count == 0 && isExist) { //插入DividedPercentStationVisitedLog记录 Dal.InsertVisitedLog(StationSource, ChannelId); return(UpdateVisitedTimes(StationSource, ChannelId)); } return(Dal.UpdateVisitedTimes(StationSource, ChannelId)); }