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

@ -86,9 +86,12 @@ class MarketingBidInfoController extends BaseAdminController
public function delete()
{
$params = (new MarketingBidInfoValidate())->post()->goCheck('delete');
MarketingBidInfoLogic::delete($params);
$result = MarketingBidInfoLogic::delete($params);
if (true === $result) {
return $this->success('删除成功', [], 1, 1);
}
return $this->fail(MarketingBidInfoLogic::getError());
}
/**

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']);
}