| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?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();
- }
- }
|