Initial project files: BESCMS full source
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php namespace Phpcmf\Controllers\Member;
|
||||
/**
|
||||
* https://www.besyun.com
|
||||
* BESCMS
|
||||
* 本文件是框架系统文件,二次开发时不可以修改本文件
|
||||
**/
|
||||
|
||||
class Pay extends \Phpcmf\Common
|
||||
{
|
||||
|
||||
/**
|
||||
* 提交支付账单
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
if (IS_POST) {
|
||||
$pay = \Phpcmf\Service::L('input')->post('pay');
|
||||
$pay['uid'] = (int)$this->member['uid'];
|
||||
$pay['username'] = (string)$this->member['username'];
|
||||
$money = floatval($pay['money']);
|
||||
if (!$money) {
|
||||
$this->_msg(0, dr_lang('金额(%s)不正确', $money));
|
||||
exit;
|
||||
}
|
||||
$rt = \Phpcmf\Service::M('Pay')->post($pay);
|
||||
if (!$rt['code']) {
|
||||
$this->_msg(0, $rt['msg'], $rt['data']);
|
||||
}
|
||||
$url = PAY_URL.'index.php?s=pay&id='.$rt['code'];
|
||||
if (IS_API_HTTP || (\Phpcmf\Service::L('input')->get('is_ajax') || IS_API_HTTP || IS_AJAX)) {
|
||||
// 回调页面
|
||||
$this->_json($rt['code'], $url, $rt['data']);
|
||||
} else {
|
||||
// 跳转到支付页面,必须跳转到统一的主域名中付款
|
||||
dr_redirect($url, 'auto');
|
||||
}
|
||||
exit;
|
||||
} else {
|
||||
$this->_msg(0, dr_lang('POST请求错误'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php namespace Phpcmf\Controllers\Member;
|
||||
|
||||
class Paylog extends \Phpcmf\Table
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// 支持附表存储
|
||||
$this->is_data = 0;
|
||||
// 表单显示名称
|
||||
$this->name = dr_lang('资金流水');
|
||||
// 初始化数据表
|
||||
$this->_init([
|
||||
'table' => 'member_paylog',
|
||||
'order_by' => 'inputtime desc',
|
||||
'date_field' => 'inputtime',
|
||||
]);
|
||||
}
|
||||
|
||||
// index
|
||||
public function index() {
|
||||
|
||||
$tid = (int)\Phpcmf\Service::L('input')->get('tid');
|
||||
$where = ['`uid`='.$this->uid];
|
||||
switch ($tid) {
|
||||
case 1: // 收入
|
||||
$where[] = '`value` > 0';
|
||||
break;
|
||||
case -1: // 消费
|
||||
$where[] = '`value` < 0';
|
||||
break;
|
||||
default : // 全部
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($this->member_cache['pay']['year']) && $this->member_cache['pay']['year']) {
|
||||
$year = (int)$this->member_cache['pay']['year'];
|
||||
if ($year) {
|
||||
$where[] = 'inputtime > '.strtotime('-'.$year.' year');
|
||||
}
|
||||
}
|
||||
|
||||
\Phpcmf\Service::M()->set_where_list(implode(' AND ', $where));
|
||||
list($tpl, $data) = $this->_List(['tid' => $tid]);
|
||||
|
||||
// 初始化
|
||||
$data['param']['tid'] = $data['param']['total'] = 0;
|
||||
|
||||
// 列出类别
|
||||
$my = [];
|
||||
$type = ['0' => '全部', '1' => '收入', '-1' => '消费'];
|
||||
foreach ($type as $i => $t) {
|
||||
$data['param']['tid'] = $i;
|
||||
$my[$i] = [
|
||||
'name' => dr_lang($t),
|
||||
'url' => dr_member_url('pay/paylog/index', $data['param'])
|
||||
];
|
||||
}
|
||||
|
||||
\Phpcmf\Service::V()->assign([
|
||||
'tid' => $tid,
|
||||
'type' => $my,
|
||||
]);
|
||||
|
||||
\Phpcmf\Service::V()->display('paylog_index.html');
|
||||
}
|
||||
|
||||
public function show() {
|
||||
|
||||
$id = \Phpcmf\Service::L('input')->get('id');
|
||||
if (strpos($id, '-') !== false) {
|
||||
list($a, $id) = explode('-', $id);
|
||||
}
|
||||
|
||||
list($a, $data) = $this->_Show((int)$id);
|
||||
if (!$data) {
|
||||
$this->_msg(0, dr_lang('交易记录不存在'));exit;
|
||||
} elseif ($data['uid'] != $this->uid) {
|
||||
$this->_msg(0, dr_lang('无权限查看'));exit;
|
||||
}
|
||||
|
||||
\Phpcmf\Service::V()->display('paylog_show.html');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php namespace Phpcmf\Controllers\Member;
|
||||
|
||||
class Recharge extends \Phpcmf\Common {
|
||||
|
||||
/**
|
||||
* 在线充值
|
||||
*/
|
||||
public function index() {
|
||||
define('FC_PAY', 1);
|
||||
$value = max(floatval(\Phpcmf\Service::L('input')->get('value')), floatval($this->member_cache['pay']['min']));
|
||||
\Phpcmf\Service::V()->assign([
|
||||
'payfield' => dr_payform('recharge', $value ? $value : '', '', '', 1),
|
||||
]);
|
||||
\Phpcmf\Service::V()->display('recharge_index.html');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user