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