Commit 2b029189 by 叶明星

去掉联营

parent ff93fe2b
...@@ -11,52 +11,25 @@ SYSTEM_NAME=商品信息处理服务(开发环境) ...@@ -11,52 +11,25 @@ SYSTEM_NAME=商品信息处理服务(开发环境)
//laravels监听IP和端口 //laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0 LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=60004 LARAVELS_LISTEN_PORT=60002
//基石自营商品主库 //基石自营商品主库
DB_Self_HOST=192.168.1.234 DB_Self_HOST=192.168.2.239
DB_Self_DATABASE=liexin_data DB_Self_DATABASE=lc_footstone
DB_Self_USERNAME=spu DB_Self_USERNAME=root
DB_Self_PASSWORD=spu DB_Self_PASSWORD=root
DB_Self_PORT=3306 DB_Self_PORT=3306
DB_Self_PREFIX=lie_ DB_Self_PREFIX=lc_
//采购系统数据库 //采购系统数据库
DB_Pur_HOST=192.168.1.232 DB_Pur_HOST=192.168.2.239
DB_Pur_DATABASE=liexin_wms DB_Pur_DATABASE=lc_wms
DB_Pur_USERNAME=root DB_Pur_USERNAME=root
DB_Pur_PASSWORD=123456 DB_Pur_PASSWORD=root
DB_Pur_PORT=3306 DB_Pur_PORT=3306
DB_Pur_PREFIX=lie_ DB_Pur_PREFIX=lc_
//基石联营SPU数据库
DB_SPU_HOST=192.168.1.234
DB_SPU_DATABASE=liexin_spu
DB_SPU_USERNAME=spu
DB_SPU_PASSWORD=spu
DB_SPU_PORT=3306
DB_SPU_PREFIX=lie_
//基石数据库名字配置
SPU_DB_DATABASE=liexin_spu
SKU_0_DB_DATABASE=liexin_sku_0
SKU_1_DB_DATABASE=liexin_sku_1
SKU_2_DB_DATABASE=liexin_sku_2
SKU_3_DB_DATABASE=liexin_sku_3
SKU_4_DB_DATABASE=liexin_sku_4
SKU_5_DB_DATABASE=liexin_sku_5
SKU_6_DB_DATABASE=liexin_sku_6
SKU_7_DB_DATABASE=liexin_sku_7
SKU_8_DB_DATABASE=liexin_sku_8
SKU_9_DB_DATABASE=liexin_sku_9
DB_CONNECTION=mysql
DB_HOST=192.168.1.235
DB_USERNAME=icDb29mLy2s
DB_PASSWORD=icDb29mLy2s
DB_PORT=3306
DB_DATABASE=0
REDIS_HOST=192.168.1.235 REDIS_HOST=192.168.1.235
......
...@@ -22,22 +22,16 @@ class ServicesController extends Controller ...@@ -22,22 +22,16 @@ class ServicesController extends Controller
$SkuId=$collert['goods_id']; $SkuId=$collert['goods_id'];
$Redis=new RedisModel(); $Redis=new RedisModel();
$GoodsModel=new SelfGoodsModel(); $GoodsModel=new SelfGoodsModel();
$SkuModel=new SkuModel();
$SpuModel=new SpuModel();
if(is_string($SkuId) && stripos($SkuId,',')!==false) $SkuId=explode(',',$SkuId);//兼容逗号方式 if(is_string($SkuId) && stripos($SkuId,',')!==false) $SkuId=explode(',',$SkuId);//兼容逗号方式
$data=[]; $data=[];
if(is_array($SkuId)){ if(is_array($SkuId)){
foreach ($SkuId as $k=>$v){ foreach ($SkuId as $k=>$v){
$data[$v]=false; $data[$v]=false;
if(strlen($v)==19) {//联营或者专卖 $data[$v]=$GoodsModel->WebSelfGoodsDetail($v, $collert['power'], $Redis);
$data[$v] = $SkuModel->combination($v,$collert['power'], $Redis,$SpuModel);
}else $data[$v]=$GoodsModel->WebSelfGoodsDetail($v, $collert['power'], $Redis);
} }
}else{ }else{
$data[$SkuId]=false; $data[$SkuId]=false;
if(strlen($SkuId)==19) {//联营或者专卖 $data[$SkuId]=$GoodsModel->WebSelfGoodsDetail($SkuId, $collert['power'], $Redis);
$data[$SkuId] = $SkuModel->combination($SkuId,$collert['power'], $Redis,$SpuModel);
}else $data[$SkuId]=$GoodsModel->WebSelfGoodsDetail($SkuId, $collert['power'], $Redis);
} }
return $this->Export(0,'success',['data'=>$data]); return $this->Export(0,'success',['data'=>$data]);
} }
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class PoolBrandModel extends Model
{
protected $connection = 'spu';
protected $table = 'brand';
public $timestamps = false;
//从redis获取分类数据
public function HdCacheBrand($BrandID,$Redis=''){
if(empty($BrandID)) return false;
if(empty($Redis)) $Redis=new RedisModel();
$Find=$Redis->hget('brand',$BrandID);
if($Find) return $Find;
$Find=$this->where('brand_id','=',$BrandID)->select('brand_name')->first();
if(!$Find) return false;
$Find=$Find->toArray();
$Redis->hset('brand',$BrandID,$Find['brand_name']);
$Redis->hset('brand_name_all',md5(strtolower($Find['brand_name'])),$BrandID);
ErrorLog('',0000,'SPU品牌缓存丢失,BrandID:'.$BrandID);
return $Find['brand_name'];
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class PoolClassModel extends Model
{
protected $connection = 'spu';
protected $table = 'classify';
public $timestamps = false;
//从redis获取分类数据
public function HdCacheClass($ClassID,$Redis=''){
if(empty($ClassID)) return false;
if(empty($Redis)) $Redis=new RedisModel();
$Find=$Redis->hget('class',$ClassID);
if($Find) return $Find;
$Find=$this->where('class_id','=',$ClassID)->select('class_name')->first();
if(!$Find) return false;
$Find=$Find->toArray();
$Redis->hset('class',$ClassID,$Find['class_name']);
//需要记录一下日志
ErrorLog('',0000,'SPU分类缓存丢失,CLASSID:'.$ClassID);
return $Find['class_name'];
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use DB;
class SpuAttrsModel extends Model
{
protected $connection = 'mongodb';
protected $table = 'spu_attrs';
public $timestamps = false;
public function HdCacheAttrs($SpuID){
$Find=DB::connection('mongodb')->table('spu_attrs')->where('spu_id','=',(int)$SpuID)->select('attrs')->first();
if(!$Find) return false;
$info=json_decode($Find['attrs'],true);
if(!$info) return false;
$Attrs=false;
foreach ($info as $k=>$v){
$Attrs[]=[
'attr_name'=>$k,
'attr_value'=>$v
];
}
return $Attrs;
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class SpuModel extends Model
{
protected $connection = false;
protected $table = false;
public $timestamps = false;
//生成数据库连接
public function ConnectDB($SpuId)
{
if (strlen($SpuId) !== 19) return false;
$dt = resolve($SpuId);
$this->connection = $dt['db'];
$this->table = $dt['table'];
return true;
}
//从redis获取spu数据
public function HdCacheSpu($SpuID,$Redis=''){
if(empty($SpuID)) return false;
if(empty($Redis)) $Redis=new RedisModel();
$Find=json_decode($Redis->hget('spu',$SpuID),true);
if($Find) return $Find;
$this->ConnectDB($SpuID);
$Find=$this->where('spu_id',$SpuID)
->select('spu_id','class_id1','class_id2','class_id3','spu_name','brand_id','status','update_time','images_l','encap','pdf','spu_brief','attrs','spu_detail')
->first();
if(!$Find) return false;
$Find=$Find->toArray();
$Find['attrs']=json_decode($Find['attrs'],true);
//更新redis
$Redis->hset('spu',$SpuID,json_encode($Find));
//需要记录一下日志
ErrorLog('',0000,'SPU缓存丢失,SPUID:'.$SpuID);
return $Find;
}
}
\ No newline at end of file
...@@ -118,182 +118,6 @@ return [ ...@@ -118,182 +118,6 @@ return [
], ],
], ],
'spu'=>[
'driver' => 'mysql',
'host' => env('DB_SPU_HOST', ''),
'database' => env('DB_SPU_DATABASE', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_SPU_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_0' => [
'driver' => 'mysql',
'database' => env('SKU_0_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_1' => [
'driver' => 'mysql',
'database' => env('SKU_1_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_2' => [
'driver' => 'mysql',
'database' => env('SKU_2_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_3' => [
'driver' => 'mysql',
'database' => env('SKU_3_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_4' => [
'driver' => 'mysql',
'database' => env('SKU_4_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_5' => [
'driver' => 'mysql',
'database' => env('SKU_5_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_6' => [
'driver' => 'mysql',
'database' => env('SKU_6_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_7' => [
'driver' => 'mysql',
'database' => env('SKU_7_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_8' => [
'driver' => 'mysql',
'database' => env('SKU_8_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'sku_9' => [
'driver' => 'mysql',
'database' => env('SKU_9_DB_DATABASE', ''),
'host' => env('DB_SPU_HOST', ''),
'username' => env('DB_SPU_USERNAME', ''),
'password' => env('DB_SPU_PASSWORD', ''),
'port' => env('DB_PORT', 3306),
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => env('DB_SPU_PREFIX', 'lie_'),
'options' => [
// 开启持久连接
\PDO::ATTR_PERSISTENT => true,
],
],
'pgsql' => [ 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
...@@ -345,6 +169,10 @@ return [ ...@@ -345,6 +169,10 @@ return [
'redis' => [ 'redis' => [
'cluster' => env('REDIS_CLUSTER', false), 'cluster' => env('REDIS_CLUSTER', false),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'predis'),
'prefix' => env('REDIS_PREFIX'),
],
'default' => [ 'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'), 'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null), 'password' => env('REDIS_PASSWORD', null),
......
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