Commit 3c1c338a by 叶明星

重要参数

parent b1b2f045
......@@ -11,7 +11,7 @@ SYSTEM_NAME=商品信息处理服务(开发环境)
//laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=60002
LARAVELS_LISTEN_PORT=62002
//基石自营商品主库
DB_Self_HOST=192.168.2.239
......@@ -19,7 +19,7 @@ DB_Self_DATABASE=lc_footstone
DB_Self_USERNAME=root
DB_Self_PASSWORD=root
DB_Self_PORT=3306
DB_Self_PREFIX=lc_
DB_Self_PREFIX=lie_
//采购系统数据库
DB_Pur_HOST=192.168.2.239
......@@ -27,7 +27,7 @@ DB_Pur_DATABASE=lc_wms
DB_Pur_USERNAME=root
DB_Pur_PASSWORD=root
DB_Pur_PORT=3306
DB_Pur_PREFIX=lc_
DB_Pur_PREFIX=lie_
REDIS_HOST=192.168.1.235
......@@ -39,10 +39,5 @@ REDIS_READ_HOST=192.168.1.237
REDIS_READ_PASSWORD=icDb29mLy2s
REDIS_READ_PORT=6379
MONG_DB_SPU_ATTRS_HOST=192.168.1.237
MONG_DB_SPU_ATTRS_USERNAME=ichunt
MONG_DB_SPU_ATTRS_PASSWORD=huntmon6699
MONG_DB_SPU_ATTRS_DATABASE=ichunt
CACHE_DRIVER=file
QUEUE_DRIVER=sync
......@@ -5,6 +5,7 @@ namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Common\Model\RedisModel;
class SelfClassifyModel extends Model
{
......@@ -79,4 +80,14 @@ class SelfClassifyModel extends Model
}
}
//获取分类参数
public function getClassAttr($class_id){
$Redis = new RedisModel();
$Cache = json_decode($Redis->hget('class_attr', $class_id), true);
if(empty($Cache)){
return false;
}
return $Cache;
}
}
......@@ -16,7 +16,6 @@ class SelfGoodsModel extends Model
if(empty($SupplierModel)) $SupplierModel = new SupplierChannelModel();
if(empty($BrandModel)) $BrandModel = new SelfBrandModel();
if(empty($UnitModel)) $UnitModel = new UnitModel();
if(empty($ResourceModel)) $ResourceModel = new ResourceModel();
if(empty($ClassModel)) $ClassModel = new SelfClassifyModel();
$Find['supplier_name']=$SupplierModel->ObSupplierName($Find['supplier_id']);
......@@ -24,10 +23,6 @@ class SelfGoodsModel extends Model
$Find['goods_unit_name']=$UnitModel->OBUnitInfo($Find['goods_unit'],$Redis);
$Find['packing_name']=$UnitModel->OBUnitInfo($Find['packing'],$Redis);
$Find['mpq_unit_name']=$UnitModel->OBUnitInfoAlias($Find['packing'],$Redis);
$GoodsImages=$ResourceModel->GetResourceInfoById($Find['goods_images'],$Redis);
$Find['goods_images']=$GoodsImages;
$GoodsPdf=$ResourceModel->GetResourceInfoById($Find['pdf'],$Redis);
$Find['pdf']=$GoodsPdf;
if(!empty($Find['class_name'])) unset($Find['class_name']);
//处理库存
......@@ -56,13 +51,26 @@ class SelfGoodsModel extends Model
if(!empty($Find['class_id2'])){
$class_id2=$ClassModel->ProduceClassRedis($Find['class_id2'],false,$Redis);
empty($class_id2['class_name']) || $Find['class_id2_name']=$class_id2['class_name'];
//处理分类参数重要值
$ClassAttrCache = $ClassModel->getClassAttr($Find['class_id2']);
if($ClassAttrCache && is_array($ClassAttrCache)){
foreach ($ClassAttrCache as $k=>$v){
$ClassAttrCache[md5($v['attr_name'])] = empty($v['is_important']) ? 1 : $v['is_important'];
unset($ClassAttrCache[$k]);
}
if(!empty($Find['attrs']) && is_array($Find['attrs'])){
foreach ($Find['attrs'] as $k=>$v){
$Find['attrs'][$k]['is_important'] = empty($ClassAttrCache[md5($v['attr_name'])]) ? 1 : $ClassAttrCache[md5($v['attr_name'])];
}
}
}
}
if(is_array($Find['ladder_price'])){
$Find['ladder_price']=arraySequence($Find['ladder_price'],'purchases','SORT_ASC');
}
if($Find['status'] != 1 || !count($Find['ladder_price'])>0 || empty($Find['ladder_price'][0]['purchases'])){
$Find['is_buy']=0;
}else{
......@@ -211,7 +219,7 @@ class SelfGoodsModel extends Model
$this->connection='self';//开始连接数据库
$fieldArr=['other_attrs', 'goods_id','goods_type','supplier_id','brand_id','class_id1','class_id2','goods_name','status',
'encoded','encap','packing','goods_unit','goods_images','pdf','goods_brief','moq','mpq',
'ladder_price','update_time','sku_name','mpl','stock','attrs','cost','new_cost'];
'ladder_price','update_time','sku_name','mpl','stock','attrs','cost','new_cost','cn_delivery_time'];
$info=$this->where('goods_id','=',$goods_id)->select($fieldArr)->first();
if(!$info) return false;
$info=$info->toArray();
......
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