You've already forked guangan
避免错误坐标上报
This commit is contained in:
@ -48,16 +48,18 @@ class Record extends Auth
|
||||
}
|
||||
$lat = $this->request->post('lat');
|
||||
$lng = $this->request->post('lng');
|
||||
if ($lat != 0 || $lng != 0) {
|
||||
$record->points()->save([
|
||||
'staff_id' => $this->staff->id,
|
||||
'lat' => $lat,
|
||||
'lng' => $lng,
|
||||
'is_pause' => 1,
|
||||
'create_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
}
|
||||
$record->status = 1;
|
||||
$record->imgs = $result['imgs'];
|
||||
$record->content = $result['content'];
|
||||
$record->points()->save([
|
||||
'staff_id' => $this->staff->id,
|
||||
'lat' => $lat,
|
||||
'lng' => $lng,
|
||||
'is_pause' => 1,
|
||||
'create_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
$record->end_at = date('Y-m-d H:i:s');
|
||||
$record->save();
|
||||
$record->autoFix();
|
||||
@ -74,13 +76,17 @@ class Record extends Auth
|
||||
if (empty($record)) {
|
||||
$this->error('记录不存在');
|
||||
}
|
||||
$point = $record->points()->save([
|
||||
'staff_id' => $this->staff->id,
|
||||
'is_pause' => $this->request->post('is_pause', 0),
|
||||
'lat' => $lat,
|
||||
'lng' => $lng,
|
||||
'create_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
if ($lat != 0 || $lng != 0) {
|
||||
$point = $record->points()->save([
|
||||
'staff_id' => $this->staff->id,
|
||||
'is_pause' => $this->request->post('is_pause', 0),
|
||||
'lat' => $lat,
|
||||
'lng' => $lng,
|
||||
'create_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
} else {
|
||||
$point = [];
|
||||
}
|
||||
$record->autoFix();
|
||||
$record->save();
|
||||
$this->success('添加点成功', $point);
|
||||
|
Reference in New Issue
Block a user