58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\store\model\recharge;
|
|
|
|
use app\common\model\recharge\Plan as PlanModel;
|
|
|
|
/**
|
|
* 用户充值订单模型
|
|
* Class Plan
|
|
* @package app\store\model\recharge
|
|
*/
|
|
class Plan extends PlanModel
|
|
{
|
|
/**
|
|
* 获取优惠券列表
|
|
* @return \think\Paginator
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function getList()
|
|
{
|
|
return $this->where('is_delete', '=', 0)
|
|
->order(['sort' => 'asc', 'create_time' => 'desc'])
|
|
->paginate(15, false, [
|
|
'query' => request()->request()
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 添加新记录
|
|
* @param $data
|
|
* @return false|int
|
|
*/
|
|
public function add($data)
|
|
{
|
|
$data['wxapp_id'] = self::$wxapp_id;
|
|
return $this->allowField(true)->save($data);
|
|
}
|
|
|
|
/**
|
|
* 更新记录
|
|
* @param $data
|
|
* @return bool|int
|
|
*/
|
|
public function edit($data)
|
|
{
|
|
return $this->allowField(true)->save($data) !== false;
|
|
}
|
|
|
|
/**
|
|
* 删除记录 (软删除)
|
|
* @return bool|int
|
|
*/
|
|
public function setDelete()
|
|
{
|
|
return $this->save(['is_delete' => 1]) !== false;
|
|
}
|
|
|
|
} |