更新
This commit is contained in:
@@ -5,16 +5,14 @@ declare(strict_types=1);
|
||||
namespace app\adminapi\controller\firstvisit;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\logic\auth\AuthLogic;
|
||||
use app\adminapi\logic\firstvisit\WecomAcquisitionCustomerLogic;
|
||||
use app\adminapi\logic\firstvisit\WecomPromotionLogic;
|
||||
use app\common\service\qywx\QywxPromotionContactApiService;
|
||||
use app\common\service\qywx\QywxPromotionMediaService;
|
||||
use app\common\service\qywx\QywxPromotionOperatorAccess;
|
||||
|
||||
class WecomPromotionController extends BaseAdminController
|
||||
{
|
||||
private const PAGE_PERMISSION = 'firstvisit.wecomPromotion/overview';
|
||||
|
||||
public function tagOptions()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
@@ -25,7 +23,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function createTag()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
if (!$this->request->isPost()) {
|
||||
@@ -68,9 +66,13 @@ class WecomPromotionController extends BaseAdminController
|
||||
if (!$this->hasPagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
$params = $this->request->post();
|
||||
if ((int) ($params['id'] ?? 0) <= 0 && !$this->hasBasePagePermission()) {
|
||||
return $this->fail('共享操作人只能编辑已授权方案,不能新建分流方案');
|
||||
}
|
||||
|
||||
return $this->run(fn () => $this->success('分流方案已保存', WecomPromotionLogic::savePool(
|
||||
$this->request->post(),
|
||||
$params,
|
||||
$this->adminId,
|
||||
$this->adminInfo
|
||||
)));
|
||||
@@ -91,7 +93,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function batchSetOperators()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function deletePool()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
$id = (int) $this->request->post('id', 0);
|
||||
@@ -158,7 +160,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function checkApiPermission()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
|
||||
@@ -167,7 +169,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function syncRemoteLinks()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
$poolId = (int) $this->request->post('pool_id', 0);
|
||||
@@ -195,7 +197,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function deleteRemoteLink()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
$id = (int) $this->request->post('id', 0);
|
||||
@@ -250,7 +252,7 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
public function deleteLink()
|
||||
{
|
||||
if (!$this->hasPagePermission()) {
|
||||
if (!$this->hasBasePagePermission()) {
|
||||
return $this->fail('权限不足');
|
||||
}
|
||||
$id = (int) $this->request->post('id', 0);
|
||||
@@ -273,10 +275,11 @@ class WecomPromotionController extends BaseAdminController
|
||||
|
||||
private function hasPagePermission(): bool
|
||||
{
|
||||
if ((int) ($this->adminInfo['root'] ?? 0) === 1) {
|
||||
return true;
|
||||
}
|
||||
return QywxPromotionOperatorAccess::hasPagePermission($this->adminId, $this->adminInfo);
|
||||
}
|
||||
|
||||
return in_array(self::PAGE_PERMISSION, AuthLogic::getAuthByAdminId($this->adminId), true);
|
||||
private function hasBasePagePermission(): bool
|
||||
{
|
||||
return QywxPromotionOperatorAccess::hasBasePagePermission($this->adminId, $this->adminInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user