Commit 2c0c651a by 杨昕

优化获取店铺列表

parent ac87dbf0
Pipeline #14026 passed with stages
in 4 minutes 44 seconds
......@@ -31,17 +31,22 @@ class MediaCategoryModel extends Eloquent
/**
* 获取用户业务线及对应业务线的权限
*/
$catgList = MediaCategoryModel::where('status',0)->limit(20)->get()->toArray();
$appids = array_column($catgList,"media_category_id");
#需要传一个默认的appid,否则接口会报参数缺失错误
$url = getRbac($request,'api/open/getPlatform','ec8747abc5dbe8288e64f327a76ac517');
$result = http_request_code($url,
array(
"Content-Type: application/json"
),
'POST',
json_encode(array())
json_encode($appids)
);
LogModel::addlog(['获取商店列表'=>json_decode($result)]);
$catgs = json_decode($result,true);
if (!isset($catgs['data'])){
......@@ -49,13 +54,8 @@ class MediaCategoryModel extends Eloquent
throw new \Exception("获取商店列表失败");
}
$catgList = MediaCategoryModel::get()->toArray();
$appids = array_column($catgs['data'],"appid");
$tmp = [];
foreach ($catgList as $catg){
......@@ -64,7 +64,6 @@ class MediaCategoryModel extends Eloquent
}
}
}catch (\Exception $exception){
throw new DatabaseException($exception->getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment