wugg 3 years ago
parent
commit
7577cb6173

+ 16 - 0
application/Admin/controller/Expire.php

@@ -0,0 +1,16 @@
+<?php
+
+
+namespace app\Admin\controller;
+use think\Db;
+
+class Expire
+{
+    public function update(){
+        $acocunt =Db::name('Account')->where("is_del=0 and status>=1 and expiretime<='".date("Y-m-d H:i:s")."'")->select();
+        foreach ($acocunt as $value){
+            Db::name("Account")->where($value)->update(['status'=>2,"updatetime"=>date("Y-m-d H:i:s")]);
+        }
+        echo 11111;
+    }
+}

+ 29 - 21
application/Admin/controller/System.php

@@ -8,7 +8,7 @@ use think\Db;
 
 class System extends Base
 {
-    protected $role = ["0" => '系统', "1" => "超级管理员", "2" => "管理员", "3" => "用户"];
+    protected $role = ["0" => '系统', "1" => "超级管理员", "2" => "运营", "3" => "用户","4"=>'库管','5'=>"管理员"];
     protected $menu = [];
     protected $action = [];
 
@@ -17,34 +17,37 @@ class System extends Base
         parent::__construct();
         $this->menu = [
             "login" => ["label" => "后台登录模块", "action" => []],
+            "homelogin" => ["label" => "用户登录模块", "action" => []],
             "menu" => ["label" => "菜单管理模块", "action" => [
-                ['value'=>"add","label"=>'新建'],
-                ['value'=>"edit","label"=>'编辑'],
-                ['value'=>"status","label"=>'状态'],
-                ['value'=>"del","label"=>'删除'],
+//                ['value'=>"add","label"=>'新建'],
+//                ['value'=>"edit","label"=>'编辑'],
+//                ['value'=>"status","label"=>'状态'],
+//                ['value'=>"del","label"=>'删除'],
                 ]],
             "menuaction" => ["label" => "菜单功能模块", "action" => [
-                ['value'=>"add","label"=>'新建'],
-                ['value'=>"edit","label"=>'编辑'],
-                ['value'=>"status","label"=>'状态'],
-                ['value'=>"del","label"=>'删除']]],
+//                ['value'=>"add","label"=>'新建'],
+//                ['value'=>"edit","label"=>'编辑'],
+//                ['value'=>"status","label"=>'状态'],
+//                ['value'=>"del","label"=>'删除']
+            ]
+            ],
             "order" => ["label" => "订单管理模块", "action" => [
-                ['value'=>"edit","label"=>'编辑'],
-                ['value'=>"status","label"=>'状态']
+//                ['value'=>"edit","label"=>'编辑'],
+//                ['value'=>"status","label"=>'状态']
             ]],
             "stock" => ["label" => "库存管理模块", "action" => [
-                ['value'=>"add","label"=>'新建'],
-                ['value'=>"edit","label"=>'编辑']
+//                ['value'=>"add","label"=>'新建'],
+//                ['value'=>"edit","label"=>'编辑']
             ]],
             "account" => ["label" => "用户管理模块", "action" => [
-                ['value'=>"add","label"=>'新建'],
-                ['value'=>"edit","label"=>'编辑'],
-                ['value'=>"status","label"=>'状态'],
-                ['value'=>"del","label"=>'删除']
+//                ['value'=>"add","label"=>'新建'],
+//                ['value'=>"edit","label"=>'编辑'],
+//                ['value'=>"status","label"=>'状态'],
+//                ['value'=>"del","label"=>'删除']
             ]],
             "version" => ["label" => "版本管理模块", "action" => [
-                ['value'=>"add","label"=>'新建'],
-                ['value'=>"edit","label"=>'编辑']
+//                ['value'=>"add","label"=>'新建'],
+//                ['value'=>"edit","label"=>'编辑']
             ]
         ]];
         $this->action = [
@@ -62,7 +65,12 @@ class System extends Base
         $where = [];
         $role = isset($this->post['role']) && $this->post['role'] != "" ? $this->post['role'] : "";
         if ($role != "") {
-            $where['role'] = $role;
+            if($role==2){
+                $where['role'] = ['in',[2,4,5]];
+            }else{
+                $where['role'] = $role;
+            }
+
         }
         $lowtime = isset($this->post['lowtime']) && $this->post['lowtime'] != "" ? $this->post['lowtime'] : "";
         if ($lowtime != "") {
@@ -78,7 +86,7 @@ class System extends Base
         }
         $moudel = isset($this->post['moudel']) && $this->post['moudel'] != "" ? $this->post['moudel'] : "";
         if ($moudel != "") {
-            $where['moudel|action'] = ["like", "%{$moudel}%"];
+            $where['module|action'] =$moudel;
         }
         $count = Db::name("system_log")->where($where)->count();
         $total = ceil($count / $size);

+ 1 - 1
application/Home/controller/Login.php

@@ -47,7 +47,7 @@ class Login
         $token = makeToken($account);
         $userinfo = Db::name("account_info")->alias("a")->join("fc_rela_account b","b.account_info=a.id")->where(["b.accountid"=>$account['id']])->field("a.*")->find();
         $userinfo['token'] = $token;
-        write_log("账户{$account['username']}登录系统","login","","",1);
+        write_log("账户{$account['username']}登录系统","","homelogin","",1);
         return app_show(0,"登录成功",$userinfo);
     }
 

+ 1 - 1
application/common.php

@@ -45,7 +45,7 @@ function write_log($log,$userinfo,$module="",$action="",$role=0){
         "module"=>$module,
         "action"=>$action,
         "username"=>isset($userinfo['username'])? $userinfo['username']:"sys",
-        "role"=>$role==0?(isset($userinfo['role'])&&$userinfo['role']!=1?2:1):3,
+        "role"=>$role==0?(isset($userinfo['role_id'])&&$userinfo['role_id']!=0?$userinfo['role_id']:0):3,
     ];
     Db::name("system_log")->insert($data);
 }

+ 2 - 0
application/route.php

@@ -50,6 +50,8 @@ Route::rule('admin/systemlist','Admin/System/list');
 Route::rule('admin/getmoudel','Admin/System/GetMenu');
 Route::rule('admin/getaction','Admin/System/GetAction');
 
+Route::rule('admin/expire','Admin/Expire/update');
+
 Route::rule("home/login","Home/Login/index");
 
 Route::rule("home/userinfo","Home/User/info");