Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
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
7d2761e2
authored
Jun 07, 2021
by
连敬荣
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
代码重构
parent
31073433
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
app/Http/Controllers/DataController.php
app/Http/routes/api.php
app/Model/InquiryItemsModel.php
app/Http/Controllers/DataController.php
View file @
7d2761e2
...
@@ -16,6 +16,7 @@ use App\Http\Controllers\Controller;
...
@@ -16,6 +16,7 @@ use App\Http\Controllers\Controller;
class
DataController
extends
Controller
class
DataController
extends
Controller
{
{
private
$STATUS_CLOSED
=
4
;
public
function
createInquiryItemsDetail
(
Request
$request
){
public
function
createInquiryItemsDetail
(
Request
$request
){
$userInfo
=
$this
->
user
();
$userInfo
=
$this
->
user
();
$input
=
$request
->
input
();
$input
=
$request
->
input
();
...
@@ -54,7 +55,7 @@ class DataController extends Controller
...
@@ -54,7 +55,7 @@ class DataController extends Controller
#插入明细
#插入明细
$brandInfo
=
json_decode
(
$input
[
"brand_s"
],
true
);
$brandInfo
=
json_decode
(
$input
[
"brand_s"
],
true
);
$check
=
$inquiryItemsModel
->
where
([
"inquiry_id"
=>
$input
[
"inquiry_id"
],
"goods_name"
=>
$input
[
"goods_name"
],
"brand_name"
=>
$brandInfo
[
0
][
"name"
]])
->
count
();
$check
=
$inquiryItemsModel
->
checkUniqueInquiryItemsDetail
(
$input
);
//检查是否存在相同的明细
if
(
$check
>
0
){
if
(
$check
>
0
){
throw
new
Exception
(
"已存在重复此型号品牌!"
);
throw
new
Exception
(
"已存在重复此型号品牌!"
);
}
}
...
@@ -107,7 +108,8 @@ class DataController extends Controller
...
@@ -107,7 +108,8 @@ class DataController extends Controller
(
new
InquiryItemsAssignModel
())
->
insert
(
$assignInsert
);
(
new
InquiryItemsAssignModel
())
->
insert
(
$assignInsert
);
}
}
$inquiryItemsModel
->
where
(
'id'
,
$inquiryItemsId
)
->
update
([
'status'
=>
4
]);
// 存在指定采购,则标记状态为已领取
// $inquiryItemsModel->where('id', $inquiryItemsId)->update(['status' => 4]); // 存在指定采购,则标记状态为已领取
$inquiryItemsModel
->
updateInquiryItemsStatus
(
$inquiryItemsId
,
$this
->
STATUS_CLOSED
);
}
}
#日志
#日志
...
...
app/Http/routes/api.php
View file @
7d2761e2
...
@@ -5,4 +5,5 @@ Route::Get('/ApiSkuList','SearchController@getSkuList');//新增询价查询sku
...
@@ -5,4 +5,5 @@ Route::Get('/ApiSkuList','SearchController@getSkuList');//新增询价查询sku
Route
::
Get
(
'/ApiBrandList'
,
'SearchController@getBrandList'
);
//新增询价查询品牌接口;
Route
::
Get
(
'/ApiBrandList'
,
'SearchController@getBrandList'
);
//新增询价查询品牌接口;
Route
::
Post
(
'/ApiCheckGoods'
,
'SearchController@checkUniqueGoods'
);
//检查是否已经存在询价单;
Route
::
Post
(
'/ApiCheckGoods'
,
'SearchController@checkUniqueGoods'
);
//检查是否已经存在询价单;
Route
::
Post
(
'/ApiCreateOneItems'
,
'DataController@createInquiryItemsDetail'
);
//创建一条询价明细;
Route
::
Post
(
'/ApiCreateOneItems'
,
'DataController@createInquiryItemsDetail'
);
//创建一条询价明细;
Route
::
Post
(
'/api/ApiDeleteInquiryItems'
,
'DataController@deleteInquiryItemsDetail'
);
//
删除询价明细
;
Route
::
Post
(
'/api/ApiDeleteInquiryItems'
,
'DataController@deleteInquiryItemsDetail'
);
//删除询价明细;
\ No newline at end of file
//
Route
::
Post
(
'/api/ApiEditInquiry'
,
'DataController@ApiEditInquiry'
);
//
新增询价
;
\ No newline at end of file
app/Model/InquiryItemsModel.php
View file @
7d2761e2
...
@@ -656,4 +656,13 @@ class InquiryItemsModel extends Model
...
@@ -656,4 +656,13 @@ class InquiryItemsModel extends Model
return
[
0
,
"通过"
];
return
[
0
,
"通过"
];
}
}
public
function
checkUniqueInquiryItemsDetail
(
$input
){
//检查是否存在相同品牌信息的明细
$brandInfo
=
json_decode
(
$input
[
"brand_s"
],
true
);
$check
=
$this
->
where
([
"inquiry_id"
=>
$input
[
"inquiry_id"
],
"goods_name"
=>
$input
[
"goods_name"
],
"brand_name"
=>
$brandInfo
[
0
][
"name"
]])
->
count
();
return
$check
;
}
public
function
updateInquiryItemsStatus
(
$inquiryItemsId
,
$status
){
$this
->
where
(
'id'
,
$inquiryItemsId
)
->
update
([
'status'
=>
$status
]);
// 存在指定采购,则标记状态为已领取
}
}
}
\ No newline at end of file
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