123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- /**
- *
- * User: anyluck
- * Date: 2020/6/2
- * Time: 17:39
- */
- namespace app\admin\controller;
- use app\common\model\Mining;
- use app\common\model\State;
- use think\facade\Request;
- use think\facade\View;
- class Certificate
- {
- //通证管理
- /**
- * 通证管理
- */
- public function index()
- {
-
- }
- /**
- * BTS管理
- */
- public function bts()
- {
- if (Request::isPost()) {
- $name = input("name");
- $page = input("page") ?: 1;
- $limit = input("limit") ?: 10;
- $where = [];
- // if ($name){
- // $where["name"]=["like","% $name %"];
- // }
- $list = Mining::where($where)->order("id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
- return $item;
- })->toArray();
- return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
- }
- return View::fetch();
- }
- // 修改状态
- public function update_bts_status()
- {
- $id=input("id");
- $mining=Mining::where(["id"=>$id])->find();
- if ($mining->status==0){
- $update["status"]=1;
- }else{
- $update["status"]=0;
- }
- Mining::update($update,["id"=>$id]);
- json_result(200,"设置成功");
- }
- // 删除bts
- public function del_mining()
- {
- $id=input("id");
- Mining::where(["id"=>$id])->delete();
- json_result(200,"删除成功");
- }
- // 修改添加
- public function addbts()
- {
- if (Request::isPost()) {
- $data = Request::post();
- $id=input("id");
- if ($id){
- Mining::update($data);
- }else{
- Mining::create($data);
- }
- json_result(200,"操作成功",$data);
- }
- $id=input("id");
- $info="";
- if ($id){
- $info= Mining::where(["id"=>$id])->find();
- }
- $view = [
- 'info' =>$info,
- ];
- View::assign($view);
- return View::fetch();
- }
- }
|