update
This commit is contained in:
parent
5c24cd4d2b
commit
e07b515620
@ -16,8 +16,8 @@ namespace app\adminapi\lists\marketing;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\marketing\MarketingBidResultDetail;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\marketing\MarketingBidResultDetail;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -15,8 +15,8 @@
|
||||
namespace app\adminapi\logic\marketing;
|
||||
|
||||
|
||||
use app\common\model\marketing\MarketingBidResultDetail;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\marketing\MarketingBidResultDetail;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -43,15 +43,14 @@ class MarketingBidResultDetailLogic extends BaseLogic
|
||||
MarketingBidResultDetail::create([
|
||||
'bid_result_id' => $params['bid_result_id'],
|
||||
'company' => $params['company'],
|
||||
'quotation_one' => $params['quotation_one'],
|
||||
'quotation_two' => $params['quotation_two'],
|
||||
'quotation_three' => $params['quotation_three'],
|
||||
'final_rate' => $params['final_rate'],
|
||||
'manager' => $params['manager'],
|
||||
'month' => $params['month'],
|
||||
'result' => $params['result'],
|
||||
'quotation_one' => $params['quotation_one'] ?? 0,
|
||||
'quotation_two' => $params['quotation_two'] ?? 0,
|
||||
'quotation_three' => $params['quotation_three'] ?? 0,
|
||||
'final_rate' => $params['final_rate'] ?? 0,
|
||||
'manager' => $params['manager'] ?? '',
|
||||
'month' => $params['month'] ?? '',
|
||||
'result' => $params['result'] ?? 0,
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -76,15 +75,14 @@ class MarketingBidResultDetailLogic extends BaseLogic
|
||||
MarketingBidResultDetail::where('id', $params['id'])->update([
|
||||
'bid_result_id' => $params['bid_result_id'],
|
||||
'company' => $params['company'],
|
||||
'quotation_one' => $params['quotation_one'],
|
||||
'quotation_two' => $params['quotation_two'],
|
||||
'quotation_three' => $params['quotation_three'],
|
||||
'final_rate' => $params['final_rate'],
|
||||
'manager' => $params['manager'],
|
||||
'month' => $params['month'],
|
||||
'result' => $params['result'],
|
||||
'quotation_one' => $params['quotation_one'] ?? 0,
|
||||
'quotation_two' => $params['quotation_two'] ?? 0,
|
||||
'quotation_three' => $params['quotation_three'] ?? 0,
|
||||
'final_rate' => $params['final_rate'] ?? 0,
|
||||
'manager' => $params['manager'] ?? '',
|
||||
'month' => $params['month'] ?? '',
|
||||
'result' => $params['result'] ?? 0,
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -15,6 +15,8 @@
|
||||
namespace app\adminapi\validate\marketing;
|
||||
|
||||
|
||||
use app\common\model\marketing\MarketingBidResult;
|
||||
use app\common\model\marketing\MarketingBidResultDetail;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
@ -31,16 +33,14 @@ class MarketingBidResultDetailValidate extends BaseValidate
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'bid_result_id' => 'require',
|
||||
'id' => 'require|checkData',
|
||||
'bid_result_id' => 'require|checkBidResult',
|
||||
'company' => 'require',
|
||||
'quotation_one' => 'require',
|
||||
'quotation_two' => 'require',
|
||||
'quotation_three' => 'require',
|
||||
'final_rate' => 'require',
|
||||
'manager' => 'require',
|
||||
'month' => 'require',
|
||||
'result' => 'require',
|
||||
'quotation_one' => 'float|egt:0',
|
||||
'quotation_two' => 'float|egt:0',
|
||||
'quotation_three' => 'float|egt:0',
|
||||
'final_rate' => 'float|egt:0',
|
||||
'result' => 'integer|in:0,1',
|
||||
];
|
||||
|
||||
|
||||
@ -109,4 +109,15 @@ class MarketingBidResultDetailValidate extends BaseValidate
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = MarketingBidResultDetail::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
public function checkBidResult($value): bool|string
|
||||
{
|
||||
$data = MarketingBidResult::where('id', $value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '投标信息数据不存在' : true;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user