Kaynağa Gözat

收入功能查询优化

wuyi 3 ay önce
ebeveyn
işleme
99c95ae547

+ 5 - 5
src/entities/income-records.entity.ts

@@ -17,10 +17,10 @@ export enum OrderType {
 }
 
 @Entity()
-@Index('idx_agent_date_type', ['agentId', 'createdAt', 'incomeType'])
-@Index('idx_user_date', ['userId', 'createdAt'])
-@Index('idx_agent_date_del_type', ['agentId', 'createdAt', 'delFlag', 'incomeType'])
-@Index('idx_user_date_del', ['userId', 'createdAt', 'delFlag'])
+@Index('idx_status_del_created', ['status', 'delFlag', 'createdAt'])
+@Index('idx_agent_status_del_created', ['agentId', 'status', 'delFlag', 'createdAt'])
+@Index('idx_user_status_del_created', ['userId', 'status', 'delFlag', 'createdAt'])
+@Index('idx_order_no', ['orderNo'])
 export class IncomeRecords {
   @PrimaryGeneratedColumn()
   id: number
@@ -62,7 +62,7 @@ export class IncomeRecords {
   })
   orderPrice: number
 
-  @Column()
+  @Column({ length: 50 })
   orderNo: string
 
   @Column()

+ 2 - 5
src/services/income-records.service.ts

@@ -43,7 +43,6 @@ export class IncomeRecordsService {
       payChannel,
       payNo,
       resourceId,
-      status,
       startDate,
       endDate,
       select,
@@ -84,14 +83,12 @@ export class IncomeRecordsService {
       where.resourceId = resourceId
     }
 
-    if (status !== undefined) {
-      where.status = status
-    }
+    where.status = true
 
     if (startDate && endDate) {
       where.createdAt = Between(new Date(startDate), new Date(endDate))
     }
-    
+
     if (delFlag !== undefined) {
       where.delFlag = delFlag
     }