|
@@ -3,13 +3,36 @@ namespace app\newhome\controller;
|
|
|
|
|
|
use think\Controller;
|
|
|
use think\Db;
|
|
|
+use app\user\model\User;
|
|
|
|
|
|
class Index extends Controller {
|
|
|
|
|
|
+ private $userModel;
|
|
|
+
|
|
|
+ public function _initialize(){
|
|
|
+ $this->userModel = new User();
|
|
|
+ }
|
|
|
+
|
|
|
public function index()
|
|
|
{
|
|
|
$data = Db::name('config')->select();
|
|
|
return json(["l"=>$data]);
|
|
|
}
|
|
|
|
|
|
+ public function robot(){
|
|
|
+ $data = decode($this->request->post());
|
|
|
+
|
|
|
+ $this->userModel->addAndSave(['id'=>$data['u'], 'robot'=>1]);
|
|
|
+
|
|
|
+ return json(['error'=>0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function number(){
|
|
|
+ $data = decode($this->request->post());
|
|
|
+
|
|
|
+ $res = $this->userModel->getRobotId($data['n']);
|
|
|
+
|
|
|
+ return json(['l'=>$res]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|