|
@@ -174,13 +174,14 @@ class LowPriceGoods extends Controller
|
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
|
$map['company_id'] = $company_id;
|
|
$map['company_id'] = $company_id;
|
|
|
|
|
+ $all_data['company_id'] = $company_id;
|
|
|
} else {
|
|
} else {
|
|
|
$map['company_id'] = $admin_company_id;
|
|
$map['company_id'] = $admin_company_id;
|
|
|
|
|
+ $all_data['company_id'] = $admin_company_id;
|
|
|
}
|
|
}
|
|
|
$data = $LowPriceGoodsModel->where($map)->first();
|
|
$data = $LowPriceGoodsModel->where($map)->first();
|
|
|
if ($data) return json_send(['code' => 'error', 'msg' => '记录已存在']);
|
|
if ($data) return json_send(['code' => 'error', 'msg' => '记录已存在']);
|
|
|
// 写入数据表
|
|
// 写入数据表
|
|
|
- $all_data['company_id'] = $company_id;
|
|
|
|
|
$result = $LowPriceGoodsModel->addLowProduct($all_data);
|
|
$result = $LowPriceGoodsModel->addLowProduct($all_data);
|
|
|
// 如果操作失败
|
|
// 如果操作失败
|
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '新增失败']);
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '新增失败']);
|
|
@@ -232,13 +233,15 @@ class LowPriceGoods extends Controller
|
|
|
$where = ['id' => $id];
|
|
$where = ['id' => $id];
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
|
$where['company_id'] = $company_id;
|
|
$where['company_id'] = $company_id;
|
|
|
|
|
+ $all_data['company_id'] = $company_id;
|
|
|
} else {
|
|
} else {
|
|
|
$where['company_id'] = $admin_company_id;
|
|
$where['company_id'] = $admin_company_id;
|
|
|
|
|
+ $all_data['company_id'] = $admin_company_id;
|
|
|
}
|
|
}
|
|
|
$LowProduct = $LowPriceGoodsModel->where($where)->first();
|
|
$LowProduct = $LowPriceGoodsModel->where($where)->first();
|
|
|
if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
|
$oldData = $LowProduct->toarray();
|
|
$oldData = $LowProduct->toarray();
|
|
|
- $all_data['company_id'] = $company_id;
|
|
|
|
|
|
|
+
|
|
|
$result = $LowPriceGoodsModel->editLowProduct_content($LowProduct, $all_data);
|
|
$result = $LowPriceGoodsModel->editLowProduct_content($LowProduct, $all_data);
|
|
|
// 如果操作失败
|
|
// 如果操作失败
|
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '修改失败']);
|
|
if (!$result) return json_send(['code' => 'error', 'msg' => '修改失败']);
|