master
ljl 10 months ago
parent df0bc2317b
commit 4382eb030d

@ -193,4 +193,13 @@ class MallAuthController extends AbstractApiController {
$this->mallAuthService->generateJoinAuthToken($this->mallId, $_POST['authGroupId']);
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_allow_member_batch_move'
];
$fieldStr = join(',', $fields);
$fieldStr = $this->formatFields($fields);
$groupMemberTbl = MallAuthGroupMemberDao::tableName();
$authGroups = [];
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 {
$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;
}

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

Loading…
Cancel
Save