admin/addon/aliapp/shop/controller/Member.php

81 lines
1.9 KiB
PHP

<?php
namespace addon\aliapp\shop\controller;
use addon\aliapp\model\AliPayMember;
use app\shop\controller\BaseShop;
class Member extends BaseShop{
// 成员角色类型。
private $memberRole = [
0 => 'DEVELOPER',
1 => 'EXPERIENCER',
'DEVELOPER' => '开发者',
'EXPERIENCER' => '体验者',
];
public function __construct(){
parent::__construct();
// 输出菜单
if(request()->isGet()) $this->forthMenu();
}
/**
* Common: 进入成员管理
* Author: wu-hui
* Time: 2022/12/30 13:53
* @return array|mixed
* @throws \think\db\exception\DbException
*/
public function index(){
if(request()->isAjax()) return (new AliPayMember($this->site_id))->getList();
return $this->fetch('member/index');
}
/**
* Common: 同步成员
* Author: wu-hui
* Time: 2022/12/30 13:47
* @return array
*/
public function synchronization(){
// 参数获取
$type = (int)input('type');
return (new AliPayMember($this->site_id))->synchronizationMember($this->memberRole[$type]);
}
/**
* Common: 添加成员
* Author: wu-hui
* Time: 2022/12/30 14:28
* @return array|mixed
*/
public function addMember(){
if (request()->isAjax()) {
return (new AliPayMember($this->site_id))->addMember();
} else {
return $this->fetch('member/add');
}
}
/**
* Common: 删除成员
* Author: wu-hui
* Time: 2022/12/30 14:41
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function delMember(){
return (new AliPayMember($this->site_id))->delMember();
}
}