Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
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
5dfbc27c
authored
May 14, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整后台下单curl请求
parent
0d0c70a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
12 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Function.php
app/Http/Controllers/AddOrderController.php
View file @
5dfbc27c
...
...
@@ -176,7 +176,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'ucoupon/bestusebyordersystem'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -244,7 +248,11 @@ Class AddOrderController extends Controller
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$response
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
$res
=
curlApi
(
$url
,
$data
,
'POST'
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
!
empty
(
$response
[
'data'
]))
{
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
,
'data'
=>
$response
[
'data'
]];
...
...
@@ -271,7 +279,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/addByOrderSystem'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -293,7 +305,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/switchSaleType'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
]];
}
...
...
@@ -312,7 +328,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/listsByOrderSystem'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -341,7 +361,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumByOrderSystem'
;
}
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -363,7 +387,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/deleteByOrderSystem'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -396,7 +424,11 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/confirm'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
$response
[
'data'
]];
...
...
@@ -423,7 +455,11 @@ Class AddOrderController extends Controller
foreach
(
$cart_info
as
$k
=>
$v
)
{
$data
[
'id'
]
=
$v
[
'gid'
];
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$sale_type
==
1
)
{
// 现货订单--判断下单数量是否大于库存,若大于则弹出提示信息
...
...
@@ -482,8 +518,12 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'order/create'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
$res
=
curlApi
(
$url
,
$data
);
if
(
!
$res
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未访问到API接口,请重新尝试'
];
$response
=
json_decode
(
$res
,
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
[
'order_id'
=>
$response
[
'data'
],
'type'
=>
$data
[
'type'
]]];
}
else
{
...
...
app/Http/Function.php
View file @
5dfbc27c
...
...
@@ -47,7 +47,7 @@
}
// curl
function
curlApi
(
$url
,
$params
=
array
(),
$method
=
'GET'
,
$multi
=
false
,
$extheaders
=
array
())
function
curlApi
(
$url
,
$params
=
array
(),
$method
=
'GET'
,
$multi
=
false
,
$extheaders
=
array
())
{
if
(
!
function_exists
(
'curl_init'
))
exit
(
'Need to open the curl extension'
);
$method
=
strtoupper
(
$method
);
...
...
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