/// <summary> /// 插入 /// </summary> /// <param name="appLog"></param> /// <returns></returns> public static int Insert(AppLog appLog) { string sql = "insert into app_log (create_time, create_timestamp, log_type, lottery_code, data_source, log_message)" + "values(@create_time, @create_timestamp, @log_type, @lottery_code, @data_source, @log_message)"; return(MysqlHelper.Execute(sql, appLog)); }
/// <summary> /// 清除指定时间之前的开奖结果 /// </summary> /// <param name="timestamp"></param> /// <returns></returns> public static int Delete(long timestamp) { string sql = "detele from open_result where create_timestamp < {0}"; sql = string.Format(sql, timestamp); return(MysqlHelper.Execute(sql)); }
/// <summary> /// 批量插入 /// </summary> /// <param name="resultList"></param> /// <returns></returns> public static int Insert(List <OpenResult> resultList) { if (resultList.Count == 0) { return(1); } string sql = "insert into open_result (create_time, create_timestamp, open_time, open_timestamp, lottery_code, issue_number, open_data, data_source, is_legal) " + "values (@create_time, @create_timestamp, @open_time, @open_timestamp, @lottery_code, @issue_number, @open_data, @data_source, @is_legal)"; return(MysqlHelper.Execute(sql, resultList.Where(o => !Exists(o.issue_number, o.lottery_code, o.data_source)).OrderBy(o => o.issue_number))); }
/// <summary> /// 修改状态 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <returns></returns> public static int UpdateStatus(string id, int status) { string sql = $"update lottery set status = {status}, update_time='{DateTime.Now}', update_timestamp={DateTime.Now.ToTimestamp()} where id in ({id})"; return(MysqlHelper.Execute(sql)); }
/// <summary> /// 插入 /// </summary> /// <param name="list"></param> /// <returns></returns> public static int Insert(List <Lottery> list) { string sql = "insert into lottery (create_time, create_timestamp, name, code) values (@create_time, @create_timestamp, @name, @code)"; return(MysqlHelper.Execute(sql, list.Where(l => !Exist(l.code)))); }
/// <summary> /// 修改状态 /// </summary> /// <param name="id"></param> /// <param name="status"></param> /// <returns></returns> public static int UpdateStatus(int id, int status) { string sql = $"update data_source set status = {status}, update_time='{DateTime.Now}', update_timestamp={DateTime.Now.ToTimestamp()} where id = {id}"; return(MysqlHelper.Execute(sql)); }
/// <summary> /// 插入 /// </summary> /// <param name="list"></param> /// <returns></returns> public static int Insert(List <DataSource> list) { string sql = "insert into data_source (create_time, create_timestamp, name, code) values (@create_time, @create_timestamp, @name, @code)"; return(MysqlHelper.Execute(sql, list)); }