Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c058592b
authored
Apr 21, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
日志
parent
0719929c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
52 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Api/SupplierLogApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierAddressService.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
config/fixed.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/SupplierLog.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
c058592b
...
@@ -11,6 +11,7 @@ use App\Http\Services\SupplierService;
...
@@ -11,6 +11,7 @@ use App\Http\Services\SupplierService;
use
App\Http\Services\SyncSupplierService
;
use
App\Http\Services\SyncSupplierService
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Http\Validators\SupplierValidator
;
use
App\Http\Validators\SupplierValidator
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -137,6 +138,9 @@ class SupplierApiController extends Controller
...
@@ -137,6 +138,9 @@ class SupplierApiController extends Controller
'status'
=>
$model
::
STATUS_IN_REVIEW
,
'status'
=>
$model
::
STATUS_IN_REVIEW
,
]);
]);
if
(
$result
)
{
if
(
$result
)
{
//写日志
$logService
=
new
LogService
();
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'禁用'
,
'禁用供应商'
);
//发送队列消息同步到金蝶
//发送队列消息同步到金蝶
$service
=
new
SyncSupplierService
();
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
$service
->
syncSupplierToErp
(
$supplierId
);
...
@@ -186,7 +190,7 @@ class SupplierApiController extends Controller
...
@@ -186,7 +190,7 @@ class SupplierApiController extends Controller
//保存日志
//保存日志
$logService
=
new
LogService
();
$logService
=
new
LogService
();
$action
=
array_get
(
config
(
'fixed.SupplierStatus'
),
$status
);
$action
=
array_get
(
config
(
'fixed.SupplierStatus'
),
$status
);
$logService
->
AddLog
(
$supplierId
,
1
,
$action
,
$action
.
'-'
.
$supplier
[
'supplier_name'
]);
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
$action
,
$action
.
'-'
.
$supplier
[
'supplier_name'
]);
if
(
!
$result
)
{
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'修改状态失败'
);
$this
->
response
(
-
1
,
'修改状态失败'
);
}
}
...
...
app/Http/Controllers/Api/SupplierLogApiController.php
View file @
c058592b
...
@@ -39,6 +39,9 @@ class SupplierLogApiController extends Controller
...
@@ -39,6 +39,9 @@ class SupplierLogApiController extends Controller
if
(
empty
(
$data
[
'type'
])
||
empty
(
$data
[
'desc'
]))
{
if
(
empty
(
$data
[
'type'
])
||
empty
(
$data
[
'desc'
]))
{
$this
->
response
(
-
1
,
'类型或者描述都不能为空'
);
$this
->
response
(
-
1
,
'类型或者描述都不能为空'
);
}
}
if
(
strlen
(
$data
[
'desc'
])
>
500
)
{
$this
->
response
(
-
1
,
'描述不能超过500个字'
);
}
$data
[
'admin_id'
]
=
$request
->
user
->
userId
;
$data
[
'admin_id'
]
=
$request
->
user
->
userId
;
$data
[
'admin_name'
]
=
$request
->
user
->
name
;
$data
[
'admin_name'
]
=
$request
->
user
->
name
;
$data
[
'add_time'
]
=
time
();
$data
[
'add_time'
]
=
time
();
...
...
app/Http/Controllers/SupplierController.php
View file @
c058592b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Http\Services\LogService
;
use
App\Http\Services\RoleService
;
use
App\Http\Services\RoleService
;
use
App\Http\Services\SupplierContactService
;
use
App\Http\Services\SupplierContactService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierService
;
...
@@ -70,10 +71,18 @@ class SupplierController extends Controller
...
@@ -70,10 +71,18 @@ class SupplierController extends Controller
$supplierId
=
$request
->
get
(
'supplier_id'
);
$supplierId
=
$request
->
get
(
'supplier_id'
);
$supplierService
=
new
SupplierService
();
$supplierService
=
new
SupplierService
();
$supplier
=
$supplierService
->
getSupplier
(
$supplierId
);
$supplier
=
$supplierService
->
getSupplier
(
$supplierId
);
// dd($supplier);
if
(
empty
(
$supplier
))
{
if
(
empty
(
$supplier
))
{
return
'供应商不存在'
;
return
'供应商不存在'
;
}
}
//记录查看日志(1个小时内查看的跳过)
$logModel
=
new
LogModel
();
$lastViewAddTime
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'admin_id'
,
$request
->
user
->
userId
)
->
where
(
'type'
,
LogModel
::
VIEW_OPERATE
)
->
value
(
'add_time'
);
$oneHourTimestamp
=
3600
;
if
(
time
()
-
$lastViewAddTime
>
$oneHourTimestamp
)
{
$logService
=
new
LogService
();
$logService
->
AddLog
(
$supplierId
,
LogModel
::
VIEW_OPERATE
,
'查看'
,
'查看供应商详情'
);
}
$this
->
data
[
'operate'
]
=
'detail'
;
$this
->
data
[
'operate'
]
=
'detail'
;
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'supplier'
]
=
$supplier
;
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
...
@@ -168,8 +177,8 @@ class SupplierController extends Controller
...
@@ -168,8 +177,8 @@ class SupplierController extends Controller
$intracodeModel
=
new
IntracodeModel
();
$intracodeModel
=
new
IntracodeModel
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
getSampleEncode
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
getSampleEncode
();
$logModel
=
new
LogModel
();
$logModel
=
new
LogModel
();
$this
->
data
[
'logs'
]
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
$this
->
data
[
'logs'
]
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'action'
,
'allocate_purchase_user'
)
->
orderBy
(
'id'
,
'desc'
)
->
where
(
'action'
,
'allocate_purchase_user'
)
->
orderBy
(
'id'
,
'desc'
)
->
limit
(
10
)
->
get
();
->
limit
(
10
)
->
get
();
return
$this
->
view
(
'审核供应商'
);
return
$this
->
view
(
'审核供应商'
);
}
}
...
...
app/Http/Services/SupplierAddressService.php
View file @
c058592b
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
namespace
App\Http\Services
;
namespace
App\Http\Services
;
use
App\Model\LogModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierContactModel
;
...
@@ -47,7 +48,7 @@ class SupplierAddressService
...
@@ -47,7 +48,7 @@ class SupplierAddressService
$result
=
$addressModel
->
insert
(
$returnData
);
$result
=
$addressModel
->
insert
(
$returnData
);
}
}
$logService
=
new
LogService
();
$logService
=
new
LogService
();
$logService
->
AddLog
(
$map
[
'supplier_id'
],
2
,
'保存地址信息'
,
' '
);
$logService
->
AddLog
(
$map
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'保存地址信息'
,
' '
);
return
$result
;
return
$result
;
}
}
}
}
\ No newline at end of file
app/Http/Services/SupplierAuditService.php
View file @
c058592b
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
namespace
App\Http\Services
;
namespace
App\Http\Services
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierContactModel
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
RedisDB
;
class
SupplierAuditService
class
SupplierAuditService
{
{
...
@@ -20,6 +20,13 @@ class SupplierAuditService
...
@@ -20,6 +20,13 @@ class SupplierAuditService
'status'
=>
$status
,
'status'
=>
$status
,
'reject_reason'
=>
$rejectReason
,
'reject_reason'
=>
$rejectReason
,
]);
]);
if
(
$result
)
{
//记录日志
$auditStatus
=
$status
==
2
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
$logService
=
new
LogService
();
$content
=
$auditStatus
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'审核供应商'
,
$content
);
}
return
$result
;
return
$result
;
}
}
...
...
app/Http/Services/SupplierService.php
View file @
c058592b
...
@@ -212,14 +212,12 @@ class SupplierService
...
@@ -212,14 +212,12 @@ class SupplierService
'update_time'
=>
time
(),
'update_time'
=>
time
(),
'purchase_uid'
=>
$purchaseUid
,
'purchase_uid'
=>
$purchaseUid
,
]);
]);
$toFollowUp
=
false
;
if
(
$result
)
{
if
(
$result
)
{
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
//重新分配渠道开发并且开发人员有变更的时候,就去检查是否需要跟进
if
(
$supplier
[
'purchase_uid'
]
!=
$purchaseUid
)
{
if
(
$supplier
[
'purchase_uid'
]
!=
$purchaseUid
)
{
$auditService
=
new
SupplierAuditService
();
$auditService
=
new
SupplierAuditService
();
//还要判断是否为待跟进供应商
//还要判断是否为待跟进供应商
if
(
!
$auditService
->
checkIsNeedToFollowUpSupplier
(
$supplierId
))
{
if
(
!
$auditService
->
checkIsNeedToFollowUpSupplier
(
$supplierId
))
{
$toFollowUp
=
true
;
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'to_follow_up'
=>
1
,
'to_follow_up'
=>
1
,
]);
]);
...
@@ -233,9 +231,8 @@ class SupplierService
...
@@ -233,9 +231,8 @@ class SupplierService
$purchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$purchaseUid
);
$purchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$purchaseUid
);
$purchaseUserName
=
array_get
(
$purchaseUser
,
'name'
,
''
);
$purchaseUserName
=
array_get
(
$purchaseUser
,
'name'
,
''
);
$logService
=
new
LogService
();
$logService
=
new
LogService
();
$name
=
request
()
->
user
->
name
;
$content
=
"将渠道开发员由 [${prePurchaseUserName}] 改为 [${purchaseUserName}]"
;
$content
=
"将渠道开发员由 [${prePurchaseUserName}] 改为 [${purchaseUserName}]"
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'
allocate_purchase_user
'
,
$content
);
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'
分配渠道开发员
'
,
$content
);
}
}
return
$result
;
return
$result
;
...
...
config/fixed.php
View file @
c058592b
...
@@ -5,7 +5,8 @@ return [
...
@@ -5,7 +5,8 @@ return [
'NotAuth'
=>
[
'NotAuth'
=>
[
'ChoiceSupplierList'
,
'ChoiceSupplierList'
,
'HoldItems'
,
'HoldItems'
,
'ObtainSkuList'
'ObtainSkuList'
,
'SupplierLog'
],
],
//api不用授权方法
//api不用授权方法
'ApiNotAuth'
=>
[
'ApiNotAuth'
=>
[
...
...
resources/views/web/SupplierDetail.blade.php
View file @
c058592b
...
@@ -27,11 +27,15 @@
...
@@ -27,11 +27,15 @@
</div>
</div>
<div
class=
"layui-col-md8"
></div>
<div
class=
"layui-col-md8"
></div>
</div>
</div>
<div
class=
"layui-row"
>
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING
<a
id=
"updateSupplierUrl"
||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED
href=
"/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}"
||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_REJECT)
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
点击修改
</a>
<div
class=
"layui-row"
>
</div>
<a
id=
"updateSupplierUrl"
href=
"/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
点击修改
</a>
</div>
@endif
</div>
</div>
<div
class=
"layui-card-body"
>
<div
class=
"layui-card-body"
>
<div
class=
"layui-tab"
>
<div
class=
"layui-tab"
>
...
...
resources/views/web/SupplierLog.blade.php
View file @
c058592b
...
@@ -2,63 +2,80 @@
...
@@ -2,63 +2,80 @@
<div
class=
"layui-card-body"
>
<div
class=
"layui-card-body"
>
<div
class=
"layui-tab"
>
<div
class=
"layui-tab"
>
<ul
class=
"layui-tab-title"
>
<ul
class=
"layui-tab-title"
>
<li
style=
"padding: 0"
class=
"layui-this"
id=
"base_info"
>
全部
</li>
@if(checkPerm('ViewAllLog'))
<li
style=
"padding: 0"
id=
"contact"
>
修改记录
</li>
<li
style=
"padding: 0"
class=
"layui-this"
id=
"base_info"
>
全部
</li>
<li
style=
"padding: 0"
id=
"ruler"
>
查看记录
</li>
@endif
<li
style=
"padding: 0"
id=
"ruler"
>
信息记录
</li>
@if(checkPerm('ViewUpdateLog'))
<li
style=
"padding: 0"
id=
"contact"
>
修改记录
</li>
@endif
@if(checkPerm('ViewLog'))
<li
style=
"padding: 0"
id=
"ruler"
>
查看记录
</li>
@endif
@if(checkPerm('ViewSupplierLog'))
<li
style=
"padding: 0"
id=
"ruler"
>
信息记录
</li>
@endif
</ul>
</ul>
<div
class=
"layui-tab-content"
>
<div
class=
"layui-tab-content"
>
<div
class=
"layui-tab-item layui-show"
>
<div
class=
"layui-tab-item layui-show"
>
<form
class=
"layui-form"
action=
""
>
@if(checkPerm('ViewAllLog'))
<div
class=
"layui-form-item"
style=
"margin-left: -70px;margin-bottom: 0"
>
@if(checkPerm('AddSupplierLog'))
@inject('statusPresenter','App\Presenters\StatusPresenter')
<form
class=
"layui-form"
action=
""
>
{!! $statusPresenter->render('type','类型',
<div
class=
"layui-form-item"
style=
"margin-left: -70px;margin-bottom: 0"
>
'',config('fixed.SupplierLogType'),['required'=>false]) !!}
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('type','类型',
'',config('fixed.SupplierLogType'),['required'=>false]) !!}
</div>
<div
class=
"layui-form-item layui-form-text"
style=
"margin-left: -70px"
>
<div
class=
"layui-input-block"
>
<textarea
name=
"desc"
placeholder=
"请输入具体的信息内容"
class=
"layui-textarea"
></textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"left"
style=
"margin-top: 20px;margin-left: 40px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-info layui-btn-sm"
lay-submit
lay-filter=
"addSupplierLog"
>
添加信息记录
</button>
</div>
</div>
</form>
@endif
<div
id=
"logs"
style=
"margin-left: 5px"
>
{{--所有操作记录列表查看--}}
@foreach($logs as $log)
<p>
{{$log['action']}} : {{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
style=
"margin-left: -70px"
>
@endif
<div
class=
"layui-input-block"
>
</div>
<textarea
name=
"desc"
placeholder=
"请输入具体的信息内容"
class=
"layui-textarea"
></textarea>
<div
class=
"layui-tab-item"
>
</div>
@if(checkPerm('ViewAllLog'))
</div>
@foreach($updateLogs as $log)
<div
class=
"layui-form-item"
>
<p>
{{$log['content']}}
</p>
<div
align=
"left"
style=
"margin-top: 20px;margin-left: 40px"
>
<button
type=
"button"
class=
"layui-btn layui-btn-info layui-btn-sm"
lay-submit
lay-filter=
"addSupplierLog"
>
添加信息记录
</button>
</div>
</div>
</form>
<div
id=
"logs"
style=
"margin-left: 5px"
>
{{--所有操作记录列表查看--}}
@foreach($logs as $log)
<p>
{{$log['action']}} : {{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
<hr/>
@endforeach
@endforeach
</div>
@endif
</div>
<div
class=
"layui-tab-item"
>
@foreach($updateLogs as $log)
<p>
{{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
</div>
</div>
<div
class=
"layui-tab-item"
>
<div
class=
"layui-tab-item"
>
@if(checkPerm('ViewAllLog'))
@foreach($viewLogs as $log)
@foreach($viewLogs as $log)
<p>
{{$log['content']}}
</p>
<p>
{{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
<hr/>
@endforeach
@endforeach
@endif
</div>
</div>
<div
class=
"layui-tab-item"
>
<div
class=
"layui-tab-item"
>
@if(checkPerm('ViewAllLog'))
@foreach($supplierLogs as $log)
@foreach($supplierLogs as $log)
<p>
{{$log['desc']}}
</p>
<p>
{{$log['desc']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
<hr/>
@endforeach
@endforeach
@endif
</div>
</div>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment