wugg 3 years ago
parent
commit
a9a8a6b8bb

+ 21 - 0
application/Admin/command/Test.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace app\admin\command;
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\Db;
+class Test extends Command
+{
+    protected function configure()
+    {
+        $this->setName('test')->setDescription('Here is the remark ');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        $acocunt =Db::name('Account')->where("is_del=0 and status>=1 and expiretime<='".date("Y-m-d H:i:s")."'")->select();
+        var_dump($acocunt);
+        $output->writeln("AccountExpire:");
+    }
+}

+ 6 - 0
application/Admin/controller/Account.php

@@ -203,6 +203,12 @@ class Account extends Base
         }
         $expiretime = isset($this->post['expiretime'])&&$this->post['expiretime']!=="" ? $this->post['expiretime'] :"";
         if($expiretime!=""){
+            $expire = strtotime($expiretime);
+            if($expire>time()){
+                $info['status'] = $info['activetime']==""? 0:1;
+            }else{
+                $info['status'] =2;
+            }
             $info['expiretime'] = $expiretime;
         }
         $info['updatetime'] = date("Y-m-d H:i:s");

+ 9 - 5
application/Admin/controller/Order.php

@@ -23,7 +23,7 @@ class Order extends Base
      if($username!=""){
          $where['username'] = ["like","%{$username}%"];
      }
-     $nickname =  isset($this->post['nickname'])&&$this->post['nickname']!=="" ? trim($this->post['username']) :"";
+     $nickname =  isset($this->post['nickname'])&&$this->post['nickname']!=="" ? trim($this->post['nickname']) :"";
      if($nickname!=""){
          $where['nickname'] = ["like","%{$nickname}%"];
      }
@@ -32,14 +32,18 @@ class Order extends Base
          $where['mobile'] = ["like","%{$mobile}%"];
      }
      $order_low =  isset($this->post['order_low'])&&$this->post['order_low']!=="" ? $this->post['order_low'] :"";
-     if($order_low!=""){
-
-         $where['order_time'] = [">=",$order_low." 00:00:00"];
+     if($order_low!="") {
+         $order_low = date("Y-m-d H:i:s", strtotime($order_low . " 00:00:00"));
+     }else{
+         $order_low = "1970-01-01 00:00:00";
      }
      $order_up =  isset($this->post['order_up'])&&$this->post['order_up']!=="" ? $this->post['order_up'] :"";
      if($order_up!=""){
-         $where['order_time'] = ["<=",$order_up." 23:59:59"];
+         $order_up = date("Y-m-d H:i:s",strtotime($order_up." 23:59:59"));
+     }else{
+         $order_up = date("Y-m-d H:i:s");
      }
+     $where['order_time'] = ["between",[$order_low,$order_up]];
      $count= Db::name("order_info")->where($where)->count();
      $total = ceil($count/$size);
      $page = $page>=$total? $total:$page;

+ 7 - 4
application/Admin/controller/Stock.php

@@ -41,17 +41,20 @@ class Stock extends Base
         }
         $stock_low =  isset($this->post['stock_low'])&&$this->post['stock_low']!=="" ? intval($this->post['stock_low'])
             :"";
+        $wherestock="1=1";
         if($stock_low!=""){
-            $where['stock_balance'] = [">=",$stock_low];
+           // $where['stock_balance'] = [">=",$stock_low];
+            $wherestock .=" and stock_balance>={$stock_low}";
         }
         $stock_up =  isset($this->post['stock_up'])&&$this->post['stock_up']!=="" ? intval($this->post['stock_up']) :"";
         if($stock_up!=""){
-            $where['stock_balance'] = ["<=",$stock_up];
+           // $where['stock_balance'] = ["<=",$stock_up];
+            $wherestock .=" and stock_balance<={$stock_up}";
         }
-        $count= Db::name("stock_list")->where($where)->count();
+        $count= Db::name("stock_list")->where($where)->where($wherestock)->count();
         $total = ceil($count/$size);
         $page = $page>=$total? $total:$page;
-        $list = Db::name("stock_list")->where($where)->page($page,$size)->field("id,username,status,nickname,mobile,stock_balance,stock_update")->order("stock_update desc")->select();
+        $list = Db::name("stock_list")->where($where)->where($wherestock)->page($page,$size)->field("id,username,status,nickname,mobile,stock_balance,stock_update")->order("stock_update desc")->select();
         return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
     }
 

+ 3 - 1
application/command.php

@@ -9,4 +9,6 @@
 // | Author: yunwuxin <448901948@qq.com>
 // +----------------------------------------------------------------------
 
-return [];
+return [
+    "app\admin\command\Test"
+];