dggzichahu/application/admin/controller/Upgrade.php

78 lines
1.9 KiB
PHP
Executable File

<?php// +----------------------------------------------------------------------
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | Author: HcyShop-松鼠
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\UpgradeLogic;
/** 升级更新
* Class Upgrade
* @package app\admin\controller
*/
class Upgrade extends AdminBase
{
/**
* Notes: 列表
* @author 松鼠
* @return mixed
*/
public function index()
{
if ($this->request->isAjax()) {
$data = UpgradeLogic::index($this->page_no, $this->page_size);
$this->_success('', $data);
}
return $this->fetch();
}
/**
* Notes: 提示
* @author 松鼠
* @return mixed
*/
public function choosePage()
{
return $this->fetch();
}
/**
* Notes: 执行更新
* @author 松鼠
*/
public function handleUpgrade()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Upgrade');
if ($result !== true) {
$this->_error($result);
}
$res = UpgradeLogic::upgrade($post);
if (true === $res) {
$this->_success('更新成功');
}
$this->_error($res);
}
$this->_error('更新失败');
}
public function addUpdatePkgLog()
{
$post = $this->request->post();
$post['update_type'] = 2; // 单商户企业版
$res = UpgradeLogic::addlog($post);
if($res === false) {
return $this->_error('添加更新日志失败');
}
return $this->_success('添加更新日志成功');
}
}