|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace hd\controllers;
|
|
|
|
|
|
+use biz\shop\services\ShopAdminService;
|
|
|
use bizHd\admin\classes\AdminClass;
|
|
|
use bizHd\admin\services\AdminService;
|
|
|
use bizHd\wx\services\WxOpenService;
|
|
|
@@ -15,6 +16,52 @@ class AdminController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['mini-full-info', 'mini-mobile', 'login-detail'];
|
|
|
|
|
|
+ public function actionHasTokenAutoLogin()
|
|
|
+ {
|
|
|
+ $admin = $this->admin;
|
|
|
+ if (empty($admin)) {
|
|
|
+ util::fail('请先注册');
|
|
|
+ }
|
|
|
+ $openShop = $admin['openShop'] ?? 1;
|
|
|
+ $currentShopId = $admin['currentShopId'] ?? 0;
|
|
|
+ if (empty($currentShopId)) {
|
|
|
+ if ($openShop == 2) {
|
|
|
+ util::fail('审核中');
|
|
|
+ }
|
|
|
+ util::fail('请先注册');
|
|
|
+ }
|
|
|
+ $adminId = $admin['id'];
|
|
|
+ $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'shopId' => $currentShopId, 'delStatus' => 0], true);
|
|
|
+ if (empty($shopAdmin)) {
|
|
|
+ util::fail('没有权限操作');
|
|
|
+ }
|
|
|
+ if (!empty($shopAdmin) && $shopAdmin->status == 0) {
|
|
|
+ util::fail("您的账号已冻结");
|
|
|
+ }
|
|
|
+ $shopId = $shopAdmin->shopId ?? 0;
|
|
|
+ if (empty($shopId)) {
|
|
|
+ util::fail('您不是管理员');
|
|
|
+ }
|
|
|
+ $shopAdmin->lastLogin = date("Y-m-d H:i:s");
|
|
|
+ $shopAdmin->save();
|
|
|
+ $shopAdminId = $shopAdmin->id ?? 0;
|
|
|
+ //是否有切换门店的权限
|
|
|
+ $switchShop = \biz\shop\classes\ShopAdminClass::hasSwitchShopRight($shopAdmin->attributes);
|
|
|
+ $showDemo = 1;
|
|
|
+ $remind = getenv('HD_UPDATE_REMIND') == false ? 0 : getenv('HD_UPDATE_REMIND');
|
|
|
+ //涉及几个登录的地方,需要同步修改,请搜索关键词uni_login_info
|
|
|
+ util::success([
|
|
|
+ 'token' => '',
|
|
|
+ 'admin' => $admin,
|
|
|
+ 'shopId' => $currentShopId,
|
|
|
+ 'shopAdminId' => $shopAdminId,
|
|
|
+ 'switchShop' => $switchShop,
|
|
|
+ 'showDemo' => $showDemo,
|
|
|
+ //有小程序新版本提示更新
|
|
|
+ 'update' => $remind,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
//最近店铺 ssh 2021.2.27
|
|
|
public function actionRecentShop()
|
|
|
{
|