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');