diff --git a/app/middleapi/controller/RechargeController.php b/app/middleapi/controller/RechargeController.php index e50e28bf7..8593e1715 100644 --- a/app/middleapi/controller/RechargeController.php +++ b/app/middleapi/controller/RechargeController.php @@ -2,7 +2,6 @@ namespace app\middleapi\controller; -use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\recharge\RechargeLogic; use app\adminapi\validate\recharge\RechargeRefundValidate; use app\common\model\recharge\RechargeOrder; diff --git a/app/middleapi/controller/RefundController.php b/app/middleapi/controller/RefundController.php new file mode 100644 index 000000000..3faf053c4 --- /dev/null +++ b/app/middleapi/controller/RefundController.php @@ -0,0 +1,108 @@ +success('', $result); + } + + + /** + * @notes 退款记录 + * @return \think\response\Json + * @author 段誉 + * @date 2023/3/1 9:47 + */ + public function record() + { + if(!$this->request->isPost()){ + return $this->fail('请求方式错误'); + } + $params = $this->request->post(['page_no','page_size', 'user_info', 'start_time', 'end_time', 'sn', 'order_sn', 'refund_type', 'refund_status']); + $where = []; + if (!empty($params['sn'])) { + $where[] = ['r.sn', '=', $params['sn']]; + } + if (!empty($params['order_sn'])) { + $where[] = ['r.order_sn', '=', $params['order_sn']]; + } + if (!empty($params['refund_type'])) { + $where[] = ['r.refund_type', '=', $params['refund_type']]; + } + 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[] = ['r.create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]]; + } + if (isset($params['refund_status']) && $params['refund_status'] != '') { + $where[] = ['r.refund_status', '=', $params['refund_status']]; + } + $pageNo = !empty($params['page_no']) ? $params['page_no'] : 1; + $pageSize = !empty($params['page_size']) ? $params['page_size'] : 20; + $lists = (new RefundRecord())->alias('r') + ->field('r.*,u.nickname,u.avatar') + ->join('user u', 'u.id = r.user_id') + ->order(['r.id' => 'desc']) + ->where($where) + ->page($pageNo, $pageSize) + ->append(['refund_type_text', 'refund_status_text', 'refund_way_text']) + ->select() + ->toArray(); + + foreach ($lists as &$item) { + $item['avatar'] = FileService::getFileUrl($item['avatar']); + } + $count = (new RefundRecord())->alias('r') + ->field('r.*,u.nickname,u.avatar') + ->join('user u', 'u.id = r.user_id') + ->order(['r.id' => 'desc']) + ->where($where)->count(); + $result = [ + 'lists' => $lists, + 'count' => $count, + 'page_no' => $pageNo, + 'page_size' => $pageSize + ]; + return $this->success('请求成功',$result); + } + + + /** + * @notes 退款日志 + * @return \think\response\Json + * @author 段誉 + * @date 2023/3/1 9:47 + */ + public function log() + { + $params = $this->request->post(['record_id']); + $recordId = $params['record_id'] ?? 0; + $result = RefundLogic::refundLog($recordId); + return $this->success('', $result); + } + +} \ No newline at end of file