|
|
|
@ -8,6 +8,7 @@ use think\response\Json; |
|
|
|
|
use app\store\controller\Controller; |
|
|
|
|
use app\store\model\ActiveMain as ActiveMainModal; |
|
|
|
|
use app\store\model\ActiveCol as ActiveColModal; |
|
|
|
|
use app\store\model\Goods as GoodsModal; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 活动管理 |
|
|
|
@ -70,7 +71,7 @@ class Active extends Controller |
|
|
|
|
$model = new ActiveColModal; |
|
|
|
|
$list = $model->getList($activeId); |
|
|
|
|
if (count($list) > 0) { |
|
|
|
|
return $this->renderError('请先删除活动模块'); |
|
|
|
|
return $this->renderError('请先删除活动栏目'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$model = ActiveMainModal::detail($activeId); |
|
|
|
@ -92,4 +93,60 @@ class Active extends Controller |
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加活动模块 |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function colAdd(): Json |
|
|
|
|
{ |
|
|
|
|
// 新增记录 |
|
|
|
|
$model = new ActiveColModal; |
|
|
|
|
|
|
|
|
|
if ($model->add($this->postForm())) { |
|
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '添加失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 更新活动模块 |
|
|
|
|
* @param int $activeColId |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function colEdit(int $activeColId): Json |
|
|
|
|
{ |
|
|
|
|
$model = ActiveColModal::detail($activeColId); |
|
|
|
|
// 更新记录 |
|
|
|
|
if ($model->edit($this->postForm())) { |
|
|
|
|
return $this->renderSuccess('更新成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '更新失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除活动模块 |
|
|
|
|
* @param int $activeColId |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function colDelete(int $activeColId): Json |
|
|
|
|
{ |
|
|
|
|
$model = ActiveColModal::detail($activeColId); |
|
|
|
|
if ($model->setDelete()) { |
|
|
|
|
return $this->renderSuccess('删除成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '删除失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* goodsList 获取商品列表 |
|
|
|
|
* @return Json |
|
|
|
|
*/ |
|
|
|
|
public function goodsList(string $goodsIds): Json |
|
|
|
|
{ |
|
|
|
|
$goodsIds = explode(',', $goodsIds); |
|
|
|
|
|
|
|
|
|
$model = new GoodsModal; |
|
|
|
|
$list = $model->getListByIds($goodsIds); |
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|