feat: 后端全量更新 - 含所有本次需求
- Contract.php: 返回合约账户余额(balance_contract) - My.php: 地址管理增加BTC/ETH - AppContract.php: 一键平仓(closeall) - AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2) - site.php: 手续费减半(0.018→0.009) - agent_permission_setup.sql: 代理权限SQL - crypto_news_crawler.py: 新闻自动采集脚本
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 策略币种
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiCoin extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiCoin模型对象
|
||||
* @var \app\admin\model\app\AppAiCoin
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiCoin;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("coinTypeList", $this->model->getCoinTypeList());
|
||||
$this->view->assign("mfStatusList", $this->model->getMfStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 量化团队设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiGrade extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiGrade模型对象
|
||||
* @var \app\admin\model\app\AppAiGrade
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiGrade;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 策略设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiStrategy extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiStrategy模型对象
|
||||
* @var \app\admin\model\app\AppAiStrategy
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiStrategy;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("isDoubleList", $this->model->getIsDoubleList());
|
||||
$this->view->assign("pcStatusList", $this->model->getPcStatusList());
|
||||
$this->view->assign("isNowList", $this->model->getIsNowList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'coinname') {
|
||||
$new_params['p.coinname'] = $value;
|
||||
$new_op['p.coinname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_ai_strategy aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.coinname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_ai_coin p', 'aa.coin_id = p.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ai_strategy aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.coinname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_ai_coin p', 'aa.coin_id = p.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 策略订单管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiStrategyOrder extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiStrategyOrder模型对象
|
||||
* @var \app\admin\model\app\AppAiStrategyOrder
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiStrategyOrder;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'coinname') {
|
||||
$new_params['p.coinname'] = $value;
|
||||
$new_op['p.coinname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_ai_strategy_order aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.coinname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_ai_coin p', 'aa.coin_id = p.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ai_strategy_order aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.coinname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_ai_coin p', 'aa.coin_id = p.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 会员累计收益
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiUserIncome extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiUserIncome模型对象
|
||||
* @var \app\admin\model\app\AppAiUserIncome
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiUserIncome;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_ai_user_income aa')
|
||||
->field('aa.*,u.nickname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ai_user_income aa')
|
||||
->field('aa.*,u.nickname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$count_price = Db::name('app_ai_user_income aa')
|
||||
->field('aa.*,u.nickname')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->sum("aa.num");
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list,"count_price"=>$count_price);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 会员累计收益
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAiUserIncomeAll extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAiUserIncomeAll模型对象
|
||||
* @var \app\admin\model\app\AppAiUserIncomeAll
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAiUserIncomeAll;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 天使投资设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAngelSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAngelSet模型对象
|
||||
* @var \app\admin\model\app\AppAngelSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAngelSet;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 天使投资记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAngelUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAngelUser模型对象
|
||||
* @var \app\admin\model\app\AppAngelUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAngelUser;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'nickname'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_angel_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_angel_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 初级认证
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAuth extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAuth模型对象
|
||||
* @var \app\admin\model\app\AppAuth
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAuth;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'nickname'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('app_auth')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_auth')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 高级认证
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppAuthHigh extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppAuthHigh模型对象
|
||||
* @var \app\admin\model\app\AppAuthHigh
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppAuthHigh;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'nickname'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$total = Db::name('app_auth_high')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_auth_high')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* banner图管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppBanner extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppBanner模型对象
|
||||
* @var \app\admin\model\app\AppBanner
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppBanner;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* PC端banner
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppBannerPc extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppBannerPc模型对象
|
||||
* @var \app\admin\model\app\AppBannerPc
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppBannerPc;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 币币交易
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCoinTrade extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCoinTrade模型对象
|
||||
* @var \app\admin\model\app\AppCoinTrade
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCoinTrade;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("cartList", $this->model->getCartList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'curr_name'){
|
||||
$new_params['p.name'] = $value;
|
||||
$new_op['p.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('app_coin_trade')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('app_rate p', 'a.coin_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_coin_trade')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('app_rate p', 'a.coin_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 合约管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppContract extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppContract模型对象
|
||||
* @var \app\admin\model\app\AppContract
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppContract;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键平仓 - 关闭所有持仓中的合约订单
|
||||
*/
|
||||
public function closeall()
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
$this->error('请求方式错误');
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
|
||||
// 构建查询条件
|
||||
$where = ['a.status' => '1'];
|
||||
|
||||
// 非超级管理员只能平仓自己团队的订单
|
||||
if ($admin_id > 1) {
|
||||
$user = Db::name("user")->where("admin_id", $admin_id)->find();
|
||||
if ($user) {
|
||||
$where['u.path'] = ['like', $user['path'] . '%'];
|
||||
}
|
||||
}
|
||||
|
||||
// 查询所有持仓中的合约
|
||||
$contracts = Db::name('app_contract')
|
||||
->alias('a')
|
||||
->field('a.*,b.close,b.symbol')
|
||||
->join('app_rate b', 'a.coin_id = b.id', 'left')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($where)
|
||||
->select();
|
||||
|
||||
if (empty($contracts)) {
|
||||
$this->error('没有持仓中的订单');
|
||||
}
|
||||
|
||||
$shizhi = Config::get('site.shizhi');
|
||||
$success_count = 0;
|
||||
$fail_count = 0;
|
||||
|
||||
foreach ($contracts as $contract) {
|
||||
Db::startTrans();
|
||||
try {
|
||||
$pc_price = $contract['close'];
|
||||
$diffnum = $pc_price - $contract['price'];
|
||||
|
||||
// 计算收益
|
||||
if ($contract['type'] == 'more') {
|
||||
$income = $diffnum * $contract['num'] * $shizhi;
|
||||
} else {
|
||||
if ($diffnum < 0) {
|
||||
$income = abs($diffnum) * $contract['num'] * $shizhi;
|
||||
} else {
|
||||
$income = 0 - $diffnum * $contract['num'] * $shizhi;
|
||||
}
|
||||
}
|
||||
$income = sprintf('%.6f', $income);
|
||||
|
||||
// 获取用户钱包
|
||||
$currency = Db::name('app_currency_user')
|
||||
->field('num,id')
|
||||
->where('user_id', $contract['user_id'])
|
||||
->where('curr_id', 1)->find();
|
||||
|
||||
if (!$currency) {
|
||||
$fail_count++;
|
||||
Db::rollback();
|
||||
continue;
|
||||
}
|
||||
|
||||
// 记录资金明细
|
||||
$detailed = [
|
||||
'user_id' => $contract['user_id'],
|
||||
'curr_id' => 1,
|
||||
'price' => abs($income),
|
||||
'cart' => $income > 0 ? '1' : '2',
|
||||
'type' => '6',
|
||||
'serial_no' => time() . mt_rand(1000, 9999),
|
||||
'order_result' => 'result',
|
||||
'description' => $income > 0 ? '合约交易平仓盈利' : '合约交易平仓亏损',
|
||||
'createtime' => time(),
|
||||
'notice' => '管理员一键平仓',
|
||||
'before_num' => $currency['num'],
|
||||
'after_num' => $currency['num'] + $income,
|
||||
];
|
||||
|
||||
$detaileds = [$detailed];
|
||||
$detaileds[] = [
|
||||
'user_id' => $contract['user_id'],
|
||||
'curr_id' => 1,
|
||||
'price' => $contract['promise_fee'],
|
||||
'cart' => '1',
|
||||
'type' => '6',
|
||||
'serial_no' => time() . mt_rand(1000, 9999),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易保证金退还',
|
||||
'createtime' => time(),
|
||||
'notice' => '管理员一键平仓',
|
||||
'before_num' => $detailed['after_num'],
|
||||
'after_num' => $detailed['after_num'] + $contract['promise_fee'],
|
||||
];
|
||||
|
||||
$lostnum = sprintf("%.6f", ($currency['num'] + $income + $contract['promise_fee']));
|
||||
|
||||
// 更新钱包余额
|
||||
Db::name('app_currency_user')
|
||||
->where('id', $currency['id'])
|
||||
->update(['num' => $lostnum, 'updatetime' => time()]);
|
||||
|
||||
// 更新订单状态
|
||||
Db::name('app_contract')
|
||||
->where('id', $contract['id'])
|
||||
->update(['status' => '2', 'pc_price' => $pc_price, 'pctime' => time(), 'income' => $income]);
|
||||
|
||||
// 写入资金明细
|
||||
Db::name('app_detailed')->insertAll($detaileds);
|
||||
|
||||
Db::commit();
|
||||
$success_count++;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
$fail_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->success("一键平仓完成:成功 {$success_count} 笔,失败 {$fail_count} 笔");
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('app_contract')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_contract')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.coinname,b.symbol,b.close,e.nickname as daili_name')
|
||||
->join('app_rate b','a.coin_id = b.id','left')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
foreach ($list as $key=>$value)
|
||||
{
|
||||
if($value['status'] == '1') {
|
||||
$diffnum = $value['close'] - $value['price'];
|
||||
if ($value['type'] == 'more') {
|
||||
//计算收益
|
||||
$income = $diffnum / 100 * $value['num'] * $value['multiple'] * Config::get('site.shizhi');
|
||||
} else {
|
||||
if ($diffnum < 0) {
|
||||
$income = abs($diffnum) / 100 * $value['num'] * $value['multiple'] * Config::get('site.shizhi');
|
||||
} else {
|
||||
$income = 0 - $diffnum / 100 * $value['num'] * $value['multiple'] * Config::get('site.shizhi');
|
||||
}
|
||||
}
|
||||
$value['income'] = sprintf('%.6f', $income);
|
||||
$list[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 商务合作
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCooperation extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCooperation模型对象
|
||||
* @var \app\admin\model\app\AppCooperation
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCooperation;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 上币申请
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCurrApply extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCurrApply模型对象
|
||||
* @var \app\admin\model\app\AppCurrApply
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCurrApply;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 一键发币
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCurrRelease extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCurrRelease模型对象
|
||||
* @var \app\admin\model\app\AppCurrRelease
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCurrRelease;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("isBbList", $this->model->getIsBbList());
|
||||
$this->view->assign("isHytradeList", $this->model->getIsHytradeList());
|
||||
$this->view->assign("isTkList", $this->model->getIsTkList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$params['symbol'] = strtolower($params['symbol']);
|
||||
$rates = Db::name("app_rate")->where("symbol",$params['symbol'])->find();
|
||||
if(!empty($rates)){
|
||||
$this->error($params['symbol']."标识已存在,请选择其他币种");
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
// $this->error("暂未开放");
|
||||
|
||||
$rate_data = array(
|
||||
"name" => $params['name'],
|
||||
"nickname" => $params['name'],
|
||||
"coinname" => $params['name']."/USDT",
|
||||
"symbol" => $params['symbol'],
|
||||
"is_hytrade" => $params['is_hytrade'],
|
||||
"high" => $params['usdt'],
|
||||
"low" => $params['usdt'],
|
||||
"open" => $params['usdt'],
|
||||
"close" => $params['usdt'],
|
||||
"usdt" => $params['usdt'],
|
||||
"rmb" => $params['usdt']*6.4,
|
||||
"jd" => 4,
|
||||
"logo_image" => $params['logo_image'],
|
||||
"liutong_num" => $params['count_num'],
|
||||
"gongji_num" => $params['count_num'],
|
||||
"count_num" => $params['count_num'],
|
||||
"faxin_price" => $params['usdt'],
|
||||
"is_bb" => $params['is_bb'],
|
||||
"bb_type" => 2,
|
||||
"market_jd" => 4,
|
||||
"price_jd" => 4,
|
||||
);
|
||||
$curr_data = array(
|
||||
"name" => $params['name'],
|
||||
"full_name" => $params['name'],
|
||||
"exchange" => $params['usdt'],
|
||||
"suffix" => $params['symbol'],
|
||||
"thumb_image" => $params['logo_image'],
|
||||
"is_reg" => 0,
|
||||
"is_wid" => 0,
|
||||
"is_tran" => 0,
|
||||
"is_otc" => 0,
|
||||
"createtime" => time(),
|
||||
);
|
||||
if($params['status'] != 3){
|
||||
$curr_data['status'] = "1";
|
||||
$rate_data['status'] = "0";
|
||||
}else{
|
||||
$curr_data['status'] = "0";
|
||||
$rate_data['status'] = "1";
|
||||
}
|
||||
$rate_id = Db::name("app_rate")->insertGetId($rate_data);
|
||||
$curr_id = Db::name("app_currency")->insertGetId($curr_data);
|
||||
$params['rate_id'] = $rate_id;
|
||||
$id = Db::name("app_curr_release")->insertGetId($params);
|
||||
$user = Db::name("user")->field("id")->select();
|
||||
$user_curr = [];
|
||||
foreach ($user as $key => $value) {
|
||||
$user_curr[] = array(
|
||||
"user_id" => $value['id'],
|
||||
"curr_id" => $curr_id,
|
||||
"num" => 0,
|
||||
);
|
||||
}
|
||||
Db::name("app_currency_user")->insertAll($user_curr);
|
||||
create_bt_kline($id);
|
||||
Db::commit();
|
||||
$this->success();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$rate_update = array(
|
||||
"is_bb" => $params['is_bb'],
|
||||
"is_hytrade" => $params['is_hytrade'],
|
||||
"logo_image" => $params['logo_image'],
|
||||
);
|
||||
$curr_update = array(
|
||||
"thumb_image" => $params['logo_image'],
|
||||
);
|
||||
if($params['status'] != 3){
|
||||
$rate_update['status'] = 0;
|
||||
$curr_update['status'] = "1";
|
||||
}else{
|
||||
$rate_update['status'] = 1;
|
||||
$curr_update['status'] = "0";
|
||||
}
|
||||
if($params['is_tk'] == 1){
|
||||
$rate_update['tradectrl_json'] = $params['tradectrl_json'];
|
||||
$rate_update['trademulte_json'] = $params['trademulte_json'];
|
||||
}else{
|
||||
$rate_update['tradectrl_json'] = "";
|
||||
$rate_update['trademulte_json'] = $params['trademulte_json'];
|
||||
}
|
||||
Db::name("app_curr_release")->where("id",$row['id'])->update($params);
|
||||
Db::name("app_rate")->where("name",$row['name'])->update($rate_update);
|
||||
Db::name("app_currency")->where("name",$row['name'])->update($curr_update);
|
||||
Db::commit();
|
||||
$this->success();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del($ids = "")
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
$this->error(__("Invalid parameters"));
|
||||
}
|
||||
$ids = $ids ? $ids : $this->request->post("ids");
|
||||
if ($ids) {
|
||||
$list = Db::name('app_curr_release')->where("id","in",$ids)->select();
|
||||
// var_dump($list);exit;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $k => $v) {
|
||||
Db::name("bb_k_15min")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("bb_k_1h")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("bb_k_1min")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("bb_k_5min")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("bb_k_24h")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("bb_k_30min")->where("symbol",$v['symbol'])->delete();
|
||||
Db::name("app_rate")->where("id",$v['rate_id'])->delete();
|
||||
$curr = Db::name("app_currency")->where("suffix",$v['symbol'])->order("id desc")->find();
|
||||
Db::name("app_currency")->where("id",$curr['id'])->delete();
|
||||
Db::name("app_currency_user")->where("curr_id",$curr['id'])->delete();
|
||||
$ico = Db::name("app_ico_set")->where("curr_id",$curr['id'])->find();
|
||||
Db::name("app_ico_set")->where("id",$ico['id'])->delete();
|
||||
Db::name("app_ico_user")->where("ico_id",$ico['id'])->delete();
|
||||
Db::name("app_detailed")->where("curr_id",$curr['id'])->delete();
|
||||
Db::name("app_curr_release")->where("id",$v['id'])->delete();
|
||||
}
|
||||
Db::commit();
|
||||
$this->success();
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 货币管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCurrency extends Backend
|
||||
{
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
/**
|
||||
* AppCurrency模型对象
|
||||
* @var \app\admin\model\app\AppCurrency
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCurrency;
|
||||
$this->view->assign("isRegList", $this->model->getIsRegList());
|
||||
$this->view->assign("isWidList", $this->model->getIsWidList());
|
||||
$this->view->assign("isOtcList", $this->model->getIsOtcList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
/**
|
||||
* 用户货币管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCurrencyUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCurrencyUser模型对象
|
||||
* @var \app\admin\model\app\AppCurrencyUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCurrencyUser;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'coinname'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('app_currency_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_currency_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function recharge()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
// exit;
|
||||
$params = $this->request->post();
|
||||
if ($params) {
|
||||
if(!isset($params['num']) || !is_numeric($params['num']))
|
||||
{
|
||||
$this->error('请输入正常的数量');
|
||||
}
|
||||
if(!isset($params['user_id']) || !is_numeric($params['user_id']))
|
||||
{
|
||||
$this->error('请选择正确的用户');
|
||||
}
|
||||
$user = Db::name('app_currency_user')->where('user_id',$params['user_id'])
|
||||
->where('curr_id',$params['curr_id'])->find();
|
||||
if(!$user)
|
||||
{
|
||||
$this->error('该用户账号不存在');
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$my_user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
$reg_user = Db::name("user")->where("id",$user['user_id'])->find();
|
||||
$path_arr = explode("|", $reg_user['path']);
|
||||
if(!in_array($my_user['id'], $path_arr)){
|
||||
$this->error("权限不足");
|
||||
}
|
||||
}
|
||||
|
||||
if($params['num'] < 0){
|
||||
$num = abs($params['num']);
|
||||
$recharge = [
|
||||
'user_id' => $user['user_id'],
|
||||
'curr_id' => $user['curr_id'],
|
||||
'price' => $num,
|
||||
'cart' => '2',
|
||||
'type' => '1',
|
||||
'description' => '后台扣除',
|
||||
'hash' => time(),
|
||||
'before_num' => $user['num'],
|
||||
'after_num' => $user['num'] - $num,
|
||||
'is_outer' => '0',
|
||||
'order_result' => 'result',
|
||||
'createtime' => time(),
|
||||
];
|
||||
$amount = $user['num'] - $num;
|
||||
}else{
|
||||
$num = $params['num'];
|
||||
$recharge = [
|
||||
'user_id' => $user['user_id'],
|
||||
'curr_id' => $user['curr_id'],
|
||||
'price' => $params['num'],
|
||||
'cart' => '1',
|
||||
'type' => '1',
|
||||
'description' => '后台充值',
|
||||
'hash' => time(),
|
||||
'before_num' => $user['num'],
|
||||
'after_num' => $user['num'] + $num,
|
||||
'is_outer' => '0',
|
||||
'order_result' => 'result',
|
||||
'createtime' => time(),
|
||||
];
|
||||
$amount = $user['num'] + $num;
|
||||
}
|
||||
if ($amount > 0) {
|
||||
Db::name('app_detailed')->insert($recharge);
|
||||
$changeamount = $amount;
|
||||
Db::name('app_currency_user')->where('id', $user['id'])
|
||||
->update(['num' => $changeamount, 'updatetime' => time()]);
|
||||
}
|
||||
$this->success('充值成功');
|
||||
}
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 冻结操作
|
||||
*/
|
||||
public function freeze()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
// exit;
|
||||
$params = $this->request->post();
|
||||
if ($params) {
|
||||
if(!isset($params['user_id']) || !is_numeric($params['user_id']))
|
||||
{
|
||||
$this->error('请选择正确的用户');
|
||||
}
|
||||
$user = Db::name('app_currency_user')->where('user_id',$params['user_id'])
|
||||
->where('curr_id',$params['curr_id'])->find();
|
||||
if(!$user)
|
||||
{
|
||||
$this->error('该用户账号不存在');
|
||||
}
|
||||
if($params['type'] == 1){
|
||||
//冻结
|
||||
switch ($params['zh_type']) {
|
||||
case 1:
|
||||
$table = "app_detailed";
|
||||
$key = "num";
|
||||
$key_dj = "num_dj";
|
||||
break;
|
||||
case 2:
|
||||
$table = "app_detailed_fb";
|
||||
$key = "num_fb";
|
||||
$key_dj = "num_fb_dj";
|
||||
break;
|
||||
case 3:
|
||||
$table = "app_detailed_lh";
|
||||
$key = "num_lh";
|
||||
$key_dj = "num_lh_dj";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if($params['num'] <= 0){
|
||||
$num = $user[$key];
|
||||
}else{
|
||||
if($params['num'] > $user[$key]){
|
||||
$this->error("账户余额不足");
|
||||
}
|
||||
$num = $params['num'];
|
||||
}
|
||||
$recharge = [
|
||||
'user_id' => $user['user_id'],
|
||||
'curr_id' => $user['curr_id'],
|
||||
'price' => $num,
|
||||
'cart' => '2',
|
||||
'type' => '5',
|
||||
'description' => '账户冻结',
|
||||
'before_num' => $user[$key],
|
||||
'after_num' => $user[$key] - $num,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$after_num = $user[$key] - $num;
|
||||
$after_num_dj = $user[$key_dj] + $num;
|
||||
}else{
|
||||
//解除冻结
|
||||
switch ($params['zh_type']) {
|
||||
case 1:
|
||||
$table = "app_detailed";
|
||||
$key = "num";
|
||||
$key_dj = "num_dj";
|
||||
break;
|
||||
case 2:
|
||||
$table = "app_detailed_fb";
|
||||
$key = "num_fb";
|
||||
$key_dj = "num_fb_dj";
|
||||
break;
|
||||
case 3:
|
||||
$table = "app_detailed_lh";
|
||||
$key = "num_lh";
|
||||
$key_dj = "num_lh_dj";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if($params['num'] <= 0){
|
||||
$num = $user[$key_dj];
|
||||
}else{
|
||||
if($params['num'] > $user[$key_dj]){
|
||||
$this->error("冻结余额不足");
|
||||
}
|
||||
$num = $params['num'];
|
||||
}
|
||||
$recharge = [
|
||||
'user_id' => $user['user_id'],
|
||||
'curr_id' => $user['curr_id'],
|
||||
'price' => $num,
|
||||
'cart' => '1',
|
||||
'type' => '5',
|
||||
'description' => '解除冻结',
|
||||
'before_num' => $user[$key],
|
||||
'after_num' => $user[$key] + $num,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$after_num = $user[$key] + $num;
|
||||
$after_num_dj = $user[$key_dj] - $num;
|
||||
}
|
||||
Db::name($table)->insert($recharge);
|
||||
Db::name('app_currency_user')->where('id', $user['id'])->update([$key => $after_num,$key_dj=>$after_num_dj]);
|
||||
$this->success('操作成功');
|
||||
}
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 周期设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppCycleset extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppCycleset模型对象
|
||||
* @var \app\admin\model\app\AppCycleset
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppCycleset;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 功能菜单分类
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppDappCate extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppDappCate模型对象
|
||||
* @var \app\admin\model\app\AppDappCate
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppDappCate;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 功能菜单列管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppDappList extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppDappList模型对象
|
||||
* @var \app\admin\model\app\AppDappList
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppDappList;
|
||||
$this->view->assign("openStatusList", $this->model->getOpenStatusList());
|
||||
$this->view->assign("isHotList", $this->model->getIsHotList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'cate_name') {
|
||||
$new_params['u.name'] = $value;
|
||||
$new_op['u.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_dapp_list aa')
|
||||
->field('aa.*,u.name as cate_name')
|
||||
->join('app_dapp_cate u', 'aa.cate_id = u.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_dapp_list aa')
|
||||
->field('aa.*,u.name as cate_name')
|
||||
->join('app_dapp_cate u', 'aa.cate_id = u.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 货币收支明细
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppDetailed extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppDetailed模型对象
|
||||
* @var \app\admin\model\app\AppDetailed
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppDetailed;
|
||||
$this->view->assign("cartList", $this->model->getCartList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("orderResultList", $this->model->getOrderResultList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'coinname'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('app_detailed')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->where('order_result','result')
|
||||
->count();
|
||||
$list = Db::name('app_detailed')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->where('order_result','result')
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$count_price = Db::name('app_detailed')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->where('order_result','result')
|
||||
->sum("a.price");
|
||||
$result = array("total" => $total, "rows" => $list,"count_price"=>$count_price);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 收支明细-法币
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppDetailedFb extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppDetailedFb模型对象
|
||||
* @var \app\admin\model\app\AppDetailedFb
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppDetailedFb;
|
||||
$this->view->assign("cartList", $this->model->getCartList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'coinname'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$w['u.path'] = ['like','|1|%'];
|
||||
if($this->auth->id != 1) {
|
||||
$admin_id = $this->auth->id;
|
||||
$proxy = Db::name('app_proxy a')
|
||||
->field('a.*,b.path')
|
||||
->where('admin_id',$admin_id)
|
||||
->join('user b','a.user_id = b.id','left')
|
||||
->find();
|
||||
$w['u.path'] = ['like',$proxy['path']."%"];
|
||||
}
|
||||
|
||||
$total = Db::name('app_detailed_fb')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_detailed_fb')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$count_price = Db::name('app_detailed_fb')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->sum("a.price");
|
||||
$result = array("total" => $total, "rows" => $list,"count_price"=>$count_price);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 收明细-量化
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppDetailedLh extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppDetailedLh模型对象
|
||||
* @var \app\admin\model\app\AppDetailedLh
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppDetailedLh;
|
||||
$this->view->assign("cartList", $this->model->getCartList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'coinname'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$w['u.path'] = ['like','|1|%'];
|
||||
if($this->auth->id != 1) {
|
||||
$admin_id = $this->auth->id;
|
||||
$proxy = Db::name('app_proxy a')
|
||||
->field('a.*,b.path')
|
||||
->where('admin_id',$admin_id)
|
||||
->join('user b','a.user_id = b.id','left')
|
||||
->find();
|
||||
$w['u.path'] = ['like',$proxy['path']."%"];
|
||||
}
|
||||
|
||||
$total = Db::name('app_detailed_lh')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_detailed_lh')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$count_price = Db::name('app_detailed_lh')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.name as coinname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_currency b', 'b.id = a.curr_id')
|
||||
->where($w)
|
||||
->sum("a.price");
|
||||
$result = array("total" => $total, "rows" => $list,"count_price"=>$count_price);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 邮件模板
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppEmsTemplate extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppEmsTemplate模型对象
|
||||
* @var \app\admin\model\app\AppEmsTemplate
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppEmsTemplate;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 汇率设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppExchangeSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppExchangeSet模型对象
|
||||
* @var \app\admin\model\app\AppExchangeSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppExchangeSet;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 帮助中心
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppHelp extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppHelp模型对象
|
||||
* @var \app\admin\model\app\AppHelp
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppHelp;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 私募设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppIcoSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppIcoSet模型对象
|
||||
* @var \app\admin\model\app\AppIcoSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppIcoSet;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['b.' . $key] = $value;
|
||||
$new_op['b.' . $key] = $op[$key];
|
||||
}else if($key == 'curr_name'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_ico_set')
|
||||
->alias('a')
|
||||
->field('a.*,b.name as curr_name')
|
||||
->join('app_currency b', 'a.curr_id = b.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ico_set')
|
||||
->alias('a')
|
||||
->field('a.*,b.name as curr_name')
|
||||
->join('app_currency b', 'a.curr_id = b.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+283
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 私募记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppIcoUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppIcoUser模型对象
|
||||
* @var \app\admin\model\app\AppIcoUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppIcoUser;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'nickname'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'ico_name'){
|
||||
$new_params['b.name'] = $value;
|
||||
$new_op['b.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
$total = Db::name('app_ico_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname,b.name as ico_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_ico_set b', 'a.ico_id = b.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ico_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname,b.name as ico_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_app_ico_set b', 'a.ico_id = b.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($row['status'] != '0')
|
||||
{
|
||||
$this->error('编辑非法,已审核记录不可重复审核');
|
||||
}else{
|
||||
if($params['status'] == '1') { //审核通过
|
||||
$user_usdt = Db::name('app_currency_user')
|
||||
->where('user_id',$params['user_id'])
|
||||
->where('curr_id','1')
|
||||
->find();
|
||||
$ico_user = Db::name("app_ico_user a")->field("b.price as ico_price,b.curr_id")
|
||||
->join("app_ico_set b","a.ico_id=b.id","left")
|
||||
->where('a.id',$row['id'])
|
||||
->find();
|
||||
$user_curr = Db::name('app_currency_user')
|
||||
->where('user_id',$params['user_id'])
|
||||
->where('curr_id',$ico_user['curr_id'])
|
||||
->find();
|
||||
$price = $params['num']*$params['bili']/100;
|
||||
$detail_data[] = array(
|
||||
"user_id" => $user_curr['user_id'],
|
||||
"curr_id" => $user_curr['curr_id'],
|
||||
"price" => $price,
|
||||
"cart" => 1,
|
||||
"type" => 5,
|
||||
"description" => "ICO",
|
||||
"createtime" => time(),
|
||||
"before_num" => $user_curr['num'],
|
||||
"after_num" => $user_curr['num'] + $price,
|
||||
);
|
||||
Db::name("app_currency_user")->where("id",$user_curr['id'])->setInc("num",$price);
|
||||
$usdt_num = sprintf("%.4f",(100-$params['bili'])*$params['num']*$ico_user['ico_price']/100);
|
||||
if($usdt_num > 0){
|
||||
$detail_data[] = array(
|
||||
"user_id" => $user_usdt['user_id'],
|
||||
"curr_id" => $user_usdt['curr_id'],
|
||||
"price" => $usdt_num,
|
||||
"cart" => 1,
|
||||
"type" => 5,
|
||||
"description" => "ICO",
|
||||
"createtime" => time(),
|
||||
"before_num" => $user_usdt['num'],
|
||||
"after_num" => $user_usdt['num'] + $usdt_num,
|
||||
);
|
||||
Db::name("app_currency_user")->where("id",$user_usdt['id'])->setInc("num",$usdt_num);
|
||||
}
|
||||
Db::name("app_detailed")->insertAll($detail_data);
|
||||
Db::name("app_ico_set")->where("id",$ico_user['ico_id'])->setDec("real_num",$price);
|
||||
$result = Db::name('app_ico_user')->where('id',$row['id'])->update($params);
|
||||
}else{ //审核失败
|
||||
$result = Db::name('app_ico_user')->where('id',$row['id'])->update($params);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
public function start($ids = '')
|
||||
{
|
||||
$default_bili = Config::get("site.default_bili");
|
||||
if($ids){
|
||||
$w['a.id'] = array("in",$ids);
|
||||
}
|
||||
$w['a.status'] = array("eq",0);
|
||||
$w['c.curr_id'] = array("eq",1);
|
||||
$list = Db::name("app_ico_user a")->field("a.*,c.num as curr_num,c.id as cid,b.curr_id,b.price as ico_price")
|
||||
->join("app_ico_set b","a.ico_id=b.id","left")
|
||||
->join("app_currency_user c","a.user_id=c.user_id","left")
|
||||
->where($w)
|
||||
->select();
|
||||
if(empty($list)){
|
||||
$this->error("暂无可发放记录");
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $key => $value) {
|
||||
if($value['bili'] > 0){
|
||||
$bili = $value['bili'];
|
||||
}else{
|
||||
$bili = $default_bili;
|
||||
}
|
||||
$user_curr = Db::name("app_currency_user")->where("user_id",$value['user_id'])->where("curr_id",$value['curr_id'])->find();
|
||||
$price = $value['num']*$bili/100;
|
||||
$detail_data[] = array(
|
||||
"user_id" => $value['user_id'],
|
||||
"curr_id" => $user_curr['curr_id'],
|
||||
"price" => $price,
|
||||
"cart" => 1,
|
||||
"type" => 5,
|
||||
"description" => "ICO",
|
||||
"createtime" => time(),
|
||||
"before_num" => $user_curr['num'],
|
||||
"after_num" => $user_curr['num'] + $price,
|
||||
);
|
||||
Db::name("app_currency_user")->where("id",$user_curr['id'])->setInc("num",$price);
|
||||
$usdt_num = sprintf("%.4f",(100-$bili)*$value['num']*$value['ico_price']/100);
|
||||
if($usdt_num > 0){
|
||||
$detail_data[] = array(
|
||||
"user_id" => $value['user_id'],
|
||||
"curr_id" => 1,
|
||||
"price" => $usdt_num,
|
||||
"cart" => 1,
|
||||
"type" => 5,
|
||||
"description" => "ICO",
|
||||
"createtime" => time(),
|
||||
"before_num" => $value['curr_num'],
|
||||
"after_num" => $value['curr_num'] + $usdt_num,
|
||||
);
|
||||
Db::name("app_currency_user")->where("id",$value['cid'])->setInc("num",$usdt_num);
|
||||
}
|
||||
Db::name("app_ico_user")->where("id",$value['id'])->update(['bili'=>$bili,'status'=>1]);
|
||||
Db::name("app_ico_set")->where("id",$value['ico_id'])->setDec("real_num",$price);
|
||||
}
|
||||
Db::name("app_detailed")->insertAll($detail_data);
|
||||
Db::commit();
|
||||
$this->success(__('发放成功'));
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error(__('系统繁忙'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 私募预约记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppIcoYuyue extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppIcoYuyue模型对象
|
||||
* @var \app\admin\model\app\AppIcoYuyue
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppIcoYuyue;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'nickname'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'day'){
|
||||
$new_params['b.day'] = $value;
|
||||
$new_op['b.day'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_ico_yuyue')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_ico_yuyue')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* IP白名单设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppIpSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppIpSet模型对象
|
||||
* @var \app\admin\model\app\AppIpSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppIpSet;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
$result = Db::name('app_ip_set')->where('id',$row['id'])->update(['content'=>$params['content']]);
|
||||
file_put_contents("./ip_set2.txt", $params['content']);
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 现货团队设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppLevel extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppLevel模型对象
|
||||
* @var \app\admin\model\app\AppLevel
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppLevel;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* C2C挂单管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMarket extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMarket模型对象
|
||||
* @var \app\admin\model\app\AppMarket
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMarket;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}elseif ($key == 'fb_name') {
|
||||
$new_params['c.name'] = $value;
|
||||
$new_op['c.name'] = $op[$key];
|
||||
}elseif ($key == 'curr_name') {
|
||||
$new_params['d.name'] = $value;
|
||||
$new_op['d.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_market aa')
|
||||
->field('aa.*,u.nickname,u.mobile,c.name as fb_name,d.name as curr_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_market_country c', 'aa.country_id = c.id','left')
|
||||
->join('app_currency d', 'aa.curr_id = d.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_market aa')
|
||||
->field('aa.*,u.nickname,u.mobile,c.name as fb_name,d.name as curr_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_market_country c', 'aa.country_id = c.id','left')
|
||||
->join('app_currency d', 'aa.curr_id = d.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* C2C申述记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMarketAppeal extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMarketAppeal模型对象
|
||||
* @var \app\admin\model\app\AppMarketAppeal
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMarketAppeal;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("victoryList", $this->model->getVictoryList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}elseif ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_market_appeal aa')
|
||||
->field('aa.*,u.nickname,u.mobile')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_market_appeal aa')
|
||||
->field('aa.*,u.nickname,u.mobile')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('jpp_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写编辑
|
||||
* @param type $ids
|
||||
* @return type
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
// echo "<pre>";var_dump($row);die;
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
// echo "<pre>";var_dump($params);die;
|
||||
//start
|
||||
$w1 = [];
|
||||
$w1['id'] = array("eq",$ids);
|
||||
$r1 = Db::name( "app_market_appeal" )->where( $w1 )->find();
|
||||
if( !$r1 ){
|
||||
$this->error( "未查询到信息" );
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($r1['status'] == 2 && $params['status'] == 1){
|
||||
if($params['victory'] == 1){
|
||||
//卖家胜 回滚
|
||||
$market_user = Db::name("app_market_user")->where("id",$r1['order_id'])->find();
|
||||
if(empty($market_user)){
|
||||
$this->error("订单错误");
|
||||
}
|
||||
$market = Db::name("app_market")->where("id",$market_user['order_id'])->find();
|
||||
if($market_user['type'] == 1){
|
||||
//买单
|
||||
$buy_user_id = $market_user['user_id'];
|
||||
$sell_user_id = $market_user['relid'];
|
||||
}else{
|
||||
//卖单
|
||||
$sell_user_id = $market_user['user_id'];
|
||||
$buy_user_id = $market_user['relid'];
|
||||
|
||||
// 退币
|
||||
$user_curr = Db::name("app_currency_user")->where("user_id",$sell_user_id)->where("curr_id",$market['curr_id'])->find();
|
||||
$count_num = $market_user['num']+$market_user['free_num'];
|
||||
$derail_date = array(
|
||||
"user_id" => $sell_user_id,
|
||||
"curr_id" => $user_curr['curr_id'],
|
||||
"price" => $count_num,
|
||||
"cart" => 1,
|
||||
"type" => 2,
|
||||
"description" => "交易失败,货币退还",
|
||||
"createtime" => time(),
|
||||
"before_num" => $user_curr['num_fb'],
|
||||
"after_num" => $user_curr['num_fb']+$count_num,
|
||||
);
|
||||
Db::name("app_detailed_fb")->insert($derail_date);
|
||||
Db::name("app_currency_user")->where("id",$user_curr['id'])->setInc("num_fb",$count_num);
|
||||
}
|
||||
//修改订单
|
||||
$market_user_update = array(
|
||||
"status" => 5,
|
||||
"cancel_time" => time(),
|
||||
);
|
||||
Db::name("app_market_user")->where("id",$market_user['id'])->update($market_user_update);
|
||||
$market_update = array(
|
||||
"status" => 1,
|
||||
"updatetime" => time(),
|
||||
);
|
||||
Db::name("app_market")->where("id",$market['id'])->update($market_update);
|
||||
}else{
|
||||
//买家胜 放币
|
||||
$market_user = Db::name("app_market_user")->where("id",$r1['order_id'])->find();
|
||||
if(empty($market_user)){
|
||||
$this->error("订单错误");
|
||||
}
|
||||
$market = Db::name("app_market")->where("id",$market_user['order_id'])->find();
|
||||
if($market_user['type'] == 1){
|
||||
//买单
|
||||
$buy_user_id = $market_user['user_id'];
|
||||
$sell_user_id = $market_user['relid'];
|
||||
}else{
|
||||
$sell_user_id = $market_user['user_id'];
|
||||
$buy_user_id = $market_user['relid'];
|
||||
}
|
||||
//修改订单
|
||||
$market_user_update = array(
|
||||
"status" => 4,
|
||||
"succ_time" => time(),
|
||||
);
|
||||
Db::name("app_market_user")->where("id",$market_user['id'])->update($market_user_update);
|
||||
//修改挂单
|
||||
if($market['residue_num']>$market_user['num']){
|
||||
$market_update = array(
|
||||
"residue_num" => $market['residue_num'] - $market_user['num'],
|
||||
"status" => 1,
|
||||
"updatetime" => time(),
|
||||
);
|
||||
}else{
|
||||
$market_update = array(
|
||||
"residue_num" => 0,
|
||||
"status" => 3,
|
||||
"endtime" => time(),
|
||||
);
|
||||
}
|
||||
Db::name("app_market")->where("id",$market['id'])->update($market_update);
|
||||
//放币
|
||||
$user_curr = Db::name("app_currency_user")->where("user_id",$buy_user_id)->where("curr_id",$market['curr_id'])->find();
|
||||
$derail_date[] = array(
|
||||
"user_id" => $buy_user_id,
|
||||
"curr_id" => $user_curr['curr_id'],
|
||||
"price" => $market_user['num'],
|
||||
"cart" => 1,
|
||||
"type" => 2,
|
||||
"description" => "货币购买",
|
||||
"createtime" => time(),
|
||||
"before_num" => $user_curr['num_fb'],
|
||||
"after_num" => $user_curr['num_fb']+$market_user['num'],
|
||||
);
|
||||
Db::name("app_currency_user")->where("id",$user_curr['id'])->setInc("num_fb",$market_user['num']);
|
||||
|
||||
Db::name("app_detailed_fb")->insertAll($derail_date);
|
||||
}
|
||||
}
|
||||
$params['updatetime'] = time();
|
||||
Db::name("app_market_appeal")->where("id",$ids)->update($params);
|
||||
Db::commit();
|
||||
$this->success("success");
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error("修改失败");
|
||||
}
|
||||
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 取消记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMarketCancelLog extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMarketCancelLog模型对象
|
||||
* @var \app\admin\model\app\AppMarketCancelLog
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMarketCancelLog;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* C2C法币国家
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMarketCountry extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMarketCountry模型对象
|
||||
* @var \app\admin\model\app\AppMarketCountry
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMarketCountry;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* C2C交易记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMarketUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMarketUser模型对象
|
||||
* @var \app\admin\model\app\AppMarketUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMarketUser;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_market_user aa')
|
||||
->field('aa.*,u.nickname,u.mobile')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_market_user aa')
|
||||
->field('aa.*,u.nickname,u.mobile')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 公告管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppMessages extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppMessages模型对象
|
||||
* @var \app\admin\model\app\AppMessages
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppMessages;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 投资产品
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppProduct extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppProduct模型对象
|
||||
* @var \app\admin\model\app\AppProduct
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppProduct;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'), true);
|
||||
$op = json_decode(input('op'), true);
|
||||
if (count($params) > 0) {
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'curr_name') {
|
||||
$new_params['c.name'] = $value;
|
||||
$new_op['c.name'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
} else {
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['b.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
// echo "<pre>";var_dump( $w );die;
|
||||
|
||||
$total = Db::name('app_product')
|
||||
->alias('aa')
|
||||
->field('aa.*,c.name as curr_name')
|
||||
->join('app_currency c', 'aa.curr_id = c.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
|
||||
$list = Db::name('app_product')
|
||||
->alias('aa')
|
||||
->field('aa.*,c.name as curr_name')
|
||||
->join('app_currency c', 'aa.curr_id = c.id' , 'left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 投资记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppProductUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppProductUser模型对象
|
||||
* @var \app\admin\model\app\AppProductUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppProductUser;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'), true);
|
||||
$op = json_decode(input('op'), true);
|
||||
if (count($params) > 0) {
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['b.nickname'] = $value;
|
||||
$new_op['b.nickname'] = $op[$key];
|
||||
} elseif ($key == 'curr_name') {
|
||||
$new_params['c.name'] = $value;
|
||||
$new_op['c.name'] = $op[$key];
|
||||
}elseif ($key == 'product_name') {
|
||||
$new_params['d.name'] = $value;
|
||||
$new_op['d.name'] = $op[$key];
|
||||
} elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
} else {
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['b.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
// echo "<pre>";var_dump( $w );die;
|
||||
|
||||
$total = Db::name('app_product_user')
|
||||
->alias('aa')
|
||||
->field('aa.*,b.nickname,c.name as curr_name,d.name as product_name,e.nickname as daili_name')
|
||||
->join('user b', 'aa.user_id = b.id' , 'left')
|
||||
->join('app_currency c', 'aa.curr_id = c.id' , 'left')
|
||||
->join('app_product d', 'aa.product_id = d.id' , 'left')
|
||||
->join('admin e', 'b.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
|
||||
$list = Db::name('app_product_user')
|
||||
->alias('aa')
|
||||
->field('aa.*,b.nickname,c.name as curr_name,d.name as product_name,e.nickname as daili_name')
|
||||
->join('user b', 'aa.user_id = b.id' , 'left')
|
||||
->join('app_currency c', 'aa.curr_id = c.id' , 'left')
|
||||
->join('app_product d', 'aa.product_id = d.id' , 'left')
|
||||
->join('admin e', 'b.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+417
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use fast\Random;
|
||||
|
||||
|
||||
/**
|
||||
* 代理管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppProxy extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppProxy模型对象
|
||||
* @var \app\admin\model\app\AppProxy
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppProxy;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'user_name')
|
||||
{
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'admin_name'){
|
||||
$new_params['b.nickname'] = $value;
|
||||
$new_op['b.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
if($this->auth->id != 1) {
|
||||
$w['a.admin_id'] = $this->auth->id;
|
||||
}
|
||||
$total = Db::name('app_proxy')
|
||||
->alias('a')
|
||||
->field('a.*,b.nickname as admin_name,u.nickname as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_admin b','b.id = a.admin_id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_proxy')
|
||||
->alias('a')
|
||||
->field('a.*,b.nickname as admin_name,u.nickname as user_name,u.referral_code')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_admin b','b.id = a.admin_id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
// 生成专属注册链接
|
||||
$front_url = Config::get('site.app_downurl') ?: $this->request->domain();
|
||||
foreach ($list as $key => $value) {
|
||||
$list[$key]['register_url'] = $front_url . '/#/pages/login/register?code=' . ($value['referral_code'] ?: '');
|
||||
}
|
||||
|
||||
//可结算金额
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Selectpage的实现方法
|
||||
*
|
||||
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
|
||||
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
|
||||
*
|
||||
*/
|
||||
protected function selectpage()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'htmlspecialchars']);
|
||||
|
||||
//搜索关键词,客户端输入以空格分开,这里接收为数组
|
||||
$word = (array)$this->request->request("q_word/a");
|
||||
//当前页
|
||||
$page = $this->request->request("pageNumber");
|
||||
//分页大小
|
||||
$pagesize = $this->request->request("pageSize");
|
||||
//搜索条件
|
||||
$andor = $this->request->request("andOr", "and", "strtoupper");
|
||||
//排序方式
|
||||
$orderby = (array)$this->request->request("orderBy/a");
|
||||
//显示的字段
|
||||
$field = $this->request->request("showField");
|
||||
//主键
|
||||
$primarykey = $this->request->request("keyField");
|
||||
//主键值
|
||||
$primaryvalue = $this->request->request("keyValue");
|
||||
//搜索字段
|
||||
$searchfield = (array)$this->request->request("searchField/a");
|
||||
//自定义搜索条件
|
||||
$custom = (array)$this->request->request("custom/a");
|
||||
//是否返回树形结构
|
||||
$istree = $this->request->request("isTree", 0);
|
||||
$ishtml = $this->request->request("isHtml", 0);
|
||||
if ($istree) {
|
||||
$word = [];
|
||||
$pagesize = 99999;
|
||||
}
|
||||
$order = [];
|
||||
foreach ($orderby as $k => $v) {
|
||||
$order[$v[0]] = $v[1];
|
||||
}
|
||||
$field = $field ? $field : 'name';
|
||||
|
||||
//如果有primaryvalue,说明当前是初始化传值
|
||||
if ($primaryvalue !== null) {
|
||||
$where = [$primarykey => ['in', $primaryvalue]];
|
||||
$pagesize = 99999;
|
||||
} else {
|
||||
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
|
||||
$logic = $andor == 'AND' ? '&' : '|';
|
||||
$searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield;
|
||||
foreach ($word as $k => $v) {
|
||||
$query->where(str_replace(',', $logic, $searchfield), "like", "%{$v}%");
|
||||
}
|
||||
if ($custom && is_array($custom)) {
|
||||
foreach ($custom as $k => $v) {
|
||||
if (is_array($v) && 2 == count($v)) {
|
||||
$query->where($k, trim($v[0]), $v[1]);
|
||||
} else {
|
||||
$query->where($k, '=', $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
$list = [];
|
||||
$total = $this->model->where($where)->count();
|
||||
if ($total > 0) {
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
$datalist = $this->model->where($where)
|
||||
->order($order)
|
||||
->page($page, $pagesize)
|
||||
->field($this->selectpageFields)
|
||||
->select();
|
||||
foreach ($datalist as $index => $item) {
|
||||
unset($item['password'], $item['salt']);
|
||||
$list[] = [
|
||||
// $primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '',
|
||||
$field => isset($item[$field]) ? $item[$field] : '',
|
||||
'pid' => isset($item['pid']) ? $item['pid'] : 0,
|
||||
'id' => $item['admin_id']
|
||||
];
|
||||
}
|
||||
if ($istree && !$primaryvalue) {
|
||||
$tree = Tree::instance();
|
||||
$tree->init(collection($list)->toArray(), 'pid');
|
||||
$list = $tree->getTreeList($tree->getTreeArray(0), $field);
|
||||
if (!$ishtml) {
|
||||
foreach ($list as &$item) {
|
||||
$item = str_replace(' ', ' ', $item);
|
||||
}
|
||||
unset($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
|
||||
return json(['list' => $list, 'total' => $total]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException(true)->validate($validate);
|
||||
}
|
||||
|
||||
//添加管理权限
|
||||
$admins['salt'] = Random::alnum();
|
||||
$admins['password'] = md5(md5($params['password']) . $admins['salt']);
|
||||
$admins['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。
|
||||
$admins['username'] = $params['username'];
|
||||
$params['password'] = $admins['password'];
|
||||
$admins['nickname'] = $admins['username'];
|
||||
$admins['email'] = $admins['username']."@qq.com";
|
||||
$admins['createtime'] = time();
|
||||
$admins['status'] = 'normal';
|
||||
|
||||
$result1 = Db::name('admin')->insertGetId($admins);
|
||||
if(!$result1){
|
||||
Db::rollback();
|
||||
$this->error('创建管理失败');
|
||||
}
|
||||
if($params['type'] == 1){
|
||||
// 一级代理 - 完整权限组
|
||||
$result2 = Db::name('auth_group_access')
|
||||
->insert(['uid'=>$result1,'group_id'=>11]);
|
||||
}else{
|
||||
// 二级代理 - 基本权限组
|
||||
$result2 = Db::name('auth_group_access')
|
||||
->insert(['uid'=>$result1,'group_id'=>12]);
|
||||
}
|
||||
|
||||
if(!$result2){
|
||||
Db::rollback();
|
||||
$this->error('创建管理失败.');
|
||||
}
|
||||
$result3 = Db::name("user")->where("id",$params['user_id'])->update(['admin_id'=>$result1]);
|
||||
if(!$result3){
|
||||
Db::rollback();
|
||||
$this->error('绑定用户失败');
|
||||
}
|
||||
$params['admin_id'] = $result1;
|
||||
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
$update['username'] = $params['username'];
|
||||
$update['updatetime'] = time();
|
||||
if(!empty($params['password']))
|
||||
{
|
||||
$admins = Db::name('admin')->where('id',$row['admin_id'])->find();
|
||||
$params['password'] = md5(md5($params['password']) . $admins['salt']);
|
||||
$update['password'] = $params['password'];
|
||||
}else{
|
||||
unset($params['password']);
|
||||
}
|
||||
Db::name('admin')
|
||||
->where('id',$row['admin_id'])
|
||||
->update($update);
|
||||
if($params['type'] != $row['type']){
|
||||
if($params['type'] == 1){
|
||||
// 升级为一级代理 - 完整权限
|
||||
Db::name('auth_group_access')->where("uid",$row['admin_id'])->update(['group_id'=>11]);
|
||||
}else{
|
||||
// 降级为二级代理 - 基本权限
|
||||
Db::name('auth_group_access')->where("uid",$row['admin_id'])->update(['group_id'=>12]);
|
||||
}
|
||||
}
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException(true)->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del($ids = "")
|
||||
{
|
||||
if ($ids) {
|
||||
$pk = $this->model->getPk();
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
$list = $this->model->where($pk, 'in', $ids)->select();
|
||||
$count = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $k => $v) {
|
||||
$count += $v->delete();
|
||||
Db::name('admin')->where('id',$v->admin_id)->delete();
|
||||
Db::name('auth_group_access')->where('uid',$v->admin_id)->delete();
|
||||
Db::name("app_proxy")->where("id",$v->id)->delete();
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($count) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were deleted'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
|
||||
}
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 代理管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppProxyTj extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppProxyTj模型对象
|
||||
* @var \app\admin\model\app\AppProxyTj
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppProxyTj;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'user_name')
|
||||
{
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'admin_name'){
|
||||
$new_params['b.nickname'] = $value;
|
||||
$new_op['b.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
$w['a.admin_id'] = array("neq",$admin_id);
|
||||
}
|
||||
}
|
||||
$total = Db::name('app_proxy')
|
||||
->alias('a')
|
||||
->field('a.*,b.nickname as admin_name,u.path')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_admin b','b.id = a.admin_id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_proxy')
|
||||
->alias('a')
|
||||
->field('a.*,b.nickname as admin_name,u.path')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('fa_admin b','b.id = a.admin_id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$today = strtotime(date("Y-m-d"));
|
||||
foreach ($list as $key => $value) {
|
||||
|
||||
$son_arr = [];
|
||||
//团队人数
|
||||
$team_arr = Db::name("user")->field("id,jointime")->where("path","like",$value['path']."%")->where("id","neq",$value['user_id'])->select();
|
||||
$team_num = count($team_arr);$today_user = 0;
|
||||
foreach ($team_arr as $ke => $val) {
|
||||
$son_arr[] = $val['id'];
|
||||
}
|
||||
foreach ($team_arr as $ke => $val) {
|
||||
if(in_array($val['id'], $son_arr) && $val['jointime']>$today){
|
||||
$today_user = $today_user+1;
|
||||
}
|
||||
}
|
||||
//累计充值
|
||||
$rechrge = Db::name("app_recharge")->field("user_id,num,addtime")->where("status",1)->select();
|
||||
$count_reg = 0;$today_reg = 0;
|
||||
foreach ($rechrge as $ke => $val) {
|
||||
if(in_array($val['user_id'], $son_arr)){
|
||||
$count_reg = $count_reg+$val['num'];
|
||||
}
|
||||
if(in_array($val['user_id'], $son_arr) && $val['addtime']>$today){
|
||||
$today_reg = $today_user+$val['num'];
|
||||
}
|
||||
}
|
||||
//累计提现
|
||||
$widthdraw = Db::name("app_widthdraw")->field("user_id,num,add_time")->where("status",1)->select();
|
||||
$count_wid = 0;$today_wid = 0;
|
||||
foreach ($widthdraw as $ke => $val) {
|
||||
if(in_array($val['user_id'], $son_arr)){
|
||||
$count_wid = $count_wid+$val['num'];
|
||||
}
|
||||
if(in_array($val['user_id'], $son_arr) && $val['add_time']>$today){
|
||||
$today_wid = $today_wid+$val['num'];
|
||||
}
|
||||
}
|
||||
//币币交易
|
||||
$trade = Db::name("app_coin_trade")->field("user_id,have_usdt,createtime")->select();
|
||||
$count_trade = 0;$today_trade = 0;
|
||||
foreach ($trade as $ke => $val) {
|
||||
if(in_array($val['user_id'], $son_arr)){
|
||||
$count_trade = $count_trade+$val['have_usdt'];
|
||||
}
|
||||
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
||||
$today_trade = $today_trade+$val['have_usdt'];
|
||||
}
|
||||
}
|
||||
//合约交易
|
||||
$contract = Db::name("app_contract")->field("user_id,num,createtime")->where("status","2")->select();
|
||||
$count_cont = 0;$today_cont = 0;
|
||||
foreach ($contract as $ke => $val) {
|
||||
if(in_array($val['user_id'], $son_arr)){
|
||||
$count_cont = $count_cont+$val['num'];
|
||||
}
|
||||
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
||||
$today_cont = $today_cont+$val['num'];
|
||||
}
|
||||
}
|
||||
|
||||
//ICO
|
||||
$detail = Db::name("app_detailed")->field("user_id,price,createtime")->where("cart",2)->where("type",5)->where("description","ICO")->select();
|
||||
$count_ico = 0;$today_ico = 0;
|
||||
foreach ($detail as $ke => $val) {
|
||||
if(in_array($val['user_id'], $son_arr)){
|
||||
$count_ico = $count_ico+$val['price'];
|
||||
}
|
||||
if(in_array($val['user_id'], $son_arr) && $val['createtime']>$today){
|
||||
$today_ico = $today_ico+$val['price'];
|
||||
}
|
||||
}
|
||||
$value['team_num'] = $team_num;
|
||||
$value['today_user'] = $today_user;
|
||||
$value['count_reg'] = sprintf("%.2f",$count_reg);
|
||||
$value['today_reg'] = sprintf("%.2f",$today_reg);
|
||||
$value['count_wid'] = sprintf("%.2f",$count_wid);
|
||||
$value['today_wid'] = sprintf("%.2f",$today_wid);
|
||||
$value['count_trade'] = sprintf("%.2f",$count_trade);
|
||||
$value['today_trade'] = sprintf("%.2f",$today_trade);
|
||||
$value['count_cont'] = sprintf("%.2f",$count_cont);
|
||||
$value['today_cont'] = sprintf("%.2f",$today_cont);
|
||||
$value['count_ico'] = sprintf("%.2f",$count_ico);
|
||||
$value['today_ico'] = sprintf("%.2f",$today_ico);
|
||||
$list[$key] = $value;
|
||||
}
|
||||
//可结算金额
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 货币汇率管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppRate extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppRate模型对象
|
||||
* @var \app\admin\model\app\AppRate
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppRate;
|
||||
$this->view->assign("isZqtradeList", $this->model->getIsZqtradeList());
|
||||
$this->view->assign("isHytradeList", $this->model->getIsHytradeList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
public function get_ctrl($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$result = Db::name('app_rate')
|
||||
->where('id',$row['id'])->update(['tradectrl_json'=>$params['tradectrl_json'],'updatetime'=>time()]);
|
||||
if($result)
|
||||
{
|
||||
$this->success('ok');
|
||||
}else{
|
||||
$this->error('系统繁忙');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 充值审核
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppRecharge extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppRecharge模型对象
|
||||
* @var \app\admin\model\app\AppRecharge
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppRecharge;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
$total = Db::name('app_recharge aa')
|
||||
->field('aa.*,u.nickname,u.mobile,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_recharge aa')
|
||||
->field('aa.*,u.nickname,u.mobile,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($row['status'] != '2')
|
||||
{
|
||||
$this->error('编辑非法,已审核记录不可重复审核');
|
||||
}else{
|
||||
$user = Db::name('app_currency_user')
|
||||
->where('user_id',$row['user_id'])
|
||||
->where('curr_id','1')
|
||||
->find();
|
||||
if($params['status'] == '1') { //审核通过
|
||||
$recharge = [
|
||||
'user_id' => $row['user_id'],
|
||||
'curr_id' => 1,
|
||||
'price' => $row['num'],
|
||||
'cart' => '1',
|
||||
'type' => '1',
|
||||
'description' => '在线充值',
|
||||
'createtime' => time(),
|
||||
'hash' => $row['hash'],
|
||||
'before_num' => $user['num'],
|
||||
'after_num' => $user['num'] + $row['num'],
|
||||
'is_outer' => '1',
|
||||
];
|
||||
|
||||
$res = Db::name('app_detailed')->insertGetId($recharge);
|
||||
$changeamount = $user['num'] + $row['num'];
|
||||
Db::name('app_currency_user')->where('id', $user['id'])->update(['num' => $changeamount, 'updatetime' => time()]);
|
||||
}
|
||||
$result = Db::name('app_recharge')->where('id', $row['id'])->update($params);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 收款银行设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppRechargeBank extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppRechargeBank模型对象
|
||||
* @var \app\admin\model\app\AppRechargeBank
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppRechargeBank;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 充值设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppRechargeSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppRechargeSet模型对象
|
||||
* @var \app\admin\model\app\AppRechargeSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppRechargeSet;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 社区内容
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppShequSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppShequSet模型对象
|
||||
* @var \app\admin\model\app\AppShequSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppShequSet;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config;
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppWidthdraw extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppWidthdraw模型对象
|
||||
* @var \app\admin\model\app\AppWidthdraw
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppWidthdraw;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'mobile') {
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}elseif ($key == 'curr_name') {
|
||||
$new_params['p.name'] = $value;
|
||||
$new_op['p.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
$total = Db::name('app_widthdraw aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.name as curr_name,e.nickname as daili_name')//bank_code
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
// ->join('app_collection l', 'aa.card_num = l.card_num','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_widthdraw aa')
|
||||
->field('aa.*,u.nickname,u.mobile,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
// ->join('app_collection l', 'aa.card_num = l.card_num','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$count_price = Db::name('app_widthdraw aa')
|
||||
->field('aa.*,u.nickname,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->sum("aa.num");
|
||||
foreach ($list as $key => $value) {
|
||||
$value['bank_code'] = Db::name("app_collection")->where("user_id",$value['user_id'])->where("card_num",$value['card_num'])->value("bank_code");
|
||||
$list[$key] = $value;
|
||||
}
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list,"count_price"=>$count_price);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
if($row['status'] != '2')
|
||||
{
|
||||
$this->error('编辑非法,已审核记录不可重复审核');
|
||||
}else{
|
||||
$user = Db::name('app_currency_user')
|
||||
->where('user_id',$row['user_id'])
|
||||
->where('curr_id','1')
|
||||
->find();
|
||||
if($params['status'] == '1') { //审核通过
|
||||
$params['exam_time'] = time();
|
||||
$result = Db::name('app_widthdraw')
|
||||
->where('id',$row['id'])->update($params);
|
||||
}else if($params['status'] == '0') {
|
||||
$recharge = [
|
||||
'user_id' => $row['user_id'],
|
||||
'curr_id' => 1,
|
||||
'price' => $row['num'],
|
||||
'cart' => '1',
|
||||
'type' => '2',
|
||||
'description' => $params['description'],
|
||||
'hash' => '',
|
||||
'before_num' => $user['num'],
|
||||
'after_num' => $user['num'] + $row['num'],
|
||||
'is_outer' => '0',
|
||||
'createtime' => time(),
|
||||
];
|
||||
|
||||
Db::name('app_detailed')->insertGetId($recharge);
|
||||
$changeamount = $user['num'] + $row['num'];
|
||||
Db::name('app_currency_user')->where('id', $user['id'])
|
||||
->update(['num' => $changeamount, 'updatetime' => time()]);
|
||||
$result = Db::name('app_widthdraw')
|
||||
->where('id',$row['id'])->update(['status'=>'0','description'=>$params['description'],'exam_time'=>time()]);
|
||||
|
||||
} else{ //审核失败
|
||||
$result = Db::name('app_widthdraw')
|
||||
->where('id',$row['id'])->update(['exam_time'=>time()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (PDOException $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function bc_dechex($decimal)
|
||||
{
|
||||
$result = [];
|
||||
while ($decimal != 0) {
|
||||
$mod = $decimal % 16;
|
||||
$decimal = floor($decimal / 16);
|
||||
array_push($result, dechex($mod));
|
||||
}
|
||||
return join(array_reverse($result));
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 提币地址管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppWidthdrawAddress extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppWidthdrawAddress模型对象
|
||||
* @var \app\admin\model\app\AppWidthdrawAddress
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppWidthdrawAddress;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* index重写
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
// print_r($params);exit;
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}elseif ($key == 'email') {
|
||||
$new_params['u.email'] = $value;
|
||||
$new_op['u.email'] = $op[$key];
|
||||
}elseif ($key == 'uid') {
|
||||
$new_params['u.uid'] = $value;
|
||||
$new_op['u.uid'] = $op[$key];
|
||||
}elseif ($key == 'curr_name') {
|
||||
$new_params['p.name'] = $value;
|
||||
$new_op['p.name'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['aa.' . $key] = $value;
|
||||
$new_op['aa.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['aa.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
$total = Db::name('app_widthdraw_address aa')
|
||||
->field('aa.*,u.nickname,u.email,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_widthdraw_address aa')
|
||||
->field('aa.*,u.nickname,u.email,p.name as curr_name,e.nickname as daili_name')
|
||||
->join('user u', 'aa.user_id = u.id','left')
|
||||
->join('app_currency p', 'aa.curr_id = p.id','left')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('aa.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
// var_dump( Db::name('app_widthdraw aa')->getlastsql() );die;
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 锁仓释放记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppZhiyaDetail extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppZhiyaDetail模型对象
|
||||
* @var \app\admin\model\app\AppZhiyaDetail
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppZhiyaDetail;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_zhiya_detail')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_zhiya_detail')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 锁仓周期设置
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppZhiyaSet extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppZhiyaSet模型对象
|
||||
* @var \app\admin\model\app\AppZhiyaSet
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppZhiyaSet;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 锁仓记录
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppZhiyaUser extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppZhiyaUser模型对象
|
||||
* @var \app\admin\model\app\AppZhiyaUser
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppZhiyaUser;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.nickname'] = $value;
|
||||
$new_op['u.nickname'] = $op[$key];
|
||||
}else if($key == 'day'){
|
||||
$new_params['b.day'] = $value;
|
||||
$new_op['b.day'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$total = Db::name('app_zhiya_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.day')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('app_zhiya_set b', 'b.id = a.zhiya_id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('app_zhiya_user')
|
||||
->alias('a')
|
||||
->field('a.*,u.nickname as user_name,b.day')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('app_zhiya_set b', 'b.id = a.zhiya_id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 资讯管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppZixun extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppZixun模型对象
|
||||
* @var \app\admin\model\app\AppZixun
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppZixun;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 资讯管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AppZixun extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AppZixun模型对象
|
||||
* @var \app\admin\model\app\AppZixun
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\AppZixun;
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
// 设置默认值
|
||||
if (!isset($params['user_id']) || empty($params['user_id'])) {
|
||||
$params['user_id'] = $this->auth->id; // 使用当前登录管理员ID
|
||||
}
|
||||
if (!isset($params['look_num']) || $params['look_num'] === '') {
|
||||
$params['look_num'] = 0;
|
||||
}
|
||||
if (!isset($params['addtime']) || empty($params['addtime'])) {
|
||||
$params['addtime'] = time();
|
||||
}
|
||||
|
||||
// 可选字段,如果为空则设置为空字符串
|
||||
$optionalFields = ['title_en', 'cover_image', 'content_en'];
|
||||
foreach ($optionalFields as $field) {
|
||||
if (!isset($params[$field])) {
|
||||
$params[$field] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$result = false;
|
||||
\think\Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException(true)->validate($validate);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
\think\Db::commit();
|
||||
} catch (\think\exception\PDOException $e) {
|
||||
\think\Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (\think\Exception $e) {
|
||||
\think\Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
// 可选字段,如果为空则设置为空字符串
|
||||
$optionalFields = ['title_en', 'cover_image', 'content_en'];
|
||||
foreach ($optionalFields as $field) {
|
||||
if (!isset($params[$field])) {
|
||||
$params[$field] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$result = false;
|
||||
\think\Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException(true)->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
\think\Db::commit();
|
||||
} catch (\think\exception\PDOException $e) {
|
||||
\think\Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
} catch (\think\Exception $e) {
|
||||
\think\Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result !== false) {
|
||||
$this->success();
|
||||
} else {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
}
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
}
|
||||
Executable
+151
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 会员管理
|
||||
*
|
||||
* @icon fa fa-user
|
||||
*/
|
||||
class Baobiao extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Baobiao模型对象
|
||||
* @var \app\admin\model\app\Baobiao
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\Baobiao;
|
||||
$this->view->assign("lhActList", $this->model->getLhActList());
|
||||
$this->view->assign("apyPayList", $this->model->getApyPayList());
|
||||
$this->view->assign("authList", $this->model->getAuthList());
|
||||
$this->view->assign("earlyAuthList", $this->model->getEarlyAuthList());
|
||||
$this->view->assign("highAuthList", $this->model->getHighAuthList());
|
||||
$this->view->assign("userTypeList", $this->model->getUserTypeList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'), true);
|
||||
$op = json_decode(input('op'), true);
|
||||
if (count($params) > 0) {
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if ($key == 'nickname') {
|
||||
$new_params['a.nickname'] = $value;
|
||||
$new_op['a.nickname'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
} else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
} else {
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['a.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('user')->alias('a')
|
||||
->field('a.id,e.nickname as daili_name')
|
||||
->join('admin e', 'a.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
|
||||
$list = Db::name('user')->alias('a')
|
||||
->field('a.*,e.nickname as daili_name')
|
||||
->join('admin e', 'a.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
foreach ($list as $key => $value) {
|
||||
|
||||
$curr = Db::name("app_currency_user a")->field("a.id,a.curr_id,a.num,a.num_fb,a.num_lh,a.num_dj,a.num_fb_dj,a.num_lh_dj,b.name,b.full_name,b.exchange,b.thumb_image,b.is_reg,b.is_wid,b.is_tran,b.is_otc,a.tron_address")
|
||||
->join("app_currency b","a.curr_id=b.id","left")
|
||||
->where("a.user_id",$value['id'])
|
||||
->order("a.curr_id asc")
|
||||
->select();
|
||||
$count_xh_usdt = 0;//现货总U
|
||||
$my_usdt = 0;$btcex = 0;
|
||||
foreach ($curr as $ke => $val) {
|
||||
if($val['curr_id'] == 1){
|
||||
$my_usdt = $val['num'];
|
||||
}
|
||||
if($val['curr_id'] == 2){
|
||||
$usdt_num = sprintf("%.6f",($val['num']+$val['num_dj'])*$val['exchange']);
|
||||
$btcex = $val['num'];
|
||||
}else{
|
||||
$usdt_num = sprintf("%.6f",($val['num']+$val['num_dj'])*$val['exchange']);
|
||||
}
|
||||
$count_xh_usdt = $count_xh_usdt+$usdt_num;
|
||||
}
|
||||
$value['count_usdt'] = sprintf("%.2f",$count_xh_usdt);
|
||||
$value['youxiao_usdt'] = sprintf("%.2f",$count_xh_usdt);
|
||||
$value['usdt_num'] = sprintf("%.2f",$my_usdt);
|
||||
$value['btcex'] = sprintf("%.2f",$btcex);
|
||||
//ICO冻结
|
||||
$ico = Db::name("app_ico_user a")->field("a.num,b.price")
|
||||
->join("app_ico_set b","a.ico_id=b.id","left")
|
||||
->where("a.user_id",$value['id'])
|
||||
->where("a.status",0)
|
||||
->select();
|
||||
$ico_usdt = 0;
|
||||
foreach ($ico as $kk => $vv) {
|
||||
$ico_usdt = $ico_usdt+($vv['num']*$vv['price']);
|
||||
}
|
||||
$value['ico_usdt'] = sprintf("%.2f",$ico_usdt);
|
||||
//合约占用
|
||||
$heyue_usdt = Db::name("app_contract")->where("user_id",$value['id'])->where("status",1)->sum("num");
|
||||
$value['heyue_usdt'] = sprintf("%.2f",$heyue_usdt);
|
||||
$list[$key] = $value;
|
||||
}
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 订单历史管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class HisOrder extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* HisOrder模型对象
|
||||
* @var \app\admin\model\app\HisOrder
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\HisOrder;
|
||||
$this->view->assign("symbolList", $this->model->getSymbolList());
|
||||
$this->view->assign("tradeResultList", $this->model->getTradeResultList());
|
||||
$this->view->assign("riseOrFallList", $this->model->getRiseOrFallList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.username'] = $value;
|
||||
$new_op['u.username'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
$total = Db::name('his_order')
|
||||
->alias('a')
|
||||
->field('a.*,u.username as user_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('his_order')
|
||||
->alias('a')
|
||||
->field('a.*,u.username as user_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
Executable
+584
@@ -0,0 +1,584 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\admin\controller\kefu\Config;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\Config as Configs;
|
||||
|
||||
/**
|
||||
* 客户订单管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Order extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Order模型对象
|
||||
* @var \app\admin\model\app\Order
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\Order;
|
||||
$this->view->assign("symbolList", $this->model->getSymbolList());
|
||||
$this->view->assign("riseOrFallList", $this->model->getRiseOrFallList());
|
||||
$this->view->assign("setLossList", $this->model->getSetLossList());
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.username'] = $value;
|
||||
$new_op['u.username'] = $op[$key];
|
||||
}elseif ($key == 'daili_name') {
|
||||
$new_params['e.nickname'] = $value;
|
||||
$new_op['e.nickname'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
$admin_id = $this->auth->id;
|
||||
if($admin_id > 1){
|
||||
$user = Db::name("user")->where("admin_id",$admin_id)->find();
|
||||
if($user){
|
||||
$w['u.path'] = array("like",$user['path']."%");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$total = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*,u.username as user_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*,u.username as user_name,e.nickname as daili_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->join('admin e', 'u.p_admin_id = e.id' , 'left')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$extend['risenum'] = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*')
|
||||
->where('rise_or_fall','rise')
|
||||
->sum('trade_num');
|
||||
$extend['fallnum'] = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*')
|
||||
->where('rise_or_fall','fall')
|
||||
->sum('trade_num');
|
||||
$extend['risewin'] = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*')
|
||||
->where('rise_or_fall','rise')
|
||||
->sum('expect_income');
|
||||
$extend['fallwin'] = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*')
|
||||
->where('rise_or_fall','fall')
|
||||
->sum('expect_income');
|
||||
$coindata = Db::name('app_rate')
|
||||
->whereIn('symbol','btcusdt,ethusdt,eosusdt,bchusdt,ltcusdt')->select();
|
||||
$extend['coin'] = array_column($coindata,'open','name');
|
||||
$extend['nowtime'] = time();
|
||||
$result = array("total" => $total, "rows" => $list,'extend' => $extend);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
//生成价格
|
||||
public function createPrice()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
if(empty($params['symbols']))
|
||||
{
|
||||
$this->error('请选择币种');
|
||||
}
|
||||
if(empty($params['zhouqi']))
|
||||
{
|
||||
$this->error('请选择周期');
|
||||
}
|
||||
if(empty($params['rise_or_falls']))
|
||||
{
|
||||
$this->error('请选择涨跌类型');
|
||||
}
|
||||
if(empty($params['prices']) || !is_numeric($params['prices']))
|
||||
{
|
||||
$this->error('请输入波动价格');
|
||||
}
|
||||
if(empty($params['createstime']))
|
||||
{
|
||||
$this->error('请选择下单时间');
|
||||
}
|
||||
|
||||
$tstime = strtotime($params['createstime']);
|
||||
$symbols = str_replace('usdt','',$params['symbols']);
|
||||
$newprice1 = Db::name('hb_1s_'.$symbols)
|
||||
->where('ts',"<=",$tstime-2)
|
||||
->order('ts','desc')->find();
|
||||
$newprice2 = Db::name('hb_1s_'.$symbols)
|
||||
->where('ts',"<=",$tstime-1)
|
||||
->order('ts','desc')->find();
|
||||
$newprice3 = Db::name('hb_1s_'.$symbols)
|
||||
->where('ts',"<=",$tstime)
|
||||
->order('ts','desc')->find();
|
||||
$newprice4 = Db::name('hb_1s_'.$symbols)
|
||||
->where('ts',"<=",$tstime+1)
|
||||
->order('ts','desc')->find();
|
||||
$newprice5 = Db::name('hb_1s_'.$symbols)
|
||||
->where('ts',"<=",$tstime+2)
|
||||
->order('ts','desc')->find();
|
||||
|
||||
if(!$newprice5)
|
||||
{
|
||||
$this->error('该时间段无效未获取到价格');
|
||||
}
|
||||
$randprice1 = $this->randomFloat(0,$params['prices'],2);
|
||||
$randprice2 = $this->randomFloat(0,$params['prices'],2);
|
||||
$randprice3 = $this->randomFloat(0,$params['prices'],2);
|
||||
$randprice4 = $this->randomFloat(0,$params['prices'],2);
|
||||
$randprice5 = $this->randomFloat(0,$params['prices'],2);
|
||||
if($params['rise_or_falls'] == 'rise')
|
||||
{
|
||||
$data = [
|
||||
'newprice1' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']-2),
|
||||
'price' => sprintf('%.2f',($randprice1+$newprice1['price']))
|
||||
],
|
||||
'newprice2' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']-1),
|
||||
'price' => sprintf('%.2f',($randprice2+$newprice2['price']))
|
||||
],
|
||||
'newprice3' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']),
|
||||
'price' => sprintf('%.2f',($randprice3+$newprice3['price']))
|
||||
],
|
||||
'newprice4' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']+1),
|
||||
'price' => sprintf('%.2f',($randprice4+$newprice4['price']))
|
||||
],
|
||||
'newprice5' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']+2),
|
||||
'price' => $newprice5['price']
|
||||
],
|
||||
];
|
||||
}else{
|
||||
$data = [
|
||||
'newprice1' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']-2),
|
||||
'price' => sprintf('%.2f',($newprice1['price']-$randprice1))
|
||||
],
|
||||
'newprice2' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']-1),
|
||||
'price' => sprintf('%.2f',($newprice2['price']-$randprice2))
|
||||
],
|
||||
'newprice3' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']),
|
||||
'price' => sprintf('%.2f',($newprice3['price']-$randprice3))
|
||||
],
|
||||
'newprice4' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']+1),
|
||||
'price' => sprintf('%.2f',($newprice4['price']-$randprice4))
|
||||
],
|
||||
'newprice5' => [
|
||||
'times' => date('Y-m-d H:i:s', $tstime+$params['zhouqi']+2),
|
||||
'price' => $newprice5['price']
|
||||
],
|
||||
];
|
||||
}
|
||||
$data['openprice'] = $newprice3['price'];
|
||||
$this->success('success','',$data);
|
||||
}
|
||||
|
||||
//创建价格
|
||||
public function buildPrice()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
if (empty($params['symbols'])) {
|
||||
$this->error('请选择币种');
|
||||
}
|
||||
if (empty($params['zhouqi'])) {
|
||||
$this->error('请选择周期');
|
||||
}
|
||||
if (empty($params['rise_or_falls'])) {
|
||||
$this->error('请选择涨跌类型');
|
||||
}
|
||||
if (empty($params['prices']) || !is_numeric($params['prices'])) {
|
||||
$this->error('请输入波动价格');
|
||||
}
|
||||
if (empty($params['createstime'])) {
|
||||
$this->error('请选择下单时间');
|
||||
}
|
||||
$insertdata = [
|
||||
[
|
||||
'symbol' => $params['symbols'],
|
||||
'ts' => strtotime($params['newpricetime1']),
|
||||
'price' => $params['newprice1'],
|
||||
'amount' => 0,
|
||||
'createtime' => time()
|
||||
],
|
||||
[
|
||||
'symbol' => $params['symbols'],
|
||||
'ts' => strtotime($params['newpricetime2']),
|
||||
'price' => $params['newprice2'],
|
||||
'amount' => 0,
|
||||
'createtime' => time()
|
||||
],
|
||||
[
|
||||
'symbol' => $params['symbols'],
|
||||
'ts' => strtotime($params['newpricetime3']),
|
||||
'price' => $params['newprice3'],
|
||||
'amount' => 0,
|
||||
'createtime' => time()
|
||||
],
|
||||
[
|
||||
'symbol' => $params['symbols'],
|
||||
'ts' => strtotime($params['newpricetime4']),
|
||||
'price' => $params['newprice4'],
|
||||
'amount' => 0,
|
||||
'createtime' => time()
|
||||
],
|
||||
[
|
||||
'symbol' => $params['symbols'],
|
||||
'ts' => strtotime($params['newpricetime5']),
|
||||
'price' => $params['newprice5'],
|
||||
'amount' => 0,
|
||||
'createtime' => time()
|
||||
],
|
||||
];
|
||||
$ret = Db::name('hb_ctrl')->insertAll($insertdata);
|
||||
if($ret){
|
||||
$result = http_curl('http://149api.ms2722.com/crest/hbmarket/syncCtrl?token=datrade');
|
||||
$this->success('添加成功',$result);
|
||||
}else{
|
||||
$this->error('系统繁忙');
|
||||
}
|
||||
}
|
||||
//清除价格
|
||||
public function cleanPrice()
|
||||
{
|
||||
$ret = Db::name('hb_ctrl')
|
||||
->where('id','>',0)
|
||||
->delete();
|
||||
if($ret){
|
||||
$result = http_curl('http://149api.ms2722.com/crest/hbmarket/cancelSyncCtrl?token=datrade');
|
||||
$this->success('已取消所有调控价格');
|
||||
}else{
|
||||
$this->error('系统繁忙');
|
||||
}
|
||||
}
|
||||
|
||||
//4位小数的随机数
|
||||
public function randomFloat($min = 0, $max = 10 , $localnum = 4)
|
||||
{
|
||||
if($localnum == 4) {
|
||||
if ($max - $min <= 0.0002) {
|
||||
return 0;
|
||||
}
|
||||
$rand = mt_rand() / mt_getrandmax() * ($max - $min-0.0001);
|
||||
$num = $min + $rand;
|
||||
$number = sprintf("%.4f", $num);
|
||||
if($number == $min){
|
||||
$number += 0.0001;
|
||||
}
|
||||
}else if($localnum == 5){
|
||||
if ($max - $min <= 0.00002) {
|
||||
return 0;
|
||||
}
|
||||
$rand = mt_rand() / mt_getrandmax() * ($max - $min-0.00001);
|
||||
$num = $min + $rand;
|
||||
$number = sprintf("%.5f", $num);
|
||||
if($number == $min){
|
||||
$number += 0.00001;
|
||||
}
|
||||
}else if($localnum == 6){
|
||||
if ($max - $min <= 0.000002) {
|
||||
return 0;
|
||||
}
|
||||
$rand = mt_rand() / mt_getrandmax() * ($max - $min-0.000001);
|
||||
$num = $min + $rand;
|
||||
$number = sprintf("%.6f", $num);
|
||||
if($number == $min){
|
||||
$number += 0.000001;
|
||||
}
|
||||
}else if($localnum == 2){
|
||||
if ($max - $min <= 0.02) {
|
||||
return 0;
|
||||
}
|
||||
$rand = mt_rand() / mt_getrandmax() * ($max - $min-0.01);
|
||||
$num = $min + $rand;
|
||||
$number = sprintf("%.2f", $num);
|
||||
if($number == $min){
|
||||
$number += 0.01;
|
||||
}
|
||||
}else if($localnum == 3){
|
||||
if ($max - $min <= 0.001) {
|
||||
return 0;
|
||||
}
|
||||
$rand = mt_rand() / mt_getrandmax() * ($max - $min-0.001);
|
||||
$num = $min + $rand;
|
||||
$number = sprintf("%.3f", $num);
|
||||
if($number == $min){
|
||||
$number += 0.001;
|
||||
}
|
||||
}
|
||||
|
||||
return $number;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听订单管理
|
||||
*/
|
||||
public function jianting()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$total = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*,u.mobile as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('order')
|
||||
->alias('a')
|
||||
->field('a.*,u.mobile as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->group('createtime')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
foreach ($list as $key=>$value)
|
||||
{
|
||||
$order = Db::name('order')
|
||||
->where('createtime',$value['createtime'])->select();
|
||||
//下单人数
|
||||
$value['ordercount'] = Db::name('order')
|
||||
->where('createtime',$value['createtime'])->count();
|
||||
//总金额
|
||||
$value['ordersum'] = Db::name('order')
|
||||
->where('createtime',$value['createtime'])->sum('trade_num');
|
||||
$risenum = $risesum = 0;
|
||||
$fallnum = $fallsum = 0;
|
||||
$normal_orders = explode('-',Configs::get('site.normal_orders'));
|
||||
$middle_orders = explode('-',Configs::get('site.middle_orders'));
|
||||
$weighest_orders = explode('-',Configs::get('site.weighest_orders'));
|
||||
$normalnum = $middlenum = $weighestnum = 0;
|
||||
foreach ($order as $kk=>$val)
|
||||
{
|
||||
if($val['rise_or_fall'] == 'rise')
|
||||
{
|
||||
$risenum++;
|
||||
$risesum += $val['trade_num'];
|
||||
}else{
|
||||
$fallnum++;
|
||||
$fallsum += $val['trade_num'];
|
||||
}
|
||||
if($val['trade_num'] > $normal_orders[0] && $val['trade_num'] <= $normal_orders[1])
|
||||
{
|
||||
$normalnum += $val['trade_num'];
|
||||
}else if($val['trade_num'] > $middle_orders[0] && $val['trade_num'] <= $middle_orders[1])
|
||||
{
|
||||
$middlenum += $val['trade_num'];
|
||||
}else if($val['trade_num'] > $weighest_orders[0] && $val['trade_num'] <= $weighest_orders[1])
|
||||
{
|
||||
$weighestnum += $val['trade_num'];
|
||||
}
|
||||
|
||||
}
|
||||
//涨
|
||||
$value['risep'] = "单数:".$risenum."\r\n"."总额:".$risesum."\r\n"."比例:".(sprintf('%.4f',$risesum/$value['ordersum'])*100)."%";
|
||||
//跌
|
||||
$value['fallp'] = "单数:".$fallnum."\r\n"."总额:".$fallsum."\r\n"."比例:".(sprintf('%.4f',$fallsum/$value['ordersum'])*100)."%";
|
||||
$value['normalp'] = "总额:".$normalnum."\r\n"."比例:".((sprintf('%.4f',$normalnum/$value['ordersum']))*100)."%";
|
||||
$value['middlep'] = "总额:".$middlenum."\r\n"."比例:".((sprintf('%.4f',$middlenum/$value['ordersum']))*100)."%";
|
||||
$value['weighestp'] = "总额:".$weighestnum."\r\n"."比例:".((sprintf('%.4f',$weighestnum/$value['ordersum']))*100)."%";
|
||||
$value['createtimes'] = date('Y-m-d H:i:s',$value['createtime']);
|
||||
$list[$key] = $value;
|
||||
}
|
||||
|
||||
$result = array("total" => $total, "rows" => $list,'extend' => '');
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function set_yk($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
// $params = $this->preExcludeFields($params);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
$this->success();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function set_bl($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->post("row/a");
|
||||
if ($params) {
|
||||
// $params = $this->preExcludeFields($params);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
$this->success();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->view->assign("row", $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置盈利
|
||||
*/
|
||||
public function set_yin()
|
||||
{
|
||||
$ids = $this->request->get("ids");
|
||||
if($ids){
|
||||
Db::name("order")->where("id",$ids)->update(['set_loss'=>1]);
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
/**
|
||||
* 设置盈利
|
||||
*/
|
||||
public function set_kui()
|
||||
{
|
||||
$ids = $this->request->get("ids");
|
||||
if($ids){
|
||||
Db::name("order")->where("id",$ids)->update(['set_loss'=>2]);
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 用户地址管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class UserAddress extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* UserAddress模型对象
|
||||
* @var \app\admin\model\app\UserAddress
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\UserAddress;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags']);
|
||||
if ($this->request->isAjax())
|
||||
{
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField'))
|
||||
{
|
||||
return $this->selectpage();
|
||||
}
|
||||
// list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
$offset = $this->request->get("offset", 0);
|
||||
$limit = $this->request->get("limit", 0);
|
||||
$params = json_decode(input('filter'),true);
|
||||
$op = json_decode(input('op'),true);
|
||||
if(count($params) > 0){
|
||||
$new_params = $new_op = [];
|
||||
foreach ($params as $key => $value) {
|
||||
if($key == 'mobile')
|
||||
{
|
||||
$new_params['u.' . $key] = $value;
|
||||
$new_op['u.' . $key] = $op[$key];
|
||||
}else if($key == 'user_name'){
|
||||
$new_params['u.mobile'] = $value;
|
||||
$new_op['u.mobile'] = $op[$key];
|
||||
}else {
|
||||
$new_params['a.' . $key] = $value;
|
||||
$new_op['a.' . $key] = $op[$key];
|
||||
}
|
||||
}
|
||||
$w = $this->rewriteQuery($new_params, $new_op);
|
||||
}else{
|
||||
$w['a.id'] = array('>', 0);
|
||||
}
|
||||
|
||||
$total = Db::name('user_address')
|
||||
->alias('a')
|
||||
->field('a.*,u.mobile as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->count();
|
||||
$list = Db::name('user_address')
|
||||
->alias('a')
|
||||
->field('a.*,u.mobile as user_name')
|
||||
->join('fa_user u', 'a.user_id = u.id')
|
||||
->where($w)
|
||||
->order('a.id', 'desc')
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 用户等级管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class UserGrade extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* UserGrade模型对象
|
||||
* @var \app\admin\model\app\UserGrade
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\UserGrade;
|
||||
|
||||
}
|
||||
|
||||
public function import()
|
||||
{
|
||||
parent::import();
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Reference in New Issue
Block a user