初始化项目
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 萤火科技 <admin@yiovo.com>
|
||||
// +----------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user