96 lines
3.0 KiB
PHP
96 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
|
* ==========================================================
|
|
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
|
* ----------------------------------------------------------
|
|
* 官方网址: https://www.zoomtk.com
|
|
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
|
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
|
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
|
* ==========================================================
|
|
*/
|
|
|
|
namespace addon\saasagent\shop\controller;
|
|
|
|
use addon\saasagent\model\AgentLevel;
|
|
|
|
class Level extends SaasBsae
|
|
{
|
|
/**
|
|
* 等级列表
|
|
* @return array|mixed
|
|
*/
|
|
public function agentlevel()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$AgentLevel = new AgentLevel();
|
|
$condition[] = ['site_id', '=', $this->site_id];
|
|
$keyword = input('search_text', '');
|
|
$page = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
if ($keyword) {
|
|
$condition[] = ['level_name', 'like', '%' . $keyword . '%'];
|
|
}
|
|
$res = $AgentLevel->getLevelPage($condition, $page, $page_size);
|
|
return $res;
|
|
}
|
|
$this->forthMenu();
|
|
return $this->fetch('level/level_list');
|
|
}
|
|
|
|
/**
|
|
* 添加等级
|
|
* @return array|mixed|void
|
|
*/
|
|
public function addlevel()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$data = request()->post();
|
|
$data['site_id'] = $this->site_id;
|
|
$data['create_time'] = time();
|
|
$data['update_time'] = time();
|
|
$AgentLevel = new AgentLevel();
|
|
$res = $AgentLevel->addAgentLevel($data);
|
|
return $res;
|
|
}
|
|
return $this->fetch('level/add_level');
|
|
}
|
|
|
|
/***
|
|
* 编辑等级
|
|
* @return array|mixed
|
|
*/
|
|
public function editlevel()
|
|
{
|
|
$level_id = input('level_id');
|
|
$AgentLevel = new AgentLevel();
|
|
$condition[] = ['site_id', '=', $this->site_id];
|
|
$condition[] = ['level_id', '=', $level_id];
|
|
if (request()->isAjax()) {
|
|
$data = request()->post();
|
|
$data['update_time'] = time();
|
|
$res = $AgentLevel->editAgentLevel($data, $condition);
|
|
return $res;
|
|
}
|
|
$info = $AgentLevel->getLevelInfo($condition);
|
|
$this->assign('info', $info['data']);
|
|
return $this->fetch('level/edit_level');
|
|
}
|
|
|
|
/**
|
|
* 删除等级
|
|
* @return array
|
|
*/
|
|
public function dellevel()
|
|
{
|
|
if (request()->isAjax()) {
|
|
$level_id = input('level_id', 0);
|
|
$condition[] = ['site_id', '=', $this->site_id];
|
|
$condition[] = ['level_id', '=', $level_id];
|
|
$AgentLevel = new AgentLevel();
|
|
$res = $AgentLevel->delAgentLevel($condition);
|
|
return $res;
|
|
}
|
|
}
|
|
} |