Browse Source

Merge branch 'dev' of ssh://192.168.10.210:10022/wugg/fivechang into dev

wugg 3 years ago
parent
commit
699e8a6353
1 changed files with 13 additions and 6 deletions
  1. 13 6
      application/Admin/controller/Order.php

+ 13 - 6
application/Admin/controller/Order.php

@@ -19,19 +19,19 @@ class Order extends Base
         $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
         $where = [];
         if ($status !== "") {
-            $where['status'] = $status;
+            $where['a.status'] = $status;
         }
         $username = isset($this->post['username']) && $this->post['username'] !== "" ? trim($this->post['username']) : "";
         if ($username != "") {
-            $where['username'] = ["like", "%{$username}%"];
+            $where['e.username'] = ["like", "%{$username}%"];
         }
         $nickname = isset($this->post['nickname']) && $this->post['nickname'] !== "" ? trim($this->post['nickname']) : "";
         if ($nickname != "") {
-            $where['nickname'] = ["like", "%{$nickname}%"];
+            $where['g.nickname'] = ["like", "%{$nickname}%"];
         }
         $mobile = isset($this->post['mobile']) && $this->post['mobile'] !== "" ? trim($this->post['mobile']) : "";
         if ($mobile != "") {
-            $where['mobile'] = ["like", "%{$mobile}%"];
+            $where['g.mobile'] = ["like", "%{$mobile}%"];
         }
         $order_low = isset($this->post['order_low']) && $this->post['order_low'] !== "" ? $this->post['order_low'] : "";
         if ($order_low != "") {
@@ -45,10 +45,15 @@ class Order extends Base
         } else {
             $order_up = date("Y-m-d H:i:s");
         }
-        $where['order_time'] = ["between", [$order_low, $order_up]];
-        $count = Db::name("order")->where($where)->count();
+        $where['a.order_time'] = ["between", [$order_low, $order_up]];
+        $count = Db::name("order a")->join("fc_order_post b", "a.order_sn=b.order_sn", "left")
+            ->join("fc_addr c", "b.addrid = c.id", "left")
+            ->join("fc_account e", "a.accountid = e.id", "left")
+            ->join("fc_rela_account f", "a.accountid = f.accountid", "left")
+            ->join("fc_account_info g", "f.account_info =g.id", "left")->where($where)->count();
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
+
         $list = Db::name("order a")->where($where)->page($page, $size)->join("fc_order_post b", "a.order_sn=b.order_sn", "left")
             ->join("fc_addr c", "b.addrid = c.id", "left")
             ->join("fc_account e", "a.accountid = e.id", "left")
@@ -84,6 +89,8 @@ class Order extends Base
 	")
             ->order("order_time desc")
             ->select();
+
+       // var_dump(Db::name("order a")->getLastSql());
         return app_show(0, "获取成功", ["list" => $list, "count" => $count]);
     }