| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com
- * =========================================================
- */
- namespace addon\fenxiao\shop\controller;
- use addon\fenxiao\model\FenxiaoStat;
- use addon\fenxiao\model\FenxiaoWithdraw as FenxiaoWithdrawModel;
- use app\shop\controller\BaseShop;
- /**
- * 分销等级管理
- */
- class Withdraw extends BaseShop
- {
- /**
- * 会员提现列表
- * @return mixed
- */
- public function lists()
- {
- $model = new FenxiaoWithdrawModel();
- $transfer_type_list = $model->getTransferType($this->site_id);
- if (request()->isAjax()) {
- $page = input('page', 1);
- $page_size = input('page_size', PAGE_LIST_ROWS);
- $withdraw_no = input('withdraw_no', '');
- $start_date = input('start_date', '');
- $end_date = input('end_date', '');
- $status = input('status', 'all');//提现状态
- $transfer_type = input('transfer_type', '');//提现转账方式
- $fenxiao_name = input('fenxiao_name', '');//提现转账方式
- $payment_start_date = input('payment_start_date', '');
- $payment_end_date = input('payment_end_date', '');
- $condition = [ [ 'fw.site_id', '=', $this->site_id ] ];
- if (!empty($withdraw_no)) {
- $condition[] = [ 'fw.withdraw_no', 'like', '%' . $withdraw_no . '%' ];
- }
- if (!empty($transfer_type)) {
- $condition[] = [ 'fw.transfer_type', '=', $transfer_type ];
- }
- if ($status != "all") {
- $condition[] = [ 'fw.status', '=', $status ];
- }
- if (!empty($fenxiao_name)) {
- $condition[] = [ 'm.nickname|fw.fenxiao_name', '=', $fenxiao_name ];
- }
- if ($start_date != '' && $end_date != '') {
- $condition[] = [ 'fw.create_time', 'between', [ strtotime($start_date), strtotime($end_date) ] ];
- } else if ($start_date != '' && $end_date == '') {
- $condition[] = [ 'fw.create_time', '>=', strtotime($start_date) ];
- } else if ($start_date == '' && $end_date != '') {
- $condition[] = [ 'fw.create_time', '<=', strtotime($end_date) ];
- }
- if ($payment_start_date != '' && $payment_end_date != '') {
- $condition[] = [ 'fw.payment_time', 'between', [ strtotime($payment_start_date), strtotime($payment_end_date) ] ];
- } else if ($payment_start_date != '' && $payment_end_date == '') {
- $condition[] = [ 'fw.payment_time', '>=', strtotime($payment_start_date) ];
- } else if ($payment_start_date == '' && $payment_end_date != '') {
- $condition[] = [ 'fw.payment_time', '<=', strtotime($payment_end_date) ];
- }
- $order = 'fw.create_time desc';
- $field = 'fw.*, m.headimg,m.nickname,m.mobile as member_mobile,m.headimg';
- $join = [
- [ 'member m', 'fw.member_id = m.member_id', 'left' ]
- ];
- $list = $model->getFenxiaoWithdrawPageList($condition, $page, $page_size, $order, $field, 'fw', $join);
- foreach ($list[ 'data' ][ 'list' ] as $k => $v) {
- $list[ 'data' ][ 'list' ][ $k ][ 'transfer_type_name' ] = $transfer_type_list[ $v[ 'transfer_type' ] ];
- }
- return $list;
- } else {
- $this->assign('transfer_type_list', $transfer_type_list);
- $fenxiao_stat_model = new FenxiaoStat();
- $fenxiao_balance_sum = $fenxiao_stat_model->getFenxiaoAccountSum($this->site_id)[ 'data' ] ?? [];
- $this->assign('fenxiao_balance_sum', $fenxiao_balance_sum);
- return $this->fetch("withdraw/lists");
- }
- }
- /**
- * 提现记录详情
- * @return mixed
- */
- public function detail()
- {
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $params = array (
- 'id' => input('id', 0),
- 'site_id' => $this->site_id
- );
- $detail = $fenxiao_withdraw_model->getFenxiaoWithdrawDetail($params)[ 'data' ] ?? [];
- if (empty($detail))
- $this->error('找不到提现账户记录');
- $this->assign('info', $detail);
- return $this->fetch('withdraw/detail');
- }
- /**
- * 同意
- * @return array
- */
- public function agree()
- {
- if (request()->isAjax()) {
- $id = input('id', 0);
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $params = array (
- 'site_id' => $this->site_id,
- "id" => $id,
- );
- $result = $fenxiao_withdraw_model->agree($params);
- return $result;
- }
- }
- /**
- * 拒绝
- * @return array
- */
- public function refuse()
- {
- if (request()->isAjax()) {
- $id = input('id', 0);
- $refuse_reason = input('refuse_reason', '');
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $data = array (
- "refuse_reason" => $refuse_reason,
- 'site_id' => $this->site_id,
- 'id' => $id
- );
- $result = $fenxiao_withdraw_model->refuse($data);
- return $result;
- }
- }
- /**
- * 转账
- */
- public function transferFinish()
- {
- if (request()->isAjax()) {
- $id = input('id', 0);
- $certificate = input('certificate', '');
- $certificate_remark = input('certificate_remark', '');
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $data = array (
- "id" => $id,
- "site_id" => $this->site_id,
- "certificate" => $certificate,
- "certificate_remark" => $certificate_remark,
- );
- $result = $fenxiao_withdraw_model->transferFinish($data);
- return $result;
- }
- }
- /**
- * 转账
- */
- public function transfer()
- {
- if (request()->isAjax()) {
- $id = input('id', 0);
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $result = $fenxiao_withdraw_model->transfer([ 'id' => $id, 'site_id' => $this->site_id ]);
- return $result;
- }
- }
- public function export()
- {
- $fenxiao_withdraw_model = new FenxiaoWithdrawModel();
- $withdraw_no = input('withdraw_no', '');
- $start_date = input('start_date', '');
- $end_date = input('end_date', '');
- $status = input('status', 'all');//提现状态
- $transfer_type = input('transfer_type', '');//提现转账方式
- $fenxiao_name = input('fenxiao_name', '');//提现转账方式
- $payment_start_date = input('payment_start_date', '');
- $payment_end_date = input('payment_end_date', '');
- $condition = [ [ 'site_id', '=', $this->site_id ] ];
- if (!empty($withdraw_no)) {
- $condition[] = [ 'withdraw_no', 'like', '%' . $withdraw_no . '%' ];
- }
- if (!empty($transfer_type)) {
- $condition[] = [ 'transfer_type', '=', $transfer_type ];
- }
- if ($status != "all") {
- $condition[] = [ 'status', '=', $status ];
- }
- if (!empty($fenxiao_name)) {
- $condition[] = [ 'fenxiao_name', '=', $fenxiao_name ];
- }
- if ($start_date != '' && $end_date != '') {
- $condition[] = [ 'create_time', 'between', [ strtotime($start_date), strtotime($end_date) ] ];
- } else if ($start_date != '' && $end_date == '') {
- $condition[] = [ 'create_time', '>=', strtotime($start_date) ];
- } else if ($start_date == '' && $end_date != '') {
- $condition[] = [ 'create_time', '<=', strtotime($end_date) ];
- }
- if ($payment_start_date != '' && $payment_end_date != '') {
- $condition[] = [ 'payment_time', 'between', [ strtotime($payment_start_date), strtotime($payment_end_date) ] ];
- } else if ($payment_start_date != '' && $payment_end_date == '') {
- $condition[] = [ 'payment_time', '>=', strtotime($payment_start_date) ];
- } else if ($payment_start_date == '' && $payment_end_date != '') {
- $condition[] = [ 'payment_time', '<=', strtotime($payment_end_date) ];
- }
- $order = 'create_time desc';
- $fenxiao_withdraw_model->exportFenxiaoWithdraw($condition, $order, $this->site_id);
- }
- //
- // public function test(){
- // $model = new FenxiaoWithdrawModel();
- // $data = array (
- // 'member_id' => 417,
- // 'transfer_type' => 'alipay',
- // 'realname' => $realname ?? 'zxczx',
- // 'bank_name' => $bank_name ?? '45yuik',
- // 'account_number' => $account_number ?? '43453',
- // 'apply_money' => $apply_money ?? '1',
- // 'mobile' => $mobile ?? '18541256985',
- // 'app_type' => $app_type ?? ''
- // );
- // $result = $model->apply($data, $this->site_id, 'shop');
- // dd($result);
- // }
- }
|