allocatr/application/admin/behavior/OrderLog.php
2025-06-05 21:15:41 +08:00

35 lines
1002 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\admin\behavior;
use think\Lang;
class OrderLog
{
//记录订单日志
public function run(&$response)
{
Lang::load(APP_PATH . 'admin/lang/zh-cn/order.php');
$Model = new \app\admin\model\Order();
$statusList = $Model->getStatusList();
$order = $response['order']; //订单对象
$role = $response['role']; //1管理员2师傅
$auth = $response['auth']??null; //角色对象
$remark = $response['remark'] ?? ''; //备注
$data = [
'order_id' => $order->id,
'order_status' => $order->status,
'order_status_text' => $statusList[$order->status],
'role' => $role,
'remark' => $remark,
'admin_id' => $auth->id ?? 0,
'admin_user' => $role==1 ? ($auth->nickname ?? '系统') : $auth->name
];
(new \app\admin\model\OrderLog())->save($data);
}
}