pub struct RewardService;Expand description
奖励服务
Implementations§
Source§impl RewardService
impl RewardService
Sourcepub async fn get_reward_balance(
state: &AppState,
member_id: i32,
event_id: i32,
) -> ApiResult<EventBalanceDto>
pub async fn get_reward_balance( state: &AppState, member_id: i32, event_id: i32, ) -> ApiResult<EventBalanceDto>
查询活动余额
Sourcepub async fn exchange(
state: &AppState,
member_id: i32,
reward_id: i32,
exchange_number: i32,
event_id: i32,
) -> ApiResult<()>
pub async fn exchange( state: &AppState, member_id: i32, reward_id: i32, exchange_number: i32, event_id: i32, ) -> ApiResult<()>
兑换奖品:兑换类写获奖记录,抽奖类写入奖池。
§Errors
AppError::business("奖品不存在喵")— reward_id 无效AppError::business("余额不足喵")— 兑换余额不足AppError::Database— 数据库操作失败
Sourcepub async fn get_reward_record(
state: &AppState,
member_id: i32,
) -> ApiResult<Vec<RewardRecordResultDto>>
pub async fn get_reward_record( state: &AppState, member_id: i32, ) -> ApiResult<Vec<RewardRecordResultDto>>
兑换记录
Sourcepub async fn get_reward_tickets(
state: &AppState,
member_id: i32,
) -> ApiResult<Vec<RewardTicketResultDto>>
pub async fn get_reward_tickets( state: &AppState, member_id: i32, ) -> ApiResult<Vec<RewardTicketResultDto>>
奖券列表
Sourcepub async fn get_tickets_details(
state: &AppState,
member_id: i32,
) -> ApiResult<Vec<RewardTicketsDetailDto>>
pub async fn get_tickets_details( state: &AppState, member_id: i32, ) -> ApiResult<Vec<RewardTicketsDetailDto>>
奖券详情
Sourcepub async fn select_winner(
state: &AppState,
member_id: i32,
reward_id: i32,
event_id: i32,
winner_number: i32,
) -> ApiResult<Vec<RewardWinnerDto>>
pub async fn select_winner( state: &AppState, member_id: i32, reward_id: i32, event_id: i32, winner_number: i32, ) -> ApiResult<Vec<RewardWinnerDto>>
抽取中奖者
Sourcepub async fn change_end_time(
state: &AppState,
member_id: i32,
event_id: &str,
end_time: &str,
) -> ApiResult<()>
pub async fn change_end_time( state: &AppState, member_id: i32, event_id: &str, end_time: &str, ) -> ApiResult<()>
修改活动结束时间(对齐 Java:更新 rewardtb.deadLine)
Sourcepub async fn transfer(
state: &AppState,
from_id: i32,
body: RewardTicketTransferRequest,
) -> ApiResult<()>
pub async fn transfer( state: &AppState, from_id: i32, body: RewardTicketTransferRequest, ) -> ApiResult<()>
转账
Sourcepub async fn get_transfer_log(
state: &AppState,
member_id: i32,
) -> ApiResult<Vec<RewardTicketTransferLog>>
pub async fn get_transfer_log( state: &AppState, member_id: i32, ) -> ApiResult<Vec<RewardTicketTransferLog>>
转账日志
Auto Trait Implementations§
impl Freeze for RewardService
impl RefUnwindSafe for RewardService
impl Send for RewardService
impl Sync for RewardService
impl Unpin for RewardService
impl UnsafeUnpin for RewardService
impl UnwindSafe for RewardService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request