This commit is contained in:
weiz 2024-01-21 15:22:18 +08:00
parent 4b20d04be7
commit af97d76141
2 changed files with 1 additions and 38 deletions

View File

@ -22,8 +22,6 @@ use app\common\model\bid\BidDocumentExamination;
use app\common\model\bid\BidResult;
use app\common\model\custom\Custom;
use app\common\logic\BaseLogic;
use app\common\model\dept\Dept;
use app\common\model\dept\Orgs;
use app\common\model\project\Project;
use think\facade\Db;
@ -50,8 +48,6 @@ class BidResultLogic extends BaseLogic
Db::startTrans();
try {
BidResult::create([
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'bid_document_examination_id' => $params['bid_document_examination_id'],
'project_id' => $bid_document_examination['project_id'],
'is_successful' => $params['is_successful'],
@ -84,8 +80,6 @@ class BidResultLogic extends BaseLogic
Db::startTrans();
try {
BidResult::where('id', $params['id'])->update([
'org_id' => $params['org_id'],
'dept_id' => $params['dept_id'],
'bid_document_examination_id' => $params['bid_document_examination_id'],
'is_successful' => $params['is_successful'],
'bidder_company' => $params['bidder_company'],
@ -127,17 +121,13 @@ class BidResultLogic extends BaseLogic
*/
public static function detail($params): array
{
$data = BidResult::field('id,org_id,dept_id,bid_document_examination_id,project_id,is_successful,bidder_company,bidder_amount,bid_summary,annex,add_user,update_user,create_time,update_time')->findOrEmpty($params['id']);
$org = Orgs::field('name')->where('id',$data['org_id'])->findOrEmpty();
$dept = Dept::field('name')->where('id',$data['dept_id'])->findOrEmpty();
$data = BidResult::field('id,bid_document_examination_id,project_id,is_successful,bidder_company,bidder_amount,bid_summary,annex,add_user,update_user,create_time,update_time')->findOrEmpty($params['id']);
$project = Project::field('name,project_code,custom_id')->where('id',$data['project_id'])->findOrEmpty();
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
$bid_document_examination = BidDocumentExamination::field('code,buy_bidding_document_id')->where('id',$data['bid_document_examination_id'])->findOrEmpty();
$buy_bidding_document = BidBuyBiddingDocument::field('bid_decision_id')->where('id',$bid_document_examination['buy_bidding_document_id'])->findOrEmpty();
$bid_decision = BidBiddingDecision::field('bidding_time,bid_opening_date')->where('id',$buy_bidding_document['bid_decision_id'])->findOrEmpty();
$admin = Admin::where('id','in',[$data['add_user'],$data['update_user']])->column('name','id');
$data['org_name'] = $org['name'];
$data['dept_name'] = $dept['name'];
$data['project_name'] = $project['name'];
$data['project_code'] = $project['project_code'];
$data['custom_name'] = $custom['name'];

View File

@ -16,8 +16,6 @@ namespace app\adminapi\validate\bid;
use app\common\model\bid\BidDocumentExamination;
use app\common\model\dept\Dept;
use app\common\model\dept\Orgs;
use app\common\validate\BaseValidate;
@ -35,8 +33,6 @@ class BidResultValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'org_id' => 'require|checkOrg',
'dept_id' => 'require|checkDept',
'bid_document_examination_id'=> 'require|checkBidDocumentExamination',
'is_successful' => 'require|in:0,1',
'bidder_company' => 'require',
@ -46,8 +42,6 @@ class BidResultValidate extends BaseValidate
protected $message = [
'id.require' => '缺少必要参数',
'org_id.require' => '请选择组织',
'dept_id.require' => '请选择部门',
'bid_document_examination_id.require'=> '请选择投标编号',
'is_successful.require' => '请选择是否中标',
'is_successful.in' => '是否中标选项无效',
@ -103,27 +97,6 @@ class BidResultValidate extends BaseValidate
return $this->only(['id']);
}
public function checkOrg($value): bool|string
{
$org = Orgs::where('id',$value)->findOrEmpty();
if($org->isEmpty()){
return '组织不存在';
}
return true;
}
public function checkDept($value,$rule,$data): bool|string
{
$dept = Dept::where('id',$value)->findOrEmpty();
if($dept->isEmpty()){
return '部门不存在';
}
if($dept['org_id'] != $data['org_id']){
return '部门无效';
}
return true;
}
public function checkBidDocumentExamination($value): bool|string
{
$data = BidDocumentExamination::where('id',$value)->findOrEmpty();