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
48da1000
authored
Jun 07, 2021
by
连敬荣
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
代码重构
parent
b1a4cf1d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
15 deletions
app/Http/Controllers/SearchController.php
app/Http/Utils/ApiCode.php
app/Http/routes/api.php
app/Model/InquiryItemsModel.php
app/Http/Controllers/SearchController.php
View file @
48da1000
...
...
@@ -3,6 +3,7 @@
namespace
App\Http\Controllers
;
use
App\Model\InquiryItemsModel
;
use
App\Model\LieBrandModel
;
use
Illuminate\Http\Request
;
...
...
@@ -37,4 +38,9 @@ class SearchController extends Controller
$lieBrandModel
=
new
LieBrandModel
();
$lieBrandModel
->
getBrandList
(
$k
,
$types
);
}
public
function
checkUniqueGoods
(
Request
$request
)
{
var_dump
(
$request
->
input
());
exit
();
$InquiryItemsModel
=
new
InquiryItemsModel
();
$InquiryItemsModel
->
checkGoods
(
$request
->
input
());
}
}
\ No newline at end of file
app/Http/Utils/ApiCode.php
View file @
48da1000
...
...
@@ -11,4 +11,5 @@ interface ApiCode
const
API_CODE_UNLOGINED
=
1001
;
//未登陆
const
API_CODE_DATA_EMPTY
=
1003
;
//数据为空
}
\ No newline at end of file
app/Http/routes/api.php
View file @
48da1000
...
...
@@ -2,4 +2,7 @@
Route
::
Get
(
'/ApiSkuList'
,
'SearchController@getSkuList'
);
//新增询价查询sku接口;
Route
::
Get
(
'/ApiBrandList'
,
'SearchController@getBrandList'
);
//
新增询价查询品牌接口
;
\ No newline at end of file
Route
::
Get
(
'/ApiBrandList'
,
'SearchController@getBrandList'
);
//新增询价查询品牌接口;
Route
::
Post
(
'/ApiCheckGoods'
,
'SearchController@checkUniqueGoods'
);
//检查是否已经存在询价单;
Route
::
Post
(
'/ApiCreateOneItems'
,
'DataController@createInquiryItemsDetail'
);
//创建一条询价明细;
//
Route
::
Post
(
'/api/ApiDeleteInquiryItems'
,
'DataController@deleteInquiryItemsDetail'
);
//
删除一条明细
;
\ No newline at end of file
app/Model/InquiryItemsModel.php
View file @
48da1000
<?php
namespace
App\Model
;
use
App\Http\Utils\ApiCode
;
use
App\map\InquiryMap
;
use
App\map\QuoteMap
;
use
App\Model\InquiryItemsAssignModel
;
...
...
@@ -211,16 +212,16 @@ class InquiryItemsModel extends Model
* 创建单个创建明细
* @param $data 批量
*/
public
function
addItems
(
$b
){
public
function
addItems
(
$b
,
$userInfo
){
if
(
count
(
$b
)
==
0
||
$b
==
""
){
return
[
1001
,
"插入数据不得为空"
];
}
if
(
empty
(
$b
[
"goods_name"
]))
return
[
1003
,
"请选择型号名称"
];
if
(
empty
(
$b
[
"inquiry_id"
]))
return
[
1003
,
"询价单ID不得为空"
];
if
(
empty
(
$b
[
"brand_s"
]))
return
[
1003
,
"请选择品牌名称"
];
if
(
empty
(
$b
[
"inquiry_number"
]))
return
[
1003
,
"请输入询价数量"
];
if
(
empty
(
$b
[
"batch"
]))
return
[
1003
,
"请输入批次要求"
];
if
(
empty
(
$b
[
"delivery_time"
]))
return
[
1003
,
"请选择交货日期"
];
if
(
empty
(
$b
[
"goods_name"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"请选择型号名称"
];
if
(
empty
(
$b
[
"inquiry_id"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"询价单ID不得为空"
];
if
(
empty
(
$b
[
"brand_s"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"请选择品牌名称"
];
if
(
empty
(
$b
[
"inquiry_number"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"请输入询价数量"
];
if
(
empty
(
$b
[
"batch"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"请输入批次要求"
];
if
(
empty
(
$b
[
"delivery_time"
]))
return
[
ApiCode
::
API_CODE_DATA_EMPTY
,
"请选择交货日期"
];
try
{
$con
=
DB
::
connection
(
'rfq'
);
...
...
@@ -290,15 +291,15 @@ class InquiryItemsModel extends Model
'relation_id'
=>
$inquiryItemsId
,
#明细id
'relation_sn'
=>
(
new
InquiryModel
())
->
FindInquirySn
(
$b
[
"inquiry_id"
]),
'content'
=>
'单个添加询价'
,
'create_uid'
=>
$
b
[
'user_id'
],
'create_name'
=>
$
b
[
"user_name"
],
'create_uid'
=>
$
userInfo
[
'user_id'
],
'create_name'
=>
$
userInfo
[
"user_name"
],
]);
$con
->
commit
();
return
[
0
,
"添加成功"
];
return
[
ApiCode
::
API_CODE_SUCCESS
,
"添加成功"
];
}
catch
(
\Exception
$e
)
{
$con
->
rollBack
();
return
[
1001
,
"添加失败:"
.
$e
->
getMessage
()];
return
[
ApiCode
::
API_CODE_ERROR
,
"添加失败:"
.
$e
->
getMessage
()];
}
}
...
...
@@ -654,5 +655,4 @@ class InquiryItemsModel extends Model
return
[
0
,
"通过"
];
}
}
\ 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