-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from Enraged-Dun-Cookie-Development-Team/fix-…
…修复最新饼id 修复最新饼id在七牛云缺失
- Loading branch information
Showing
13 changed files
with
190 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::collections::HashMap; | ||
|
||
use ceobe_qiniu_upload::QiniuManager; | ||
use persistence::{operate::GetMutDatabaseConnect, redis::RedisConnect}; | ||
use qiniu_service::QiniuService; | ||
use qq_channel_warning::QqChannelGrpcService; | ||
use redis::AsyncCommands; | ||
use redis_global::redis_key::cookie_list::CookieListKey; | ||
|
||
use super::CeobeCookieLogic; | ||
use crate::error::LogicResult; | ||
|
||
impl CeobeCookieLogic { | ||
// 缓慢同步redis的combid数据到七牛云 | ||
pub async fn synchronous_qiniu_from_redis( | ||
redis_client: &mut RedisConnect, | ||
mut qq_channel: QqChannelGrpcService, qiniu: QiniuManager, | ||
) -> LogicResult<()> { | ||
let redis = redis_client.mut_connect(); | ||
let comb_ids: HashMap<String, String> = | ||
redis.hgetall(CookieListKey::NEWEST_COOKIES).await?; | ||
for (comb_id, cookie_id) in comb_ids.into_iter() { | ||
QiniuService::upload_newest_cookie_id_use_script( | ||
qiniu.clone(), | ||
cookie_id, | ||
&mut qq_channel, | ||
comb_id.to_owned(), | ||
) | ||
.await; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use axum::Router; | ||
pub use newest::CeobeCookieNewestBackend; | ||
|
||
use self::newest::newest_router; | ||
use crate::{ | ||
middleware::authorize::AuthorizeLayer, new_auth_level, | ||
utils::user_authorize::auth_level::prefabs::Chef, | ||
}; | ||
|
||
mod newest; | ||
|
||
pub(super) fn ceobe_cookie_router() -> crate::router::ServerRoute { | ||
Router::new() | ||
.nest("/newest", newest_router()) | ||
.route_layer(AuthorizeLayer::<CeobeCookieAuth>::new()) | ||
} | ||
|
||
new_auth_level! { | ||
pub CeobeCookieAuth=>[ | ||
Chef | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use axum::{routing::post, Router}; | ||
|
||
pub struct CeobeCookieNewestBackend; | ||
|
||
pub(super) fn newest_router() -> crate::router::ServerRoute { | ||
Router::new().route( | ||
"/synchronousCombId", | ||
post(CeobeCookieNewestBackend::synchronous_qiniu_from_redis), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod newest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use ceobe_cookie_logic::impletements::CeobeCookieLogic; | ||
use ceobe_qiniu_upload::QiniuManager; | ||
use persistence::redis::RedisConnect; | ||
use qq_channel_warning::QqChannelGrpcService; | ||
use resp_result::resp_try; | ||
use tracing::instrument; | ||
|
||
use super::error::CookieNewestRResult; | ||
use crate::router::CeobeCookieNewestBackend; | ||
|
||
impl CeobeCookieNewestBackend { | ||
#[instrument(ret, skip(redis_client, qiniu))] | ||
pub async fn synchronous_qiniu_from_redis( | ||
mut redis_client: RedisConnect, | ||
(qiniu, qq_channel): (QiniuManager, QqChannelGrpcService), | ||
) -> CookieNewestRResult<()> { | ||
resp_try(async move { | ||
CeobeCookieLogic::synchronous_qiniu_from_redis( | ||
&mut redis_client, | ||
qq_channel, | ||
qiniu, | ||
) | ||
.await?; | ||
Ok(()) | ||
}) | ||
.await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use ceobe_cookie_logic::error::LogicError; | ||
use resp_result::RespResult; | ||
|
||
use crate::error_generate; | ||
|
||
error_generate! { | ||
pub CookieNewestError | ||
|
||
LogicError = LogicError | ||
} | ||
|
||
pub type CookieNewestRResult<T> = RespResult<T, CookieNewestError>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod controllers; | ||
pub mod error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod bakery_mansion; | ||
pub mod ceobe_cookie; | ||
pub mod ceobe_operation; | ||
mod fetcher; | ||
mod user_auth; |