73 lines
2.2 KiB
PHP
73 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace app\index\controller;
|
|
|
|
use app\common\classLibrary\ClWechat;
|
|
use think\Session;
|
|
|
|
class SysUser extends Common
|
|
{
|
|
/**
|
|
* lists
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|\think\response\View
|
|
*/
|
|
public function lists()
|
|
{
|
|
return view();
|
|
}
|
|
|
|
/**
|
|
* actionLists
|
|
* @return \think\response\Json
|
|
*/
|
|
public function actionLists()
|
|
{
|
|
$field_arr = array(
|
|
array('field_name' => 'page','rule' => 'require|number'),
|
|
array('field_name' => 'pageSize','rule' => 'require|number')
|
|
);
|
|
$check_arr = $this->checkHave($field_arr);
|
|
if($check_arr[self::$error_code_name] == 0)
|
|
{
|
|
$url = config('api_domain').'/user/lists';
|
|
$session = Session::get('admin');
|
|
$params = array();
|
|
$params['token'] = $session['password'];
|
|
$params['debug'] = 1;
|
|
$params['is_count'] = 1;
|
|
$params['page'] = $check_arr[self::$data_name]['page'];
|
|
$params['pageSize'] = $check_arr[self::$data_name]['pageSize'];
|
|
$result = ClWechat::http_post($url,$params);
|
|
$json_arr = json_decode($result,true);
|
|
$json_arr['code'] = $json_arr['error_code'];
|
|
$json_arr['data'] = $json_arr['lists'];
|
|
self::$result = $json_arr;
|
|
}
|
|
return json(self::$result);
|
|
}
|
|
|
|
/**
|
|
* actionDelete
|
|
* @return \think\response\Json
|
|
*/
|
|
public function actionDelete()
|
|
{
|
|
$field_arr = array(
|
|
array('field_name' => 'id','rule' => 'require|number')
|
|
);
|
|
$check_arr = $this->checkHave($field_arr);
|
|
if($check_arr[self::$error_code_name] == 0)
|
|
{
|
|
$url = config('api_domain').'/user/delete';
|
|
$session = Session::get('admin');
|
|
$params = array();
|
|
$params['token'] = $session['password'];
|
|
$params['id'] = $check_arr[self::$data_name]['id'];
|
|
$params['debug'] = 1;
|
|
$result = ClWechat::http_post($url,$params);
|
|
$json_arr = json_decode($result,true);
|
|
self::$result = $json_arr;
|
|
}
|
|
return json(self::$result);
|
|
}
|
|
} |