Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
a0b18ef9
Commit
a0b18ef9
authored
Apr 04, 2018
by
zfc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人表转移到新表
parent
f1235efb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
0 deletions
+154
-0
Agent.php
application/index/controller/Agent.php
+152
-0
route.php
application/route.php
+2
-0
No files found.
application/index/controller/Agent.php
View file @
a0b18ef9
...
...
@@ -23,7 +23,10 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\model\AAgents
;
use
app\model\Agents
;
use
app\model\AStore
;
use
think\Session
;
use
think\Db
;
class
Agent
extends
Basic
{
...
...
@@ -196,4 +199,152 @@ class Agent extends Basic
return
$this
->
response
(
$code
,
$msg
,
$data
);
}
//
public
function
shop_district
(){
}
/**
* 添加门店
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
shop_a_store
(){
$field
=
''
;
$where
=
'level=1'
;
$table
=
new
AStore
();
$list
=
Db
::
table
(
"agents"
)
->
field
(
$field
)
->
where
(
$where
)
->
select
();
$data
=
array
();
//var_dump($list);
foreach
(
$list
as
$k
=>
$v
){
$data
[
$k
][
'id'
]
=
$v
[
'id'
];
/*id*/
//部门id
$district_id
=
Db
::
table
(
"a_district"
)
->
field
(
'id'
)
->
where
(
"agent_id in(select agent_id from chiefs_agents where sub_agent_id='
{
$v
[
'id'
]
}
')"
)
->
value
();
if
(
$district_id
){
$data
[
$k
][
'district_id'
]
=
$district_id
;
/*部门Id 对应部门表*/
}
else
{
$data
[
$k
][
'district_id'
]
=
0
;
/*部门Id 对应部门表*/
}
$data
[
$k
][
'store_name'
]
=
$v
[
'agentshopname'
];
/*门店名*/
$data
[
$k
][
'scale'
]
=
$v
[
'scale'
];
/*门店规模 如1-22人*/
$data
[
$k
][
'province'
]
=
$v
[
'province'
];
/*省*/
$data
[
$k
][
'city'
]
=
$v
[
'city'
];
/*市*/
$data
[
$k
][
'district'
]
=
$v
[
'district'
];
/*区*/
$data
[
$k
][
'status'
]
=
$v
[
'inuse'
];
/*状态 0 正常 1禁用*/
$data
[
$k
][
'code'
]
=
$v
[
'province'
]
.
'##'
.
$v
[
'city'
]
.
'##'
.
$v
[
'district'
];
/*省市区code ## 隔开 10001##2000##123123*/
$data
[
$k
][
'address'
]
=
$v
[
'address'
];
/*详细地址*/
$data
[
$k
][
'longitude'
]
=
$v
[
'longitude'
];
/*经度*/
$data
[
$k
][
'latitude'
]
=
$v
[
'latitude'
];
/*纬度*/
$data
[
$k
][
'create_time'
]
=
$v
[
'created'
];
/**/
$data
[
$k
][
'update_time'
]
=
$v
[
'modified'
];
/**/
}
var_dump
(
$data
);
$table
->
saveAll
(
$data
,
false
);
}
/**
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agent_zhuan_aagent
()
{
$table
=
New
AAgents
();
$table2
=
New
Agents
();
$field
=
'id,device_id,father_id,role_id,level,realname,phone,password,sex,head_portrait,inuse,created,modified,is_inside'
;
$where
=
'level in(2,5)'
;
$list
=
$table2
->
field
(
$field
)
->
where
(
$where
)
->
select
();
$li
=
collection
(
$list
)
->
toArray
();
//转化arr
// var_dump($li);
//exit;
$data
=
array
();
foreach
(
$li
as
$k
=>
$v
){
$data
[
$k
][
'id'
]
=
$v
[
'id'
];
/* '经济人表'*/
$data
[
$k
][
'device_id'
]
=
$v
[
'device_id'
];
/* '设备id'*/
$data
[
$k
][
'store_id'
]
=
$v
[
'father_id'
];
/* '门店id关联门店表'*/
switch
(
$v
[
'role_id'
]){
case
6
:/*
旧总监
*/
$data
[
$k
][
'auth_group_id'
]
=
4
;
break
;
case
4
:/*
旧店长
*/
$data
[
$k
][
'auth_group_id'
]
=
3
;
break
;
case
7
:/*
业务员
*/
$data
[
$k
][
'auth_group_id'
]
=
5
;
break
;
case
11
:/*
总负责人
*/
$data
[
$k
][
'auth_group_id'
]
=
1
;
break
;
case
13
:/*
行政
*/
$data
[
$k
][
'auth_group_id'
]
=
6
;
break
;
case
17
:/*
人事
*/
$data
[
$k
][
'auth_group_id'
]
=
2
;
break
;
default
:/*
默认权限
*/
$data
[
$k
][
'auth_group_id'
]
=
7
;
}
/*******************************************************************/
$district_id
=
Db
::
table
(
"a_district"
)
->
field
(
'id'
)
->
where
(
"agent_id in(select agent_id from chiefs_agents where sub_agent_id='
{
$v
[
'father_id'
]
}
')"
)
->
value
();
if
(
$district_id
){
$data
[
$k
][
'district_id'
]
=
$district_id
;
/*部门Id 对应部门表*/
}
else
{
$data
[
$k
][
'district_id'
]
=
0
;
/*部门Id 对应部门表*/
}
/*******************************************************************/
/************************级别****************************************/
if
(
$v
[
'level'
]
==
2
){
$data
[
$k
][
'level'
]
=
10
;
}
else
if
(
$v
[
'level'
]
==
5
){
$agent_id
=
Db
::
table
(
"chieves"
)
->
field
(
'id'
)
->
where
(
"agent_id='
{
$v
[
'id'
]
}
'"
)
->
value
();
if
(
$agent_id
){
$data
[
$k
][
'level'
]
=
40
;
}
else
{
$data
[
$k
][
'level'
]
=
20
;
}
}
/************************级别****************************************/
$data
[
$k
][
'name'
]
=
$v
[
'realname'
];
/*'经济人姓名'*/
$data
[
$k
][
'phone'
]
=
$v
[
'phone'
];
/*'手机号'*/
$data
[
$k
][
'password'
]
=
$v
[
'password'
];
/*'登录密码'*/
$data
[
$k
][
'sex'
]
=
0
;
/*'性别 0保密 1男 2女'*/
$data
[
$k
][
'img'
]
=
$v
[
'head_portrait'
];
/*'头像'*/
if
(
$v
[
'inuse'
]
==
1
){
$data
[
$k
][
'status'
]
=
0
;
/*'账号状态,0正常 1冻结 2离职'*/
}
else
{
$data
[
$k
][
'status'
]
=
2
;
}
$data
[
$k
][
'inviter_id'
]
=
0
;
/* '邀请人id'*/
$data
[
$k
][
'create_time'
]
=
$v
[
'created'
];
$data
[
$k
][
'update_time'
]
=
$v
[
'modified'
];
/* 修改时间*/
$data
[
$k
][
'admin_off'
]
=
$v
[
'is_inside'
];
/*'0可以访问后台,1不可以'*/
$data
[
$k
][
'remarks'
]
=
''
;
/*'备注'*/
$data
[
$k
][
'last_login_ip'
]
=
''
;
/* 'ip存入数字 php ip2long和long2ip转换'*/
$data
[
$k
][
'last_login_time'
]
=
''
;
/*'最后登录时间'*/
$data
[
$k
][
'quit_time'
]
=
''
;
/*'离职日期'*/
}
// var_dump($data);
Db
::
table
(
"a_agents"
)
->
insertAll
(
$data
);
}
}
\ No newline at end of file
application/route.php
View file @
a0b18ef9
...
...
@@ -205,6 +205,8 @@ Route::group('index', [
'phone_up_list'
=>
[
'index/remark/phone_up_list'
,
[
'method'
=>
'get|post'
]
],
//电话跟进列表
'selectReportAll'
=>
[
'index/Finance/selectReportAll'
,
[
'method'
=>
'get|post'
]
],
//时间轴
'test123'
=>
[
'index/WatchShop/test123'
,
[
'method'
=>
'get|post'
]
],
//时间轴
'agent_zhuan_aagent'
=>
[
'index/agent/agent_zhuan_aagent'
,
[
'method'
=>
'post|get'
]
],
//经纪人
'shop_a_store'
=>
[
'index/agent/shop_a_store'
,
[
'method'
=>
'post|get'
]
],
//经纪人
]);
...
...
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