Commit 1da5945d authored by 冯超鹏's avatar 冯超鹏

新模块

parent 0bd713ac
Pipeline #29 failed with stages
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Laravue\Models\wxUser; use App\Laravue\Models\wxUser;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
...@@ -26,18 +26,54 @@ class WxuserController extends Controller ...@@ -26,18 +26,54 @@ class WxuserController extends Controller
* */ * */
$pagenNum=$request->input('page')-1;//页数 $pagenNum=$request->input('page')-1;//页数
$limit = $request->input('limit'); $limit = $request->input('limit');
if($pagenNum === '' || $limit == ''){ if($pagenNum === '' || $limit == ''){
return $this->jsonErrorData(105,'页数或limit不能为空'); return $this->jsonErrorData(105,'页数或limit不能为空');
} }
$cont = Wxuser::count();
$Wxuser = Wxuser::select('nickname','id','openid','sex','province','city','mobile','country','headimgurl','created_at','state') $Wxuser = Wxuser::select('nickname','id','openid','sex','province','city','mobile','country','headimgurl','created_at','state')
->offset($pagenNum) ->offset($pagenNum)
->orderBy('id', 'desc') ->orderBy('id', 'desc')
->limit($limit) ->limit($limit)
->get(); ->get();
$data = ['Wxuser'=>$Wxuser,'cont'=>$cont];
if ($Wxuser){ if ($Wxuser){
return $this->jsonSuccessData($Wxuser); return $this->jsonSuccessData($data);
}else{ }else{
return $this->jsonErrorData('105','获取数据失败'); return $this->jsonErrorData('105','获取数据失败');
} }
} }
//用户搜索
public function seek (Request $request){
$keys = $request->all();
$handle = DB::table('wx_User');
foreach ($keys as $key => $val) {
if ($key == 'page') {
unset($keys[$key]);
} elseif ($key == 'limit'){
unset($keys[$key]);
}
}
foreach ($keys as $k => $v) {
if($k == 'sex'){
if ($v == '男'){
$v = 1;
}else if ($v == '女'){
$v =2;
}
}else if ($k == 'state'){
if ($v == '正常'){
$v = 2;
}else if ('禁用'){
$v = 1;
}
}
$keys[$key] && $handle->where($k, 'like', '%' . $v . '%');
}
$datas = $handle->get();
$cont = $handle->count();
$data = ['Wxuser'=>$datas,'cont'=>$cont];
return $this->jsonSuccessData($data);
}
} }
\ No newline at end of file
No preview for this file type
import request from '@/utils/request';
import Resource from '@/api/resource';
class UserResource extends Resource {
constructor() {
super('wxuser/wxlist');
}
permissions(id) {
return request({
url: '/' + this.uri + '/' + id + '/permissions',
method: 'get',
});
}
fetchArticle(data) {
return request({
url: '/wxuser/seek',
method: 'post',
data,
});
}
updatePermission(id, permissions) {
return request({
url: '/' + this.uri + '/' + id + '/permissions',
method: 'put',
data: permissions,
});
}
}
export { UserResource as default };
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1587887688558" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1201" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M860.16 184.32H163.84a122.88 122.88 0 0 0-122.88 122.88v40.96a122.88 122.88 0 0 0 122.88 122.88h696.32a122.88 122.88 0 0 0 122.88-122.88v-40.96a122.88 122.88 0 0 0-122.88-122.88z m81.92 163.84a81.92 81.92 0 0 1-81.92 81.92H163.84a81.92 81.92 0 0 1-81.92-81.92v-40.96a81.92 81.92 0 0 1 81.92-81.92h696.32a81.92 81.92 0 0 1 81.92 81.92zM860.16 552.96H163.84a122.88 122.88 0 0 0-122.88 122.88v40.96a122.88 122.88 0 0 0 122.88 122.88h696.32a122.88 122.88 0 0 0 122.88-122.88v-40.96a122.88 122.88 0 0 0-122.88-122.88z m81.92 163.84a81.92 81.92 0 0 1-81.92 81.92H163.84a81.92 81.92 0 0 1-81.92-81.92v-40.96a81.92 81.92 0 0 1 81.92-81.92h696.32a81.92 81.92 0 0 1 81.92 81.92z" p-id="1202"></path><path d="M184.32 266.24a61.44 61.44 0 1 0 61.44 61.44 61.44 61.44 0 0 0-61.44-61.44z m0 81.92a20.48 20.48 0 1 1 20.48-20.48 20.48 20.48 0 0 1-20.48 20.48zM839.68 634.88a61.44 61.44 0 1 0 61.44 61.44 61.44 61.44 0 0 0-61.44-61.44z m0 81.92a20.48 20.48 0 1 1 20.48-20.48 20.48 20.48 0 0 1-20.48 20.48zM204.8 614.4a81.92 81.92 0 0 0-79.0528 102.4h43.8272A40.96 40.96 0 0 1 163.84 696.32a40.96 40.96 0 0 1 40.96-40.96h81.92v-40.96zM860.16 327.68a40.96 40.96 0 0 1-5.7344 20.48h43.8272A81.92 81.92 0 0 0 819.2 245.76v40.96a40.96 40.96 0 0 1 40.96 40.96zM737.28 245.76h40.96v40.96h-40.96z" p-id="1203"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1587888568774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1355" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M448 416h-64a32 32 0 1 1 0-64h64a32 32 0 1 1 0 64z m320 256H256a32 32 0 0 1 0-64h512a32 32 0 0 1 0 64z m0 128H256a32 32 0 0 1 0-64h512a32 32 0 0 1 0 64z m-32-256H288a64 64 0 0 1-64-64V288a64 64 0 0 1 64-64h448a64 64 0 0 1 64 64v192a64 64 0 0 1-64 64zM288 288v192h448V288H288z" p-id="1356"></path></svg>
\ No newline at end of file
...@@ -18,6 +18,7 @@ import componentRoutes from './modules/components'; ...@@ -18,6 +18,7 @@ import componentRoutes from './modules/components';
import chartsRoutes from './modules/charts'; import chartsRoutes from './modules/charts';
import tableRoutes from './modules/table'; import tableRoutes from './modules/table';
import adminRoutes from './modules/admin'; import adminRoutes from './modules/admin';
import deviceRoutes from './modules/device';
import nestedRoutes from './modules/nested'; import nestedRoutes from './modules/nested';
import errorRoutes from './modules/error'; import errorRoutes from './modules/error';
import excelRoutes from './modules/excel'; import excelRoutes from './modules/excel';
...@@ -128,6 +129,7 @@ export const asyncRoutes = [ ...@@ -128,6 +129,7 @@ export const asyncRoutes = [
nestedRoutes, nestedRoutes,
tableRoutes, tableRoutes,
adminRoutes, adminRoutes,
deviceRoutes,
{ {
path: '/theme', path: '/theme',
component: Layout, component: Layout,
...@@ -210,7 +212,7 @@ export const asyncRoutes = [ ...@@ -210,7 +212,7 @@ export const asyncRoutes = [
meta: { permissions: ['view menu wx_user'] }, meta: { permissions: ['view menu wx_user'] },
children: [ children: [
{ {
path: 'index', path: 'wxuser/wxlist',
component: () => import('@/views/wx_user'), component: () => import('@/views/wx_user'),
name: 'wx_user', name: 'wx_user',
meta: { title: 'wx_user', icon: 'wechat' }, meta: { title: 'wx_user', icon: 'wechat' },
......
import Layout from '@/layout';
const deviceRoutes = {
path: '/device',
component: Layout,
redirect: '/device/index',
name: 'Device',
alwaysShow: true,
meta: {
title: 'device',
icon: 'device',
permissions: ['view menu administrator'],
},
children: [
{
path: 'device',
component: () => import('@/views/device/index'),
name: 'Device',
meta: { title: '设备管理', icon: 'devicelist', permissions: ['manage user'] },
},
],
};
export default deviceRoutes;
<template>
<div></div>
</template>
<script>
</script>
<style>
</style>
This diff is collapsed.
...@@ -28,6 +28,7 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -28,6 +28,7 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::apiResource('permissions', 'PermissionController')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE); Route::apiResource('permissions', 'PermissionController')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);
Route::get('wxuser/wxlist', 'WxuserController@wxlist');//微信用户列表 Route::get('wxuser/wxlist', 'WxuserController@wxlist');//微信用户列表
Route::post('wxuser/seek','WxuserController@seek');//微信搜索
Route::get('user/HUserList', 'UserController@HUserList');//用户列表 Route::get('user/HUserList', 'UserController@HUserList');//用户列表
Route::post('user/addUser', 'UserController@addUser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增用户 Route::post('user/addUser', 'UserController@addUser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增用户
Route::post('user/deleteuser','UserController@deleteuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除用户 Route::post('user/deleteuser','UserController@deleteuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除用户
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment