This commit is contained in:
weiz 2024-04-12 14:50:29 +08:00
parent 74d261bb28
commit 5c24cd4d2b
2 changed files with 104 additions and 95 deletions

View File

@ -11,98 +11,101 @@
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\marketing;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\marketing\MarketingBidInfoLists;
use app\adminapi\logic\marketing\MarketingBidInfoLogic;
use app\adminapi\validate\marketing\MarketingBidInfoValidate;
/**
* 市场经营--投标管理--投标信息控制器
* Class MarketingBidInfoController
* @package app\adminapi\controller\marketing
*/
class MarketingBidInfoController extends BaseAdminController
{
/**
* @notes 获取市场经营--投标管理--投标信息列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function lists()
{
return $this->dataLists(new MarketingBidInfoLists());
}
/**
* @notes 添加市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function add()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('add');
$result = MarketingBidInfoLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**
* @notes 编辑市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function edit()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('edit');
$result = MarketingBidInfoLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**
* @notes 删除市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function delete()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('delete');
MarketingBidInfoLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取市场经营--投标管理--投标信息详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function detail()
{
$params = (new MarketingBidInfoValidate())->goCheck('detail');
$result = MarketingBidInfoLogic::detail($params);
return $this->data($result);
}
}
namespace app\adminapi\controller\marketing;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\marketing\MarketingBidInfoLists;
use app\adminapi\logic\marketing\MarketingBidInfoLogic;
use app\adminapi\validate\marketing\MarketingBidInfoValidate;
/**
* 市场经营--投标管理--投标信息控制器
* Class MarketingBidInfoController
* @package app\adminapi\controller\marketing
*/
class MarketingBidInfoController extends BaseAdminController
{
/**
* @notes 获取市场经营--投标管理--投标信息列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function lists()
{
return $this->dataLists(new MarketingBidInfoLists());
}
/**
* @notes 添加市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function add()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('add');
$result = MarketingBidInfoLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**
* @notes 编辑市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function edit()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('edit');
$result = MarketingBidInfoLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**
* @notes 删除市场经营--投标管理--投标信息
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function delete()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('delete');
$result = MarketingBidInfoLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**
* @notes 获取市场经营--投标管理--投标信息详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/04/12 09:23
*/
public function detail()
{
$params = (new MarketingBidInfoValidate())->goCheck('detail');
$result = MarketingBidInfoLogic::detail($params);
return $this->data($result);
}
}

View File

@ -20,6 +20,7 @@
use app\common\model\dept\Dept;
use app\common\model\marketing\MarketingBidEvaluation;
use app\common\model\marketing\MarketingBidInfo;
use app\common\model\marketing\MarketingBidResult;
use app\common\model\marketing\MarketingBusinessOpportunity;
use app\common\model\marketing\MarketingCustom;
use think\facade\Db;
@ -120,6 +121,11 @@
*/
public static function delete(array $params): bool
{
$bid_result = MarketingBidResult::where('bid_info_id', 'in', $params['id'])->findOrEmpty();
if (!$bid_result->isEmpty()) {
self::setError('此数据关联了投标结果内容,需删除投标结果内容');
return false;
}
return MarketingBidInfo::destroy($params['id']);
}