master
ljl 10 months ago
parent df0bc2317b
commit 4382eb030d

@ -193,4 +193,13 @@ class MallAuthController extends AbstractApiController {
$this->mallAuthService->generateJoinAuthToken($this->mallId, $_POST['authGroupId']); $this->mallAuthService->generateJoinAuthToken($this->mallId, $_POST['authGroupId']);
return $this->renderSuccess(); return $this->renderSuccess();
} }
/**
* @api GET 获取授权店铺列表
*/
public function getMultiVenderList()
{
$data = $this->mallAuthService->getAuthMallMap(CommonTool::getOperatorInfo());
return $this->renderSuccess($data);
}
} }

@ -55,14 +55,14 @@ class MallAuthGroupDao extends AbstractDao {
'is_open_privacy', 'is_open_privacy',
'is_allow_member_batch_move' 'is_allow_member_batch_move'
]; ];
$fieldStr = join(',', $fields); $fieldStr = $this->formatFields($fields);
$groupMemberTbl = MallAuthGroupMemberDao::tableName(); $groupMemberTbl = MallAuthGroupMemberDao::tableName();
$authGroups = []; $authGroups = [];
if (AppConst::isPddRubyApp()) { if (AppConst::isPddRubyApp()) {
$authGroups = $this->query("SELECT %l FROM %b WHERE `group_owner_mall_id` = %i", $this->getTable(), $fieldStr, $mallId); $authGroups = $this->query("SELECT %l FROM %b WHERE `group_owner_mall_id` = %i", $fieldStr, $this->getTable(), $mallId);
} else { } else {
$authGroups = $this->query("SELECT %l FROM %b vag WHERE vag.`mall_auth_group_id` IN (SELECT DISTINCT `mall_auth_group_id` FROM %b WHERE mall_id = %i) ORDER BY vag.`mall_auth_group_id` ASC ", $this->getTable(), $groupMemberTbl, $fieldStr, $mallId); $authGroups = $this->query("SELECT %l FROM %b vag WHERE vag.`mall_auth_group_id` IN (SELECT DISTINCT `mall_auth_group_id` FROM %b WHERE mall_id = %i) ORDER BY vag.`mall_auth_group_id` ASC ", $fieldStr, $this->getTable(), $groupMemberTbl, $mallId);
} }
return $authGroups; return $authGroups;
} }

@ -52,4 +52,9 @@ class OpPageSettingDao extends AbstractDao {
public function getByMallIdAndSubAccountId($mallId, $subAccountId) { public function getByMallIdAndSubAccountId($mallId, $subAccountId) {
return $this->queryFirstRow('select * from %b where mall_id = %s and mall_sub_account_id = %s', $mallId, $subAccountId); return $this->queryFirstRow('select * from %b where mall_id = %s and mall_sub_account_id = %s', $mallId, $subAccountId);
} }
public function getSelectedAuthMallIds($mallId, $subAccountId) {
$selectedAuthMallIds = $this->queryFirstField('select selected_auth_mall_ids from %b where mall_id = %s and mall_sub_account_id = %s', $this->getTable(), $mallId, $subAccountId);
return empty($selectedAuthMallIds) ? [] : explode(',', $selectedAuthMallIds);
}
} }

