Beispiel #1
0
        /// <summary>根据马车状态获取实体集合</summary>
        public static int GetCarUpdate(tg_car car)
        {
            var _set   = string.Format("time={0},start_ting_id={1},stop_ting_id={2},distance={3},state={4} ", car.time, car.start_ting_id, car.stop_ting_id, car.distance, car.state);
            var _where = string.Format("id={0}", car.id);

            return(Update(_set, _where));
        }
Beispiel #2
0
 /// <summary>初始马车</summary>
 public static bool InitCar(Int64 user_id)
 {
     try
     {
         var rbp = Variable.BASE_RULE.FirstOrDefault(q => q.id == "1003");
         var rp  = Variable.BASE_RULE.FirstOrDefault(q => q.id == "3009");
         if (rp == null || rbp == null)
         {
             return(false);
         }
         var birthplace = Convert.ToInt32(rbp.value);    //马车出生地
         var packet     = Convert.ToInt32(rp.value);     //默认马车开启车厢数量
         var list       = Variable.BASE_PART.Where(m => m.vip == 0).ToList();
         foreach (var item in list)
         {
             if (item.id <= 0)
             {
                 continue;
             }
             var car = new tg_car
             {
                 car_id        = item.id,
                 distance      = 0,
                 packet        = packet,
                 rid           = 0,
                 speed         = item.speed,
                 start_ting_id = birthplace,
                 state         = (int)CarStatusType.STOP,
                 stop_ting_id  = 0,
                 time          = 0,
                 user_id       = user_id,
             };
             car.Save();
         }
         return(true);
     }
     catch (Exception ex)
     {
         XTrace.WriteException(ex);
         return(false);
     }
 }