Commit 8737b0ec by 杨树贤

品牌列表

parent 7633b78a
<?php
namespace App\Http\Controllers;
use App\Model\SelfBrandModel;
use Illuminate\Http\Request;
class BrandController extends Controller
{
public function index(Request $request, SelfBrandModel $model)
{
$list = $model->getBrandList();
return $this->Export(0, 'ok', ['data' => $list]);
}
}
\ No newline at end of file
......@@ -9,9 +9,9 @@ use Illuminate\Http\Request;
class ClassController extends Controller
{
public function classList(Request $request, SelfClassifyModel $model)
public function index(Request $request, SelfClassifyModel $model)
{
$classifications = $model->getClass();
$classifications = $model->getClassList();
return $this->Export(0, 'ok', ['data' => $classifications]);
}
......
......@@ -3,35 +3,76 @@
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()
{
$expireMinutes = 5;
return Cache::remember('brandListsss', $expireMinutes, function () {
$field = [
'brand_id',
'brand_name',
'brand_logo',
'create_time',
'brand_area',
'brand_brief',
];
return $this->select($field)->where('status', 1)->limit(10)
->get()->toArray();
});
}
}
......@@ -49,11 +49,11 @@ class SelfClassifyModel extends Model
}
//获取一二级分类(有关联关系)
public function getClass()
public function getClassList()
{
$classificationsExpireMinute = 5;
return Cache::remember('class', $classificationsExpireMinute, function () {
return Cache::remember('classList', $classificationsExpireMinute, function () {
$field = [
'class_id',
'class_name',
......
......@@ -26,5 +26,8 @@ $router->post('/self/sample/list', 'ServicesController@SelfSampleList');
$router->post('/get_new_customer_limit', 'ServicesController@getnewCustomerLimit');
//分类
$router->post('/class/list', 'ClassController@classList');
$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.
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