- 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: 新闻自动采集脚本
152 lines
6.0 KiB
PHP
Executable File
152 lines
6.0 KiB
PHP
Executable File
<?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();
|
|
}
|
|
|
|
}
|