|
|
@@ -4,6 +4,10 @@ namespace app\admin\controller;
|
|
|
|
|
|
use think\Validate;
|
|
|
use think\Lang;
|
|
|
+use app\admin\model\User;
|
|
|
+use app\admin\model\Product;
|
|
|
+
|
|
|
+use think\Db;
|
|
|
|
|
|
class Order extends AdminControl
|
|
|
{
|
|
|
@@ -22,34 +26,38 @@ class Order extends AdminControl
|
|
|
{
|
|
|
$model_order = Model('Order');
|
|
|
$order_identity = input('order_identity', '');
|
|
|
- $user_id = intval(input('user_id', 0));
|
|
|
- $product_id = intval(input('product_id', 0));
|
|
|
+ $user_id = trim(input('user_id', ''));
|
|
|
+ $product_id = trim(input('product_id', ''));
|
|
|
$timeRang = trim(input('timeRang', ''));
|
|
|
|
|
|
- $where = [];
|
|
|
+ $where = [];
|
|
|
if ($order_identity != '') {
|
|
|
$where['order_identity'] = $order_identity;
|
|
|
}
|
|
|
|
|
|
if ($user_id) {
|
|
|
- $where['user_id'] = $user_id;
|
|
|
+ $umodel = (new User())->getIdsByEmailLike($user_id);
|
|
|
+ $uids = array_merge([0], $umodel);
|
|
|
+ $where['user_id'] = ['IN', $uids];
|
|
|
}
|
|
|
|
|
|
if ($product_id) {
|
|
|
- $where['product_id'] = $product_id;
|
|
|
+ $pmodel = (new Product())->getIdsByNameLike($product_id);
|
|
|
+ $pids = array_merge([0], $pmodel);
|
|
|
+ $where['product_id'] = ['IN', $pids];
|
|
|
}
|
|
|
|
|
|
- if ($timeRang){
|
|
|
- $t1 = substr($timeRang,0,10);
|
|
|
- $t2 = substr($timeRang,-10,10);
|
|
|
- $where['order_buyTime']=[[">=",$t1],['<=',$t2]];
|
|
|
+ if ($timeRang) {
|
|
|
+ $t1 = substr($timeRang, 0, 10);
|
|
|
+ $t2 = substr($timeRang, -10, 10);
|
|
|
+ $where['order_buyTime'] = [[">=", $t1], ['<=', $t2]];
|
|
|
}
|
|
|
|
|
|
$order_list = $model_order->getOrdList($where, '*', 10);
|
|
|
$this->assign('order_list', $order_list);
|
|
|
$this->assign('show_page', $order_list->render());
|
|
|
$this->setAdminCurItem('index');
|
|
|
- $this->assign('oinput', ['order_identity' => input("order_identity",''), 'user_id' => input("user_id",''), 'product_id' => input("product_id",""),'timeRang'=>$timeRang]);
|
|
|
+ $this->assign('oinput', ['order_identity' => input("order_identity", ''), 'user_id' => input("user_id", ''), 'product_id' => input("product_id", ""), 'timeRang' => $timeRang]);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|