From 2b61ed16f080b2447b4d86db0301ae07980f6f66 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Sat, 9 Dec 2023 16:58:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=8E=BF=E8=B4=A6=E5=8F=B7=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E7=99=BB=E5=BD=95=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/dataview/Merchant.php | 13 ++++++++++++- route/api.php | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controller/api/dataview/Merchant.php b/app/controller/api/dataview/Merchant.php index 95b96472..3a0f666c 100644 --- a/app/controller/api/dataview/Merchant.php +++ b/app/controller/api/dataview/Merchant.php @@ -13,7 +13,7 @@ use app\common\repositories\user\UserVisitRepository; use crmeb\basic\BaseController; use app\common\repositories\system\merchant\MerchantRepository as repository; use think\App; -use think\Db; +use think\facade\Db; use think\exception\ValidateException; use think\facade\Cache; @@ -152,4 +152,15 @@ class Merchant extends BaseController return app('json')->success($res); } + public function merchant() + { + $merId = $this->request->param('mer_id'); + $merchant = Db::name('merchant')->where('mer_id', $merId)->find(); + $expire = time()+ 3600 * 24; + $token = md5($expire); + // 缓存token + Cache::set($token.'_merchant_'.$merchant['uid'], $expire); + return app('json')->success(compact('merchant', 'token', 'expire')); + } + } \ No newline at end of file diff --git a/route/api.php b/route/api.php index 9697bb20..48c5d40e 100644 --- a/route/api.php +++ b/route/api.php @@ -761,6 +761,7 @@ Route::group('api/', function () { Route::get('merchant_product_ranking', 'Merchant/merchantProductRanking'); Route::get('merchant_product_visit', 'Merchant/merchantProductVisit'); Route::get('merchant_product_cart', 'Merchant/merchantProductCart'); + Route::get('merchant', 'Merchant/merchant'); // api.dataview.Finance Route::get('withdraw_list', 'Finance/withdrawList');