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
8de4f3be
authored
Oct 12, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_order_20200923'
parents
c1317f7b
91390ae0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
34 deletions
app/Model/UserCompanyModel.php
app/Model/UserCompanyModel.php
View file @
8de4f3be
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Excel
;
use
DB
;
use
App\Model\RegionModel
;
class
UserCompanyModel
extends
Model
{
protected
$connection
=
'order'
;
protected
$table
=
'lie_user_company'
;
protected
$primaryKey
=
'com_id'
;
public
$timestamps
=
false
;
// 获取公司信息
public
function
getCompanyInfo
(
$user_id
)
{
$info
=
$this
->
where
(
'user_id'
,
$user_id
)
->
first
();
// 公司性质
$company_type
=
Config
(
'params.company_type'
);
$info
[
'type_id_val'
]
=
$company_type
[
$info
[
'type_id'
]];
// 省市区
$RegionModel
=
new
RegionModel
;
$info
[
'com_province'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_province_id'
]);
$info
[
'com_city'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_city_id'
]);
$info
[
'com_area'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_area_id'
]);
return
$info
;
}
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Excel
;
use
DB
;
use
App\Model\RegionModel
;
class
UserCompanyModel
extends
Model
{
protected
$connection
=
'order'
;
protected
$table
=
'lie_user_company'
;
protected
$primaryKey
=
'com_id'
;
public
$timestamps
=
false
;
// 获取公司信息
public
function
getCompanyInfo
(
$user_id
)
{
$info
=
$this
->
where
(
'user_id'
,
$user_id
)
->
first
();
if
(
!
$info
)
return
false
;
// 公司性质
$company_type
=
Config
(
'params.company_type'
);
$info
[
'type_id_val'
]
=
$company_type
[
$info
[
'type_id'
]];
// 省市区
$RegionModel
=
new
RegionModel
;
$info
[
'com_province'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_province_id'
]);
$info
[
'com_city'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_city_id'
]);
$info
[
'com_area'
]
=
$RegionModel
->
getRegionName
(
$info
[
'com_area_id'
]);
return
$info
;
}
}
\ 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