接入公共服务
This commit is contained in:
@@ -4,7 +4,11 @@ namespace app\controller;
|
||||
|
||||
use app\model\Area;
|
||||
use app\model\Country;
|
||||
use app\util\HttpClient;
|
||||
use app\util\RedisHelper;
|
||||
use app\util\Util;
|
||||
use support\Log;
|
||||
use support\Redis;
|
||||
use support\Request;
|
||||
|
||||
class AreaController
|
||||
@@ -41,7 +45,19 @@ class AreaController
|
||||
|
||||
public function getCountry (Request $request)
|
||||
{
|
||||
$list = Country::get()->toArray();
|
||||
$list = RedisHelper::get("rpc_country");
|
||||
$list = null;
|
||||
if(!$list){
|
||||
$res = HttpClient::get(config('const.rpc_domain') . '/country/all');
|
||||
if ($res['code'] != 200 && $res['data']['code'] != 0){
|
||||
Log::info('register_rpc',$res);
|
||||
return Util::fail($res, trans('register_fail'));
|
||||
}
|
||||
$list = $res['data']['data']['data'];
|
||||
RedisHelper::set("rpc_country", $list, 600);
|
||||
}
|
||||
|
||||
// $list = Country::get()->toArray();
|
||||
$language = 'en_addr';
|
||||
if($request->user['language'] == 'zh_CN'){
|
||||
$language = 'cn_addr';
|
||||
|
||||
Reference in New Issue
Block a user