Commit a7d0b0a6 by 朱继来

fix

parent bf5175b2
Showing with 10 additions and 20 deletions
...@@ -29,8 +29,6 @@ class OrderModel extends Model ...@@ -29,8 +29,6 @@ class OrderModel extends Model
if ($request->isMethod('get')) { if ($request->isMethod('get')) {
$map['order_type'] = $request->input('order_type', ''); $map['order_type'] = $request->input('order_type', '');
$map['order_contain'] = $request->input('order_contain', ''); $map['order_contain'] = $request->input('order_contain', '');
$map['order_sn'] = $request->input('order_sn', '');
$map['goods_name'] = $request->input('goods_name', '');
$map['time_start'] = $request->input('time_start', ''); $map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', ''); $map['time_end'] = $request->input('time_end', '');
$map['order_status'] = $request->input('order_status', ''); $map['order_status'] = $request->input('order_status', '');
...@@ -82,32 +80,24 @@ class OrderModel extends Model ...@@ -82,32 +80,24 @@ class OrderModel extends Model
->where(function ($query) use ($map) { ->where(function ($query) use ($map) {
// 查询类型 // 查询类型
if (!empty($map['order_contain'])) { if (!empty($map['order_contain'])) {
if ($map['order_type'] == 3) { // 发票抬头 if ($map['order_type'] == 1) { // 会员账号
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) { // 会员ID
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 会员账号
if (preg_match('/@/', $map['order_contain'])) { if (preg_match('/@/', $map['order_contain'])) {
$query->where('u.email', '=', $map['order_contain']); $query->where('u.email', '=', $map['order_contain']);
} else { } else {
$query->where('u.mobile', '=', $map['order_contain']); $query->where('u.mobile', '=', $map['order_contain']);
} }
} else if ($map['order_type'] == 2) { // 型号名称
$query->where('it.goods_name', '=', $map['order_contain']);
} else if ($map['order_type'] == 3) { // 发票抬头
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) {
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 订单编号
$query->where('o.order_sn', '=', $map['order_contain']);
} }
} }
}) })
->where(function ($query) use ($map) { ->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->whereIn('o.order_sn', explode(',', $map['order_sn']));
}
})
->where(function ($query) use ($map) {
// 型号
if (!empty($map['goods_name'])) {
$query->where('it.goods_name', '=', $map['goods_name']);
}
})
->where(function ($query) use ($map) {
// 创建时间 // 创建时间
if (!empty($map['time_start']) && !empty($map['time_end'])) { if (!empty($map['time_start']) && !empty($map['time_end'])) {
$query->whereBetween('o.create_time', [$map['time_start'], $map['time_end']]); $query->whereBetween('o.create_time', [$map['time_start'], $map['time_end']]);
......
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 sign in to comment