|
@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Manager\WashConfig;
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Http\Requests\Manager\WashConfig\ViolationStore as Request;
|
|
use App\Http\Requests\Manager\WashConfig\ViolationStore as Request;
|
|
|
use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
|
|
use App\Models\Manager\WashConfig\ViolationStore as ViolationStoreModel;
|
|
|
|
|
+use App\Models\Manager\WashConfig\LowPriceGoodsCompany as LowPriceGoodsCompanyModel;
|
|
|
|
|
+use App\Models\Manager\WashConfig\ViolationProductCompany as ViolationProductCompanyModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -123,7 +125,9 @@ class ViolationStore extends Controller
|
|
|
// 接收数据
|
|
// 接收数据
|
|
|
$all_data = request()->all();
|
|
$all_data = request()->all();
|
|
|
$store_scope = request('store_scope', '');
|
|
$store_scope = request('store_scope', '');
|
|
|
- $all_data['store_scope'] = $store_scope;
|
|
|
|
|
|
|
+ $all_data['store_scope'] = $store_scope;//店铺范围
|
|
|
|
|
+ $employee_ids = request('employee_ids', '');
|
|
|
|
|
+ $all_data['employee_ids'] = $employee_ids;
|
|
|
//查询是否存在
|
|
//查询是否存在
|
|
|
$map = ['social_credit_code' => $all_data['social_credit_code']];
|
|
$map = ['social_credit_code' => $all_data['social_credit_code']];
|
|
|
$data = $ViolationStoreModel->where($map)->first();
|
|
$data = $ViolationStoreModel->where($map)->first();
|
|
@@ -152,7 +156,9 @@ class ViolationStore extends Controller
|
|
|
$all_data = request()->all();
|
|
$all_data = request()->all();
|
|
|
$store_scope = request('store_scope','');
|
|
$store_scope = request('store_scope','');
|
|
|
$all_data['store_scope'] = $store_scope;
|
|
$all_data['store_scope'] = $store_scope;
|
|
|
- //查询是否存在
|
|
|
|
|
|
|
+ $employee_ids = request('employee_ids', '');
|
|
|
|
|
+ $all_data['employee_ids'] = $employee_ids;
|
|
|
|
|
+ //查询是否存在
|
|
|
$map = ['social_credit_code' => $all_data['social_credit_code']];
|
|
$map = ['social_credit_code' => $all_data['social_credit_code']];
|
|
|
$data = $ViolationStoreModel->where($map)->where('id', '!=', $id)->first();
|
|
$data = $ViolationStoreModel->where($map)->where('id', '!=', $id)->first();
|
|
|
if ($data) return json_send(['code' => 'error', 'msg' => '营业执照记录已存在']);
|
|
if ($data) return json_send(['code' => 'error', 'msg' => '营业执照记录已存在']);
|
|
@@ -197,12 +203,23 @@ class ViolationStore extends Controller
|
|
|
* @date 2025-12-03
|
|
* @date 2025-12-03
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
- public function delete(Request $request, ViolationStoreModel $ViolationStoreModel)
|
|
|
|
|
|
|
+ public function delete(Request $request, ViolationStoreModel $ViolationStoreModel,LowPriceGoodsCompanyModel $LowPriceGoodsCompanyModel,ViolationProductCompanyModel $ViolationProductCompanyModel)
|
|
|
{
|
|
{
|
|
|
// 验证参数
|
|
// 验证参数
|
|
|
$request->scene('delete')->validate();
|
|
$request->scene('delete')->validate();
|
|
|
// 接收数据
|
|
// 接收数据
|
|
|
$id = request('id', 0);
|
|
$id = request('id', 0);
|
|
|
|
|
+ //查询是否已经被使用
|
|
|
|
|
+ if ($id > 0) {
|
|
|
|
|
+ $use_low_price_goods_company_log = $LowPriceGoodsCompanyModel->where('company_id', $id)->first();
|
|
|
|
|
+ if ($use_low_price_goods_company_log) {
|
|
|
|
|
+ return json_send(['code' => 'error', 'msg' => '该记录已被使用在低价商品配置中,不能删除']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $use_violation_product_company_log = $ViolationProductCompanyModel->where('company_id', $id)->first();
|
|
|
|
|
+ if ($use_violation_product_company_log) {
|
|
|
|
|
+ return json_send(['code' => 'error', 'msg' => '该记录已被使用在违规商品配置中,不能删除']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// 查询用户
|
|
// 查询用户
|
|
|
$where = ['id' => $id];
|
|
$where = ['id' => $id];
|
|
|
// 执行删除
|
|
// 执行删除
|