|
@@ -36,7 +36,7 @@ class Product extends Controller
|
|
|
$start_time = request('start_time', '');
|
|
$start_time = request('start_time', '');
|
|
|
$end_time = request('end_time', '');
|
|
$end_time = request('end_time', '');
|
|
|
$product_name = request('product_name', '');
|
|
$product_name = request('product_name', '');
|
|
|
- $platform = request('platform', '');
|
|
|
|
|
|
|
+ $platforms = request('platform', '');
|
|
|
$product_brand = request('product_brand', '');
|
|
$product_brand = request('product_brand', '');
|
|
|
// 时间条件
|
|
// 时间条件
|
|
|
if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
@@ -44,7 +44,14 @@ class Product extends Controller
|
|
|
// 其他条件
|
|
// 其他条件
|
|
|
if (is_numeric($status)) $map[] = ['status', '=', $status];
|
|
if (is_numeric($status)) $map[] = ['status', '=', $status];
|
|
|
if ($product_name) $map[] = ['product_name', 'like', "%$product_name%"];
|
|
if ($product_name) $map[] = ['product_name', 'like', "%$product_name%"];
|
|
|
- if (is_numeric($platform) || $platform) $map[] = ['platform', 'like', "%$platform%"];
|
|
|
|
|
|
|
+ if (is_numeric($platforms) || $platforms) {
|
|
|
|
|
+ $ProductModel = $ProductModel
|
|
|
|
|
+ ->where(function ($query) use ($platforms) {
|
|
|
|
|
+ foreach ($platforms as $platform) {
|
|
|
|
|
+ $query->orWhereRaw("FIND_IN_SET(?, platform)", [$platform]);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
if ($product_brand) $map[] = ['product_brand', 'like', "%$product_brand%"];
|
|
if ($product_brand) $map[] = ['product_brand', 'like', "%$product_brand%"];
|
|
|
// 权限判断
|
|
// 权限判断
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
@@ -53,7 +60,7 @@ class Product extends Controller
|
|
|
$map[] = ['company_id', '=', $admin_company_id];
|
|
$map[] = ['company_id', '=', $admin_company_id];
|
|
|
}
|
|
}
|
|
|
// 查询数据
|
|
// 查询数据
|
|
|
- $result = $ProductModel->query()
|
|
|
|
|
|
|
+ $result = $ProductModel
|
|
|
->where($map)
|
|
->where($map)
|
|
|
->with(['product_keyword'])
|
|
->with(['product_keyword'])
|
|
|
->orderByDesc('id')
|
|
->orderByDesc('id')
|
|
@@ -94,7 +101,6 @@ class Product extends Controller
|
|
|
$end_time = request('end_time', '');
|
|
$end_time = request('end_time', '');
|
|
|
$product_name = request('product_name', '');
|
|
$product_name = request('product_name', '');
|
|
|
$product_brand = request('product_brand', '');
|
|
$product_brand = request('product_brand', '');
|
|
|
- $platform = request('platform', '');
|
|
|
|
|
// 时间条件
|
|
// 时间条件
|
|
|
if ($start_time) {
|
|
if ($start_time) {
|
|
|
$map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
$map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
@@ -109,11 +115,6 @@ class Product extends Controller
|
|
|
// 其他条件
|
|
// 其他条件
|
|
|
$map[] = ['status', '=', 0];
|
|
$map[] = ['status', '=', 0];
|
|
|
if ($product_name) $map2[] = ['product_name', 'like', "%$product_name%"];
|
|
if ($product_name) $map2[] = ['product_name', 'like', "%$product_name%"];
|
|
|
- if (is_numeric($platform) || $platform) {
|
|
|
|
|
- $map[] = ['platform', 'like', "%$platform%"];
|
|
|
|
|
- $map2[] = ['platform', 'like', "%$platform%"];
|
|
|
|
|
- $map3[] = ['platform', 'like', "%$platform%"];
|
|
|
|
|
- }
|
|
|
|
|
if ($product_brand) $map[] = ['product_brand', 'like', "%$product_brand%"];
|
|
if ($product_brand) $map[] = ['product_brand', 'like', "%$product_brand%"];
|
|
|
// 权限判断
|
|
// 权限判断
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
if ($is_admin != 1 && $company_id != 0) {
|