REAPI/app/channel/controller/CardGroup.php

119 lines
3.0 KiB
PHP
Raw Normal View History

2024-09-29 15:43:18 +08:00
<?php
namespace app\channel\controller;
set_time_limit(0);
ini_set('memory_limit','512M');
ini_set('default_socket_timeout', -1); //不超时
use think\admin\Controller;
use app\channel\service\CardGroupService;
use app\channel\service\CardService;
use app\merchant\service\CardService as Log;
use app\merchant\service\MerchantService;
/**
* 渠道卡密批次管理
* Class ChannelProduct
* @package app\channel\controller
*/
class CardGroup extends Controller
{
/**
* 绑定数据表
* @var string
*/
private $table = 'ChannelCardGroup';
/**
* 批次管理
* @auth true
* @menu true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$this->title = '卡密批次管理';
$query = $this->_query($this->table);
$query->equal('status')->dateBetween('create_at');
$query->like('name');
$query->order('status desc, reorder desc, id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
protected function _page_filter(&$data)
{
}
/**
* 表单数据处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
protected function _form_filter(&$data)
{
//$this->merchant = MerchantService::instance()->getAll();
$this->merchant = array();
if ($this->request->isPost()) {
if (empty($data['name'])) $this->error('批次号不能为空');
} else {
$this->name = date('Ymd');
}
}
/**
* 添加批次
* @auth true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function add()
{
$this->_form($this->table, 'form');
}
/**
* 编辑批次
* @auth true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit()
{
$this->_form($this->table, 'form');
}
/**
* 修改批次状态
* @auth true
* @throws \think\db\exception\DbException
*/
public function state()
{
$this->_save($this->table, $this->_vali([
'status.in:0,1' => '状态值范围异常!',
'status.require' => '状态值不能为空!',
]));
}
/**
* 删除批次
* @auth true
* @throws \think\db\exception\DbException
*/
public function remove()
{
$this->_delete($this->table);
}
}