Commit 2f26e091 by 杨树贤

添加品牌信息接口

parent 33684742
...@@ -11,7 +11,7 @@ SYSTEM_NAME=商品信息处理服务(开发环境) ...@@ -11,7 +11,7 @@ SYSTEM_NAME=商品信息处理服务(开发环境)
//laravels监听IP和端口 //laravels监听IP和端口
LARAVELS_LISTEN_IP=0.0.0.0 LARAVELS_LISTEN_IP=0.0.0.0
LARAVELS_LISTEN_PORT=60002 LARAVELS_LISTEN_PORT=62002
//基石自营商品主库 //基石自营商品主库
DB_Self_HOST=192.168.1.234 DB_Self_HOST=192.168.1.234
......
...@@ -8,6 +8,7 @@ use Illuminate\Http\Request; ...@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
class BrandController extends Controller class BrandController extends Controller
{ {
//获取品牌列表
public function index(Request $request, SelfBrandModel $model) public function index(Request $request, SelfBrandModel $model)
{ {
$map = $request->only(['brand_area']); $map = $request->only(['brand_area']);
...@@ -15,4 +16,13 @@ class BrandController extends Controller ...@@ -15,4 +16,13 @@ class BrandController extends Controller
return $this->Export(0, 'ok', ['data' => $list]); return $this->Export(0, 'ok', ['data' => $list]);
} }
//获取单个品牌信息
public function info(Request $request, SelfBrandModel $model)
{
$brandId = $request->get('brand_id');
$info = $model->getBrand($brandId);
return $this->Export(0, 'ok', ['data' => $info]);
}
} }
\ No newline at end of file
...@@ -56,6 +56,23 @@ class SelfBrandModel extends Model ...@@ -56,6 +56,23 @@ class SelfBrandModel extends Model
return $Find; return $Find;
} }
//获取品牌信息
public function getBrand($brandId)
{
$expireMinutes = 5;
return Cache::remember('brandList_' . $brandId, $expireMinutes, function () use ($brandId) {
//没有再去数据库里面取
$field = ['brand_id', 'brand_name', 'brand_logo', 'brand_desc', 'brand_brief', 'brand_area'];
$brand = $this->select($field)->where('brand_id', $brandId)->first();
if (!empty($brand)) {
return $brand->toArray();
}
return null;
});
}
//品牌列表 //品牌列表
public function getBrandList($map = []) public function getBrandList($map = [])
{ {
...@@ -84,12 +101,7 @@ class SelfBrandModel extends Model ...@@ -84,12 +101,7 @@ class SelfBrandModel extends Model
//没有就去数据库里面取 //没有就去数据库里面取
if (!$brandList) { if (!$brandList) {
return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) { return Cache::remember('brandList_' . json_encode($map), $expireMinutes, function () use ($map) {
$field = [ $field = ['brand_id', 'brand_name', 'brand_logo', 'brand_area'];
'brand_id',
'brand_name',
'brand_logo',
'brand_area',
];
$query = $this->select($field)->where('status', 1); $query = $this->select($field)->where('status', 1);
if (!empty($map['brand_area'])) { if (!empty($map['brand_area'])) {
......
...@@ -30,4 +30,5 @@ $router->post('/class/list', 'ClassController@index'); ...@@ -30,4 +30,5 @@ $router->post('/class/list', 'ClassController@index');
//品牌 //品牌
$router->post('/brand/list', 'BrandController@index'); $router->post('/brand/list', 'BrandController@index');
$router->post('/brand/info', 'BrandController@info');
1575532911a:6:{s:8:"brand_id";i:5290;s:10:"brand_name";s:20:"CJIANG(长江微电)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:4;}
\ No newline at end of file
1575532918a:6:{s:8:"brand_id";i:5291;s:10:"brand_name";s:15:"STARSEA(星海)";s:10:"brand_logo";s:0:"";s:10:"brand_desc";s:0:"";s:11:"brand_brief";s:0:"";s:10:"brand_area";i:4;}
\ No newline at end of file
1575532933a:6:{s:8:"brand_id";i:70;s:10:"brand_name";s:5:"ACARD";s:10:"brand_logo";s:79:"http://img.ichunt.com/images/ichunt/uploadfiles/20150929/201509291802573384.jpg";s:10:"brand_desc";s:1272:"<p><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">ACARD Technology Corp.(信亿科技)成立于1996年,为提供储存设备解决方案之世界级专业领导厂商。创业初期即专注在研发IC晶片,是台湾第一家拥有SCSI晶片设计能力的公司,在ACARD秉持诚信、高品质的经营理念下公司持续稳定的成长,更在2004年12月6日正式挂牌上柜营运(代号3126),而为了使经营版图更为扩张以及让台湾以外的客户能放心与信亿合作,ACARD在2008年正式取得邓白氏认証的核准资格。</span></p><p><span style="font-size: 14px; font-family: arial, helvetica, sans-serif; color: rgb(89, 89, 89);">ACARD以ACARD作为品牌行销,在IDE &amp; SCSI享有高度评价,也是全球率先推出PCI Ultra ATA-100/133 IDE RAID Adapter for PCI PowerMac以及PCI Ultra ATA-133 IDE RAID Adapter for PC之厂商。目前所提供产品包括积体电路、SCSI/IDE/SCSI-to-IDE/ SATA 储存控制器、磁碟储存控制器及系统、储存应用软体等。与ACARD合作的客户包含了IBM、HP、Nokia...等知名企业,产品供应全球涵括PC、Macintosh和Unix工作站的使用者,并可提供OEM/ODM服务。</span></p><p><br/></p>";s:11:"brand_brief";s:228:"ACARD Technology Corp.(信亿科技)成立于1996年,为提供储存设备解决方案之世界级专业领导厂商。创业初期即专注在研发IC晶片,是台湾第一家拥有SCSI晶片设计能力的公司,在ACA";s:10:"brand_area";i:3;}
\ 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