修正客户销售价格可编辑功能

This commit is contained in:
2021-05-08 17:28:46 +08:00
parent d44ca9d556
commit dafdbc1746
4 changed files with 17 additions and 7 deletions
@@ -162,17 +162,21 @@ class CustomerController extends DefaultController
try {
foreach($ids as $id) {
// 查找客户价格本
$count = DB::table('customer_price')
$row = DB::table('customer_price')
->where('customer_id', $id)
->where('product_id', $product_id)
->count();
->first();
if ($count == 0) {
if (empty($row)) {
DB::table('customer_price')->insert([
'customer_id' => $id,
'product_id' => $product_id,
'price' => $price,
]);
} else {
DB::table('customer_price')->where('id', $row['id'])->update([
'price' => $price
]);
}
}
// 提交事务
+1 -1
View File
@@ -15,7 +15,7 @@ class Controller extends BaseController
/**
* @var 程序版本
*/
public $version = '2.3.1';
public $version = '2.3.2';
/**
* @var 配置参数