初始化代码

This commit is contained in:
2025-12-22 14:32:54 +08:00
parent e27ab90d9f
commit d02b31a8b9
1459 changed files with 240973 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
<?php
namespace app\farm\server;
use app\shop\model\BargainRecord;
use think\App;
use work;
class CancelOrder
{
public $_observer = [];
public function __construct() {
}
/**
* @purpose: 添加观察者
* @param string $key 给所添加的观察者的一个唯一 key方便从注册树中移除观察者
* @param Observer $observer 观察者对象
* @return mixed
*/
public function addObserver( $observer)
{
$this->_observer[] = $observer;
}
/**
* @purpose: 从注册树中移除观察者
* @param string $key 给所添加的观察者的一个唯一 key方便从注册树中移除观察者
* @return mixed
*/
public function removeObserver($key)
{
unset($this->_observer[$key]);
}
/**
* @purpose: 广播通知以注册的观察者,对注册树进行遍历,让每个对象实现其接口提供的操作
* @return mixed
*/
public function notify($uniacid,$userid)
{
if(!empty($this->_observer)){
foreach ($this->_observer as $observer) {
$data[] = $observer->autoCancelOrder($uniacid,$userid);
}
}
return !empty($data)?$data:[];
}
}