// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\api\model; use app\common\model\Notify as NotifyModel; use app\common\library\helper; use cores\exception\BaseException; use think\cache\driver\Redis; /** * 通知模型 * Class Order * @package app\api\model */ class Notify extends NotifyModel { /** * 隐藏字段 * @var array */ protected $hidden = [ 'store_id', 'update_time' ]; // 信息提示 private $message = ''; private $redis = null; /** * 通知列表 * @return \think\Paginator * @throws \think\exception\DbException */ public function getList() { // 获取数据列表 return $this->where('status', '=', 0) ->where('num', '<', 3) ->order(['create_time' => 'asc']) ->paginate(200); } /** * 新增通知记录 * @param $order * @return false|int */ public function add($order) { return $this->save([ 'order_id' => $order['order_id'], 'notify_url' => $order['notify_url'], 'store_id' => 10001, ]); } /** * 修改通知状态 * @param $data * @return bool */ public function sureNotify($data) { return $this->save([ 'status' => $data['status'], 'num' => $data['num'], 'last_time' => time(), ]) !== false; } }