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
5eb4df95
authored
Mar 03, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
25b1f636
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
38 deletions
app/Http/Controllers/ApiController.php
app/Model/LoginModel.php
app/Http/Controllers/ApiController.php
View file @
5eb4df95
...
@@ -7,6 +7,7 @@ use App\Model\CommonModel;
...
@@ -7,6 +7,7 @@ use App\Model\CommonModel;
use
App\Model\InquiryItemsReportModel
;
use
App\Model\InquiryItemsReportModel
;
use
App\Model\InquiryModel
;
use
App\Model\InquiryModel
;
use
App\Model\InquiryItemsModel
;
use
App\Model\InquiryItemsModel
;
use
App\Model\LoginModel
;
use
App\Model\OperationLogModel
;
use
App\Model\OperationLogModel
;
use
App\Jobs\FastDelivery
;
use
App\Jobs\FastDelivery
;
use
App\Model\OpLogModel
;
use
App\Model\OpLogModel
;
...
@@ -29,44 +30,16 @@ use RedisDB;
...
@@ -29,44 +30,16 @@ use RedisDB;
*/
*/
class
ApiController
extends
Controller
class
ApiController
extends
Controller
{
{
public
$user_id
=
""
;
public
$user_id
=
""
;
//用户id
public
$user_name
=
""
;
public
$user_name
=
""
;
//用户名称
public
function
Entrance
(
Request
$request
,
$id
){
public
function
Entrance
(
Request
$request
,
$id
){
//允许跨域
$loginInfo
=
(
new
LoginModel
())
->
checkLogin
(
$request
);
$origin
=
isset
(
$_SERVER
[
'HTTP_ORIGIN'
])
?
$_SERVER
[
'HTTP_ORIGIN'
]
:
''
;
$this
->
user_id
=
$loginInfo
[
"user_id"
];
$origin_arr
=
explode
(
'//'
,
$origin
);
$this
->
user_name
=
$loginInfo
[
"user_name"
];
$allow_origin
=
config
(
'website.ALLOW_ORIGIN'
);
if
(
in_array
(
$origin_arr
[
'1'
],
$allow_origin
)){
header
(
'Access-Control-Allow-Origin:'
.
$origin
);
header
(
'Access-Control-Allow-Credentials:true'
);
header
(
'Access-Control-Allow-Methods:POST'
);
header
(
'Access-Control-Allow-Headers:x-requested-with,content-type'
);
}
$Redis
=
\RedisDB
::
connection
();
//来自不一样的端,判断是否已经登录
$source
=
$request
->
input
(
"source"
,
"pc"
);
//来源端:内部后台:pc 云芯系统:yunxin App: app 小程序:h5_app
switch
(
$source
){
case
"pc"
://
来源
内部后台
$oa_skey
=
$request
->
cookie
(
"oa_skey"
);
$oa_user_id
=
$request
->
cookie
(
"oa_user_id"
);
$key
=
$oa_user_id
.
":"
.
substr
(
$oa_skey
,
0
,
8
);
$userInfo
=
$Redis
->
get
(
$key
);
if
(
empty
(
$oa_skey
)
||
empty
(
$oa_user_id
)
||
empty
(
$userInfo
)){
Export
(
1001
,
"请先登录"
);
}
$userInfoArr
=
\GuzzleHttp\json_decode
(
$userInfo
,
true
);
$this
->
user_id
=
$userInfoArr
[
"userId"
];
$this
->
user_name
=
$userInfoArr
[
"email"
];
break
;
}
$this
->
$id
(
$request
,
$id
);
$this
->
$id
(
$request
,
$id
);
}
}
//关闭整个询价单
//关闭整个询价单
private
function
ApiInquiryClose
(
$request
,
$id
){
private
function
ApiInquiryClose
(
$request
,
$id
){
Export
((
new
InquiryModel
())
->
inquiryClose
(
$request
->
input
(
'inquiry_id'
)));
Export
((
new
InquiryModel
())
->
inquiryClose
(
$request
->
input
(
'inquiry_id'
)));
...
@@ -86,8 +59,8 @@ class ApiController extends Controller
...
@@ -86,8 +59,8 @@ class ApiController extends Controller
//询价池
//询价池
private
function
ApiInquiryListPool
(
$request
,
$id
){
private
function
ApiInquiryListPool
(
$request
,
$id
){
$input
=
$_REQUEST
;
$input
=
$_REQUEST
;
$input
[
"user_id"
]
=
$
request
->
user
->
userI
d
;
$input
[
"user_id"
]
=
$
this
->
user_i
d
;
$input
[
"email"
]
=
$
request
->
user
->
email
;
$input
[
"email"
]
=
$
this
->
user_name
;
ExportLayui
((
new
InquiryModel
())
->
getListPool
(
$input
));
ExportLayui
((
new
InquiryModel
())
->
getListPool
(
$input
));
}
}
...
@@ -123,12 +96,12 @@ class ApiController extends Controller
...
@@ -123,12 +96,12 @@ class ApiController extends Controller
}
}
//清空询价列表
//清空询价列表
private
function
ApiDeleteInquiryItems
(
$request
,
$id
){
private
function
ApiDeleteInquiryItems
(
$request
,
$id
){
Export
((
new
InquiryItemsModel
())
->
DeleteInquiryItems
(
$request
->
input
(
'inquiry_id'
),
$
request
->
user
->
userI
d
));
Export
((
new
InquiryItemsModel
())
->
DeleteInquiryItems
(
$request
->
input
(
'inquiry_id'
),
$
this
->
user_i
d
));
}
}
//导出询价
//导出询价
private
function
ApiInquiryExport
(
$request
){
private
function
ApiInquiryExport
(
$request
){
(
new
ExportModel
())
->
InquiryExport
(
$request
->
input
(),
$
request
->
user
->
userI
d
);
(
new
ExportModel
())
->
InquiryExport
(
$request
->
input
(),
$
this
->
user_i
d
);
}
}
//生成报价pdf
//生成报价pdf
private
function
ApiOfferPdf
(
$request
){
private
function
ApiOfferPdf
(
$request
){
...
...
app/Model/LoginModel.php
View file @
5eb4df95
...
@@ -18,8 +18,48 @@ class LoginModel extends Model
...
@@ -18,8 +18,48 @@ class LoginModel extends Model
public
$timestamps
=
false
;
public
$timestamps
=
false
;
private
$CheckCode
=
true
;
//是否开启验证码验证
private
$CheckCode
=
true
;
//是否开启验证码验证
public
$isOneLogin
=
true
;
//是否开启单一账号登录
public
$isOneLogin
=
true
;
//是否开启单一账号登录
/*
* 检测登录
*/
public
function
checkLogin
(
$request
){
$user_id
=
""
;
//用户id
$user_name
=
""
;
//用户名称
//允许跨域
$origin
=
isset
(
$_SERVER
[
'HTTP_ORIGIN'
])
?
$_SERVER
[
'HTTP_ORIGIN'
]
:
''
;
$origin_arr
=
explode
(
'//'
,
$origin
);
$allow_origin
=
config
(
'website.ALLOW_ORIGIN'
);
if
(
in_array
(
$origin_arr
[
'1'
],
$allow_origin
)){
header
(
'Access-Control-Allow-Origin:'
.
$origin
);
header
(
'Access-Control-Allow-Credentials:true'
);
header
(
'Access-Control-Allow-Methods:POST'
);
header
(
'Access-Control-Allow-Headers:x-requested-with,content-type'
);
}
$Redis
=
\RedisDB
::
connection
();
//来自不一样的端,判断是否已经登录
$source
=
$request
->
input
(
"source"
,
"pc"
);
//来源端:内部后台:pc 云芯系统:yunxin App: app 小程序:h5_app
switch
(
$source
){
case
"pc"
://
来源
内部后台
$oa_skey
=
$request
->
cookie
(
"oa_skey"
);
$oa_user_id
=
$request
->
cookie
(
"oa_user_id"
);
$key
=
$oa_user_id
.
":"
.
substr
(
$oa_skey
,
0
,
8
);
$userInfo
=
$Redis
->
get
(
$key
);
if
(
empty
(
$oa_skey
)
||
empty
(
$oa_user_id
)
||
empty
(
$userInfo
)){
Export
(
1001
,
"请先登录"
);
}
$userInfoArr
=
\GuzzleHttp\json_decode
(
$userInfo
,
true
);
$user_id
=
$userInfoArr
[
"userId"
];
$user_name
=
$userInfoArr
[
"email"
];
break
;
}
return
[
"user_id"
=>
$user_id
,
"user_name"
=>
$user_name
];
}
/*
/*
*
供应商
登录
* 登录
* @param int $account_id 账号id
* @param int $account_id 账号id
*/
*/
public
function
Login
(
$request
){
public
function
Login
(
$request
){
...
...
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