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
b0241f75
authored
May 19, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加账号维护缓存
parent
7084aa32
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
app/Http/Controllers/Api/SupplierAccountApiController.php
app/Http/Validators/SupplierAccountValidator.php
app/Http/Controllers/Api/SupplierAccountApiController.php
View file @
b0241f75
...
...
@@ -8,6 +8,7 @@ use App\Http\Services\SupplierAccountService;
use
App\Http\Transformers\SupplierLogTransformer
;
use
App\Http\Validators\SupplierAccountValidator
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierLogModel
;
...
...
@@ -52,11 +53,14 @@ class SupplierAccountApiController extends Controller
$data
[
'create_uid'
]
=
$request
->
user
->
userId
;
$data
[
'password'
]
=
Hash
::
make
(
$data
[
'password_raw'
]);
$model
=
new
SupplierAccountModel
();
$result
=
$model
->
insert
(
$data
);
if
(
$result
)
{
$id
=
$model
->
insertGetId
(
$data
);
if
(
$id
)
{
//还要插入一个redis
$redis
=
new
RedisModel
();
$redis
->
hset
(
'yunxin_api_user_mobile'
,
$data
[
'mobile'
],
$id
);
$this
->
response
(
0
,
'添加成功'
);
}
$this
->
response
(
-
1
,
'添加失败'
,
$result
);
$this
->
response
(
-
1
,
'添加失败'
);
}
//修改
...
...
app/Http/Validators/SupplierAccountValidator.php
View file @
b0241f75
...
...
@@ -31,7 +31,7 @@ class SupplierAccountValidator
if
(
empty
(
$receipt
[
'id'
]))
{
$model
=
new
SupplierAccountModel
();
$count
=
$model
->
where
(
'supplier_code'
,
$receipt
[
'supplier_code'
])
->
w
here
(
'mobile'
,
$receipt
[
'mobile'
])
->
count
();
->
orW
here
(
'mobile'
,
$receipt
[
'mobile'
])
->
count
();
if
(
$count
>
0
)
{
return
'该供应商以及对应的账号已经存在,请更换手机号'
;
}
...
...
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