|
|
@@ -7,6 +7,7 @@ use App\Http\Requests\Manager\WashConfig\LowPriceGoods as Request;
|
|
|
use App\Models\Manager\WashConfig\LowPriceGoods as LowPriceGoodsModel;
|
|
|
use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
|
|
|
use App\Models\Manager\WashConfig\LowPriceGoodsCompany as LowPriceGoodsCompanyModel;
|
|
|
+use App\Models\Manager\WashConfig\ProductCategory as ProductCategoryModel;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -24,7 +25,7 @@ class LowPriceGoods extends Controller
|
|
|
* @date 2025-12-02
|
|
|
*
|
|
|
*/
|
|
|
- public function list(Request $request, LowPriceGoodsModel $LowPriceGoodsModel, ViolationStoreModel $ViolationStoreModel, LowPriceGoodsCompanyModel $LowPriceGoodsCompanyModel)
|
|
|
+ public function list(Request $request, LowPriceGoodsModel $LowPriceGoodsModel, ViolationStoreModel $ViolationStoreModel, LowPriceGoodsCompanyModel $LowPriceGoodsCompanyModel, ProductCategoryModel $ProductCategoryModel)
|
|
|
{
|
|
|
$request->scene('list')->validate();
|
|
|
// 查询条件
|
|
|
@@ -37,6 +38,7 @@ class LowPriceGoods extends Controller
|
|
|
$platform = request('platform', '');
|
|
|
$store_scope = request('store_scope', '');
|
|
|
$company_scope = request('company_scope', '');
|
|
|
+ $category_id = request('category_id', '');
|
|
|
// 时间条件
|
|
|
if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
|
if ($end_time) $map[] = ['insert_time', '<=', strtotime($end_time)];
|
|
|
@@ -46,6 +48,7 @@ class LowPriceGoods extends Controller
|
|
|
if ($platform) $map[] = ['platform', 'like', "%$platform%"];
|
|
|
if ($store_scope) $map[] = ['store_scope', '=',$store_scope];
|
|
|
if ($company_scope) $map[] = ['company_scope', '=',$company_scope];
|
|
|
+ if ($category_id) $map[] = ['category_id', '=', $category_id];
|
|
|
// 查询数据
|
|
|
$result = $LowPriceGoodsModel->query()
|
|
|
->where($map)
|
|
|
@@ -56,6 +59,8 @@ class LowPriceGoods extends Controller
|
|
|
if (isset($result['data']) && count($result['data']) > 0) {
|
|
|
foreach ($result['data'] as $key => $value) {
|
|
|
$result['data'][$key]['platform'] = isset($value['platform']) ? explode(',', $value['platform']) : '';
|
|
|
+ $category_name = $value['category_id'] > 0 ? $ProductCategoryModel->where('id', $value['category_id'])->value('name'):'';
|
|
|
+ $result['data'][$key]['category_name'] = $category_name;
|
|
|
//查询店铺名称
|
|
|
if ($value['store_scope'] == '1') {
|
|
|
$result['data'][$key]['store_name'] = ['全部店铺'];
|
|
|
@@ -83,7 +88,7 @@ class LowPriceGoods extends Controller
|
|
|
* @version 1.0
|
|
|
* @date 2025-12-02
|
|
|
*/
|
|
|
- public function detail(Request $request, LowPriceGoodsModel $LowPriceGoodsModel, ViolationStoreModel $ViolationStoreModel, LowPriceGoodsCompanyModel $LowPriceGoodsCompanyModel)
|
|
|
+ public function detail(Request $request, LowPriceGoodsModel $LowPriceGoodsModel,LowPriceGoodsCompanyModel $LowPriceGoodsCompanyModel, ProductCategoryModel $ProductCategoryModel)
|
|
|
{
|
|
|
$request->scene('detail')->validate();
|
|
|
// 接收参数
|
|
|
@@ -97,7 +102,6 @@ class LowPriceGoods extends Controller
|
|
|
} else {
|
|
|
$data['store_name'] = '';
|
|
|
}
|
|
|
- $data->platform = isset($data->platform) ? explode(',', $data->platform) : '';
|
|
|
//查询公司名称
|
|
|
if ($data->company_scope == '1') {
|
|
|
$data->company_name = ['全部公司'];
|
|
|
@@ -109,6 +113,8 @@ class LowPriceGoods extends Controller
|
|
|
$data->company_name = !empty($company_data) ? array_column($company_data, 'company_name') : '';
|
|
|
$data->company_ids = !empty($company_data) ? array_column($company_data, 'company_id') : '';
|
|
|
}
|
|
|
+ $data->platform = isset($data->platform) ? explode(',',$data->platform) : '';
|
|
|
+ $data->category_name = $data->category_id > 0 ? $ProductCategoryModel->where('id', $data->category_id)->value('name'):'';
|
|
|
// 加载模板
|
|
|
return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $data]);
|
|
|
}
|
|
|
@@ -129,6 +135,8 @@ class LowPriceGoods extends Controller
|
|
|
$all_data['store_scope'] = $store_scope;
|
|
|
$company_scope = request('company_scope', '');
|
|
|
$all_data['company_scope'] = $company_scope;
|
|
|
+ $category_id = request('category_id', '');
|
|
|
+ $all_data['category_id'] = $category_id;
|
|
|
//查询是否存在
|
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
|
$data = $LowPriceGoodsModel->where($map)->first();
|
|
|
@@ -159,6 +167,8 @@ class LowPriceGoods extends Controller
|
|
|
$all_data['store_scope'] = $store_scope;
|
|
|
$company_scope = request('company_scope', '');
|
|
|
$all_data['company_scope'] = $company_scope;
|
|
|
+ $category_id = request('category_id', '');
|
|
|
+ $all_data['category_id'] = $category_id;
|
|
|
//查询是否存在
|
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
|
$data = $LowPriceGoodsModel->where($map)->where('id', '!=', $id)->first();
|