Files
xk-api-yii/common/models/OrderLog.php
2024-09-19 11:32:39 +08:00

36 lines
841 B
PHP

<?php
namespace common\models;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
class OrderLog extends \common\modelsgii\OrderLog
{
public function behaviors()
{
return [
[
'class' => TimestampBehavior::class,
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
],
],
];
}
/**
* 保存下单后的事件队列处理日志
* @param $order_id
* @param $message
*/
public static function saveLog($order_id, $message)
{
$orderLog = new OrderLog();
$orderLog->order_id = $order_id;
$orderLog->content = $message;
$orderLog->save();
}
}