157 lines
4.0 KiB
PHP
Executable File
157 lines
4.0 KiB
PHP
Executable File
<?php
|
|
namespace app\shopapi\controller;
|
|
use app\shopapi\lists\MyGoodsLists;
|
|
use app\shopapi\lists\ShopGoodsLists;
|
|
use app\shopapi\logic\GoodsLogic;
|
|
use app\shopapi\validate\GoodsValidate;
|
|
|
|
/**
|
|
* 服务控制器类
|
|
* Class GoodsController
|
|
* @package app\shopapi\controller
|
|
*/
|
|
class GoodsController extends BaseShopController
|
|
{
|
|
public array $notNeedLogin = ['detail'];
|
|
|
|
/**
|
|
* @notes 分类列表
|
|
* @return \think\response\Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author cjhao
|
|
* @date 2024/10/5 14:48
|
|
*/
|
|
public function categoryLists()
|
|
{
|
|
$lists = (new GoodsLogic())->categoryLists();
|
|
return $this->success('',$lists);
|
|
}
|
|
|
|
/**
|
|
* @notes 技能列表
|
|
* @return \think\response\Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author cjhao
|
|
* @date 2024/10/16 16:47
|
|
*/
|
|
public function skillLists()
|
|
{
|
|
$lists = (new GoodsLogic())->skillLists();
|
|
return $this->success('',$lists);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 服务列表
|
|
* @return \think\response\Json
|
|
* @author cjhao
|
|
* @date 2024/10/5 14:49
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists();
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加服务
|
|
* @return \think\response\Json
|
|
* @author cjhao
|
|
* @date 2024/10/16 17:38
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new GoodsValidate())->post()->goCheck('add',['shop_id'=>$this->shopId]);
|
|
$result = (new GoodsLogic())->add($params);
|
|
if(true === $result){
|
|
return $this->success('添加成功,请等待管理员审核');
|
|
}
|
|
return $this->fail($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 编辑服务
|
|
* @return \think\response\Json
|
|
* @author cjhao
|
|
* @date 2024/10/16 18:13
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new GoodsValidate())->post()->goCheck('',['shop_id'=>$this->shopId]);
|
|
$result = (new GoodsLogic())->edit($params);
|
|
if(true === $result){
|
|
return $this->success('编辑成功,请等待管理员审核');
|
|
}
|
|
return $this->fail($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 我的项目列表
|
|
* @return \think\response\Json
|
|
* @author cjhao
|
|
* @date 2024/12/11 17:30
|
|
*/
|
|
public function myGoodsLists()
|
|
{
|
|
return $this->dataLists((new MyGoodsLists()));
|
|
}
|
|
|
|
/**
|
|
* @notes 门店服务列表
|
|
* @return \think\response\Json
|
|
* @author cjhao
|
|
* @date 2024/10/16 16:57
|
|
*/
|
|
public function shopGoodsLists()
|
|
{
|
|
return $this->dataLists((new ShopGoodsLists()));
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 查看服务详情
|
|
* @return \think\response\Json
|
|
* @author ljj
|
|
* @date 2022/2/9 3:52 下午
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new GoodsValidate())->get()->goCheck('detail');
|
|
$result = (new GoodsLogic())->detail($params['id']);
|
|
return $this->success('获取成功',$result);
|
|
}
|
|
|
|
/**
|
|
* @notes 删除服务
|
|
* @return \think\response\Json
|
|
* @author ljj
|
|
* @date 2022/2/9 4:13 下午
|
|
*/
|
|
public function del()
|
|
{
|
|
$params = (new GoodsValidate())->post()->goCheck('del',['shop_id'=>$this->shopId]);
|
|
$result = (new GoodsLogic())->del($params['id'],$this->shopId);
|
|
if (true !== $result) {
|
|
return $this->fail($result);
|
|
}
|
|
return $this->success('操作成功',[],1,1);
|
|
}
|
|
|
|
/**
|
|
* @notes 修改服务状态
|
|
* @return \think\response\Json
|
|
* @author ljj
|
|
* @date 2022/2/9 4:55 下午
|
|
*/
|
|
public function status()
|
|
{
|
|
$params = (new GoodsValidate())->post()->goCheck('status');
|
|
(new GoodsLogic)->status($params,$this->shopId);
|
|
return $this->success('操作成功',[],1,1);
|
|
}
|
|
} |