Merge branch 'master' of 47.101.48.251:/data/git/bd-fangke

master
lion 3 years ago
commit 3923690213

@ -128,9 +128,9 @@ class GateController extends CommonController
if ($all['type'] == 2) { if ($all['type'] == 2) {
$remark = '离厂'; $remark = '离厂';
} }
$gateLog = GateLog::add($all['admin_id'], $all['code'], $all['person_no'], $all['car_no'], $remark); $gateLog = GateLog::add($all['admin_id'], $all['code'], $all['person_no']??[], $all['car_no']??[], $remark);
if ($all['type'] == 1) { if ($all['type'] == 1) {
Visit::where('code', $all['code'])->update(['audit_status' => 3, 'person_no' => $all['person_no'], 'car_no' => $all['car_no']]); Visit::where('code', $all['code'])->update(['audit_status' => 3, 'person_no' => $all['person_no']??'', 'car_no' => $all['car_no']??'']);
} }
if ($all['type'] == 2) { if ($all['type'] == 2) {
Visit::where('code', $all['code'])->update(['audit_status' => 4]); Visit::where('code', $all['code'])->update(['audit_status' => 4]);

@ -88,8 +88,16 @@ class VisitController extends CommonController
// 创建时候审核流程写入 // 创建时候审核流程写入
$area = VisitArea::find($all['visit_area_id']); $area = VisitArea::find($all['visit_area_id']);
if ($area->audit_admin && !isset($all['id'])) { if ($area->audit_admin && !isset($all['id'])) {
// 被访问做第一级审核
VisitAudit::create([
'visit_id' => $model->id,
'audit_admin_id' => $all['accept_admin_id'],
'status' => 0,
'level' => 0
]);
// 其他按设置审核
$audit_admin = collect($area->audit_admin)->sortBy('level'); $audit_admin = collect($area->audit_admin)->sortBy('level');
foreach ($audit_admin as $item) { foreach ($audit_admin as $key => $item) {
if (empty($item['admin_id'])) { if (empty($item['admin_id'])) {
// 上级审核 // 上级审核
$admin = Admin::find($all['accept_admin_id']); $admin = Admin::find($all['accept_admin_id']);
@ -102,11 +110,15 @@ class VisitController extends CommonController
} }
$item['admin_id'] = $department->manager_id; $item['admin_id'] = $department->manager_id;
} }
// 判断不能重复
if ($item['admin_id'] == $all['accept_admin_id']) {
continue;
}
VisitAudit::create([ VisitAudit::create([
'visit_id' => $model->id, 'visit_id' => $model->id,
'audit_admin_id' => $item['admin_id'], 'audit_admin_id' => $item['admin_id'],
'status' => 0, 'status' => 0,
'level' => $item['level'] 'level' => $item['level'] + 1
]); ]);
} }
} }
@ -235,7 +247,7 @@ class VisitController extends CommonController
public function askLog() public function askLog()
{ {
$type = request('type'); $type = request('type');
$log = StudyLog::where('type', $type)->orderBy('id', 'desc')->first(); $log = StudyLog::where('type', $type)->where('user_id', $this->getUserId())->orderBy('id', 'desc')->first();
if (empty($log)) { if (empty($log)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '未学习']); return $this->fail([ResponseCode::ERROR_BUSINESS, '未学习']);
} }

@ -8,7 +8,7 @@ class Blacklist extends SoftDeletesModel
protected $appends = ['file_detail']; protected $appends = ['file_detail'];
protected $casts = [ protected $casts = [
'file'=>'array' 'file'=>'json'
]; ];
public function getFileDetailAttribute() public function getFileDetailAttribute()

@ -7,8 +7,8 @@ class GateLog extends CommonModel
protected $guarded = ['id']; protected $guarded = ['id'];
protected $casts = [ protected $casts = [
'person_no' => 'array', 'person_no' => 'json',
'car_no' => 'array' 'car_no' => 'json'
]; ];
public static function add($admin_id, $code, $person_no, $car_no, $remark = '') public static function add($admin_id, $code, $person_no, $car_no, $remark = '')

@ -7,7 +7,7 @@ class Study extends SoftDeletesModel
protected $guarded = ['id']; protected $guarded = ['id'];
protected $casts = [ protected $casts = [
'file' => 'array' 'file' => 'json'
]; ];
protected $appends = ['file_detail']; protected $appends = ['file_detail'];

@ -11,11 +11,11 @@ class Visit extends SoftDeletesModel
protected $appends = ['type_text', 'audit_status_text', 'file_detail']; protected $appends = ['type_text', 'audit_status_text', 'file_detail'];
protected $casts = [ protected $casts = [
'follw_people' => 'array', 'follw_people' => 'json',
'cars' => 'array', 'cars' => 'json',
'file' => 'array', 'file' => 'json',
'person_no' => 'array', 'person_no' => 'json',
'car_no' => 'array' 'car_no' => 'json'
]; ];
public function getFileDetailAttribute() public function getFileDetailAttribute()

@ -7,6 +7,6 @@ class VisitArea extends SoftDeletesModel
protected $guarded = ['id']; protected $guarded = ['id'];
protected $casts = [ protected $casts = [
'audit_admin' => 'array' 'audit_admin' => 'json'
]; ];
} }

Loading…
Cancel
Save