refactor(admin): 优化变更日志列表和购买产品报价逻辑

- 修复 ChangeLogLists 类中的搜索字段
- 优化 ChangeLogLists 类的 lists 方法,增加对 admin_name 的处理
- 修改 PurchaseProductOfferLogic 中的 outbound_price 字段名称
- 在 StoreProduct 模型中添加 doNotRecordLog 属性,不生成日志
This commit is contained in:
mkm 2025-01-07 14:33:25 +08:00
parent 07643c6d11
commit b9adf2dce3
3 changed files with 14 additions and 10 deletions

View File

@ -27,7 +27,7 @@ class ChangeLogLists extends BaseAdminDataLists implements ListsSearchInterface
{
return [
'=' => ['model', 'link_id', 'nums', 'pm'],
'%like%' => ['mark','url'],
'%like%' => ['mark', 'url'],
];
}
@ -45,13 +45,17 @@ class ChangeLogLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array
{
return ChangeLog::where($this->searchWhere)
->field(['id', 'admin_id','model', 'link_id', 'nums', 'pm', 'url', 'mark'])
->field(['id', 'admin_id', 'model', 'link_id', 'nums', 'pm', 'url', 'mark'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) {
if($item->admin_id){
$item->admin_name = Admin::where('id', $item->admin_id)->value('name');
}}
->select()->each(
function ($item) {
if ($item->admin_id) {
$item->admin_name = Admin::where('id', $item->admin_id)->value('name');
} else {
$item->admin_name = $item->admin_id;
}
}
)
->toArray();
}
@ -67,5 +71,4 @@ class ChangeLogLists extends BaseAdminDataLists implements ListsSearchInterface
{
return ChangeLog::where($this->searchWhere)->count();
}
}
}

View File

@ -171,7 +171,7 @@ class PurchaseProductOfferLogic extends BaseLogic
'buyer_nums' => $params['buyer_nums'],
'supplier_id' => $params['supplier_id'],
'price' => $params['purchase'],
'outbound_price' => $params['outbound_price'] ?? 0,
'purchase_price' => $params['purchase_price'] ?? 0,
'total_price' => $params['total_price'],
'pay_type' => $params['pay_type'] ?? 0,
'buyer_confirm' => 1,

View File

@ -20,7 +20,8 @@ class StoreProduct extends BaseModel
use SoftDelete;
protected $name = 'store_product';
protected $deleteTime = 'delete_time';
// 不生成该表的日志
public $doNotRecordLog = true;
public function unitName()
{