Ver Fonte

增加企业登录验证,企业订单列表

林海涛 há 1 ano atrás
pai
commit
230a9f609d
1 ficheiros alterados com 78 adições e 0 exclusões
  1. 78 0
      app/api/lists/recharge/FirmOrderLists.php

+ 78 - 0
app/api/lists/recharge/FirmOrderLists.php

@@ -0,0 +1,78 @@
+<?php
+namespace app\api\lists\recharge;
+use app\api\lists\BaseApiDataLists;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\recharge\RechargeOrder;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/15 上午10:14
+ */
+class FirmOrderLists extends BaseApiDataLists implements ListsSearchInterface
+{
+
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['sn', 'payment_type','pay_way', 'pay_status','refund_status'],
+        ];
+    }
+    /**
+     * @notes 搜索条件
+     * @author 段誉
+     * @date 2023/2/24 16:08
+     */
+    public function queryWhere()
+    {
+        $where = [];
+        $where[] =  ['order_type','=',0];
+       // $where[] =  ['user_id','=',$this->userId];
+        // 创建时间
+        if (!empty($this->params['create_time'])) {
+            $time = [strtotime($this->params['create_time'][0]), strtotime($this->params['create_time'][1])];
+            $where[] = ['create_time', 'between', $time];
+        }
+        //更新时间
+        if (!empty($this->params['update_time'])) {
+            $time = [strtotime($this->params['update_time'][0]), strtotime($this->params['update_time'][1])];
+            $where[] = ['update_time', 'between', $time];
+        }
+        if (!empty($this->params['pay_time'])) {
+            $time = [strtotime($this->params['pay_time'][0]), strtotime($this->params['pay_time'][1])];
+            $where[] = ['pay_time', 'between', $time];
+        }
+        if (!empty($this->params['pay_time'])) {
+            $time = [strtotime($this->params['pay_time'][0]), strtotime($this->params['pay_time'][1])];
+            $where[] = ['pay_time', 'between', $time];
+        }
+
+        return $where;
+    }
+
+    public function lists(): array
+    {
+        $lists = RechargeOrder::with(['order_goods'=>function ($query) {
+            $query->visible(['goods_name','goods_image','goods_number','good_unit']);
+        },'service_work'=>function ($query) {
+            $query->visible(['service_status']);
+        }])
+            ->where($this->queryWhere())
+            ->where($this->searchWhere)
+            ->visible(['id','sn','order_type','order_total','order_amount','payment_type','pay_way','pay_status','create_time'])
+
+            ->order('id', 'desc')
+            ->select()
+            ->toArray();
+        return $lists;
+    }
+
+
+    /**
+     * @notes  获取数量
+     * @return int
+     */
+    public function count(): int
+    {
+        return RechargeOrder::where($this->queryWhere())->where($this->searchWhere)->count();
+    }
+}