修复异常

This commit is contained in:
yaooo 2023-12-11 17:29:58 +08:00
parent b1b44bb0f3
commit 84e58e0d28
8 changed files with 91 additions and 74 deletions

View File

@ -41,16 +41,16 @@ class CustomFollowLogic extends BaseLogic
Db::startTrans();
try {
CustomFollow::create([
'custom_id' => $params['custom_id'],
'contacts' => $params['contacts'],
'custom_id' => $params['custom_id'] ?? 0,
'contacts' => $params['contacts'] ?? '',
'date' => strtotime($params['date']),
'types' => $params['types'],
'admin_id' => $params['admin_id'],
'description' => $params['description'],
'annex' => $params['annex'],
'coordinate' => $params['coordinate'],
'types' => $params['types'] ?? 0,
'admin_id' => $params['admin_id'] ?? 0,
'description' => $params['description'] ?? '',
'annex' => $params['annex'] ?? '',
'coordinate' => $params['coordinate'] ?? 0,
'next_follow_date' => strtotime($params['next_follow_date']),
'status' => $params['status']
'status' => $params['status'] ?? 0
]);
Db::commit();
@ -75,16 +75,16 @@ class CustomFollowLogic extends BaseLogic
Db::startTrans();
try {
CustomFollow::where('id', $params['id'])->update([
'custom_id' => $params['custom_id'],
'contacts' => $params['contacts'],
'custom_id' => $params['custom_id'] ?? 0,
'contacts' => $params['contacts'] ?? '',
'date' => strtotime($params['date']),
'types' => $params['types'],
'admin_id' => $params['admin_id'],
'description' => $params['description'],
'annex' => $params['annex'],
'coordinate' => $params['coordinate'],
'types' => $params['types'] ?? 0,
'admin_id' => $params['admin_id'] ?? 0,
'description' => $params['description'] ?? '',
'annex' => $params['annex'] ?? '',
'coordinate' => $params['coordinate'] ?? 0,
'next_follow_date' => strtotime($params['next_follow_date']),
'status' => $params['status']
'status' => $params['status'] ?? 0
]);
Db::commit();

View File

@ -41,20 +41,20 @@ class CustomServiceLogic extends BaseLogic
Db::startTrans();
try {
CustomService::create([
'project_id' => $params['project_id'],
'custom_id' => $params['custom_id'],
'approve_id' => $params['approve_id'],
'contacts' => $params['contacts'],
'phone' => $params['phone'],
'project_id' => $params['project_id'] ?? 0,
'custom_id' => $params['custom_id'] ?? 0,
'approve_id' => $params['approve_id'] ?? 0,
'contacts' => $params['contacts'] ?? '',
'phone' => $params['phone'] ?? '',
'date' => strtotime($params['date']),
'classification' => $params['classification'],
'urgency' => $params['urgency'],
'receiver' => $params['receiver'],
'processed_admin_id' => $params['processed_admin_id'],
'name' => $params['name'],
'description' => $params['description'],
'notes' => $params['notes'],
'annex' => $params['annex']
'classification' => $params['classification'] ?? 0,
'urgency' => $params['urgency'] ?? 0,
'receiver' => $params['receiver'] ?? '',
'processed_admin_id' => $params['processed_admin_id'] ?? 0,
'name' => $params['name'] ?? '',
'description' => $params['description'] ?? 0,
'notes' => $params['notes'] ?? '',
'annex' => $params['annex'] ?? ''
]);
Db::commit();
@ -79,20 +79,20 @@ class CustomServiceLogic extends BaseLogic
Db::startTrans();
try {
CustomService::where('id', $params['id'])->update([
'project_id' => $params['project_id'],
'custom_id' => $params['custom_id'],
'approve_id' => $params['approve_id'],
'contacts' => $params['contacts'],
'phone' => $params['phone'],
'project_id' => $params['project_id'] ?? 0,
'custom_id' => $params['custom_id'] ?? 0,
'approve_id' => $params['approve_id'] ?? 0,
'contacts' => $params['contacts'] ?? '',
'phone' => $params['phone'] ?? '',
'date' => strtotime($params['date']),
'classification' => $params['classification'],
'urgency' => $params['urgency'],
'receiver' => $params['receiver'],
'processed_admin_id' => $params['processed_admin_id'],
'name' => $params['name'],
'description' => $params['description'],
'notes' => $params['notes'],
'annex' => $params['annex']
'classification' => $params['classification'] ?? 0,
'urgency' => $params['urgency'] ?? 0,
'receiver' => $params['receiver'] ?? '',
'processed_admin_id' => $params['processed_admin_id'] ?? 0,
'name' => $params['name'] ?? '',
'description' => $params['description'] ?? 0,
'notes' => $params['notes'] ?? '',
'annex' => $params['annex'] ?? ''
]);
Db::commit();

View File

@ -42,20 +42,20 @@ class QuotationLogic extends BaseLogic
Db::startTrans();
try {
$quotation = Quotation::create([
'customer_id' => $params['customer_id'],
'approve_id' => $params['approve_id'],
'quotation_date' => $params['quotation_date'],
'contacts' => $params['contacts'],
'contacts_phone' => $params['contacts_phone'],
'create_user' => $params['create_user'],
'invoice_type' => $params['invoice_type'],
'amount_including_tax' => $params['amount_including_tax'],
'freight' => $params['freight'],
'other_fee' => $params['other_fee'],
'total_amount' => $params['total_amount'],
'customer_require' => $params['customer_require'],
'remark' => $params['remark'],
'annex' => $params['annex']
'customer_id' => $params['customer_id'] ?? 0,
'approve_id' => $params['approve_id'] ?? 0,
'quotation_date' => $params['quotation_date'] ?? '',
'contacts' => $params['contacts'] ?? '',
'contacts_phone' => $params['contacts_phone'] ?? '',
'create_user' => $params['create_user'] ?? '',
'invoice_type' => $params['invoice_type'] ?? 0,
'amount_including_tax' => $params['amount_including_tax'] ?? 0,
'freight' => $params['freight'] ?? 0,
'other_fee' => $params['other_fee'] ?? 0,
'total_amount' => $params['total_amount'] ?? 0,
'customer_require' => $params['customer_require'] ?? '',
'remark' => $params['remark'] ?? '',
'annex' => $params['annex'] ?? '',
]);
foreach ($params['product'] as $item)
{
@ -89,20 +89,20 @@ class QuotationLogic extends BaseLogic
Db::startTrans();
try {
Quotation::where('id', $params['id'])->update([
'customer_id' => $params['customer_id'],
'approve_id' => $params['approve_id'],
'quotation_date' => $params['quotation_date'],
'contacts' => $params['contacts'],
'contacts_phone' => $params['contacts_phone'],
'create_user' => $params['create_user'],
'invoice_type' => $params['invoice_type'],
'amount_including_tax' => $params['amount_including_tax'],
'freight' => $params['freight'],
'other_fee' => $params['other_fee'],
'total_amount' => $params['total_amount'],
'customer_require' => $params['customer_require'],
'remark' => $params['remark'],
'annex' => $params['annex']
'customer_id' => $params['customer_id'] ?? 0,
'approve_id' => $params['approve_id'] ?? 0,
'quotation_date' => $params['quotation_date'] ?? '',
'contacts' => $params['contacts'] ?? '',
'contacts_phone' => $params['contacts_phone'] ?? '',
'create_user' => $params['create_user'] ?? '',
'invoice_type' => $params['invoice_type'] ?? 0,
'amount_including_tax' => $params['amount_including_tax'] ?? 0,
'freight' => $params['freight'] ?? 0,
'other_fee' => $params['other_fee'] ?? 0,
'total_amount' => $params['total_amount'] ?? 0,
'customer_require' => $params['customer_require'] ?? '',
'remark' => $params['remark'] ?? '',
'annex' => $params['annex'] ?? '',
]);
QuotationDetail::where('quotation_id', $params['id'])->delete();
foreach ($params['product'] as $item)

View File

@ -32,6 +32,7 @@ class CustomFollowValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'custom_id' => 'require',
];
@ -64,7 +65,7 @@ class CustomFollowValidate extends BaseValidate
*/
public function sceneEdit()
{
return $this->only(['id']);
return $this->only(['id', 'custom_id']);
}

View File

@ -32,6 +32,12 @@ class CustomServiceValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'project_id' => 'require',
'custom_id' => 'require',
'approve_id' => 'require',
'receiver' => 'require',
'processed_admin_id' => 'require',
'name' => 'require',
];

View File

@ -32,6 +32,8 @@ class QuotationValidate extends BaseValidate
*/
protected $rule = [
'id' => 'require',
'customer_id' => 'require',
'approve_id' => 'require',
'product' => 'require|array|checkProduct',
];
@ -56,7 +58,6 @@ class QuotationValidate extends BaseValidate
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return QuotationValidate
@ -65,7 +66,7 @@ class QuotationValidate extends BaseValidate
*/
public function sceneEdit()
{
return $this->only(['id', 'product']);
return $this->only(['id', 'customer_id', 'approve_id', 'product']);
}

View File

@ -30,5 +30,10 @@ class CustomFollow extends BaseModel
protected $name = 'custom_follow';
protected $deleteTime = 'delete_time';
public function getDateAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
}

View File

@ -30,5 +30,9 @@ class CustomService extends BaseModel
protected $name = 'custom_service';
protected $deleteTime = 'delete_time';
public function getDateAttr($value)
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
}
}