Files
2026-03-14 16:20:49 +08:00

104 lines
2.9 KiB
PHP

<?php
namespace app\storeapi\controller;
use app\storeapi\logic\GroupLogic;
use app\storeapi\validate\GroupValidate;
class GroupController extends BaseApiController
{
public array $notNeedLogin = ['cancelCode'];
/**
* @return \think\response\Json
* 新增团购套餐
*/
public function addGroup(){
$params = (new GroupValidate())->post()->goCheck('addGroup');
$result = GroupLogic::addGroup($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 编辑团购套餐
*/
public function editGroup(){
$params = (new GroupValidate())->post()->goCheck('editGroup');
$result = GroupLogic::editGroup($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 套餐列表
*/
public function groupLists(){
$params = (new GroupValidate())->post()->goCheck('groupLists');
$result = GroupLogic::groupLists($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 删除套餐
*/
public function delGroup(){
$params = (new GroupValidate())->post()->goCheck('delGroup');
$result = GroupLogic::delGroup($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 上下架套餐
*/
public function operateGroup(){
$params = (new GroupValidate())->post()->goCheck('operateGroup');
$result = GroupLogic::operateGroup($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 套餐详情页
*/
public function groupDetails(){
$params = (new GroupValidate())->post()->goCheck('groupDetails');
$result = GroupLogic::groupDetails($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
/**
* @return \think\response\Json
* 门店核销券码
*/
public function cancelCode(){
$params = (new GroupValidate())->post()->goCheck('cancelCode');
$params['user_id'] = $this->userId;
$result = GroupLogic::cancelCode($params);
if ($result === false) {
return $this->fail(GroupLogic::getError());
}
return $this->success('', $result, 1, 1);
}
}