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