This commit is contained in:
你的名字
2025-07-14 10:22:40 +08:00
commit 0483b4b364
1388 changed files with 219353 additions and 0 deletions

View File

@ -0,0 +1,140 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 文章管理
* Class Item
* @package app\akszadmin\controller
*/
class Article extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcArticle';
/**
* 文章列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '文章列表';
$query = $this->_query($this->table)->alias('i')->field('i.*,t.name');
$query->join('lc_article_type t','i.type=t.id')->equal('i.type#i_type')->like('i.title#i_title')->dateBetween('i.time#i_time')->order('i.sort asc,i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->mlist = Db::name('LcArticleType')->select();
}
/**
* 添加文章
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加文章';
$this->assign('langss', [
['name' => '中文', 'value' => 'zh-cn'],
['name' => '英文', 'value' => 'en'],
['name' => '法文', 'value' => 'fr'],
['name' => '德文', 'value' => 'de'],
['name' => '西班牙文', 'value' => 'es'],
['name' => '意大利文', 'value' => 'it'],
['name' => '葡萄牙文', 'value' => 'pt'],
['name' => '俄文', 'value' => 'ru'],
['name' => '阿拉伯文', 'value' => 'ar'],
]);
$this->_form($this->table, 'form');
}
/**
* 编辑文章
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑文章';
$this->assign('langss', [
['name' => '中文', 'value' => 'zh-cn'],
['name' => '英文', 'value' => 'en'],
['name' => '法文', 'value' => 'fr'],
['name' => '德文', 'value' => 'de'],
['name' => '西班牙文', 'value' => 'es'],
['name' => '意大利文', 'value' => 'it'],
['name' => '葡萄牙文', 'value' => 'pt'],
['name' => '俄文', 'value' => 'ru'],
['name' => '阿拉伯文', 'value' => 'ar'],
]);
$this->_form($this->table, 'form');
}
/**
* 删除文章
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
$this->class = Db::name("LcArticleType")->order('id asc')->select();
if(!isset($vo['show'])) $vo['show'] = '1';
}
if (empty($vo['time'])) $vo['time'] = date("Y-m-d H:i:s");
}
}

View File

@ -0,0 +1,113 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )s
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 文章分类管理
* Class Item
* @package app\akszadmin\controller
*/
class ArticleType extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcArticleType';
/**
* 文章分类管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '文章分类管理';
$query = $this->_query($this->table)->like('name');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
/**
* 添加文章分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加文章分类';
$this->_form($this->table, 'form');
}
/**
* 编辑文章分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑文章分类';
$this->_form($this->table, 'form');
}
/**
* 删除文章分类
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isPost()&&empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s");
}
}

View File

@ -0,0 +1,180 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\service\AdminService;
use think\Db;
/**
* 系统权限管理
* Class Auth
* @package app\akszadmin\controller
*/
class Auth extends Controller
{
/**
* 默认数据模型
* @var string
*/
public $table = 'SystemAuth';
/**
* 系统权限管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '系统权限管理';
$query = $this->_query($this->table)->dateBetween('create_at');
$query->like('title,desc')->equal('status')->order('sort desc,id desc')->page();
}
/**
* 权限配置节点
* @auth true
* @throws \ReflectionException
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function apply()
{
$map = ['auth' => input('id', '0')];
$action = strtolower(input('action', ''));
if ($action === 'get') {
$checkeds = Db::name('SystemAuthNode')->where($map)->column('node');
$this->success('获取权限节点成功!', AdminService::instance()->getTree($checkeds));
} elseif ($action === 'save') {
list($post, $data) = [$this->request->post(), []];
foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
$data[] = ['auth' => $map['auth'], 'node' => $node];
}
Db::name('SystemAuthNode')->where($map)->delete();
Db::name('SystemAuthNode')->insertAll($data);
AdminService::instance()->apply(true);
$this->success('权限授权更新成功!', 'javascript:history.back()');
} else {
$this->title = '权限配置节点';
$this->_form($this->table, 'apply');
}
}
/**
* 添加系统权限
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 编辑系统权限
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 刷新系统权限
* @auth true
*/
public function refresh()
{
try {
AdminService::instance()->apply(true);
$this->success('刷新系统授权成功!');
} catch (\think\exception\HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error("刷新系统授权失败<br>{$e->getMessage()}");
}
}
/**
* 禁用系统权限
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function forbid()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '0']);
}
/**
* 启用系统权限
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function resume()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '1']);
}
/**
* 删除系统权限
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
/**
* 删除结果处理
* @param boolean $result
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
protected function _remove_delete_result($result)
{
if ($result) {
$map = ['auth' => $this->request->post('id')];
Db::name('SystemAuthNode')->where($map)->delete();
$this->success("权限删除成功!", '');
} else {
$this->error("权限删除失败,请稍候再试!");
}
}
}

View File

@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 银行卡管理
* Class Item
* @package app\akszadmin\controller
*/
class Bank extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcBank';
/**
* 银行卡列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '银行卡列表';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name as u_name');
$query->join('lc_user u','i.uid=u.id')->like('i.account#i_account,u.phone#u_phone,u.name#u_name')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
/**
* 编辑银行卡
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑银行卡';
$this->_form($this->table, 'form');
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if($this->request->isGet()){
$vo['phone'] = Db::name("LcUser")->where(['id'=>$vo['uid']])->value('phone');
}
}
/**
* 删除银行卡
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,131 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 提现管理
* Class Item
* @package app\akszadmin\controller
*/
class Cash extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcCash';
/**
* 提现记录
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '提现记录';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone');
$query->join('lc_user u','i.uid=u.id')
->equal('i.status#i_status')
->like('u.phone#u_phone,u.name#u_name')
->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
public function edit()
{
$this->applyCsrfToken();
if($this->request->isPost()) {
$id = $this->request->param('id');
$reaolae = $this->request->param('reaolae');
$cash = Db::name($this->table)->find($id);
if(!$cash){
$this->error('提现订单不存在');
}
if($cash['status'] != 0){
$this->error('提现订单已处理');
}
addFinance($cash['uid'], $cash['money'],1, '提现失败,返还金额' . $cash['money'] . '元');
setNumber('LcUser', 'money', $cash['money'], 1, "id = {$cash['uid']}");
$this->_save($this->table, ['reaolae'=>$reaolae,'status' => '2', 'time2' => date('Y-m-d H:i:s')]);
}else{
$this->title = '拒绝提现';
$id = $this->request->param('id');
$recharge = Db::name($this->table)->find($id);
if($recharge){
$recharge['username'] = Db::name("LcUser")->where(['id'=>$recharge['uid']])->value('phone');
}
$this->_form($this->table, 'edit');
}
}
/**
* 同意提现
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function agree()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '1', 'time2' => date('Y-m-d H:i:s')]);
}
/**
* 拒绝提现
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function refuse()
{
$this->applyCsrfToken();
$id = $this->request->param('id');
$cash = Db::name($this->table)->find($id);
addFinance($cash['uid'], $cash['money'],1, '提现失败,返还金额' . $cash['money'] . '元');
setNumber('LcUser', 'money', $cash['money'], 1, "id = {$cash['uid']}");
$this->_save($this->table, ['status' => '2', 'time2' => date('Y-m-d H:i:s')]);
}
/**
* 删除记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,130 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\exception\HttpResponseException;
use think\facade\Request;
/**
* 系统参数配置
* Class Config
* @package app\akszadmin\controller
*/
class Config extends Controller
{
/**
* 默认数据模型
* @var string
*/
protected $table = 'SystemConfig';
/**
* 阿里云OSS上传点
* @var array
*/
protected $ossPoints = [
'oss-cn-hangzhou.aliyuncs.com' => '华东 1 杭州',
'oss-cn-shanghai.aliyuncs.com' => '华东 2 上海',
'oss-cn-qingdao.aliyuncs.com' => '华北 1 青岛',
'oss-cn-beijing.aliyuncs.com' => '华北 2 北京',
'oss-cn-zhangjiakou.aliyuncs.com' => '华北 3 张家口',
'oss-cn-huhehaote.aliyuncs.com' => '华北 5 呼和浩特',
'oss-cn-shenzhen.aliyuncs.com' => '华南 1 深圳',
'oss-cn-hongkong.aliyuncs.com' => '香港 1',
'oss-us-west-1.aliyuncs.com' => '美国西部 1 硅谷',
'oss-us-east-1.aliyuncs.com' => '美国东部 1 弗吉尼亚',
'oss-ap-southeast-1.aliyuncs.com' => '亚太东南 1 新加坡',
'oss-ap-southeast-2.aliyuncs.com' => '亚太东南 2 悉尼',
'oss-ap-southeast-3.aliyuncs.com' => '亚太东南 3 吉隆坡',
'oss-ap-southeast-5.aliyuncs.com' => '亚太东南 5 雅加达',
'oss-ap-northeast-1.aliyuncs.com' => '亚太东北 1 日本',
'oss-ap-south-1.aliyuncs.com' => '亚太南部 1 孟买',
'oss-eu-central-1.aliyuncs.com' => '欧洲中部 1 法兰克福',
'oss-eu-west-1.aliyuncs.com' => '英国 1 伦敦',
'oss-me-east-1.aliyuncs.com' => '中东东部 1 迪拜',
];
/**
* 系统参数配置
* @auth true
* @menu true
*/
public function info()
{
$this->title = '系统参数配置';
$this->fetch();
}
/**
* 修改系统能数配置
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function config()
{
$this->applyCsrfToken();
if (Request::isGet()) {
$this->fetch('system-config');
}
foreach (Request::post() as $key => $value) {
sysconf($key, $value);
}
$this->success('系统参数配置成功!');
}
/**
* 文件存储引擎
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function file()
{
$this->applyCsrfToken();
if (Request::isGet()) {
$this->type = input('type', 'local');
$this->fetch("storage-{$this->type}");
}
$post = Request::post();
if (isset($post['storage_type']) && isset($post['storage_local_exts'])) {
$exts = array_unique(explode(',', strtolower($post['storage_local_exts'])));
sort($exts);
if (in_array('php', $exts)) $this->error('禁止上传可执行文件到本地服务器!');
$post['storage_local_exts'] = join(',', $exts);
}
foreach ($post as $key => $value) sysconf($key, $value);
if (isset($post['storage_type']) && $post['storage_type'] === 'oss') {
try {
$local = sysconf('storage_oss_domain');
$bucket = $this->request->post('storage_oss_bucket');
$domain = \library\File::instance('oss')->setBucket($bucket);
if (empty($local) || stripos($local, '.aliyuncs.com') !== false) {
sysconf('storage_oss_domain', $domain);
}
$this->success('阿里云OSS存储配置成功');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error("阿里云OSS存储配置失效{$e->getMessage()}");
}
} else {
$this->success('文件存储配置成功!');
}
}
}

View File

@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 流水记录
* Class Item
* @package app\akszadmin\controller
*/
class Finance extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcFinance';
/**
* 流水记录
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '流水记录';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.type#i_type')->like('i.reason#i_reason,u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->valueBetween('i.money')->order('i.id desc')->page();
}
/**
* 删除记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,171 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 产品管理
* Class Item
* @package app\akszadmin\controller
*/
class Goods extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcProduct';
protected $risk_table = 'LcRisk';
/**
* 产品列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '产品列表';
$query = $this->_query($this->table)->like('title');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
/**
* 添加产品
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加产品';
$this->_form($this->table, 'form');
}
/**
* 编辑产品
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑产品';
$this->_form($this->table, 'form');
}
/**
* 状态 开启或者关闭
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function iskqopen()
{
$this->applyCsrfToken();
$id = $this->request->param('id');
$iskq = $this->request->param('iskq');
$this->_save($this->table, ['iskq' => $iskq]);
}
public function showps(){
$this->applyCsrfToken();
$id = $this->request->param('id');
$iskq = $this->request->param('do');
$this->_save($this->table, ['showps' => $iskq]);
}
public function showps2(){
$this->applyCsrfToken();
$id = $this->request->param('id');
$iskq = $this->request->param('do');
$this->_save($this->table, ['showps2' => $iskq]);
}
/**
* 状态
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function proisopen()
{
$this->applyCsrfToken();
$id = $this->request->param('id');
$isopen = $this->request->param('isopen');
$this->_save($this->table, ['isopen' => $isopen]);
}
/**
* 删除产品
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
}
}
/**
* 风控管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function risk()
{
$this->title = '风控管理';
$this->_form($this->risk_table, 'risk');
}
}

View File

@ -0,0 +1,311 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\service\AdminService;
use library\service\MenuService;
use library\tools\Data;
use think\Console;
use think\Db;
use think\exception\HttpResponseException;
/**
* 系统公共操作
* Class Index
* @package app\akszadmin\controller
*/
class Index extends Controller
{
/**
* 获取在线人数
*/
public function online_user()
{
$now = time() - 300;
$online_user = Db::name('LcUser')->where("access_time > $now")->count();
return json(['code' => 200, 'data' => $online_user]);
}
/**
* 显示后台首页
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$this->title = '系统管理后台';
$auth = AdminService::instance()->apply(true);
if (!$auth->isLogin()) {
$this->redirect('@' . ADMIN_MODULE . '/login');
}
$this->menus = MenuService::instance()->getTree();
if (empty($this->menus) && !$auth->isLogin()) {
$this->redirect('@' . ADMIN_MODULE . '/login');
} else {
$this->fetch();
}
}
/**
* Describe:查询充值提现记录
* DateTime: 2020/5/15 0:54
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function check()
{
$auth = AdminService::instance()->apply(true);
if ($auth->isLogin()) {
$cash_count = Db::name("LcCash")->where(['status' => 0, 'warn' => 0])->count();
$firstDate = time();
$lastDate = time() + 300;
$Order_count = Db::name("LcOrder")->where("ostaus = 0 AND warn = 0 and kong_type = 0")->count();
$recharge_count = Db::name("LcRecharge")->where(['status' => 0, 'warn' => 0])->count();
if ($Order_count > 0) {
$this->success("您有{$Order_count}条新的订单记录,<a href='/" . ADMIN_MODULE . ".html#/" . ADMIN_MODULE . "/order/index.html?spm=m-109-111-116' style='color:#fc5531'>请查看</a>",
["url" => "/static/mp3/order.mp3_{$recharge_count}@{$cash_count}&{$Order_count}"]);
}
if ($cash_count > 0 && $recharge_count > 0) {
$this->success("您有{$cash_count}条新的提现记录和{$recharge_count}条新的充值记录,<a href='/" . ADMIN_MODULE . ".html#/" . ADMIN_MODULE . "/cash/index.html?spm=m-69-105-108' style='color:#50a14f'>请查看</a>",
["url" => "/static/mp3/cztx.mp3_{$recharge_count}@{$cash_count}&{$Order_count}"]);
}
if ($cash_count > 0 && $recharge_count == 0) {
$this->success("您有{$cash_count}条新的提现记录,<a href='/" . ADMIN_MODULE . ".html#/" . ADMIN_MODULE . "/cash/index.html?spm=m-69-105-108' style='color:#090 '>请查看</a>",
["url" => "/static/mp3/tx.mp3_{$recharge_count}@{$cash_count}&{$Order_count}"]);
}
if ($cash_count == 0 && 0 < $recharge_count) {
$this->success("您有{$recharge_count}条新的充值记录,<a href='/" . ADMIN_MODULE . ".html#/" . ADMIN_MODULE . "/recharge/index.html?spm=m-69-105-107' style='color:#ec494e'>请查看</a>",
["url" => "/static/mp3/cz.mp3_{$recharge_count}@{$cash_count}&{$Order_count}"]);
}
$this->error("暂无记录");
}
$this->error("请先登录");
}
/**
* Describe:忽略提醒
* DateTime: 2020/5/15 0:56
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function system_ignore()
{
$auth = AdminService::instance()->apply(true);
if ($auth->isLogin()) {
Db::name("LcCash")->where(['warn' => 0])->update(['warn' => 1]);
Db::name("LcRecharge")->where(['warn' => 0])->update(['warn' => 1]);
Db::name("LcOrder")->where(['warn' => 0])->update(['warn' => 1]);
$this->success("操作成功");
}
$this->error("请先登录");
}
/**
* 后台环境信息
*/
public function main()
{
/*$this->think_ver = \think\App::VERSION;
$this->mysql_ver = Db::query('select version() as ver')[0]['ver'];*/
$this->invest_count = Db::name('LcOrder')->sum('ploss');
$this->user_count = Db::name('LcUser')->count();
$this->recharge_sum = Db::name('LcRecharge')->where("status = 1")->sum('money');
$this->cash_sum = Db::name('LcCash')->where("status = 1")->sum('money');
$table = $this->finance_report();
$this->month = $table['month'];
$this->last_month = $table['last_month'];
$this->day = $table['day'];
$this->today_key = array_search(date('Y-m-d'), array_column($this->day, 'date'));
$now = time() - 300;
$this->online_user = Db::name('LcUser')->where("logintime > $now")->count();
$this->fetch();
}
private function finance_report()
{
$firstDate = strtotime(date('Y-m-01 00:00:00', strtotime(date("Y-m-d"))));
$lastDate = strtotime(date('Y-m-01 23:59:59', strtotime(date("Y-m-d"))) . " +1 month -1 day");
$month['recharge'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $firstDate AND $lastDate AND status = 1")->sum('money');
$month['cash'] = Db::name('LcCash')->where("UNIX_TIMESTAMP(time) BETWEEN $firstDate AND $lastDate AND status = 1")->sum('money');
$month['invest_list'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $firstDate AND $lastDate AND status = 1")->group('uid')->count();
$month['invest'] = Db::name('LcInvest')->where("UNIX_TIMESTAMP(time) BETWEEN $firstDate AND $lastDate")->count();
$month['invest_sum'] = Db::name('LcOrder')->where(" buytime BETWEEN $firstDate AND $lastDate")->sum('ploss');
$lastMonthFirstDate = strtotime(date('Y-m-01 00:00:00', strtotime(date("Y-m-d"))) . " -1 month");
$lastMonthLastDate = strtotime(date('Y-m-01 23:59:59', strtotime(date("Y-m-d"))) . " -1 day");
$lastMonth['recharge'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $lastMonthFirstDate AND $lastMonthLastDate AND status = 1")->sum('money');
$lastMonth['cash'] = Db::name('LcCash')->where("UNIX_TIMESTAMP(time) BETWEEN $lastMonthFirstDate AND $lastMonthLastDate AND status = 1")->sum('money');
$lastMonth['invest_list'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $lastMonthFirstDate AND $lastMonthLastDate AND status = 1")->group('uid')->count();
$lastMonth['invest'] = Db::name('LcInvest')->where("UNIX_TIMESTAMP(time) BETWEEN $lastMonthFirstDate AND $lastMonthLastDate")->count();
$lastMonth['invest_sum'] = Db::name('LcOrder')->where(" buytime BETWEEN $lastMonthFirstDate AND $lastMonthLastDate")->sum('ploss');
$monthDays = $this->getMonthDays();
foreach ($monthDays as $k => $v) {
$first = strtotime($v);
$last = $first + 86400 - 1;
$day[$k]['date'] = $v;
$day[$k]['recharge'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last AND status = 1")->sum('money');
$day[$k]['cash'] = Db::name('LcCash')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last AND status = 1")->sum('money');
$day[$k]['invest_list'] = Db::name('LcRecharge')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last AND status = 1")->group('uid')->count();
$day[$k]['new_user'] = Db::name('LcUser')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last")->count();
$day[$k]['invest'] = Db::name('LcInvest')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last")->count();
$day[$k]['invest_sum'] = Db::name('LcInvest')->where("UNIX_TIMESTAMP(time) BETWEEN $first AND $last")->sum('money');
$day[$k]['expire'] = Db::name('LcOrder')->where(" buytime BETWEEN $first AND $last")->sum('ploss');
$day[$k]['ordernumer'] = Db::name('LcOrder')->where(" buytime BETWEEN $first AND $last ")->count();
$day[$k]['interest'] = Db::name('LcOrder')->where(" buytime BETWEEN $first AND $last")->sum('fee');
}
return array('day' => $day, 'month' => $month, 'last_month' => $lastMonth);
}
/**
* 获取当前月已过日期
* @return array
*/
private function getMonthDays()
{
$monthDays = [];
$firstDay = date('Y-m-01', time());
$i = 0;
$now_day = date('d');
$lastDay = date('Y-m-d', strtotime("$firstDay +1 month -1 day"));
while (date('Y-m-d', strtotime("$firstDay +$i days")) <= $lastDay) {
// if($i>=$now_day) break;
$monthDays[] = date('Y-m-d', strtotime("$firstDay +$i days"));
$i++;
}
return $monthDays;
}
/**
* 修改密码
* @login true
* @param integer $id
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function pass($id)
{
$this->applyCsrfToken();
if (intval($id) !== intval(session('user.id'))) {
$this->error('只能修改当前用户的密码!');
}
if (!AdminService::instance()->isLogin()) {
$this->error('需要登录才能操作哦!');
}
if ($this->request->isGet()) {
$this->verify = true;
$this->_form('SystemUser', 'admin@user/pass', 'id', [], ['id' => $id]);
} else {
$data = $this->_input([
'password' => $this->request->post('password'),
'repassword' => $this->request->post('repassword'),
'oldpassword' => $this->request->post('oldpassword'),
], [
'oldpassword' => 'require',
'password' => 'require|min:4',
'repassword' => 'require|confirm:password',
], [
'oldpassword.require' => '旧密码不能为空!',
'password.require' => '登录密码不能为空!',
'password.min' => '登录密码长度不能少于4位有效字符',
'repassword.require' => '重复密码不能为空!',
'repassword.confirm' => '重复密码与登录密码不匹配,请重新输入!',
]);
$user = Db::name('SystemUser')->where(['id' => $id])->find();
if (md5($data['oldpassword']) !== $user['password']) {
$this->error('旧密码验证失败,请重新输入!');
}
if (Data::save('SystemUser', ['id' => $user['id'], 'password' => md5($data['password'])])) {
$this->success('密码修改成功,下次请使用新密码登录!', '');
} else {
$this->error('密码修改失败,请稍候再试!');
}
}
}
/**
* 修改用户资料
* @login true
* @param integer $id 会员ID
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function info($id = 0)
{
if (!AdminService::instance()->isLogin()) {
$this->error('需要登录才能操作哦!');
}
$this->applyCsrfToken();
if (intval($id) === intval(session('user.id'))) {
$this->_form('SystemUser', 'akszadmin@user/form', 'id', [], ['id' => $id]);
} else {
$this->error('只能修改登录用户的资料!');
}
}
/**
* 清理运行缓存
* @auth true
*/
public function clearRuntime()
{
try {
Console::call('clear');
Console::call('xclean:session');
$this->success('清理运行缓存成功!');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error("清理运行缓存失败,{$e->getMessage()}");
}
}
/**
* 压缩发布系统
* @auth true
*/
public function buildOptimize()
{
try {
Console::call('optimize:route');
Console::call('optimize:schema');
Console::call('optimize:autoload');
Console::call('optimize:config');
$this->success('压缩发布成功!');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error("压缩发布失败,{$e->getMessage()}");
}
}
}

View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 网站配置
* Class Item
* @package app\akszadmin\controller
*/
class Info extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcInfo';
protected $reward_table = 'LcReward';
/**
* 网站设置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function set()
{
$this->title = '网站设置';
$this->_form($this->table, 'form');
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isPost()&&isset($vo['ban_ip'])&&!empty($vo['ban_ip'])){
$vo['ban_ip'] = trim(str_replace('',',',$vo['ban_ip']));
}
}
/**
* 奖励设置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function reward()
{
$this->title = '奖励设置';
$this->_form($this->reward_table, 'reward');
}
/**
* 支付设置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function pay()
{
$this->title = '支付设置';
$this->_form($this->table, 'pay');
}
/**
* 图片设置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function img()
{
$this->title = '支付设置';
$this->_form($this->table, 'img');
}
}

View File

@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 已投项目管理
* Class Item
* @package app\akszadmin\controller
*/
class Invest extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcInvest';
/**
* 已投项目管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '已投项目管理';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.type1#i_type1')->like('i.title#i_title,u.phone#u_phone')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->tlist = Db::name('LcItemType')->select();
$this->profit = sprintf("%.2f",Db::name('LcInvestList')->where("status = 1 AND pay1 > 0")->sum('pay1'));
$this->un_profit = sprintf("%.2f",Db::name('LcInvestList')->where("status = 0 AND pay1 > 0")->sum('pay1'));
}
}

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 还款详情
* Class Item
* @package app\akszadmin\controller
*/
class InvestList extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcInvestList';
/**
* 还款详情
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '已投项目管理';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.iid#i_iid')->like('i.title#i_title,u.phone#u_phone')->dateBetween('i.time1#i_time1')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->refund = sprintf("%.2f",Db::name('LcInvestList')->where("status = 1 AND pay1 > 0")->sum('pay1'));
foreach($data as &$vo){
if($vo['status'] == '0') $vo['time2'] = '未返款';
}
}
}

View File

@ -0,0 +1,132 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 项目管理
* Class Item
* @package app\akszadmin\controller
*/
class Item extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcItem';
/**
* 项目管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '项目管理';
$query = $this->_query($this->table)->equal('type,class')->like('title');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->mlist = Db::name('LcItemClass')->select();
$this->tlist = Db::name('LcItemType')->select();
foreach ($data as &$vo) {
list($vo['pay_type'], $vo['item_class']) = [[], []];
foreach ($this->tlist as $type) if ($type['id'] == $vo['type']) $vo['pay_type'] = $type;
foreach ($this->mlist as $class) if ($class['id'] == $vo['class']) $vo['item_class'] = $class;
$vo['percent'] = model('akszadmin/item')->getProjectPercent($vo['id']);
}
}
/**
* 添加项目
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加项目';
$this->_form($this->table, 'form');
}
/**
* 编辑项目
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑项目';
$this->_form($this->table, 'form');
}
/**
* 删除项目
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
$vo['prize'] = isset($vo['prize'])?$vo['prize']:0;
$vo['integral'] = isset($vo['integral'])?$vo['integral']:0;
if (empty($vo['class']) && $this->request->get('class', '0')) $vo['class'] = $this->request->get('class', '0');
if (empty($vo['type']) && $this->request->get('type', '0')) $vo['type'] = $this->request->get('type', '0');
$this->class = Db::name("LcItemClass")->order('id asc')->select();
$this->type = Db::name("LcItemType")->order('id asc')->select();
}
if ($this->request->isPost()) {
if($vo['type']==2&&$vo['day']<7) $this->error("每周返息期限需大于等于7天");
if($vo['type']==3&&$vo['day']<30) $this->error("每月返息期限需大于等于30天");
}
if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s");
}
}

View File

@ -0,0 +1,121 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 项目分类管理
* Class Item
* @package app\akszadmin\controller
*/
class ItemClass extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcItemClass';
/**
* 项目分类管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '项目分类管理';
$query = $this->_query($this->table)->like('name');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->mlist = Db::name('LcUserMember')->select();
foreach ($data as &$vo) {
list($vo['member']) = [[]];
foreach ($this->mlist as $member) if ($member['id'] == $vo['member_id']) $vo['member'] = $member;
}
}
/**
* 添加项目分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加项目分类';
$this->_form($this->table, 'form');
}
/**
* 编辑项目分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑项目分类';
$this->_form($this->table, 'form');
}
/**
* 删除项目分类
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
if (empty($vo['member_id']) && $this->request->get('member_id', '0')) $vo['member_id'] = $this->request->get('member_id', '0');
$this->member = Db::name("LcUserMember")->order('id desc')->select();
}
if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s");
}
}

View File

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\service\AdminService;
use library\service\CaptchaService;
use library\service\SystemService;
use library\tools\Data;
use think\Db;
use think\facade\Request;
/**
* 用户登录管理
* Class Login
* @package app\akszadmin\controller
*/
class Login extends Controller
{
/**
* 后台登录入口
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
if (Request::isGet()) {
if (AdminService::instance()->isLogin()) {
$this->redirect('@' . ADMIN_MODULE);
} else {
$this->title = '系统登录';
$this->captcha_type = 'login_captcha';
$this->captcha_token = Data::uniqidDateCode(18);
$this->app->session->set($this->captcha_type, $this->captcha_token);
$this->devmode = SystemService::instance()->checkRunMode('dev');
$this->fetch();
}
} else {
$data = $this->_vali([
'username.require' => '登录账号不能为空!',
'username.min:4' => '登录账号长度不能少于4位有效字符',
'password.require' => '登录密码不能为空!',
'password.min:4' => '登录密码长度不能少于4位有效字符',
'verify.require' => '图形验证码不能为空!',
'uniqid.require' => '图形验证标识不能为空!',
]);
if (!CaptchaService::instance()->check($data['verify'], $data['uniqid'])) {
$this->error('图形验证码验证失败,请重新输入!');
}
// 用户信息验证
$map = ['is_deleted' => '0', 'username' => $data['username']];
$user = Db::name('SystemUser')->where($map)->order('id desc')->find();
if (empty($user)) {
$this->error('登录账号或密码错误请重新输入1!');
}
if (md5("{$user['password']}{$data['uniqid']}") !== $data['password']) {
$this->error('登录账号或密码错误请重新输入2!');
}
if (empty($user['status'])) {
$this->error('账号已经被禁用,请联系管理员!');
}
Db::name('SystemUser')->where(['id' => $user['id']])->update([
'login_ip' => Request::ip(),
'login_at' => Db::raw('now()'),
'login_num' => Db::raw('login_num+1'),
]);
$this->app->session->set('user', $user);
AdminService::instance()->apply(true);
sysoplog('系统管理', '用户登录系统后台成功');
$this->success('登录成功', url('@' . ADMIN_MODULE));
}
}
/**
* 生成验证码
* 需要指定类型及令牌
*/
public function captcha()
{
$image = CaptchaService::instance();
$this->type = input('type', 'captcha-type');
$this->token = input('token', 'captcha-token');
$captcha = ['image' => $image->getData(), 'uniqid' => $image->getUniqid()];
if ($this->app->session->get($this->type) === $this->token) {
$captcha['code'] = $image->getCode();
$this->app->session->delete($this->type);
}
$this->success('生成验证码成功', $captcha);
}
/**
* 退出登录
*/
public function out()
{
$this->app->session->clear();
$this->app->session->destroy();
$this->success('退出登录成功!', url('@' . ADMIN_MODULE . '/login'));
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 矿机管理
* Class Item
* @package app\akszadmin\controller
*/
class Mall extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcMall';
/**
* 矿机管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '矿机管理';
$query = $this->_query($this->table)->like('title');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
/**
* 添加矿机
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加矿机';
$this->_form($this->table, 'form');
}
/**
* 编辑矿机
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑矿机';
$this->_form($this->table, 'form');
}
/**
* 删除矿机
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isPost()) {
if($vo['total']<$vo['stock']) $this->error("矿机总量需大于剩余库存");
if($vo['day_income']<$vo['cost']) $this->error("日总产出需大于日运维费");
}
}
}

View File

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 已投矿机管理
* Class Item
* @package app\akszadmin\controller
*/
class MallInvest extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcMallInvest';
/**
* 已投项目管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '已投项目管理';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.type1#i_type1')->like('i.title#i_title,u.phone#u_phone')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
}
}

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 还款详情
* Class Item
* @package app\akszadmin\controller
*/
class MallInvestList extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcMallInvestList';
/**
* 还款详情
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '已租矿机管理';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.iid#i_iid')->like('i.title#i_title,u.phone#u_phone')->dateBetween('i.time1#i_time1')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->refund = sprintf("%.2f",Db::name('LcInvestList')->where("status = 1 AND pay1 > 0")->sum('pay1'));
foreach($data as &$vo){
if($vo['status'] == '0') $vo['time2'] = '挖矿中';
}
}
}

View File

@ -0,0 +1,93 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 会员等级管理
* Class Item
* @package app\akszadmin\controller
*/
class Member extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcUserMember';
/**
* 会员等级管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '会员等级管理';
$query = $this->_query($this->table)->like('name');
$query->order('id asc')->page();
}
/**
* 添加会员组
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加会员组';
$this->_form($this->table, 'form');
}
/**
* 编辑会员组
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑会员组';
$this->_form($this->table, 'form');
}
/**
* 删除会员组
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,160 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\service\MenuService;
use library\tools\Data;
use think\Db;
/**
* 系统菜单管理
* Class Menu
* @package app\akszadmin\controller
*/
class Menu extends Controller
{
/**
* 当前操作数据库
* @var string
*/
protected $table = 'SystemMenu';
/**
* 系统菜单管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '系统菜单管理';
$this->_page($this->table, false);
}
/**
* 列表数据处理
* @param array $data
*/
protected function _index_page_filter(&$data)
{
foreach ($data as &$vo) {
if ($vo['url'] !== '#') {
$vo['url'] = trim(url($vo['url']) . (empty($vo['params']) ? '' : "?{$vo['params']}"), '/\\');
}
$vo['ids'] = join(',', Data::getArrSubIds($data, $vo['id']));
}
$data = Data::arr2table($data);
}
/**
* 添加系统菜单
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 编辑系统菜单
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _form_filter(&$vo)
{
if ($this->request->isGet()) {
// 读取系统功能节点
$this->nodes = MenuService::instance()->getList();
// 选择自己的上级菜单
if (empty($vo['pid']) && $this->request->get('pid', '0')) $vo['pid'] = $this->request->get('pid', '0');
// 列出可选上级菜单
$menus = Db::name($this->table)->where(['status' => '1'])->order('sort desc,id asc')->column('id,pid,url,title');
$this->menus = Data::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']]));
if (isset($vo['id'])) foreach ($this->menus as $key => $menu) if ($menu['id'] === $vo['id']) $vo = $menu;
foreach ($this->menus as $key => &$menu) {
if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]);
if (isset($vo['spt']) && $vo['spt'] <= $menu['spt']) unset($this->menus[$key]);
}
}
}
/**
* 启用系统菜单
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function resume()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '1']);
}
/**
* 禁用系统菜单
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function forbid()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '0']);
}
/**
* 删除系统菜单
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,121 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 站内信管理
* Class Item
* @package app\akszadmin\controller
*/
class Msg extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcMsg';
/**
* 站内信列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '站内信列表';
$query = $this->_query($this->table)->like('phone');
$query->dateBetween('add_time')->order('sort asc,id dasc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
foreach($data as &$vo){
if(empty($vo['phone'])) $vo['phone'] = "所有人";
}
}
/**
* 添加站内信
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加站内信';
$this->_form($this->table, 'form');
}
/**
* 编辑站内信
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑站内信';
$this->_form($this->table, 'form');
}
/**
* 删除站内信
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
if(!isset($vo['top'])) $vo['top'] = '0';
}
if($this->request->isPost()) {
if($vo['phone']) $vo['uid'] = Db::name('LcUser')->where("phone = '{$vo['phone']}'")->value('id');
}
if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s");
}
}

View File

@ -0,0 +1,94 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 系统日志管理
* Class Oplog
* @package app\akszadmin\controller
*/
class Oplog extends Controller
{
/**
* 指定当前数据表
* @var string
*/
public $table = 'SystemLog';
/**
* 系统操作日志
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$this->title = '系统操作日志';
$query = $this->_query($this->table)->like('action,node,content,username,geoip');
$query->dateBetween('create_at')->order('id desc')->page();
}
/**
* 列表数据处理
* @auth true
* @param array $data
* @throws \Exception
*/
protected function _index_page_filter(&$data)
{
$ip = new \Ip2Region();
foreach ($data as &$vo) {
$result = $ip->btreeSearch($vo['geoip']);
$vo['isp'] = isset($result['region']) ? $result['region'] : '';
$vo['isp'] = str_replace(['内网IP', '0', '|'], '', $vo['isp']);
}
}
/**
* 清理系统日志
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function clear()
{
if (Db::name($this->table)->whereRaw('1=1')->delete() !== false) {
$this->success('日志清理成功!');
} else {
$this->error('日志清理失败,请稍候再试!');
}
}
/**
* 删除系统日志
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,130 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )s
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 持仓管理
* Class Item
* @package app\akszadmin\controller
*/
class Order extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcOrder';
/**
* 持仓列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '持仓列表';
$this->type = $this->request->param('type');
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name as u_name');
$query->leftjoin('lc_user u','i.uid=u.id')->like('u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 编辑持仓
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '查看';
$this->_form($this->table, 'form');
}
public function edits()
{
if(\think\facade\Request::isPost()){
$param = \think\facade\Request::param();
$id=$param['id'];
if($param['pid']){
$title=Db::name('LcProduct')->where(['id'=>$param['pid']])->value('title');
};
$datac['uid']=$param['uid'];
$datac['pid']=$param['pid'];
$datac['ptitle']=$title;
$datac['ostyle']=$param['ostyle'];
$datac['buyprice']=$param['buyprice'];
$datac['sellprice']=$param['sellprice'];
$datac['ploss']=$param['ploss'];
$datac['buytime']=strtotime($param['buytime']);
$datac['selltime']=strtotime($param['selltime']);
$this->_save($this->table, $datac);
}
$this->title = '编辑订单信息';
$this->goods = Db::name('LcProduct')->field("id,title")->order("sort asc,id desc")->select();
$this->_form($this->table, 'edits');
}
/**
* 改平仓
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function gaipingcang()
{
// $this->applyCsrfToken();
$id = $this->request->param('id');
$sellprice = $this->request->param('sellprice');
$this->_save($this->table, ['sellprice' => $sellprice]);
}
/*单控操作*/
public function dankong(){
$id = $this->request->param('oid');
$kong_type = $this->request->param('kong_type');
if($kong_type==3 ){
$risk = Db::name('LcRisk')->find();
$this->_save($this->table, ['kong_type' => $kong_type,'endloss'=>$risk['qybl']]);
}else if($kong_type==4){
$risk = Db::name('LcRisk')->find();
$this->_save($this->table, ['kong_type' => $kong_type,'lossrate'=>$risk['qkbl']]);
}else{
$this->_save($this->table, ['kong_type' => $kong_type]);
}
}
public function remove()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止删除!');
}
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 平仓日志管理
* Class Item
* @package app\akszadmin\controller
*/
class OrderLog extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcOrderLog';
/**
* 平仓日志列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '平仓日志列表';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name as u_name');
$query->leftjoin('lc_user u','i.uid=u.id')->like('u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 抽奖管理
* Class Item
* @package app\akszadmin\controller
*/
class Prize extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcPrize';
/**
* 抽奖设置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function set()
{
$this->title = '抽奖设置';
$this->_form($this->table, 'form');
}
}

View File

@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 抽奖记录
* Class Item
* @package app\akszadmin\controller
*/
class PrizeList extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcPrizeList';
/**
* 抽奖记录
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '抽奖记录';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name as u_name');
$query->join('lc_user u','i.uid=u.id')->equal('i.type#i_type')->like('u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 增减余额
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function add(){
$this->title = '添加抽奖记录';
$this->_form($this->table, 'form');
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if($this->request->isPost()){
if(!$vo['phone']) $this->error("用户账号必填");
if(!$vo['name']) $this->error("奖品名称必填");
$uid = Db::name("LcUser")->where(['phone'=>$vo['phone']])->value('id');
if(!$uid) $this->error("暂无该用户");
$vo['uid'] = $uid;
$vo['time'] = date('Y-m-d H:i:s');
}
}
/**
* 删除抽奖记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\service\ProcessService;
use think\Console;
use think\Db;
use think\exception\HttpResponseException;
/**
* 系统系统任务
* Class Queue
* @package app\akszadmin\controller
*/
class Queue extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'SystemQueue';
/**
* 系统系统任务
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
if (session('user.username') === 'admin') try {
$this->message = Console::call('xtask:state')->fetch();
$this->command = ProcessService::instance()->think('xtask:start');
$this->listen = preg_match('/process.*?\d+.*?running/', $this->message, $attr);
} catch (\Exception $exception) {
$this->listen = false;
$this->message = $exception->getMessage();
}
$this->title = '系统任务管理';
$this->iswin = ProcessService::instance()->iswin();
$query = $this->_query($this->table)->dateBetween('create_at,start_at,end_at');
$query->like('title,preload')->equal('status')->order('id desc')->page();
}
/**
* 重启系统任务
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function redo()
{
$this->_save($this->table, ['status' => '1']);
}
/**
* WIN开始监听任务
* @auth true
*/
public function start()
{
try {
$message = nl2br(Console::call('xtask:start')->fetch());
if (preg_match('/process.*?\d+/', $message, $attr)) {
$this->success('任务监听主进程启动成功!');
} else {
$this->error($message);
}
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error($e->getMessage());
}
}
/**
* WIN停止监听任务
* @auth true
*/
public function stop()
{
try {
$message = nl2br(Console::call('xtask:stop')->fetch());
if (stripos($message, 'succeeded')) {
$this->success('停止任务监听主进程成功!');
} elseif (stripos($message, 'finish')) {
$this->success('没有找到需要停止的进程!');
} else {
$this->error($message);
}
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $e) {
$this->error($e->getMessage());
}
}
/**
* 清理3天前的记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function clear()
{
$map = [['time', '<', strtotime('-3days')]];
$result = Db::name($this->table)->where($map)->delete();
if ($result !== false) {
$this->success('成功清理3天前的任务记录');
} else {
$this->error('清理3天前的任务记录失败');
}
}
/**
* 删除系统任务
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,175 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 充值管理
* Class Item
* @package app\akszadmin\controller
*/
class Recharge extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcRecharge';
/**
* 充值记录
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '充值记录';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name');
$query->join('lc_user u','i.uid=u.id')->equal('i.status#i_status')->like('i.orderid#i_orderid,i.type#i_type,u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->type = Db::name($this->table)->field('type')->group('type')->select();
$this->rejected = sprintf("%.2f",Db::name($this->table)->where("status = 2")->sum('money'));
$this->finished = sprintf("%.2f",Db::name($this->table)->where("status = 1")->sum('money'));
$this->reviewed = sprintf("%.2f",Db::name($this->table)->where("status = 0")->sum('money'));
}
public function edit()
{
$this->applyCsrfToken();
if($this->request->isPost()) {
$id = $this->request->param('id');
$reaolae = $this->request->param('reaolae');
$this->_save($this->table, ['reaolae'=>$reaolae,'status' => '2','time2' => date('Y-m-d H:i:s')]);
}else{
$this->title = '拒绝充值';
$id = $this->request->param('id');
$recharge = Db::name($this->table)->find($id);
if($recharge){
$recharge['username'] = Db::name("LcUser")->where(['id'=>$recharge['uid']])->value('phone');
}
$this->_form($this->table, 'edit');
}
}
/**
* 同意充值
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function agree()
{
$this->applyCsrfToken();
$id = $this->request->param('id');
$recharge = Db::name($this->table)->find($id);
if($recharge&&$recharge['status'] == 0){
$money = $recharge['money'];
$uid = $recharge['uid'];
$type = $recharge['type'];
addFinance($uid, $money,1, $type . '入款' . $money . '元');
setNumber('LcUser', 'money', $money, 1, "id = $uid");
$rechargeMoney = Db::name('LcFinance')->where('uid = '.$uid.' and reason like "%入款%"')->sum('money');
$level = Db::name('LcUserMember')->where('value <='.$rechargeMoney.' ')->order('level desc')->find();
if (!empty($level)){
Db::name('LcUser')->where('id', $uid)->update([
'level' => $level['level'],
'member' => $level['id'],
]);
}
// if($tid) setRechargeRebate($tid, $money);
if(getInfo('pay_bank_give') > 0 && $recharge['type'] == '银行入款'){
$money = $money * getInfo('pay_bank_give') /100;
addFinance($uid, $money, 1, '通过'.$type . '奖励' . $money . '元');
setNumber('LcUser', 'money', $money, 1, "id = $uid");
}
if(getInfo('gz_bankz') > 0 && $recharge['type'] == '公账入款'){
$money = $money * getInfo('gz_bankz') /100;
addFinance($uid, $money, 1, '通过'.$type . '奖励' . $money . '元');
setNumber('LcUser', 'money', $money, 1, "id = $uid");
}
if(getInfo('wx_bank_give') > 0 && $recharge['type'] == '微信转银行卡'){
$money = $money * getInfo('wx_bank_give') /100;
addFinance($uid, $money, 1, '通过'.$type . '奖励' . $money . '元');
setNumber('LcUser', 'money', $money, 1, "id = $uid");
}
if(getInfo('alipay_bank_give') > 0 && $recharge['type'] == '支付宝转银行卡'){
$money = $money * getInfo('alipay_bank_give') /100;
addFinance($uid, $money, 1, '通过'.$type . '奖励' . $money . '元');
setNumber('LcUser', 'money', $money, 1, "id = $uid");
}
$this->_save($this->table, ['status' => '1','time2' => date('Y-m-d H:i:s')]);
}
}
/**
* 增减余额
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function change(){
if(\think\facade\Request::isPost()){
$data = $this->request->param();
if(!$data['name']) $this->error("用户账号必填");
if(!$data['money']) $this->error("增减金额必填");
$uid = Db::name("LcUser")->where(['phone'=>$data['name']])->value('id');
if(!$uid) $this->error("暂无该用户");
addFinance($uid, $data['money'], $data['type'], $data['reason']);
setNumber('LcUser', 'money', $data['money'], $data['type'], "id = $uid");
$this->success("操作成功");
}
$this->fetch('form');
}
/**
* 拒绝充值
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function refuse()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '2','time2' => date('Y-m-d H:i:s')]);
}
/**
* 删除充值记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 积分商城
* Class Item
* @package app\akszadmin\controller
*/
class Shop extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcShop';
/**
* 商品列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '商品列表';
$query = $this->_query($this->table)->like('title');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->mlist = Db::name('LcArticleType')->select();
}
/**
* 添加商品
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加商品';
$this->_form($this->table, 'form');
}
/**
* 编辑商品
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑商品';
$this->_form($this->table, 'form');
}
/**
* 删除商品
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
if(!isset($vo['type'])) $vo['type'] = '1';
}
}
}

View File

@ -0,0 +1,62 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 兑换管理
* Class Item
* @package app\akszadmin\controller
*/
class ShopOrder extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcShopOrder';
/**
* 兑换列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '兑换列表';
$query = $this->_query($this->table)->alias('i')->field('i.*,u.phone,u.name as u_name');
$query->join('lc_user u','i.uid=u.id')->equal('i.type#i_type')->like('u.phone#u_phone,u.name#u_name')->dateBetween('i.time#i_time')->order('i.id desc')->page();
}
/**
* 删除兑换
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,103 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 轮播图管理
* Class Item
* @package app\akszadmin\controller
*/
class Slide extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcSlide';
/**
* 轮播图列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '轮播图列表';
$query = $this->_query($this->table);
$query->order('sort asc,id asc')->page();
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
if(!isset($vo['show'])) $vo['show'] = '1';
}
}
/**
* 添加轮播图
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加轮播图';
$this->_form($this->table, 'form');
}
/**
* 编辑轮播图
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑轮播图';
$this->_form($this->table, 'form');
}
/**
* 删除轮播图
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 文章分类管理
* Class Item
* @package app\akszadmin\controller
*/
class Sms extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcSms';
/**
* 短信模板管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '短信模板管理';
$query = $this->_query($this->table)->like('type');
$query->order('id asc')->page();
}
/**
* 编辑短信
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 启用短信
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function resume()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '1']);
}
/**
* 关闭短信
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function forbid()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '0']);
}
}

View File

@ -0,0 +1,202 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use library\tools\Data;
use think\Db;
use library\service\AdminService;
use library\service\MenuService;
/**
* 系统用户管理
* Class User
* @package app\akszadmin\controller
*/
class User extends Controller
{
/**
* 指定当前数据表
* @var string
*/
public $table = 'SystemUser';
/**
* 系统用户管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '系统用户管理';
$query = $this->_query($this->table)->like('username,phone,mail')->equal('status');
$query->dateBetween('login_at,create_at')->where(['is_deleted' => '0'])->order('id desc')->page();
}
/**
* 添加系统用户
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 编辑系统用户
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 修改用户密码
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function pass()
{
$this->applyCsrfToken();
if ($this->request->isGet()) {
$this->verify = false;
$this->_form($this->table, 'pass');
} else {
$post = $this->request->post();
if ($post['password'] !== $post['repassword']) {
$this->error('两次输入的密码不一致!');
}
if (Data::save($this->table, ['id' => $_SESSION['fw']['user']['id'], 'password' => md5($post['password'])], 'id')) {
$this->success('密码修改成功,下次请使用新密码登录!', '');
} else {
$this->error('密码修改失败,请稍候再试!');
}
}
}
/**
* 后台加密
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function suffix() {
$this->applyCsrfToken();
$adminModuleFile = env('root_path') . '/admin_module.php';
if ($this->request->isGet()) {
if (file_exists($adminModuleFile)) {
$this->adminModule = include $adminModuleFile;
}
return $this->fetch();
} else {
$suffix = $this->request->post('suffix');
if (!preg_match('/^([0-9a-zA-Z]+)$/', $suffix)) {
$this->error('后台加密后缀只能包含数字/大小写英文!');
}
if (file_put_contents($adminModuleFile, "<?php return '$suffix';")) {
$this->success('后台加密后缀修改成功!', url("@$suffix"));
} else {
$this->error('后台加密后缀修改失败,请稍候再试!');
}
}
}
/**
* 表单数据处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function _form_filter(&$data)
{
if ($this->request->isPost()) {
// 用户权限处理
$data['authorize'] = (isset($data['authorize']) && is_array($data['authorize'])) ? join(',', $data['authorize']) : '';
// 用户账号重复检查
if (isset($data['id'])) unset($data['username']);
elseif (Db::name($this->table)->where(['username' => $data['username'], 'is_deleted' => '0'])->count() > 0) {
$this->error("账号{$data['username']}已经存在,请使用其它账号!");
}
} else {
$data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : '');
$this->authorizes = Db::name('SystemAuth')->where(['status' => '1'])->order('sort desc,id desc')->select();
}
}
/**
* 禁用系统用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function forbid()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止操作!');
}
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '0']);
}
/**
* 启用系统用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function resume()
{
$this->applyCsrfToken();
$this->_save($this->table, ['status' => '1']);
}
/**
* 删除系统用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止删除!');
}
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,281 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 会员管理
* Class Item
* @package app\akszadmin\controller
*/
class Users extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcUser';
/**
* 会员列表
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '会员列表';
$query = $this->_query($this->table)->alias('u')->field('u.*,m.name as m_name');
if (input('get.online_user/d') === 1) {
$query->order('u.access_time', 'desc');
}
$query->join('lc_user_member m',
'u.member=m.id')->equal('u.auth#u_auth,u.clock#u_clock,u.member#u_member')
->like('u.ip#i_orderid,u.phone#u_phone,u.name#u_name,u.ip#u_ip')
->dateBetween('u.time#u_time')
->order('u.id desc')->page();
}
/**
* 状态 开启或者关闭
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function iskqopen()
{
$id = $this->request->param('id');
$iskq = $this->request->param('iskq');
$this->_save($this->table, ['isjy' => $iskq]);
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->member = Db::name("lc_user_member")->field('id,name')->select();
$ip = new \Ip2Region();
foreach ($data as &$vo) {
$vo['online'] = $vo['access_time'] > (time() - 300) ? 1 : 0;
$vo['top'] = Db::name("lc_user")->where("id = {$vo['top']}")->value('phone');
$vo['cash_sum'] = Db::name("lc_cash")->where("uid = {$vo['id']} AND status = '1'")->sum('money');
$vo['recharge_sum'] = Db::name("lc_recharge")->where("uid = {$vo['id']} AND status = '1'")->sum('money');
$vo['invest_sum'] = Db::name('lc_invest')->where("uid = {$vo['id']}")->sum('money');
$vo['wait_invest'] = Db::name('lc_invest_list')->where("uid = {$vo['id']} AND pay1 > 0 AND status = 0")->sum('money1');
$vo['wait_money'] = Db::name('lc_invest_list')->where("uid = {$vo['id']} AND money2 > 0 AND status = 0")->sum('money2');
$result = $ip->btreeSearch($vo['ip']);
$vo['isp'] = isset($result['region']) ? $result['region'] : '';
$vo['isp'] = str_replace(['内网IP', '0', '|'], '', $vo['isp']);
$result2 = $ip->btreeSearch($vo['loginip']);
$vo['isp2'] = isset($result2['region']) ? $result2['region'] : '';
$vo['isp2'] = str_replace(['内网IP', '0', '|'], '', $vo['isp2']);
}
}
public function user_relation()
{
$this->title = '会员关系网';
if ($this->request->isGet()) {
$list = [];
$phone = $this->request->param('phone');
$type = $this->request->param('type');
if ($type == 1) {
$top = Db::name('LcUser')->where(['phone' => $phone])->value('top');
if ($top) {
$list = Db::name('LcUser')->where(['id' => $top])->select();
}
} else {
$uid = Db::name('LcUser')->where(['phone' => $phone])->value('id');
if ($uid) {
$list = Db::name('LcUser')->where(['top' => $uid])->select();
}
}
if ($list) {
foreach ($list as &$v) {
$vo['top_phone'] = '';
if ($v['top']) {
$vo['top_phone'] = Db::name('LcUser')->where(['id' => $v['top']])->value('phone');
}
}
}
$this->assign('list', $list);
}
$this->fetch();
}
/**
* 表单数据处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function _form_filter(&$vo)
{
if ($this->request->isPost()) {
if ($vo['mwpassword']) {
$vo['password'] = md5($vo['mwpassword']);
}
if ($vo['mwpassword2']) {
$vo['password2'] = md5($vo['mwpassword2']);
}
if (isset($vo['id'])) {
$money = Db::name($this->table)->where("id = {$vo['id']}")->value('money');
if ($money && $money != $vo['money']) {
$handle_money = $money - $vo['money'];
$type = $handle_money > 0 ? 2 : 1;
model('akszadmin/Users')->addFinance($vo['id'], abs($handle_money), $type, '系统操作');
}
if (!empty($vo['bank'])) {
Db::name("LcBank")->where('uid', $vo['id'])->update([
'bank' => $vo['bank'],
'area' => $vo['area'],
'account' => $vo['account']
]);
}
} else {
$vo['time'] = date('Y-m-d H:i:s');
}
} else {
if (!isset($vo['auth'])) {
$vo['auth'] = '0';
}
$this->member = Db::name("LcUserMember")->order('id desc')->select();
}
}
/**
* 添加用户
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->applyCsrfToken();
$this->_form($this->table, 'form');
}
/**
* 编辑用户
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->applyCsrfToken();
$uid = $this->request->param('id');
$this->bankinfo = Db::name("LcBank")->where("uid = {$uid}")->order('id desc')->find();
$this->_form($this->table, 'form');
}
/**
* 实名认证审核
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function review()
{
$this->title = '实名认证审核';
$this->id = input('id');
if ($this->request->isGet()) {
$user = Db::name("LcUser")->where("id = {$this->id}")->find();
$this->assign('user', $user);
$this->fetch();
}else{
$id = input('id');
$rz_status = input('rz_status');
$name = input('name');
$idcard = input('idcard');
$res = Db::name("LcUser")->where("id = {$id}")->update(['name'=>$name,'idcard'=>$idcard,'rz_status'=>$rz_status]);
if($res){
$this->success('审核成功');
}else{
$this->error('审核失败');
}
}
}
/**
* 禁用用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function forbid()
{
$this->applyCsrfToken();
$this->_save($this->table, ['clock' => '0']);
}
/**
* 启用用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function resume()
{
$this->applyCsrfToken();
$this->_save($this->table, ['clock' => '1']);
}
public function setrobot()
{
$this->applyCsrfToken();
$this->_save($this->table, ['robot' => $_POST['clock']]);
}
/**
* 删除用户
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}

View File

@ -0,0 +1,220 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 流水记录
* Class Item
* @package app\akszadmin\controller
*/
class Yuebao extends Controller
{
/**
* 绑定数据表
* @var string
*/
/**
* 流水记录
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
//$list=Db::name('lc_yuebao')->where('id',">",0)->select();
$query = $this->_query('lc_yuebao')->where("id > 0 and status < 5");
$query->order('id desc')->page();
//$this->assign('list',$list);
$this->fetch();
}
/**
* 删除记录
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function lists()
{
$list=Db::name('lc_yuebao_lists')->where("status < 5")->order('id desc')->select();
$lists=array();
foreach($list as $x=>$v){
$v['start_time']=date('Y-m-d H:i:s',$v['start_time']);
$v['end_time']=date('Y-m-d H:i:s',$v['end_time']);
$lists[$x]=$v;
}
$counttotal=count($list);
$counttotalmoney=Db::name('lc_yuebao_lists')->where("status = 1")->sum('money');
$countdoing=Db::name('lc_yuebao_lists')->where("status = 1")->count();
$countnosend=Db::name('lc_yuebao_lists')->where("status = 1")->sum('nowprofit');
$countsended=Db::name('lc_yuebao_log')->where("status = 2")->sum('nowprofit');
//$list=$lists;
$this->assign('list',$lists);
$this->assign('counttotal',$counttotal);
$this->assign('counttotalmoney',round($counttotalmoney,4));
$this->assign('countdoing',$countdoing);
$this->assign('countnosend',round($countnosend,4));
$this->assign('countsended',round($countsended,4));
$query = $this->_query('lc_yuebao_lists')->where("status < 5");
$query->order('id desc')->page();
//var_dump($list);die;
$this->fetch();
//$this->fetch();
}
public function yebdel(){
if($_SESSION['fw']['user']['username']=="admin"){
Db::name('lc_yuebao')->where("id = ".$_GET['id'])->update(['status'=>9]);
return "OK";
}else{
return "false";
}
}
public function yebstop(){
if($_SESSION['fw']['user']['username']=="admin"){
$getstatus=Db::name('lc_yuebao')->where("id = ".$_GET['id'])->find();
if($getstatus['status']==0) Db::name('lc_yuebao')->where("id = ".$_GET['id'])->update(['status'=>1]);
if($getstatus['status']==1) Db::name('lc_yuebao')->where("id = ".$_GET['id'])->update(['status'=>0]);
//Db::name('lc_yuebao')->where("id = ".$_GET['id'])->update(['status'=>0]);
return "OK";
}else{
return "false";
}
}
public function yebadd(){
if($_SESSION['fw']['user']['username']!="admin"){return "非法访问";exit;die;}
if(empty($_POST)){return "数据错误!";exit;die;}
$adddata=array(
'title'=>$_POST['title'],
'lily'=>$_POST['lily'],
'days'=>$_POST['days'],
'advise'=>0,
'lowmoney'=>$_POST['lowmoney'],
'stars'=>$_POST['stars'],
'addtime'=>time(),
'status'=>$_POST['status'],
);
$ok=Db::name('lc_yuebao')->insert($adddata);
return $ok==1?"OK":"false";die;
}
public function yebedit(){
if($_SESSION['fw']['user']['username']!="admin"){return "非法访问";exit;die;}
if(empty($_POST)){return "数据错误!";exit;die;}
$adddata=array(
'title'=>$_POST['title'],
'lily'=>$_POST['lily'],
'days'=>$_POST['days'],
'advise'=>0,
'lowmoney'=>$_POST['lowmoney'],
'stars'=>$_POST['stars'],
'addtime'=>time(),
'status'=>$_POST['status'],
);
$ok=Db::name('lc_yuebao')->where('id = '.$_POST['yebid'])->update($adddata);
return $ok==1?"OK":"false";die;
}
public function yebgetbyid(){
$res=Db::name('lc_yuebao')->where('id = '.$_GET['id'])->find();
return $res;
}
public function listclear(){
if($_SESSION['fw']['user']['username']!="admin"){return "非法访问";exit;die;}
if(empty($_POST)){return "数据错误!";exit;die;}
$getlistinfo=Db::table('lc_yuebao_lists')->where('id='.$_POST['id'])->find();
if($getlistinfo['status']!=1 or empty($getlistinfo)){return "操作失败:订单无法操作!";die;}
$getuserinfo=Db::table('lc_user')->where('id='.$getlistinfo['uid'])->find();
if(!empty($getuserinfo)){
Db::table('lc_yuebao_lists')->where('id='.$_POST['id'])->update(['status'=>2,'end_time'=>time()]);
//记录日志!
unset($getlistinfo['id']);
$getlistinfo['status']=2;
$getlistinfo['end_time']=time();
$getlistinfo['balance']=$getuserinfo['money'];
$getlistinfo['closetime']=time();
$getlistinfo['remarks']="管理员".$_SESSION['fw']['user']['username']."人工结算";
Db::table('lc_yuebao_log')->insert($getlistinfo);
//更新用户余额
$newbalance=$getuserinfo['money']+$getlistinfo['nowprofit']+$getlistinfo['money'];
Db::table('lc_user')->where('id='.$getlistinfo['uid'])->update(['money'=>$newbalance]);
//更新UC
$where['uid']=$getlistinfo['uid'];
$yebucinfo=Db::table('lc_yuebao_uc')->where($where)->find();
$newbalance=$yebucinfo['balance']-$getlistinfo['money'];
Db::table('lc_yuebao_uc')->where($where)->update(['balance'=>$newbalance]);
//再做UCLOG
$yebuclog=array(
'uid'=>$getlistinfo['uid'],
'balance'=>$yebucinfo['balance'],
'money'=>$getlistinfo['money'],
'addtime'=>time(),
'remarks'=>"用户购买理财方案:".$getlistinfo['yebtitle']
);
Db::table('lc_yuebao_uclog')->insert($yebuclog);
return "ok";
}else{
return "操作失败:订单无法操作!";
}
die;
//更新参保状态。
}
public function listkeep(){
if($_SESSION['fw']['user']['username']!="admin"){return "非法访问";exit;die;}
if(empty($_POST)){return "数据错误!";exit;die;}
$getlistinfo=Db::table('lc_yuebao_lists')->where('id='.$_POST['id'])->find();
if($getlistinfo['status']==2){
$getlistinfo['start_time']=time();
$getlistinfo['end_time']=time()+$getlistinfo['days']*86400;
$getlistinfo['status']=1;
$getlistinfo['nowprofit']=0;
}elseif($getlistinfo['status']==1){
$getlistinfo['end_time']=$getlistinfo['end_time']+$getlistinfo['days']*86400;
}
unset($getlistinfo['id']);
Db::table('lc_yuebao_lists')->where('id='.$_POST['id'])->update($getlistinfo);
return "操作成功";die;
}
public function listdel(){
if($_SESSION['fw']['user']['username']!="admin"){return "非法访问";exit;die;}
if(empty($_POST)){return "数据错误!";exit;die;}
Db::name('lc_yuebao')->where("id = ".$_GET['id'])->update(['status'=>9]);
return "OK";die;
}
}

View File

@ -0,0 +1,150 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller\api;
use GdImageClass;
use Kaadon\Helper\GdImageHelper;
use library\Controller;
use library\File;
/**
* 后台插件管理
* Class Plugs
* @package app\akszadmin\controller\api
*/
class Plugs extends Controller
{
/**
* 系统图标选择器
*/
public function icon()
{
$this->title = '图标选择器';
$this->field = input('field', 'icon');
$this->fetch();
}
/**
* 获取文件上传参数
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function check()
{
$diff1 = explode(',', strtolower(input('exts', '')));
$diff2 = explode(',', strtolower(sysconf('storage_local_exts')));
$exts = array_intersect($diff1, $diff2);
$this->success('获取文件上传参数', [
'exts' => join('|', $exts),
'mime' => File::mine($exts),
'type' => $this->getUploadType(),
'data' => $this->getUploadData(),
]);
}
/**
* 后台通用文件上传
* @login true
* @return \think\response\Json
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function upload()
{
if (!($file = $this->getUploadFile()) || empty($file)) {
return json(['uploaded' => false, 'error' => ['message' => '文件上传异常,文件可能过大或未上传']]);
}
if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
return json(['uploaded' => false, 'error' => ['message' => '文件上传类型受限,请在后台配置']]);
}
if ($file->checkExt('php,sh')) {
return json(['uploaded' => false, 'error' => ['message' => '可执行文件禁止上传到本地服务器']]);
}
$this->safe = boolval(input('safe'));
$this->uptype = $this->getUploadType();
$this->extend = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
if ($this->uptype === 'local' && GdImageClass::isSupportSuffix($this->extend)) {
try {
(new GdImageClass($file->getRealPath(),$this->extend))->convertTo($file->getRealPath(), 'webp');
$file= new \think\File($file->getRealPath());
$this->extend = 'webp';
} catch (\Exception $exception) {
return json(['uploaded' => false, 'error' => ['message' => '文件处理失败: ' . $exception->getMessage()]]);
}
}
/** @noinspection DuplicatedCode */
$name = File::name($file->getPathname(), $this->extend, '', 'md5_file');
$info = File::instance($this->uptype)->save($name, file_get_contents($file->getRealPath()), $this->safe);
if (is_array($info) && isset($info['url'])) {
return json(['uploaded' => true, 'filename' => $name, 'url' => $this->safe ? $name : $info['url']]);
} else {
return json(['uploaded' => false, 'error' => ['message' => '文件处理失败,请稍候再试!']]);
}
}
/**
* 生成文件上传参数
* @return array
* @throws \think\Exception
*/
private function getUploadData()
{
if ($this->getUploadType() === 'qiniu') {
$file = File::instance('qiniu');
return [
'url' => $file->upload(true),
'token' => $file->buildUploadToken(),
'uptype' => $this->getUploadType()
];
} else {
return [
'url' => '?s=' . ADMIN_MODULE . '/api.plugs/upload',
'token' => uniqid('local_upload_'),
'uptype' => $this->getUploadType()
];
}
}
/**
* 获取文件上传方式
* @return string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
private function getUploadType()
{
$this->uptype = input('uptype');
if (!in_array($this->uptype, ['local', 'oss', 'qiniu'])) {
$this->uptype = sysconf('storage_type');
}
return $this->uptype;
}
/**
* 获取本地文件对象
* @return \think\File
*/
private function getUploadFile()
{
try {
return $this->request->file('file');
} catch (\Exception $e) {
$this->error(lang($e->getMessage()));
}
}
}

View File

@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller\api;
use library\command\Sync;
use library\Controller;
/**
* 系统更新接口
* Class Update
* @package app\akszadmin\controller\api
*/
class Update extends Controller
{
/**
* 基础URL地址
* @var string
*/
protected $baseUri = 'https://demo.thinkadmin.top';
/**
* 获取文件列表
*/
public function tree()
{
$sync = new Sync('Update');
$this->success('获取当前文件列表成功!', $sync->build());
}
/**
* 读取线上文件数据
* @param string $encode
*/
public function read($encode)
{
$this->file = env('root_path') . decode($encode);
if (file_exists($this->file)) {
$this->success('读取文件成功!', [
'format' => 'base64',
'content' => base64_encode(file_get_contents($this->file)),
]);
} else {
$this->error('获取文件内容失败!');
}
}
}