Commit 4f8a36bc by 叶明星

去掉联营合并分支

parents 2b029189 33684742
......@@ -4,7 +4,7 @@ APP_KEY=
APP_TIMEZONE=PRC
//系统编码,用于生成错误码
SYSTEM_CODE=04
SYSTEM_CODE=02
//系统名称,用于告警识别
SYSTEM_NAME=商品信息处理服务(开发环境)
......@@ -30,11 +30,10 @@ DB_Pur_PORT=3306
DB_Pur_PREFIX=lc_
REDIS_HOST=192.168.1.235
REDIS_PASSWORD=icDb29mLy2s
REDIS_PORT=6379
REDIS_PREFIX=LC_
REDIS_READ_HOST=192.168.1.237
REDIS_READ_PASSWORD=icDb29mLy2s
......
<?php
namespace App\Http\Controllers;
use App\Model\SelfBrandModel;
use Illuminate\Http\Request;
class BrandController extends Controller
{
public function index(Request $request, SelfBrandModel $model)
{
$map = $request->only(['brand_area']);
$list = $model->getBrandList($map);
return $this->Export(0, 'ok', ['data' => $list]);
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use App\Model\SelfClassifyModel;
use Illuminate\Http\Request;
class ClassController extends Controller
{
public function index(Request $request, SelfClassifyModel $model)
{
$classifications = $model->getClassList();
return $this->Export(0, 'ok', ['data' => $classifications]);
}
}
\ No newline at end of file
......@@ -3,35 +3,104 @@
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
class SelfBrandModel extends Model
{
protected $connection=false;
protected $table='brand';
protected $connection = false;
protected $table = 'brand';
public $timestamps = false;
public function HDBrandName($BrandID='',$Redis=''){
if(empty($BrandID)) return false;
if(empty($Redis)) $Redis=new RedisModel();
$BrandName=$Redis->hget('Self_Brand',$BrandID);
if(!$BrandName){
$result=$this->ToRedis($BrandID,$Redis);
if(!$result) return false;
public function HDBrandName($BrandID = '', $Redis = '')
{
if (empty($BrandID)) {
return false;
}
if (empty($Redis)) {
$Redis = new RedisModel();
}
$BrandName = $Redis->hget('Self_Brand', $BrandID);
if (!$BrandName) {
$result = $this->ToRedis($BrandID, $Redis);
if (!$result) {
return false;
}
return $result['brand_name'];
}else{
$BrandName=json_decode($BrandName,true);
} else {
$BrandName = json_decode($BrandName, true);
return $BrandName['brand_name'];
}
}
public function ToRedis($BrandID,$Redis=''){
if(empty($BrandID)) return false;
if(empty($Redis)) $Redis=new RedisModel;
if(empty($this->connection)) $this->connection='self';
$Find=$this->where('brand_id','=',$BrandID)->select('brand_logo','brand_id','brand_name','brand_area','status')->first();
if(!$Find) return false;
$Find=$Find->toArray();
$Redis->hset('Self_Brand',$BrandID,json_encode($Find));
public function ToRedis($BrandID, $Redis = '')
{
if (empty($BrandID)) {
return false;
}
if (empty($Redis)) {
$Redis = new RedisModel;
}
if (empty($this->connection)) {
$this->connection = 'self';
}
$Find = $this->where('brand_id', '=', $BrandID)->select('brand_logo', 'brand_id', 'brand_name', 'brand_area',
'status')->first();
if (!$Find) {
return false;
}
$Find = $Find->toArray();
$Redis->hset('Self_Brand', $BrandID, json_encode($Find));
return $Find;
}
//品牌列表
public function getBrandList($map = [])
{
$expireMinutes = 5;
//先去缓存里面取
$Redis = new RedisModel;
$brandList = $Redis->hgetall('Self_Brand');
$brandList = array_map(function ($value) {
return json_decode($value, true);
}, $brandList);
//如果要有地区筛选,则需要做数据处理
if (!empty($map['brand_area']) && !empty($brandList)) {
$brandListByArea = [];
$areaIds = explode(',', $map['brand_area']);
foreach ($brandList as $key => $brand) {
if (in_array($brand['brand_area'], $areaIds)) {
$brandListByArea[] = $brand;
}
}
return $brandListByArea;
}
//没有就去数据库里面取
if (!$brandList) {
return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) {
$field = [
'brand_id',
'brand_name',
'brand_logo',
'brand_area',
];
$query = $this->select($field)->where('status', 1);
if (!empty($map['brand_area'])) {
$areaIds = explode(',', $map['brand_area']);
$query->whereIn('brand_area', $areaIds);
}
return $query->get()->toArray();
});
}
return $brandList;
}
}
......@@ -3,27 +3,80 @@
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class SelfClassifyModel extends Model
{
protected $connection=false;
protected $table='self_classify';
protected $connection = false;
protected $table = 'self_classify';
public $timestamps = false;
//生成自营分类redis
public function ProduceClassRedis($class_id='',$Redis=''){
if(empty($class_id)) return false;
if(empty($Redis)) $Redis=new RedisModel();
$info=json_decode($Redis->hget('Self_SelfClassInfo',$class_id),true);
if(!$info){
if(empty($this->connection)) $this->connection='self';
$info=$this->where('class_id','=',$class_id)->select('class_id','class_name','parent_id','sort','status','class_icon','ladder', 'is_dc')->first();
if($info){
$info=$info->toArray();
if(!empty($info['ladder'])) $info['ladder']=json_decode($info['ladder'],true);
$Redis->hset('Self_SelfClassInfo',$class_id,json_encode($info));
}else return false;
public function ProduceClassRedis($class_id = '', $Redis = '')
{
if (empty($class_id)) {
return false;
}
if (empty($Redis)) {
$Redis = new RedisModel();
}
$info = json_decode($Redis->hget('Self_SelfClassInfo', $class_id), true);
if (!$info) {
if (empty($this->connection)) {
$this->connection = 'self';
}
$info = $this->where('class_id', '=', $class_id)->select('class_id', 'class_name', 'parent_id', 'sort',
'status', 'class_icon', 'ladder', 'is_dc')->first();
if ($info) {
$info = $info->toArray();
if (!empty($info['ladder'])) {
$info['ladder'] = json_decode($info['ladder'], true);
}
$Redis->hset('Self_SelfClassInfo', $class_id, json_encode($info));
} else {
return false;
}
}
return $info;
}
//二级分类关联模型
public function sub_class()
{
return $this->hasMany(SelfClassifyModel::class, 'parent_id', 'class_id');
}
//获取一二级分类(有关联关系)
public function getClassList()
{
$classificationsExpireMinute = 5;
//先去缓存里面取
$Redis = new RedisModel;
$classList = $Redis->hgetall('Self_SelfClassInfo');
$classList = array_map(function ($value) {
return json_decode($value, true);
}, $classList);
if (!$classList) {
return Cache::remember('classList', $classificationsExpireMinute, function () {
$field = [
'class_id',
'class_name',
'status',
'class_icon',
];
return $this->select($field)->with([
'sub_class' => function ($query) use ($field) {
array_push($field, 'parent_id');
$query->select($field);
},
])->where('status', 1)->where('parent_id', 0)
->orderBy('sort', 'desc')->get()->toArray();
});
}
}
}
......@@ -16,7 +16,7 @@ class UnitModel extends Model
$Find=$Redis->hget('Self_Unit',$UnitID);
if(!$Find){
if(empty($this->connection)) $this->connection='self';
$list=$this->lists('unit_name','unit_id')->toArray();
$list=$this->pluck('unit_name','unit_id')->toArray();
$Redis->hmset('Self_Unit',$list);
return empty($list[$UnitID])? '':$list[$UnitID];
}else{
......@@ -30,7 +30,7 @@ class UnitModel extends Model
$Find=$Redis->hget('Self_UnitAlias',$UnitID);
if(!$Find){
if(empty($this->connection)) $this->connection='self';
$list=$this->lists('unit_name_alias','unit_id')->toArray();
$list=$this->pluck('unit_name_alias','unit_id')->toArray();
$Redis->hmset('Self_UnitAlias',$list);
return empty($list[$UnitID])? '':$list[$UnitID];
}else{
......
......@@ -108,4 +108,12 @@ $app->router->group([
], function ($router) {
require __DIR__.'/../routes/web.php';
});
//lumen日志按日分割
$app->configureMonologUsing(function(Monolog\Logger $monoLog) use ($app){
return $monoLog->pushHandler(
new \Monolog\Handler\RotatingFileHandler($app->storagePath().'/logs/lumen.log',5)
);
});
return $app;
common @ 58c9ab73
Subproject commit 58c9ab735bada96c2f9175771693de1a4386e917
......@@ -170,7 +170,7 @@ return [
'cluster' => env('REDIS_CLUSTER', false),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'predis'),
'cluster' => env('REDIS_CLUSTER', false),
'prefix' => env('REDIS_PREFIX'),
],
'default' => [
......
......@@ -13,14 +13,21 @@
$router->get('/', function () use ($router) {
return swoole_get_local_ip();
return $router->app->version();
});
$router->post('/synchronization', 'ServicesController@synchronization');
$router->post('/ladderprice', 'ServicesController@ladderprice');
$router->post('/uuid', 'ServicesController@uuid');
$router->post('/self/sample/class/list', 'ServicesController@SelfSampleClassList');
$router->post('/self/sample/list', 'ServicesController@SelfSampleList');
$router->post('/synchronization', 'ServicesController@synchronization');
$router->post('/ladderprice', 'ServicesController@ladderprice');
$router->post('/uuid', 'ServicesController@uuid');
$router->get('/self/sample/class/list', 'ServicesController@SelfSampleClassList');
$router->post('/self/sample/list', 'ServicesController@SelfSampleList');
$router->post('/get_new_customer_limit', 'ServicesController@getnewCustomerLimit');
//分类
$router->post('/class/list', 'ClassController@index');
//品牌
$router->post('/brand/list', 'BrandController@index');
1575438498a:10:{i:0;a:7:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:1;a:7:{s:8:"brand_id";i:2;s:10:"brand_name";s:14:"ADI(亚德诺)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:2;a:7:{s:8:"brand_id";i:3;s:10:"brand_name";s:20:"ALTERA(阿尔特拉)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:3;a:7:{s:8:"brand_id";i:4;s:10:"brand_name";s:19:"Atmel(爱特梅尔)";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150616/201506161031403697.jpg";s:10:"brand_desc";s:2379:"<p><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;">Atmel 公司为全球性的业界领先企业,致力于设计和制造各类微控制器、电容式触摸解决方案、先进逻辑、混合信号、非易失性存储器和射频 (RF) 元件。凭借业界最广泛的知识产权 (IP) 技术组合之一,Atmel 为电子行业提供针对工业、消费、安全、通信、计算和汽车市场的全面的系统解决方案。</span></p><p><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;">Atmel公司的股票代码为“ATML.O”在纳斯达克股票市场上市。ATMEL公司是世界上高级半导体产品设计、制造和行销的领先者,产品包括了</span><a target="_blank" href="http://baike.baidu.com/view/1125.htm" style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;"><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">微处理器</span></a><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;">、可编程逻辑器件、非易失性存储器、</span><a target="_blank" href="http://baike.baidu.com/view/3375318.htm" style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;"><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">安全芯片</span></a><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;">、</span><a target="_blank" href="http://baike.baidu.com/view/11767732.htm" style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;"><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">混合信号</span></a><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89); text-decoration: none;">及RF射频集成电路。通过这些核心技术的组合,ATMEL生产出了各种通用目的及特定应用的系统级芯片,以满足当今电子系统设计工程师不断增长和演进的需求。</span></p>";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:262:"Atmel 公司为全球性的业界领先企业,致力于设计和制造各类微控制器、电容式触摸解决方案、先进逻辑、混合信号、非易失性存储器和射频 (RF) 元件。凭借业界最广泛的知识产权 (IP) 技术组合之一,A";}i:4;a:7:{s:8:"brand_id";i:5;s:10:"brand_name";s:16:"AVAGO(安华高)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:5;a:7:{s:8:"brand_id";i:6;s:10:"brand_name";s:9:"Brand REX";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:6;a:7:{s:8:"brand_id";i:7;s:10:"brand_name";s:8:"BUSSMANN";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:7;a:7:{s:8:"brand_id";i:8;s:10:"brand_name";s:17:"EVERLIGHT(亿光)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:0:"";}i:8;a:7:{s:8:"brand_id";i:9;s:10:"brand_name";s:6:"ILITEK";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150710/201507100953371396.jpg";s:10:"brand_desc";s:581:"<p><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">奕力科技是由一群拥有多年模拟集成电路设计经验的资深团队于2004年7月创立,并于同年11月获准进入新竹科学园区。藉由对多种IC成功量产之经验,本团队运用最佳化模拟混合技术,提供创新且高质量之产品以服务客户。目前产品专注于各式中小尺寸a-TFT LCD 及LTPS LCD 面板驱动IC,终端产品则涵盖手机、MP3、数字相机、PDA、GPS, PMP, 学习机及游戏机等应用。</span></p>";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:282:"奕力科技是由一群拥有多年模拟集成电路设计经验的资深团队于2004年7月创立,并于同年11月获准进入新竹科学园区。藉由对多种IC成功量产之经验,本团队运用最佳化模拟混合技术,提供创新且高质量之产品以服务";}i:9;a:7:{s:8:"brand_id";i:10;s:10:"brand_name";s:16:"intel(英特尔)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}}
\ No newline at end of file
1575440237a:10:{i:0;a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:1;a:6:{s:8:"brand_id";i:2;s:10:"brand_name";s:14:"ADI(亚德诺)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:2;a:6:{s:8:"brand_id";i:3;s:10:"brand_name";s:20:"ALTERA(阿尔特拉)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:3;a:6:{s:8:"brand_id";i:4;s:10:"brand_name";s:19:"Atmel(爱特梅尔)";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150616/201506161031403697.jpg";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:262:"Atmel 公司为全球性的业界领先企业,致力于设计和制造各类微控制器、电容式触摸解决方案、先进逻辑、混合信号、非易失性存储器和射频 (RF) 元件。凭借业界最广泛的知识产权 (IP) 技术组合之一,A";}i:4;a:6:{s:8:"brand_id";i:5;s:10:"brand_name";s:16:"AVAGO(安华高)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:5;a:6:{s:8:"brand_id";i:6;s:10:"brand_name";s:9:"Brand REX";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:6;a:6:{s:8:"brand_id";i:7;s:10:"brand_name";s:8:"BUSSMANN";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:7;a:6:{s:8:"brand_id";i:8;s:10:"brand_name";s:17:"EVERLIGHT(亿光)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:0:"";}i:8;a:6:{s:8:"brand_id";i:9;s:10:"brand_name";s:6:"ILITEK";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150710/201507100953371396.jpg";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:282:"奕力科技是由一群拥有多年模拟集成电路设计经验的资深团队于2004年7月创立,并于同年11月获准进入新竹科学园区。藉由对多种IC成功量产之经验,本团队运用最佳化模拟混合技术,提供创新且高质量之产品以服务";}i:9;a:6:{s:8:"brand_id";i:10;s:10:"brand_name";s:16:"intel(英特尔)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1575440677a:10:{i:0;a:6:{s:8:"brand_id";i:1;s:10:"brand_name";s:7:"ALLEGRO";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:1;a:6:{s:8:"brand_id";i:2;s:10:"brand_name";s:14:"ADI(亚德诺)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:2;a:6:{s:8:"brand_id";i:3;s:10:"brand_name";s:20:"ALTERA(阿尔特拉)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:3;a:6:{s:8:"brand_id";i:4;s:10:"brand_name";s:19:"Atmel(爱特梅尔)";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150616/201506161031403697.jpg";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:262:"Atmel 公司为全球性的业界领先企业,致力于设计和制造各类微控制器、电容式触摸解决方案、先进逻辑、混合信号、非易失性存储器和射频 (RF) 元件。凭借业界最广泛的知识产权 (IP) 技术组合之一,A";}i:4;a:6:{s:8:"brand_id";i:5;s:10:"brand_name";s:16:"AVAGO(安华高)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}i:5;a:6:{s:8:"brand_id";i:6;s:10:"brand_name";s:9:"Brand REX";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:6;a:6:{s:8:"brand_id";i:7;s:10:"brand_name";s:8:"BUSSMANN";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:0;s:11:"brand_brief";s:0:"";}i:7;a:6:{s:8:"brand_id";i:8;s:10:"brand_name";s:17:"EVERLIGHT(亿光)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:0:"";}i:8;a:6:{s:8:"brand_id";i:9;s:10:"brand_name";s:6:"ILITEK";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150710/201507100953371396.jpg";s:11:"create_time";i:1510329451;s:10:"brand_area";i:3;s:11:"brand_brief";s:282:"奕力科技是由一群拥有多年模拟集成电路设计经验的资深团队于2004年7月创立,并于同年11月获准进入新竹科学园区。藉由对多种IC成功量产之经验,本团队运用最佳化模拟混合技术,提供创新且高质量之产品以服务";}i:9;a:6:{s:8:"brand_id";i:10;s:10:"brand_name";s:16:"intel(英特尔)";s:10:"brand_logo";s:0:"";s:11:"create_time";i:1510329451;s:10:"brand_area";i:1;s:11:"brand_brief";s:0:"";}}
\ No newline at end of file
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