jh-admin/addon/team/shop/controller/Index.php

153 lines
3.7 KiB
PHP

<?php
namespace addon\team\shop\controller;
use addon\team\model\Commission;
use addon\team\model\Level;
use addon\team\model\Team;
use app\shop\controller\BaseShop;
use addon\team\model\Setting;
class Index extends BaseShop{
/**
* Common: 成员列表
* Author: wu-hui
* Time: 2024/08/09 11:19
* @return array|mixed
*/
public function index(){
if (request()->isAjax()) {
// 参数获取
$params = input('params',[]);
return (new Team())->getPageList($params, $this->site_id);
}
$this->forthMenu();
return $this->fetch("index/index");
}
/**
* Common: 修改团队等级
* Author: wu-hui
* Time: 2024/08/09 14:35
* @return array
*/
public function teamLevelUpdate(){
// 参数获取
$levelId = input('level_id', 0);
$memberId = input('member_id', 0);
// 修改
return (new Team())->TeamUpgrade($memberId, $levelId, ['admin_operate']);
}
/**
* Common: 获取团队等级变更记录
* Author: wu-hui
* Time: 2024/08/09 14:55
* @return array
*/
public function getTeamLevelChangeLog(){
// 参数获取
$params = input('params',[]);
return (new Team())->levelChangeLogRecord($params);
}
/**
* Common: 删除信息
* Author: wu-hui
* Time: 2024/08/09 15:29
* @return array
*/
public function delInfo(){
// 参数获取
$teamId = input('team_id', 0);
model('team')->delete([
['id', '=', $teamId],
]);
// 删除
return success(0,'删除成功');
}
/**
* Common: 等级管理 - 等级列表
* Author: wu-hui
* Time: 2024/08/07 11:45
* @return array|mixed
*/
public function level(){
if (request()->isAjax()) {
// 参数获取
$params = input('params',[]);
return (new Level())->getPageList($params, $this->site_id);
}
$this->forthMenu();
return $this->fetch("index/level");
}
/**
* Common: 等级管理 - 保存设置
* Author: wu-hui
* Time: 2024/08/08 9:04
* @return array
*/
public function levelEdit(){
$info = input('info',[]);
$info['site_id'] = $this->site_id;
return (new Level())->editInfo($info);
}
/**
* Common: 等级管理 - 删除等级
* Author: wu-hui
* Time: 2024/08/08 9:08
* @return array
*/
public function levelDel(){
$id = input('id', 0);
return (new Level())->deleteInfo($id);
}
/**
* Common: 佣金明细
* Author: wu-hui
* Time: 2024/08/12 15:07
* @return array|mixed
*/
public function commissionIndex(){
if (request()->isAjax()) {
// 参数获取
$params = input('params',[]);
return (new Commission())->getPageList($params, $this->site_id);
}
$this->forthMenu();
return $this->fetch("index/commission");
}
/**
* Common: 基本设置
* Author: wu-hui
* Time: 2024/08/07 10:57
* @return array|mixed
*/
public function set(){
if (request()->isAjax()) {
// 参数获取
$info = input('set',[]);
(new Setting())->setConfig((int)$this->site_id, (array)$info);
return success(0, '修改成功');
}
else {
$set = (new Setting())->getConfig((int)$this->site_id);
$this->forthMenu();
return $this->fetch("index/set",[
'set' => json_encode($set, JSON_UNESCAPED_UNICODE)
]);
}
}
}