Commit b59b1607 by 庄欣

fix bug

parent 4de2a24a
...@@ -66,7 +66,7 @@ class Sets extends ControllerBase ...@@ -66,7 +66,7 @@ class Sets extends ControllerBase
} }
/** /**
* 保存 * 新增
*/ */
public function store(Request $request) public function store(Request $request)
{ {
...@@ -80,8 +80,42 @@ class Sets extends ControllerBase ...@@ -80,8 +80,42 @@ class Sets extends ControllerBase
'abroad' => $data['abroad'] // 旅拍套系按照传入的值来 'abroad' => $data['abroad'] // 旅拍套系按照传入的值来
]); ]);
} }
if ($data['is_promotion'] == 1 && isset($data['promotion'][0])) {
$request->merge([
'n_order_count' => $data['n_cost'] + $data['promotion'][0]['p_cost']
]);
} else {
$request->merge([
'n_order_count' => $data['n_cost']
]);
}
return parent::store($request); return parent::store($request);
} }
/**
* 修改
*/
public function update($id, Request $request)
{
$data = $request->all();
if ($data['type'] == self::SETS_TYPE_NORMAL) {
$request->merge([
'abroad' => 0
]);
} else {
$request->merge([
'abroad' => $data['abroad']
]);
}
if ($data['is_promotion'] == 1 && isset($data['promotion'][0])) {
$request->merge([
'n_order_count' => $data['n_cost'] + $data['promotion'][0]['p_cost']
]);
} else {
$request->merge([
'n_order_count' => $data['n_cost']
]);
}
return parent::update($id, $request);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment