update
This commit is contained in:
parent
895fb8743b
commit
ccf555ac2f
@ -701,8 +701,7 @@ async def deliveryman_cancel_order(
|
|||||||
):
|
):
|
||||||
"""配送员取消订单"""
|
"""配送员取消订单"""
|
||||||
order = db.query(ShippingOrderDB).filter(
|
order = db.query(ShippingOrderDB).filter(
|
||||||
ShippingOrderDB.orderid == orderid,
|
ShippingOrderDB.orderid == orderid
|
||||||
ShippingOrderDB.deliveryman_user_id == deliveryman.userid
|
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if not order:
|
if not order:
|
||||||
|
|||||||
@ -504,7 +504,7 @@ async def change_password(
|
|||||||
if not redis_code:
|
if not redis_code:
|
||||||
return error_response(message="验证码已过期")
|
return error_response(message="验证码已过期")
|
||||||
|
|
||||||
if redis_code.decode() != request.verify_code:
|
if redis_code != request.verify_code:
|
||||||
return error_response(message="验证码错误")
|
return error_response(message="验证码错误")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -17,6 +17,8 @@ router = APIRouter()
|
|||||||
|
|
||||||
class WithdrawApproveRequest(BaseModel):
|
class WithdrawApproveRequest(BaseModel):
|
||||||
"""提现审核请求"""
|
"""提现审核请求"""
|
||||||
|
skip: int = Field(default=0)
|
||||||
|
limit: int = Field(default=20)
|
||||||
transaction_id: str = Field(..., max_length=64) # 银行交易流水号
|
transaction_id: str = Field(..., max_length=64) # 银行交易流水号
|
||||||
|
|
||||||
class WithdrawRejectRequest(BaseModel):
|
class WithdrawRejectRequest(BaseModel):
|
||||||
@ -150,18 +152,40 @@ async def reject_withdraw(
|
|||||||
@router.get("/user", response_model=ResponseModel)
|
@router.get("/user", response_model=ResponseModel)
|
||||||
async def get_user_withdraws(
|
async def get_user_withdraws(
|
||||||
status: Optional[WithdrawStatus] = None,
|
status: Optional[WithdrawStatus] = None,
|
||||||
|
skip: int = Field(default=0),
|
||||||
|
limit: int = Field(default=20),
|
||||||
db: Session = Depends(get_db),
|
db: Session = Depends(get_db),
|
||||||
current_user: UserDB = Depends(get_current_user)
|
current_user: UserDB = Depends(get_current_user)
|
||||||
):
|
):
|
||||||
"""获取提现记录列表"""
|
"""获取提现记录列表"""
|
||||||
query = db.query(WithdrawDB).filter(WithdrawDB.user_id == current_user.userid)
|
query = db.query(WithdrawDB).join(
|
||||||
|
UserBankCardDB,
|
||||||
|
WithdrawDB.bank_card_id == UserBankCardDB.id
|
||||||
|
).filter(WithdrawDB.user_id == current_user.userid)
|
||||||
|
|
||||||
if status:
|
if status:
|
||||||
query = query.filter(WithdrawDB.status == status)
|
query = query.filter(WithdrawDB.status == status)
|
||||||
|
|
||||||
|
total = query.count()
|
||||||
|
|
||||||
withdraws = query.order_by(WithdrawDB.create_time.desc()).all()
|
withdraws = query.order_by(WithdrawDB.create_time.desc()).offset(skip).limit(limit).all()
|
||||||
|
|
||||||
return success_response(data=[WithdrawInfo.model_validate(w) for w in withdraws])
|
withdraw_list = []
|
||||||
|
for w in withdraws:
|
||||||
|
withdraw_info = WithdrawInfo.model_validate(w)
|
||||||
|
# 添加额外信息
|
||||||
|
withdraw_info_dict = withdraw_info.model_dump()
|
||||||
|
withdraw_info_dict.update({
|
||||||
|
"bank_card_number": w.bank_card.card_number, # 银行卡号
|
||||||
|
"bank_name": w.bank_card.bank_name, # 银行名称
|
||||||
|
"name": w.bank_card.name, # 持卡人姓名
|
||||||
|
})
|
||||||
|
withdraw_list.append(withdraw_info_dict)
|
||||||
|
|
||||||
|
return success_response(data={
|
||||||
|
"items": withdraw_list,
|
||||||
|
"total": total
|
||||||
|
})
|
||||||
|
|
||||||
@router.get("", response_model=ResponseModel)
|
@router.get("", response_model=ResponseModel)
|
||||||
async def get_all_withdraws(
|
async def get_all_withdraws(
|
||||||
|
|||||||
@ -4,7 +4,7 @@ from sqlalchemy import Column, Integer, String, DECIMAL, DateTime, Enum
|
|||||||
from sqlalchemy.sql import func
|
from sqlalchemy.sql import func
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
from .database import Base
|
from .database import Base
|
||||||
|
from app.core.imageprocessor import process_image, ImageFormat
|
||||||
class CommunityStatus(str, enum.Enum):
|
class CommunityStatus(str, enum.Enum):
|
||||||
UNOPEN = "UNOPEN" # 未运营
|
UNOPEN = "UNOPEN" # 未运营
|
||||||
OPENING = "OPENING" # 已运营
|
OPENING = "OPENING" # 已运营
|
||||||
@ -23,6 +23,12 @@ class CommunityDB(Base):
|
|||||||
create_time = Column(DateTime(timezone=True), server_default=func.now())
|
create_time = Column(DateTime(timezone=True), server_default=func.now())
|
||||||
update_time = Column(DateTime(timezone=True), onupdate=func.now())
|
update_time = Column(DateTime(timezone=True), onupdate=func.now())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def optimized_qy_group_qrcode(self):
|
||||||
|
if self.qy_group_qrcode:
|
||||||
|
return process_image(self.qy_group_qrcode).thumbnail(600, 600).format(ImageFormat.WEBP).build()
|
||||||
|
return None
|
||||||
|
|
||||||
# Pydantic 模型
|
# Pydantic 模型
|
||||||
class CommunityCreate(BaseModel):
|
class CommunityCreate(BaseModel):
|
||||||
name: str = Field(..., max_length=100)
|
name: str = Field(..., max_length=100)
|
||||||
@ -48,6 +54,7 @@ class CommunityInfo(BaseModel):
|
|||||||
longitude: float
|
longitude: float
|
||||||
status: CommunityStatus
|
status: CommunityStatus
|
||||||
qy_group_qrcode: Optional[str] = None
|
qy_group_qrcode: Optional[str] = None
|
||||||
|
optimized_qy_group_qrcode: Optional[str] = None
|
||||||
distance: Optional[float] = None # 距离,单位:米
|
distance: Optional[float] = None # 距离,单位:米
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user