12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Services\App;
- use App\Exceptions\ApiException;
- use App\Services\Service;
- use Exception;
- use Illuminate\Support\Facades\Redis;
- /**
- * Class ProfileService
- * @package App\Services\App
- */
- class ProfileService extends Service
- {
- /**
- * 获取配置
- * @param string $key
- * @return string
- * @throws ApiException
- */
- public function get(string $key)
- {
- try {
- $public_id = config('miniprogram.public_id');
- $profile = Redis::hget("app:config:{$public_id}", $key);
- return $profile;
- } catch (Exception $e) {
- throw new ApiException($e->getMessage(), $e->getCode());
- }
- }
- }
|