| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php
- namespace app\controller\merchant\store\seckill;
- use app\common\repositories\store\StoreSeckillActiveRepository;
- use crmeb\basic\BaseController;
- use think\App;
- /**
- * 秒杀活动
- */
- class SeckillActive extends BaseController
- {
- protected $repository;
- /**
- * SeckillActive constructor.
- * @param App $app
- * @param StoreSeckillActiveRepository $repository
- */
- public function __construct(App $app ,StoreSeckillActiveRepository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- /**
- * 获取秒杀活动列表
- * FerryZhao 2024/4/16
- */
- public function list()
- {
- $where = $this->request->params([
- 'name',
- 'seckill_active_status',
- 'date',
- 'active_status'
- ]);
- [$page, $limit] = $this->getPage();
- $append = ['status_text', 'seckill_time_text_arr','atmosphere_pic','border_pic'];
- $list = $this->repository->getList($where, $page, $limit, $append);
- return app('json')->success($list);
- }
- /**
- * 返回所有列表数据-下拉
- * FerryZhao 2024/4/16
- */
- public function select()
- {
- return app('json')->success('获取成功',$this->repository->getActiveAll());
- }
- /**
- * 获取秒杀活动详情
- * @return void
- * FerryZhao 2024/4/16
- */
- public function detail($id)
- {
- if (!$id) {
- return app('json')->fail('参数异常');
- }
- $exists = $this->repository->exists($id);
- if(!$exists)
- return app('json')->fail('数据不存在');
- $info = $this->repository->get($id)->append(['status_text', 'seckill_time_text_arr','atmosphere_pic','border_pic']) ?? [];
- return app('json')->success('获取成功', $info);
- }
- /**
- * 活动统计-面板
- * @return array[]|void
- * FerryZhao 2024/4/23
- */
- public function chart_panel($id)
- {
- if( !$id ) {
- return app('json')->fail('参数错误');
- }
- $exists = $this->repository->exists($id);
- if(!$exists)
- return app('json')->fail('活动不存在');
- return app('json')->success($this->repository->chartPanel($id,$this->request->merId()));
- }
- /**
- * 活动参与人统计列表
- * @param $id
- * FerryZhao 2024/4/22
- */
- public function chart_people($id)
- {
- if(!$id){
- return app('json')->fail('参数异常');
- }
- $exists = $this->repository->exists($id);
- if (!$exists)
- return app('json')->fail('活动不存在');
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['keyword','date']);
- $merId = $this->request->merId();
- return app('json')->success($this->repository->chartPeople($id,$merId,$where,$page,$limit));
- }
- /**
- * 活动订单统计列表
- * @param $id
- * FerryZhao 2024/4/28
- */
- public function chart_order($id)
- {
- if(!$id){
- return app('json')->fail('参数异常');
- }
- $exists = $this->repository->exists($id);
- if (!$exists)
- return app('json')->fail('活动不存在');
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['keyword','status','mer_id','date']);
- $merId = $this->request->merId();
- return app('json')->success($this->repository->chartOrder($id,$merId,$where,$page,$limit));
- }
- /**
- * 活动商品统计列表
- * @param $id
- * FerryZhao 2024/4/28
- */
- public function chart_product($id)
- {
- if (!$id) {
- return app('json')->fail('参数异常');
- }
- $exists = $this->repository->exists($id);
- if (!$exists)
- return app('json')->fail('活动不存在');
- [$page, $limit] = $this->getPage();
- $where = $this->request->params(['keyword']);
- $merId = $this->request->merId();
- return app('json')->success($this->repository->chartProduct($id,$merId,$where,$page,$limit));
- }
- }
|