246 lines
9.2 KiB
PHP
246 lines
9.2 KiB
PHP
<?php
|
|
/**
|
|
* B2B商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2023-2046 四川正今科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.viewsphp.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);
|
|
// }
|
|
} |