You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.1 KiB
100 lines
2.1 KiB
<?php
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
use app\admin\model\Agency;
|
|
use think\Controller;
|
|
use think\db\Query;
|
|
|
|
class License extends Base
|
|
{
|
|
public function __construct(){
|
|
parent::__construct();
|
|
}
|
|
/**
|
|
* 列表
|
|
*/
|
|
public function index()
|
|
{
|
|
$map=array();
|
|
$admin_list=Db::name('license')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
|
|
|
|
$page = $admin_list->render();
|
|
$this->assign('list',$admin_list);
|
|
$this->assign('page',$page);
|
|
|
|
return $this->fetch();
|
|
}
|
|
|
|
|
|
/**
|
|
* 修改
|
|
*/
|
|
public function edit()
|
|
{
|
|
$kind=input("kind");
|
|
$this->assign('kind',$kind);
|
|
$list=Db::name('license')->find(input('admin_id'));
|
|
$this->assign('list',$list);
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 修改操作
|
|
*/
|
|
public function runedit()
|
|
{
|
|
|
|
$kind=input("kind");
|
|
$this->assign('kind',$kind);
|
|
|
|
$data=[];
|
|
$data['state']=input('state');
|
|
$id=input('id');
|
|
$rst=Db::name('license')->where(['id'=>$id])->update($data);
|
|
if($rst!==false){
|
|
$this->success('修改成功',url('License/index',['kind'=>$kind]));
|
|
}else{
|
|
$this->error('修改失败',url('License/index',['kind'=>$kind]));
|
|
}
|
|
}
|
|
/**
|
|
* 删除
|
|
*/
|
|
public function del()
|
|
{
|
|
$kind=input("kind");
|
|
$this->assign('kind',$kind);
|
|
$admin_id=input('id');
|
|
if (empty($admin_id)){
|
|
$this->error('ID不存在',url('License/index',['kind'=>$kind]));
|
|
}
|
|
$rst=Db::name('license')->delete($admin_id);
|
|
if($rst!==false){
|
|
$this->success('删除成功',url('License/index',['kind'=>$kind]));
|
|
}else{
|
|
$this->error('删除失败',url('License/index',['kind'=>$kind]));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 审核/取消审核
|
|
*/
|
|
public function state()
|
|
{
|
|
$id=input('x');
|
|
$find=Db::name('license')->where(array('id'=>$id))->find();
|
|
$msg='未审';
|
|
if($find){
|
|
$status=$find['state'];
|
|
if($status==1){
|
|
$statedata = array('state'=>0);
|
|
}else{
|
|
$statedata = array('state'=>1);
|
|
$msg='已审';
|
|
}
|
|
$query=Db::name('license')->where(array('id'=>$id))->setField($statedata);
|
|
}
|
|
$this->success($msg);
|
|
}
|
|
}
|