| xqd
@@ -170,16 +170,21 @@ class Order extends BaseModel
|
|
|
}
|
|
|
$this->update(['money' => $total]);
|
|
|
} else {
|
|
|
+ $using_id = Option::get('inner_devices', 'status', 'using');
|
|
|
foreach($devices as $device) {
|
|
|
OrderDevice::create([
|
|
|
'name' => $device['name'],
|
|
|
'order_id' => $this['id'],
|
|
|
- 'device_id' => $device['id'],
|
|
|
+ 'project_id' => $this['project_id'],
|
|
|
+ 'user_id' => $this['user_id'],
|
|
|
+ 'inner_device_id' => $device['id'],
|
|
|
'start_date' => $device['start_date'],
|
|
|
'end_date' => $device['end_date']
|
|
|
]);
|
|
|
if($device['id']) {
|
|
|
InnerDevice::find($device['id'])->update([
|
|
|
+ 'project_id' => $this['project_id'],
|
|
|
+ 'status' => $using_id,
|
|
|
'start_date' => $device['start_date'],
|
|
|
'end_date' => $device['end_date'],
|
|
|
'work_point_id' => $this['work_point_id']
|