@ -21,6 +21,7 @@ use Dao\Mall\MallSDao;
use Dao\Mall\MallSmsSendLogDao; use Dao\Mall\MallSmsSendLogDao;
use Dao\Mall\MallSubAccountAuthMallDao; use Dao\Mall\MallSubAccountAuthMallDao;
use Dao\Mall\MoveAuthMallDao; use Dao\Mall\MoveAuthMallDao;
use Dao\OrderPrint\OpPageSettingDao;
use DbTool; use DbTool;
use DdcRequestClient; use DdcRequestClient;
use Exception; use Exception;
@ -58,8 +59,7 @@ class MallAuthService extends AbstractService {
private $mallBizTraceDtDao; private $mallBizTraceDtDao;
private $moveAuthMallDao; private $moveAuthMallDao;
private $mallSmsSendLogDao; private $mallSmsSendLogDao;
private $mallLoginLogDao; private $opPageSettingDao;
private $mallLoginIpDao;
/** /**
* @var DdcRequestClient * @var DdcRequestClient
@ -97,8 +97,7 @@ class MallAuthService extends AbstractService {
$this->moveAuthMallDao = MoveAuthMallDao::instance(); $this->moveAuthMallDao = MoveAuthMallDao::instance();
$this->mallSmsSendLogDao = MallSmsSendLogDao::instance(); $this->mallSmsSendLogDao = MallSmsSendLogDao::instance();
$this->mallSubAccountAuthMallDao = MallSubAccountAuthMallDao::instance(); $this->mallSubAccountAuthMallDao = MallSubAccountAuthMallDao::instance();
$this->mallLoginLogDao = MallLoginLogDao::instance(); $this->opPageSettingDao = OpPageSettingDao::instance();
$this->mallLoginIpDao = MallLoginIpDao::instance();
$this->ddcRequestClient = \Zc::singleton(DdcRequestClient::class); $this->ddcRequestClient = \Zc::singleton(DdcRequestClient::class);
$this->appGateRequestClient = \Zc::singleton(AppGateRequestClient::class); $this->appGateRequestClient = \Zc::singleton(AppGateRequestClient::class);
@ -1154,11 +1153,11 @@ class MallAuthService extends AbstractService {
$authGroupIds = array_keys($authGroupMap); $authGroupIds = array_keys($authGroupMap);
if (empty($authGroupIds)) { if (empty($authGroupIds)) {
return array(); return [];
} }
$memberList = $this->mallAuthGroupMemberDao->getListByAuthGroupIds($authGroupIds, $skipExpire); $memberList = $this->mallAuthGroupMemberDao->getListByAuthGroupIds($authGroupIds, $skipExpire);
$memberMap = array(); $memberMap = [];
foreach ($memberList as $member) { foreach ($memberList as $member) {
if (($member['mallId'] == $mallId) && $skipCurrentMallId) { if (($member['mallId'] == $mallId) && $skipCurrentMallId) {
continue; continue;
@ -1225,28 +1224,34 @@ class MallAuthService extends AbstractService {
return $row ? true : false; return $row ? true : false;
} }
/* public function getAuthMallMap($venderId, $shopName, $preVenderIdList) { public function getAuthMallMap($operatorInfo) {
list($multiShopOptions, $groupIdAndGroupNameMap) = $this->getVenderAuthGroupMultiShopOptions($venderId, $shopName, $preVenderIdList); $mallId = $operatorInfo['mallId'];
$venderIds = array_keys($multiShopOptions); $shopName = $operatorInfo['mallName'];
$selectedAuthVenderIds = ((count($multiShopOptions) > 1) && $venderAuthConfig['selectedAuthVenderIds']) ? explode(',', $venderAuthConfig['selectedAuthVenderIds']) : array_keys($multiShopOptions); $mallSubAccountId = $operatorInfo['mallSubAccountId'];
$selectedAuthVenderIds = array_map(function ($selectedAuthVenderId) { $preMallIdList = $operatorInfo['preMallIdList'];
return (string)$selectedAuthVenderId; $multiShopOptions = $this->mallRepository->getMultiShopOptions($mallId, $shopName, $mallSubAccountId);
}, $selectedAuthVenderIds); $mallAuthGroupMap = $this->getMallAuthGroupMapWithMembers($mallId, $preMallIdList);
$selectedAuthGroupIds = ((count($groupIdAndGroupNameMap) > 1) && $venderAuthConfig['selectedAuthGroupIds']) ? explode(',', $venderAuthConfig['selectedAuthGroupIds']) : array_keys($groupIdAndGroupNameMap); $groupIdAndGroupNameMap = [];
$selectedAuthGroupIds = array_map(function ($selectedAuthGroupId) { foreach ($mallAuthGroupMap as $groupInfo) {
return (string)$selectedAuthGroupId; $groupIdAndGroupNameMap[$groupInfo['mallAuthGroupId']] = $groupInfo['groupName'];
}, $selectedAuthGroupIds); }
$mallIds = array_keys($multiShopOptions);
$authVenderInfoList = $this->getVenderAppByVenderIds($venderIds, Zc::C('appName')); $selectedAuthMallIds = $this->opPageSettingDao->getSelectedAuthMallIds($mallId, $mallSubAccountId);
$venderIdAndShopNameMap = []; $selectedAuthMallIds = (count($multiShopOptions) > 1) && $selectedAuthMallIds ? $selectedAuthMallIds : array_keys($multiShopOptions);
$expiredVenderIdAndShopNameMap = []; $selectedAuthMallIds = array_map(function ($selectedAuthMallId) {
foreach ($multiShopOptions as $venderId => $shopName) { return (string)$selectedAuthMallId;
if ($authVenderInfoList[$venderId]['accessTokenIsInvalid'] || strtotime($authVenderInfoList[$venderId]['gmtExpire']) < time()) { }, $selectedAuthMallIds);
$expiredVenderIdAndShopNameMap[$venderId] = $shopName;
$authMallInfoMap = $this->mallSDao->getMapByMallIds($mallIds);
$mallIdAndShopNameMap = [];
$expiredMallIdAndShopNameMap = [];
foreach ($multiShopOptions as $mallId => $shopName) {
if (strtotime($authMallInfoMap[$mallId]['gmtAccessTokenExpire']) < time() || strtotime($authMallInfoMap[$mallId]['gmtExpire']) < time()) {
$expiredMallIdAndShopNameMap[$mallId] = $shopName;
} else { } else {
$venderIdAndShopNameMap[$venderId] = $shopName; $mallIdAndShopNameMap[$mallId] = $shopName;
} }
} }
return compact('venderIdAndShopNameMap', 'expiredVenderIdAndShopNameMap', 'selectedAuthVenderIds', 'selectedAuthGroupIds', 'groupIdAndGroupNameMap', 'selectedAuthType'); return compact('mallIdAndShopNameMap', 'expiredMallIdAndShopNameMap', 'selectedAuthMallIds', 'groupIdAndGroupNameMap');
} */ }
} }

@ -366,7 +366,12 @@ class InvoiceTplService extends AbstractService {
list($authList, $total) = $this->opUserInvoiceTplAuthDao->searchPage($tplId, $mallId, $page, $pageSize); list($authList, $total) = $this->opUserInvoiceTplAuthDao->searchPage($tplId, $mallId, $page, $pageSize);
if (empty($authList)) { if (empty($authList)) {
return [$authList, $total]; return [
'authList' => $authList,
'total' => $total,
'page' => $page,
'pageSize' => $pageSize,
];
} }
$authList = $this->buildUserInvoiceTplAuthList($authList); $authList = $this->buildUserInvoiceTplAuthList($authList);
return [ return [

Loading…
Cancel
Save