Commit f4987535 by 杨树贤

fix

parent af283379
Showing with 8 additions and 5 deletions
......@@ -156,10 +156,8 @@ class SkuService extends BaseService
$intraCodeModel = new IntracodeModel();
$encodedList = array_column($list, 'encoded');
$encodedUsers = $intraCodeModel->getEncodedUserByEncoded($encodedList);
$list = array_map(function ($item) use ($encodedUsers, $redis) {
if (empty($item['goods_name'])) {
return $item;
}
$goodsLabelMap = $this->orgId == 1 ? config('field.SkuGoodsLabel') : config('field.SkuGoodsLabelForIedge');
$list = array_map(function ($item) use ($encodedUsers, $redis, $goodsLabelMap) {
$encoded = array_get($item, 'encoded', 0);
$item['encoded_user_name'] = array_get($encodedUsers, $encoded, '');
$item['moq'] = $item['moq'] ?: 0;
......@@ -173,9 +171,14 @@ class SkuService extends BaseService
$dbInfo = getSpuSkuDb($item['goods_id']);
$connection = DB::connection($dbInfo["db"]);
$table = $dbInfo['table'];
$selectFields = ['goods_id', 'create_time', 'eccn', 'source', 'encoded', 'org_id'];
$selectFields = ['goods_id', 'create_time', 'eccn', 'source', 'encoded', 'org_id', 'goods_label'];
$skuDBData = $connection->table($table)->select($selectFields)->where('goods_id', $item['goods_id'])->first();
$skuDBData = $skuDBData ? $skuDBData : [];
$item['goods_label'] = (int) array_get($skuDBData, 'goods_label', 0);
$item['goods_label_name'] = array_get($goodsLabelMap, $item['goods_label'], '');
if (empty($item['goods_name'])) {
return $item;
}
$item['source_name'] = array_get(config('field.SkuSource'), !empty($skuDBData['source']) ? $skuDBData['source'] : 1, '');
$item['org_name'] = array_get(config('field.SkuOrgList'), !empty($skuDBData['org_id']) ? $skuDBData['org_id'] : 1, '');
$item['ability_level_name'] = (!empty($item['ability_level']) ? $item['ability_level'] : 0) == 2 ? '强履约' : '弱履约';
......
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 sign in to comment