示例#1
0
 public async Task Create([FromBody] OrderReap orderReap)
 {
     try
     {
         if (orderReap.Percent < (decimal)1.0005 || orderReap.Percent > (decimal)1.2)
         {
             throw new ApplicationException("不要随意下指令");
         }
         new OrderReapDao().Create(orderReap);
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message, ex);
         throw ex;
     }
 }
示例#2
0
        public void Create(OrderReap orderReap)
        {
            orderReap.IsFinished = false;

            var sql = $"select * from t_order_reap where OrderId={orderReap.OrderId}";

            if (Database.Query <OrderReap>(sql).FirstOrDefault() != null)
            {
                sql = $"update t_order_reap set ReapType={(int)orderReap.ReapType} where OrderId={orderReap.OrderId}";
                Database.Execute(sql);
            }
            else
            {
                using (var tx = Database.BeginTransaction())
                {
                    Database.Insert(orderReap);
                    tx.Commit();
                }
            }
        }