vr-shopxo-source/application/plugins/wallet/Recharge.php

193 lines
5.1 KiB
PHP
Executable File

<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\plugins\wallet;
use app\plugins\wallet\Common;
use app\plugins\wallet\service\BaseService;
/**
* 钱包 - 充值
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Recharge extends Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-15
* @desc description
*/
public function __construct()
{
parent::__construct();
}
/**
* 充值明细
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-03-15T23:51:50+0800
* @param [array] $params [输入参数]
*/
public function index($params = [])
{
// 参数
$params['user'] = $this->user;
// 分页
$number = MyC('admin_page_number', 10, true);
// 条件
$where = BaseService::RechargeWhere($params);
// 获取总数
$total = BaseService::RechargeTotal($where);
// 分页
$page_params = array(
'number' => $number,
'total' => $total,
'where' => $params,
'page' => isset($params['page']) ? intval($params['page']) : 1,
'url' => PluginsHomeUrl('wallet', 'recharge', 'index'),
);
$page = new \base\Page($page_params);
$this->assign('page_html', $page->GetPageHtml());
// 获取列表
$data_params = array(
'm' => $page->GetPageStarNumber(),
'n' => $number,
'where' => $where,
);
$data = BaseService::RechargeList($data_params);
$this->assign('data_list', $data['data']);
// 参数
$this->assign('params', $params);
return $this->fetch('../../../plugins/view/wallet/recharge/index');
}
/**
* 充值订单创建
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-03-15T23:51:50+0800
* @param [array] $params [输入参数]
*/
public function create($params = [])
{
// 是否ajax请求
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 用户
$params['user'] = $this->user;
return BaseService::RechargeCreate($params);
}
/**
* 支付
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-03-15T23:51:50+0800
* @param [array] $params [输入参数]
*/
public function pay($params = [])
{
// 用户
$params['user'] = $this->user;
return BaseService::Pay($params);
}
/**
* 支付状态校验
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-03-15T23:51:50+0800
* @param [array] $params [输入参数]
*/
public function paycheck($params = [])
{
if(input('post.'))
{
$params['user'] = $this->user;
return BaseService::RechargePayCheck($params);
} else {
$this->assign('msg', '非法访问');
return $this->fetch('public/tips_error');
}
}
/**
* 支付同步页面
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-29
* @desc description
* @param [array] $params [输入参数]
*/
public function respond($params = [])
{
$this->assign('msg', '支付失败');
return $this->fetch('public/pay_error');
}
/**
* 支付异步通知
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-04-29
* @desc description
* @param [array] $params [输入参数]
*/
public function notify($params = [])
{
$this->assign('msg', '支付成功');
return $this->fetch('public/pay_success');
}
/**
* 充值纪录删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-14
* @desc description
* @param [array] $params [输入参数]
*/
public function delete($params = [])
{
// 是否ajax请求
if(!IS_AJAX)
{
$this->error('非法访问');
}
// 开始处理
$params['user'] = $this->user;
return BaseService::RechargeDelete($params);
}
}
?>