You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\controller;
|
|
|
|
use app\BaseController;
|
|
use app\model\ZoneGoods;
|
|
use app\validate\Zone as ZoneValidate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Request;
|
|
|
|
class AdminZoneManage extends BaseController
|
|
{
|
|
/**
|
|
* 刮奖专区列表
|
|
* @return array
|
|
*/
|
|
public function zoneGoodsList()
|
|
{
|
|
$param = Request::param();
|
|
return $this->renderSuccess('数据返回成功',ZoneGoods::getList($param['zone_id'],true));
|
|
}
|
|
|
|
/**
|
|
* 刮奖专区启用禁用
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function zoneGoodsChangeStatus()
|
|
{
|
|
$param = Request::param();
|
|
|
|
try {
|
|
validate(ZoneValidate::class)->scene('changeStatus')->check($param);
|
|
|
|
$id = $param['zone_goods_id'];
|
|
$status = $param['status'];
|
|
|
|
$ZoneGoods = new ZoneGoods();
|
|
$ZoneGoodsUp = $ZoneGoods->find($id);
|
|
$ZoneGoodsUp->status = $status;
|
|
$ZoneGoodsUp->save();
|
|
|
|
return $this->renderSuccess($status == 1 ? '已启用' : '已禁用');
|
|
} catch (ValidateException $validateException) {
|
|
return $this->renderError($validateException->getMessage());
|
|
}
|
|
}
|
|
}
|
|
|