Sfoglia il codice sorgente

优化支付控制器的字段验证逻辑,移除IP地址的必填检查;在收入记录实体中新增用户ID和创建时间的索引以提升查询性能。

wuyi 3 mesi fa
parent
commit
63c1e0eb29

+ 1 - 1
src/controllers/payment.controller.ts

@@ -14,7 +14,7 @@ export class PaymentController {
       const { userId, type } = request.body
       const ip = request.ip
 
-      if (!userId || !type || !ip) {
+      if (!userId || !type) {
         return reply.code(400).send({
           message: '缺少字段'
         })

+ 1 - 0
src/entities/income-records.entity.ts

@@ -18,6 +18,7 @@ export enum OrderType {
 
 @Entity()
 @Index('idx_agent_date_type', ['agentId', 'createdAt', 'incomeType'])
+@Index('idx_user_date', ['userId', 'createdAt'])
 @Index('idx_del_flag', ['delFlag'])
 @Index('idx_status', ['status'])
 export class IncomeRecords {