<?php namespace Tool\Api;
use Dever;
class App
{
    # 安装应用
    public function lock()
    {
        $extend = Dever::load('common', 'manage')->extend();
        $where['uid'] = $extend['data_id'];
        $where['tool_id'] = Dever::input('id');
        $info = Dever::db('user', 'tool')->find($where);
        if (!$info) {
            Dever::db('user', 'tool')->insert($where);
        }
        return '安装成功';
    }

    # 卸载应用
    public function unlock()
    {
        $extend = Dever::load('common', 'manage')->extend();
        $where['uid'] = $extend['data_id'];
        $where['tool_id'] = Dever::input('id');
        $info = Dever::db('user', 'tool')->find($where);
        if ($info) {
            Dever::db('user', 'tool')->delete($where);
        }
        return '卸载成功';
    }
}