pull/1/head
wmc 1 year ago
parent d036ff25fa
commit 4574aa8c22
  1. 2
      .env
  2. 28
      app/api/controller/Goods.php
  3. 1
      app/api/controller/sharp/Goods.php
  4. 62
      app/api/service/Goods.php

@ -1 +1 @@
APP_DEBUG = false [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = yoshop2.0-pro USERNAME = root PASSWORD = 123456 HOSTPORT = 3306 CHARSET = utf8 DEBUG = false [CACHE] DRIVER = file [REDIS] HOSTNAME = 127.0.0.1 HOSTPORT = 6379 PASSWORD = SELECT = 0 [LANG] default_lang = zh-cn
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = rm-bp16g0z062kdo7dycmo.mysql.rds.aliyuncs.com DATABASE = ssxcx USERNAME = rdsuser PASSWORD = RtO73KKs123 HOSTPORT = 3306 CHARSET = utf8 DEBUG = false [CACHE] DRIVER = file [REDIS] HOSTNAME = 127.0.0.1 HOSTPORT = 6379 PASSWORD = SELECT = 0 [LANG] default_lang = zh-cn

@ -113,6 +113,34 @@ class Goods extends Controller
return $this->renderSuccess(compact('goodsList'));
}
public function brandList(): Json
{
$service = new GoodsService;
$goodsList = $service->brandList();
return $this->renderSuccess(compact('goodsList'));
}
public function newList(): Json
{
$service = new GoodsService;
$goodsList = $service->newList();
return $this->renderSuccess(compact('goodsList'));
}
public function cityInfo(): Json
{
$service = new GoodsService;
$goodsList = $service->cityInfo();
return $this->renderSuccess($goodsList);
}
public function panicList(): Json
{
$service = new GoodsService;
$goodsList = $service->panicList();
return $this->renderSuccess($goodsList);
}
/**
* 生成商品海报
* @param int $goodsId 商品ID

@ -36,6 +36,7 @@ class Goods extends Controller
*/
public function list(int $activeTimeId): Json
{
// 获取秒杀活动会场首页数据
$service = new ActiveService;
$list = $service->getGoodsListByActiveTimeId($activeTimeId);

@ -17,6 +17,8 @@ use app\api\model\Setting as SettingModel;
use app\api\model\GoodsSku as GoodsSkuModel;
use app\common\enum\Setting as SettingEnum;
use app\common\service\Goods as GoodsService;
use app\api\model\sharp\Active as SharpActiveModel;
use app\api\model\sharp\ActiveTime as ActiveTimeModel;
/**
* 商品服务类
@ -71,6 +73,66 @@ class Goods extends GoodsService
return $this->formatGoodsList($goodsList);
}
//大牌正品列表
public function brandList(): array
{
$model = new GoodsModel;
$list = $model->where([
'is_delete' => 0,
'status' => 10,
'is_brand' => 1,
'store_id' => $_GET['store_id']
])->select()->toArray();
return $list;
}
//新品首发
public function newList(): array
{
$model = new GoodsModel;
$list = $model->where([
'is_delete' => 0,
'status' => 10,
'is_new' => 1,
'store_id' => $_GET['store_id']
])->select()->toArray();
return $list;
}
//同城信息
public function cityInfo(): array
{
$model = new GoodsModel;
$list = $model->where([
'is_delete' => 0,
'status' => 10,
'is_brand' => 1,
'store_id' => $_GET['store_id']
])->select()->toArray();
return $list;
}
//抢购会场列表
public function panicList()
{
$model = new SharpActiveModel;
$list = $model->alias('a')
->join('sharpActiveTime', 'a.active_id = sharpActiveTime.active_id', 'left')->where([
'a.is_delete' => 0,
'a.status' => 1,
'a.store_id' => $_GET['store_id'],
'sharpActiveTime.status' => 1,
])->select()->toArray();
foreach ($list as &$v) {
$v['active_date'] = date('Y-m-d H:i:s', $v['active_date']);
}
return $list;
}
/**
* 格式化商品列表
* @param $goodsList

Loading…
Cancel
Save