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
d4b9ec8b
authored
Aug 26, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into ysx-协议相关改动-20250811
parents
3ec5d95a
f5366706
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
76 additions
and
37 deletions
app/Http/Controllers/Api/ExternalApiController.php
app/Http/Controllers/Filter/SkuListFilter.php
app/Http/Services/DataService.php
app/Http/Services/SkuService.php
app/Http/Services/SupplierService.php
app/Http/Services/SyncSupplierService.php
app/Http/Validators/SupplierAccountValidator.php
app/Http/routes.php
resources/views/script/AddSupplierScript.blade.php
resources/views/script/SkuListScript.blade.php
resources/views/script/SupplierAccountListScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/script/supplier/SupplierAttachmentScript.blade.php
resources/views/web/AddSupplier.blade.php
resources/views/web/AddSupplierAccount.blade.php
resources/views/web/BatchUpdateSkuStatus.blade.php
resources/views/web/UpdateSupplierAccount.blade.php
resources/views/web/sku/SkuListFilter.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/ExternalApiController.php
View file @
d4b9ec8b
...
...
@@ -94,4 +94,19 @@ class ExternalApiController extends Controller
(
new
MessageService
())
->
sendMessage
(
'supplier_apply_admin_notify'
,
$data
,
'vendor@ichunt.com'
,
true
);
$this
->
externalResponse
(
0
,
'申请供应商成功'
);
}
//判断是否有芯链账号
public
function
checkSupplierAccountExist
(
Request
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
);
if
(
empty
(
$supplierId
))
{
$this
->
externalResponse
(
-
1
,
'供应商ID不能为空'
);
}
$supplierAccount
=
SupplierAccountModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
();
if
(
$supplierAccount
)
{
$this
->
externalResponse
(
0
,
'ok'
,
'有芯链账号'
);
}
$this
->
externalResponse
(
-
1
,
'没有找到芯链账号'
);
}
}
app/Http/Controllers/Filter/SkuListFilter.php
View file @
d4b9ec8b
...
...
@@ -52,6 +52,14 @@ class SkuListFilter
unset
(
$map
[
'update_time'
]);
}
if
(
!
empty
(
$map
[
'create_time'
]))
{
$times
=
explode
(
'~'
,
$map
[
'create_time'
]);
$startTime
=
strtotime
(
$times
[
0
])
?:
1420041600
;
$endTime
=
strtotime
(
$times
[
1
])
?:
time
();
$map
[
'create_time/range'
]
=
$startTime
.
','
.
$endTime
;
unset
(
$map
[
'create_time'
]);
}
if
(
!
empty
(
$map
[
'source_type'
]))
{
switch
(
$map
[
'source_type'
])
{
...
...
app/Http/Services/DataService.php
View file @
d4b9ec8b
...
...
@@ -7,6 +7,7 @@ use Carbon\Carbon;
use
GuzzleHttp\Client
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\NationModel
;
use
App\Model\SkuUploadItem
;
use
App\Model\SpuBrandModel
;
use
App\Model\UserInfoModel
;
...
...
@@ -29,7 +30,7 @@ use App\Model\SupplierAttachmentsModel;
use
App\Model\StandardBrandMappingModel
;
use
App\Model\Purchase\PurchaseOrderModel
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\NationModel
;
use
PhpAmqpLib\Connection\AMQPStreamConnection
;
//这个服务是处理数据的,比如导出信息,或者临时修复数据,所以代码会比较多
class
DataService
...
...
@@ -826,7 +827,7 @@ class DataService
}
$nation
=
$nation
[
0
];
NationModel
::
where
(
'nation_id'
,
$item
[
'nation_id'
])
->
update
([
'
nation_id
'
=>
$nation
[
'abb2'
],
'
international_code
'
=>
$nation
[
'abb2'
],
]);
}
}
...
...
@@ -857,7 +858,7 @@ class DataService
public
static
function
initSupplierReceiptNationId
()
{
ini_set
(
'memory_limit'
,
'2048M'
);
$supplierReceiptList
=
SupplierReceiptModel
::
where
(
'
r
ation_id'
,
0
)
->
get
()
->
toArray
();
$supplierReceiptList
=
SupplierReceiptModel
::
where
(
'
n
ation_id'
,
0
)
->
get
()
->
toArray
();
foreach
(
$supplierReceiptList
as
$supplierReceipt
)
{
$supplierReceipt
[
'nation_id'
]
=
0
;
$receiptType
=
$supplierReceipt
[
'receipt_type'
];
...
...
@@ -881,4 +882,15 @@ class DataService
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
);
}
}
public
static
function
repaireSkuUploadRuler
()
{
NationModel
::
where
(
'nation_id'
,
194
)
->
update
([
'international_code'
=>
'HK'
,
]);
NationModel
::
where
(
'nation_id'
,
195
)
->
update
([
'international_code'
=>
'TW'
,
]);
}
}
app/Http/Services/SkuService.php
View file @
d4b9ec8b
...
...
@@ -165,6 +165,7 @@ class SkuService extends BaseService
$item
[
'source_name'
]
=
array_get
(
config
(
'field.SkuSource'
),
@
$skuDBData
[
'source'
],
''
);
$item
[
'org_name'
]
=
array_get
(
config
(
'field.SkuOrgList'
),
@
$skuDBData
[
'org_id'
],
''
);
$item
[
'ability_level_name'
]
=
(
!
empty
(
$item
[
'ability_level'
])
?
$item
[
'ability_level'
]
:
0
)
==
2
?
'强履约'
:
'弱履约'
;
$item
[
'create_time'
]
=
$skuDBData
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$skuDBData
[
'create_time'
])
:
''
;
return
$item
;
},
$list
);
$list
=
$this
->
transformInvalidSkuTag
(
$list
);
...
...
app/Http/Services/SupplierService.php
View file @
d4b9ec8b
...
...
@@ -600,16 +600,16 @@ class SupplierService
]);
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
//还要丢队列给批量修改sku的内部编码
$redisKey
=
'lie_supplier_change_yunxin_user_'
.
$supplierId
;
if
(
$redis
->
get
(
$redisKey
)
)
{
//
$redisKey = 'lie_supplier_change_yunxin_user_' . $supplierId;
if
(
true
)
{
$data
=
[
'canal'
=>
$supplier
[
'supplier_code'
],
"encoded"
=>
$yunxinChannelUid
,
];
//改成队列
(
new
SkuService
())
->
batchUpdateEncodedQueue
(
$data
);
$redis
->
set
(
$redisKey
,
1
);
$redis
->
expire
(
$redisKey
,
60
*
60
*
3
);
//
$redis->set($redisKey, 1);
//
$redis->expire($redisKey, 60 * 60 * 3);
}
$preYunxinChannelUserName
=
(
new
AdminUserService
())
->
getAdminUserNameByCodeId
(
$preYunxinChannelUid
);
$content
=
"将线上采购员由 [${preYunxinChannelUserName}] 改为 [${yunxinChannelUserName}]"
;
...
...
app/Http/Services/SyncSupplierService.php
View file @
d4b9ec8b
...
...
@@ -88,7 +88,7 @@ class SyncSupplierService
if
(
!
empty
(
$supplier
[
'nation_id'
]))
{
$countryIsocode
=
NationModel
::
where
(
'nation_id'
,
$supplier
[
'nation_id'
])
->
value
(
'international_code'
);
$message
[
'country_isocode'
]
=
$countryIsocode
;
$message
[
'country_isocode'
]
=
!
empty
(
$countryIsocode
)
?
$countryIsocode
:
""
;
}
...
...
@@ -124,7 +124,7 @@ class SyncSupplierService
'recid'
=>
$receipt
[
'receipt_id'
],
'intermediaryBank'
=>
$receipt
[
'intermediary_bank'
],
'remark'
=>
$receipt
[
'remark'
],
'country_isocode'
=>
$receipt
[
'nation'
][
'international_code'
]
,
'country_isocode'
=>
!
empty
(
$receipt
[
'nation'
][
'international_code'
])
?
$receipt
[
'nation'
][
'international_code'
]
:
""
,
];
}
}
...
...
app/Http/Validators/SupplierAccountValidator.php
View file @
d4b9ec8b
...
...
@@ -5,7 +5,7 @@ namespace App\Http\Validators;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
Validator
;
use
Illuminate\Support\Facades\
Validator
;
class
SupplierAccountValidator
{
...
...
@@ -18,6 +18,7 @@ class SupplierAccountValidator
$rules
=
[
"supplier_code"
=>
"required"
,
"contacts_name"
=>
"required"
,
'email'
=>
'required|email'
,
"mobile"
=>
"required|regex:/^1[0-9][0-9]
{
9
}
$/"
,
"password_raw"
=>
"required"
,
"a_type"
=>
"required"
,
...
...
@@ -34,7 +35,7 @@ class SupplierAccountValidator
$yunxinChannelUid
=
$supplierModel
->
where
(
'supplier_code'
,
$account
[
'supplier_code'
])
->
value
(
'yunxin_channel_uid'
);
if
(
empty
(
$yunxinChannelUid
))
{
return
'该供应商没有绑定SKU采购,请完善相关信息'
;
//
return '该供应商没有绑定SKU采购,请完善相关信息';
}
$model
=
new
SupplierAccountModel
();
$supplierCount
=
$model
->
where
(
'supplier_code'
,
$account
[
'supplier_code'
])
...
...
@@ -61,6 +62,8 @@ class SupplierAccountValidator
'mobile.required'
=>
'登录账号不能为空'
,
'mobile.regex'
=>
'账号格式必须为手机号'
,
'password_raw.required'
=>
'账号密码不能为空'
,
'email.required'
=>
'邮箱不能为空'
,
'email.email'
=>
'邮箱格式不对'
,
];
}
}
\ No newline at end of file
}
app/Http/routes.php
View file @
d4b9ec8b
...
...
@@ -69,7 +69,6 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_contract/{key}'
,
'SupplierContractApiController@Entrance'
);
//单独的统计接口
Route
::
match
([
'get'
,
'post'
],
'/statisticsSkuNumber'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
statisticsSkuNumberFromSKu
();
});
});
...
...
@@ -78,6 +77,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Api'], function () {
Route
::
get
(
'/api/external/searchSupplier'
,
'ExternalApiController@searchSupplier'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/checkSupplierApply'
,
'ExternalApiController@checkSupplierApply'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/applySupplier'
,
'ExternalApiController@applySupplier'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/checkSupplierAccountExist'
,
'ExternalApiController@checkSupplierAccountExist'
);
});
//同步相关的接口
...
...
@@ -91,5 +91,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
DataService
::
repairNationInternationalCode
();
// DataService::initSupplierNationId();
// DataService::initSupplierReceiptNationId();
DataService
::
repaireSkuUploadRuler
();
});
resources/views/script/AddSupplierScript.blade.php
View file @
d4b9ec8b
...
...
@@ -8,23 +8,22 @@
let
element
=
layui
.
element
;
let
xmSelect
=
layui
.
xmSelect
;
form
.
on
(
'radio(
supplier
_type)'
,
function
(
data
)
{
form
.
on
(
'radio(
receipt
_type)'
,
function
(
data
)
{
if
(
data
.
value
==
1
)
{
$
(
'#swift_code_div'
).
hide
();
$
(
'#account_name_label'
).
text
(
'账户名称 : '
);
$
(
'#account_name_require_span'
).
hide
();
$
(
'#bank_address_require_span'
).
hide
();
$
(
'#nation_id'
).
val
(
'36'
);
$
(
'#nation_id'
).
attr
(
'disabled'
,
true
);
$
(
'#nation_id'
).
addClass
(
'layui-disabled'
);
$
(
'#receipt_nation_id'
).
val
(
'36'
);
form
.
render
(
'select'
);
}
else
{
$
(
'#swift_code_div'
).
show
();
$
(
'#account_name_label'
).
text
(
'国外受益人 : '
);
$
(
'#account_name_require_span'
).
show
();
$
(
'#bank_address_require_span'
).
show
();
$
(
'#nation_id'
).
attr
(
'disabled'
,
false
);
$
(
'#nation_id'
).
removeClass
(
'layui-disabled'
);
$
(
'#receipt_nation_id'
).
attr
(
'disabled'
,
false
);
$
(
'#receipt_nation_id'
).
val
(
''
);
$
(
'#receipt_nation_id'
).
removeClass
(
'layui-disabled'
);
form
.
render
(
'select'
);
}
});
...
...
@@ -32,8 +31,7 @@
//不让选,也不隐藏
form
.
on
(
'checkbox(stockup_type_filter)'
,
function
(
data
)
{
if
(
data
.
elem
.
checked
&&
data
.
elem
.
name
===
"stockup_type[5]"
)
{
layer
.
msg
(
'新增供应商没法设置为芯链账号类型,设置芯链账号要先去魔方系统配置阶梯系数'
,
{
icon
:
5
})
$
(
'input[name="stockup_type[5]"]'
).
next
().
click
();
}
});
...
...
resources/views/script/SkuListScript.blade.php
View file @
d4b9ec8b
...
...
@@ -177,6 +177,7 @@
},
{
field
:
'org_name'
,
title
:
'所属组织'
,
align
:
'center'
,
width
:
100
},
{
field
:
'audit_user'
,
title
:
'审核人'
,
align
:
'center'
,
width
:
100
},
{
field
:
'create_time'
,
title
:
'创建时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'update_time'
,
title
:
'最近修改时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'audit_time'
,
title
:
'上传时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'cp_time'
,
title
:
'上架有效期'
,
align
:
'center'
,
width
:
180
},
...
...
resources/views/script/SupplierAccountListScript.blade.php
View file @
d4b9ec8b
...
...
@@ -28,7 +28,7 @@
{
field: '
password_raw
', title: '
密码
', align: '
center
', width: 170,
templet: function (data) {
let text = canViewAccountInfo ? '
查看
' : '';
let text = canViewAccountInfo ? '' : '';
return '
<
span
>
' + data.password_raw + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewAccount" type="password_raw" id="' + data.id + '">' + text + '</
span
>
';
}
},
...
...
@@ -41,8 +41,8 @@
{
field
:
'supplier_code'
,
title
:
'供应商编码'
,
align
:
'center'
,
width
:
120
},
{
field
:
'supplier_name'
,
title
:
'供应商名称'
,
align
:
'center'
},
{
field
:
'type_name'
,
title
:
'账号类型'
,
align
:
'center'
},
{
field
:
'supplier_name'
,
title
:
'供应商名称'
,
align
:
'center'
,
width
:
180
},
{
field
:
'type_name'
,
title
:
'账号类型'
,
align
:
'center'
,
width
:
120
},
{
field
:
'is_entity'
,
title
:
'实体名单'
,
align
:
'center'
,
width
:
80
,
templet
:
function
(
data
)
{
let
color
=
''
;
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
d4b9ec8b
...
...
@@ -28,8 +28,8 @@
if
(
res
.
err_code
===
0
)
{
}
else
{
layer
.
msg
(
'请先去魔方系统配置阶梯系数,再新建芯链账号'
,
{
icon
:
5
})
$
(
'input[name="stockup_type[5]"]'
).
next
().
click
();
//
layer.msg('请先去魔方系统配置阶梯系数,再新建芯链账号', {icon: 5})
//
$('input[name="stockup_type[5]"]').next().click();
}
},
error
:
function
()
{
...
...
resources/views/script/supplier/SupplierAttachmentScript.blade.php
View file @
d4b9ec8b
...
...
@@ -38,7 +38,7 @@
},
{
field
:
'description'
,
title
:
'附件说明'
,
align
:
'center'
,
width
:
250
},
{
field
:
'validity_period'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>有效期', align: 'center', width: 220}
,
{
field
:
'create_name'
,
title
:
'
线上采购员
'
,
align
:
'center'
,
width
:
100
},
{
field
:
'create_name'
,
title
:
'
上传人
'
,
align
:
'center'
,
width
:
100
},
{
field
:
'create_time'
,
title
:
'上传时间'
,
align
:
'center'
,
width
:
150
},
]],
id
:
'attachmentList'
,
...
...
resources/views/web/AddSupplier.blade.php
View file @
d4b9ec8b
...
...
@@ -350,7 +350,7 @@
<div
class=
"layui-col-md4"
>
<div
class=
"layui-form-item"
id=
"receipt_nation_id_div"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('receipt_nation_id','国家/地区 : ',
0
,
{!! $statusPresenter->render('receipt_nation_id','国家/地区 : ',
36
,
$nationList,['required'=>true]) !!}
</div>
</div>
...
...
resources/views/web/AddSupplierAccount.blade.php
View file @
d4b9ec8b
...
...
@@ -23,7 +23,7 @@
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
邮箱 :
</label>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
邮箱 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"email"
id=
"email"
placeholder=
"请输入邮箱"
class=
"layui-input"
value=
"{{$account['email'] or ''}}"
>
</div>
...
...
resources/views/web/BatchUpdateSkuStatus.blade.php
View file @
d4b9ec8b
...
...
@@ -15,7 +15,7 @@
lay-text=
"是|否"
>
</div>
</div>
<div
class=
"layui-form-item"
style=
"
margin-left: 260px;
padding-bottom: 30px;margin-top:220px;"
>
<div
class=
"layui-form-item"
style=
"padding-bottom: 30px;margin-top:220px;"
>
<div
class=
"layui-input-block"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
lay-submit
lay-filter=
"batchUpdateSkuStatus"
>
确定
</button>
...
...
resources/views/web/UpdateSupplierAccount.blade.php
View file @
d4b9ec8b
...
...
@@ -24,7 +24,7 @@
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
邮箱 :
</label>
<label
class=
"layui-form-label"
>
<span
class=
"require"
>
*
</span>
邮箱 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"email"
id=
"email"
placeholder=
"请输入邮箱"
class=
"layui-input"
value=
"{{$account['email'] or ''}}"
>
</div>
...
...
resources/views/web/sku/SkuListFilter.blade.php
View file @
d4b9ec8b
...
...
@@ -156,7 +156,7 @@
</div>
<div
class=
"layui-inline"
style=
"width: 600px"
>
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'上传时间']) !!}
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'
创建时间','audit_time'=>'
上传时间']) !!}
</div>
</div>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
d4b9ec8b
...
...
@@ -32,18 +32,18 @@
?>
<div
class=
"layui-form-item"
>
<div
class=
"layui-col-md
2
"
>
<div
class=
"layui-col-md
3
"
>
@inject('singleSelectPresenter','App\Presenters\SingleSelectPresenter')
{!! $singleSelectPresenter->render('supplier_type','供应商类别',!empty($supplier)?array_get($supplier,'supplier_type',0):'1',$supplierType,$option) !!}
</div>
<div
class=
"layui-col-md
4
"
>
<div
class=
"layui-col-md
5
"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('region','所在区域 : ',$supplier['region'],
config('fixed.Region'),['required'=>true,'width'=>'150px']) !!}
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('nation_id','所在国家/地区: ',!empty($supplier)?$supplier['nation_id']:'',$nationList,['required'=>true,'width'=>'110px','label_width'=>'90px']) !!}
</div>
<div
class=
"layui-col-md
6
"
>
<div
class=
"layui-col-md
4
"
>
<div
class=
"city-div"
style=
"display: none"
>
<label
class=
"layui-form-label"
>
选择省市 :
</label>
<div
class=
"city-selector"
id=
"city-selector"
></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