request->isPost()){ return $this->fail('请求方式错误'); } $params = $this->request->post(['page_no','page_size', 'user_info', 'start_time', 'end_time', 'sn', 'pay_way', 'pay_status' ]); $where = []; if (!empty($params['sn'])) { $where[] = ['ro.sn', '=', $params['sn']]; } if (!empty($params['pay_way'])) { $where[] = ['ro.pay_way', '=', $params['pay_way']]; } if (!empty($params['pay_status'])) { $where[] = ['ro.pay_status', '=', $params['pay_status']]; } if (!empty($params['user_info'])) { $where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $params['user_info'] . '%']; } if (!empty($params['start_time']) && !empty($params['end_time'])) { $where[] = ['ro.create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]]; } $pageNo = !empty($params['page_no']) ? $params['page_no'] : 1; $pageSize = !empty($params['page_size']) ? $params['page_size'] : 20; $field = 'ro.id,ro.sn,ro.order_amount,ro.pay_way,ro.pay_time,ro.pay_status,ro.create_time,ro.refund_status'; $field .= ',u.avatar,u.nickname,u.company_id'; $data = RechargeOrder::alias('ro') ->join('user u', 'u.id = ro.user_id') ->join('admin a', 'u.admin_id = a.id') ->join('company c', 'u.company_id = c.id') ->field($field) ->where($where) ->order('ro.id', 'desc') ->page($pageNo, $pageSize) ->append(['pay_status_text', 'pay_way_text']) ->select() ->toArray(); foreach ($data as &$item) { $item['avatar'] = FileService::getFileUrl($item['avatar']); $item['pay_time'] = empty($item['pay_time']) ? '' : date('Y-m-d H:i:s', $item['pay_time']); } $count = RechargeOrder::alias('ro') ->join('user u', 'u.id = ro.user_id') ->join('admin a', 'u.admin_id = a.id') ->join('company c', 'u.company_id = c.id') ->where($where)->count(); $result = [ 'lists' => $data, 'count' => $count, 'page_no' => $pageNo, 'page_size' => $pageSize ]; return $this->success('请求成功',$result); } /** * @notes 退款 * @return \think\response\Json * @author 段誉 * @date 2023/2/28 17:29 */ public function refund() { $params = (new RechargeRefundValidate())->post()->goCheck('refund'); $adminId = 1; $result = RechargeLogic::refund($params, $adminId); list($flag, $msg) = $result; if(false === $flag) { return $this->fail($msg); } return $this->success($msg, [], 1, 1); } }