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

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

View File

@ -162,17 +162,21 @@ class CustomerController extends DefaultController
try { try {
foreach($ids as $id) { foreach($ids as $id) {
// 查找客户价格本 // 查找客户价格本
$count = DB::table('customer_price') $row = DB::table('customer_price')
->where('customer_id', $id) ->where('customer_id', $id)
->where('product_id', $product_id) ->where('product_id', $product_id)
->count(); ->first();
if ($count == 0) { if (empty($row)) {
DB::table('customer_price')->insert([ DB::table('customer_price')->insert([
'customer_id' => $id, 'customer_id' => $id,
'product_id' => $product_id, 'product_id' => $product_id,
'price' => $price, 'price' => $price,
]); ]);
} else {
DB::table('customer_price')->where('id', $row['id'])->update([
'price' => $price
]);
} }
} }
// 提交事务 // 提交事务

View File

@ -15,7 +15,7 @@ class Controller extends BaseController
/** /**
* @var 程序版本 * @var 程序版本
*/ */
public $version = '2.3.1'; public $version = '2.3.2';
/** /**
* @var 配置参数 * @var 配置参数

View File

@ -893,6 +893,14 @@ function array_find($data, $key)
return false; return false;
} }
/**
* 获取自定义变量
*/
function get_gdoo_var()
{
return json_decode(App\Support\AES::decrypt('WyJxdThDblJqd2hCWXF0Y2ZCT0JveTNBPT0iLCJGdUlcLzVUMTRYK1dCTnFtZGoxYWZucUk3MVhNanYzTEpkV094QVQ3K0c1S2wrTnZyQ3ppN0pFZTNIWEs3VzdGekhDblJQXC9PUDN3bmtMRWJKVVNwWVd5RE5EaFllazh0bHdUOWxBNXdyTXVPTk1qazljd2xtaUxqXC9MZTU0QXdwSm1ZYkhaOU01bWFSUFRnMVphcmN5UU43Zm9PR0xJdHNvUnUyc1YwSEJnaTR5a0Mzc1RUdHAxSzdwMHpjRzF6TlQiXQ','tm1Ctgi7CEmabw'),true);
}
/** /**
* 数组重新按指定键排序 * 数组重新按指定键排序
*/ */

View File

@ -1,11 +1,9 @@
<?php <?php
use App\Support\AES;
require __DIR__.'/macros.php'; require __DIR__.'/macros.php';
require __DIR__.'/sql.php'; require __DIR__.'/sql.php';
$keys = json_decode(AES::decrypt('WyJxdThDblJqd2hCWXF0Y2ZCT0JveTNBPT0iLCJGdUlcLzVUMTRYK1dCTnFtZGoxYWZucUk3MVhNanYzTEpkV094QVQ3K0c1S2wrTnZyQ3ppN0pFZTNIWEs3VzdGekhDblJQXC9PUDN3bmtMRWJKVVNwWVd5RE5EaFllazh0bHdUOWxBNXdyTXVPTk1qazljd2xtaUxqXC9MZTU0QXdwSm1ZYkhaOU01bWFSUFRnMVphcmN5UU43Zm9PR0xJdHNvUnUyc1YwSEJnaTR5a0Mzc1RUdHAxSzdwMHpjRzF6TlQiXQ','tm1Ctgi7CEmabw'),true); $keys = get_gdoo_var();
View::composer('*', function ($view) use($keys) { View::composer('*', function ($view) use($keys) {
foreach($keys as $k => $v) { foreach($keys as $k => $v) {
$view->with($k, $v); $view->with($k, $v);