移除无用的use

This commit is contained in:
李运家 2024-05-22 16:02:22 +08:00
parent 518d9190e1
commit f090382d15
5 changed files with 8 additions and 21 deletions

View File

@ -4,7 +4,6 @@ use axum_extra::extract::WithRejection;
use validator::Validate;
use domain::dto::feedback::FeedbackAdd;
use domain::dto::pageable::PageParams;
use domain::entities::feedback;
use domain::entities::feedback::Feedback;
use library::resp::pageable::Pageable;
use library::resp::rejection::IRejection;

View File

@ -1,8 +1,7 @@
use chrono::{FixedOffset, NaiveDateTime, NaiveTime, Utc};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, PgPool};
use sqlx::postgres::types::PgTimeTz;
use sqlx::types::chrono::{self, DateTime};
use sqlx::PgPool;
use sqlx::types::chrono;
use crate::db_result::CountResult;
#[derive(Debug, Clone, Deserialize, Default, Serialize)]
@ -30,7 +29,7 @@ impl Feedback {
}
pub async fn add_feedback(feedback: &mut Feedback, db_pool: &PgPool) -> Result<Feedback, sqlx::Error> {
feedback.created_at = NaiveDateTime::default();
feedback.created_at = chrono::Local::now().naive_local();
sqlx::query_as!(
Feedback,
r#"insert into feedback

View File

@ -1,7 +1,6 @@
use chrono::{NaiveDateTime, Utc};
use sqlx::{FromRow, PgPool, QueryBuilder};
use sqlx::types::chrono::{self, DateTime};
use library::db;
use chrono::NaiveDateTime;
use sqlx::PgPool;
use sqlx::types::chrono;
#[derive(Debug, Clone, Default)]
pub struct PlayerInfo {
@ -26,7 +25,7 @@ impl PlayerInfo {
}
pub async fn add_player_info(player_info: &mut PlayerInfo, db_pool: &PgPool) -> Result<PlayerInfo, sqlx::Error> {
player_info.created_at = Utc::now().naive_utc();
player_info.created_at = chrono::Local::now().naive_local();
sqlx::query_as!(
PlayerInfo,
r#"

View File

@ -1,7 +1,4 @@
use std::future::Future;
use sqlx::Error;
use domain::dto::feedback::FeedbackAdd;
use domain::entities::feedback;
use domain::entities::feedback::Feedback;
use library::db;
use library::resp::pageable::Pageable;
@ -30,8 +27,6 @@ async fn get_feedback_count() -> i64 {
/// 添加反馈信息
pub async fn add_feedback(req: FeedbackAdd) -> ResResult<ResOK<()>> {
let now = chrono::Local::now().naive_local();
match Feedback::add_feedback(&mut Feedback{
user_id: req.user_id.unwrap(),
content: req.content.unwrap(),

View File

@ -1,6 +1,3 @@
use std::ptr::null;
use sqlx::Error;
use domain::entities::player_info;
use domain::dto::player_info::PlayerInfoRegister;
use domain::entities::player_info::PlayerInfo;
use library::db;
@ -22,8 +19,6 @@ pub async fn register(req: PlayerInfoRegister) -> ResResult<ResOK<()>> {
}
}
let now = chrono::Local::now().naive_local();
match PlayerInfo::add_player_info(
&mut PlayerInfo{
username: req.username.unwrap(),