Commit 2f91c765 authored by hujun's avatar hujun

案场权限人转换

parent 5903982f
...@@ -91,7 +91,7 @@ class TransferHouseInfo extends Controller ...@@ -91,7 +91,7 @@ class TransferHouseInfo extends Controller
$g_house_data['is_has_gas'] = $house_info_data['has_gas']; $g_house_data['is_has_gas'] = $house_info_data['has_gas'];
$g_house_data['is_carefully_chosen'] = empty($house_info_data['carefully_chosen']) ? 1: 0; $g_house_data['is_carefully_chosen'] = empty($house_info_data['carefully_chosen']) ? 1: 0;
//是否独家0否1是 //是否独家0否1是
$g_house_data['is_exclusive_type'] = $house_info_data['exclusive_type']; $g_house_data['is_exclusive_type'] = $house_info_data['exclusienter_numve_type'];
$g_house_data['upload_id'] = $house_info_data['admin_id']; $g_house_data['upload_id'] = $house_info_data['admin_id'];
// $g_house_data['operation_id'] = $house_info_data['title']; // $g_house_data['operation_id'] = $house_info_data['title'];
$g_house_data['file_path'] = $house_info_data['file_path']; $g_house_data['file_path'] = $house_info_data['file_path'];
...@@ -110,7 +110,7 @@ class TransferHouseInfo extends Controller ...@@ -110,7 +110,7 @@ class TransferHouseInfo extends Controller
$g_house_data_ext['traffic'] = $house_info_data['traffic']; $g_house_data_ext['traffic'] = $house_info_data['traffic'];
$g_house_data_ext['agent_start_time'] = $house_info_data['exclusive_start']; $g_house_data_ext['agent_start_time'] = $house_info_data['exclusive_start'];
$g_house_data_ext['agent_end_time'] = $house_info_data['exclusive_end']; $g_house_data_ext['agent_end_time'] = $house_info_data['exclusive_end'];
$g_house_data_ext['enter_num'] = $house_info_data['enter_num']; $g_house_data_ext['enter_num'] = $house_info_data['has_moved'];
$g_house_data_ext['do_business_date'] = $house_info_data['business_date']; $g_house_data_ext['do_business_date'] = $house_info_data['business_date'];
if (!empty($house_info_data['start_business_date'])) { if (!empty($house_info_data['start_business_date'])) {
$g_house_data_ext['start_business_date'] = $house_info_data['start_business_date']; $g_house_data_ext['start_business_date'] = $house_info_data['start_business_date'];
...@@ -202,12 +202,48 @@ class TransferHouseInfo extends Controller ...@@ -202,12 +202,48 @@ class TransferHouseInfo extends Controller
Db::table('g_houses_imgs')->insert($house_img_save); Db::table('g_houses_imgs')->insert($house_img_save);
} }
} }
// if ($i == 5000) {
// echo $i;
// break;
// }
} }
return ; return ;
} }
/**
* 案场权限人
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentHouse() {
$agent_data = Db::table('agents')->field('id,house_ids,house_ids2')->where('level in(2,5)')->select();
$agent_house_data = [];
foreach ($agent_data as $k=>$v) {
$key=0;
if (!empty($v['house_ids'])) {
$house_ids_arr = explode(',',$v['house_ids']);
foreach ($house_ids_arr as $kk => $vv) {
$agent_house_data[$key]['houses_id'] = $vv;
$agent_house_data[$key]['agents_id'] = $v['id'];
$agent_house_data[$key]['type'] = 1;
$key++;
}
}
if (!empty($v['house_ids2'])) {
$house_ids_arr = explode(',',$v['house_ids2']);
foreach ($house_ids_arr as $kkk => $vvv) {
$agent_house_data[$key]['houses_id'] = $vvv;
$agent_house_data[$key]['agents_id'] = $v['id'];
$agent_house_data[$key]['type'] = 1;
$key++;
}
}
if (!empty($agent_house_data)) {
$result[] = Db::table('g_houses_to_agents')->insertAll($agent_house_data);
}
}
dump($result);die;
}
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ use app\index\extend\Basic; ...@@ -25,6 +25,7 @@ use app\index\extend\Basic;
use app\model\AAgents; use app\model\AAgents;
use app\model\Agents; use app\model\Agents;
use app\model\AStore; use app\model\AStore;
use app\model\Regions;
use think\Session; use think\Session;
use think\Db; use think\Db;
...@@ -215,12 +216,16 @@ class Agent extends Basic ...@@ -215,12 +216,16 @@ class Agent extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function shop_a_store(){ public function shop_a_store(){
$field=''; Db::table("agents")->execute('TRUNCATE `a_store`');
$where='level=1'; $field = '';
$table=new AStore(); // $where='level=1';
$list=Db::table("agents")->field($field)->where($where)->select(); $where['level'] = 1;
$data=array(); $where['father_id'] = 0;
//var_dump($list); $table = new AStore();
$region = new Regions();
$list = Db::table("agents")->field($field)->where($where)->select();
$data = [];
foreach ($list as $k=>$v){ foreach ($list as $k=>$v){
$data[$k]['id']=$v['id'];/*id*/ $data[$k]['id']=$v['id'];/*id*/
...@@ -230,17 +235,25 @@ class Agent extends Basic ...@@ -230,17 +235,25 @@ class Agent extends Basic
->where("agent_id in(select agent_id from chiefs_agents where sub_agent_id='{$v['id']}')") ->where("agent_id in(select agent_id from chiefs_agents where sub_agent_id='{$v['id']}')")
->value(); ->value();
if($district_id){ if($district_id){
$data[$k]['district_id']=$district_id;/*部门Id 对应部门表*/ $data[$k]['district_id'] = $district_id;/*部门Id 对应部门表*/
}else{ }else{
$data[$k]['district_id']=0;/*部门Id 对应部门表*/ $data[$k]['district_id']=0;/*部门Id 对应部门表*/
} }
$data[$k]['store_name']=$v['agentshopname'];/*门店名*/ $data[$k]['store_name'] = trim($v['agentshopname']) .'-'.trim($v['sub_shopname']);/*门店名*/
$data[$k]['scale']=$v['scale'];/*门店规模 如1-22人*/ $data[$k]['scale'] = $v['scale'];/*门店规模 如1-22人*/
$data[$k]['province']=$v['province'];/*省*/ if ($v['province'] == '上海市') {
$data[$k]['city']=$v['city'];/*市*/ $data[$k]['province']= rtrim($v['province'], '市');/*省*/
$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*/ if ($v['province'] == '南京市') {
$data[$k]['province']= '江苏省';/*省*/
}
$data[$k]['city']=$v['province'];/*市*/
$data[$k]['district']=$v['city'];/*区*/
$data[$k]['status']=$v['inuse'] == 1 ? 0 : $v['inuse'];/*状态 0 正常 1禁用*/
$code_arr = $region->getRegionsCodeByName($data[$k]['province'], $data[$k]['city'], $data[$k]['district']);
$data[$k]['code']=implode('##', $code_arr);
$data[$k]['address']=$v['address'];/*详细地址*/ $data[$k]['address']=$v['address'];/*详细地址*/
$data[$k]['longitude']=$v['longitude'];/*经度*/ $data[$k]['longitude']=$v['longitude'];/*经度*/
$data[$k]['latitude']=$v['latitude'];/*纬度*/ $data[$k]['latitude']=$v['latitude'];/*纬度*/
...@@ -261,14 +274,13 @@ class Agent extends Basic ...@@ -261,14 +274,13 @@ class Agent extends Basic
*/ */
public function agent_zhuan_aagent() public function agent_zhuan_aagent()
{ {
$table = New AAgents(); Db::table("a_agents")->execute('TRUNCATE `a_agents`');
$table2 = New Agents(); $table2 = new Agents();
$field='id,device_id,father_id,role_id,level,realname,phone,password,sex,head_portrait,inuse,created,modified,is_inside'; $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)'; $where['level'] = ['in','2,5'];
$list = $table2->field($field)->where($where)->select(); $list = $table2->field($field)->where($where)->select();
$li=collection($list)->toArray();//转化arr
// var_dump($li); $li = collection($list)->toArray();//转化arr
//exit;
$data=array(); $data=array();
foreach ($li as $k=> $v){ foreach ($li as $k=> $v){
$data[$k]['id'] = $v['id'];/* '经济人表'*/ $data[$k]['id'] = $v['id'];/* '经济人表'*/
...@@ -343,8 +355,9 @@ class Agent extends Basic ...@@ -343,8 +355,9 @@ class Agent extends Basic
// $data[$k]['last_login_time']=''; /*'最后登录时间'*/ // $data[$k]['last_login_time']=''; /*'最后登录时间'*/
// $data[$k]['quit_time']=''; /*'离职日期'*/ // $data[$k]['quit_time']=''; /*'离职日期'*/
} }
// var_dump($data);
Db::table("a_agents")->insertAll($data); Db::table("a_agents")->insertAll($data);
var_dump($data);
} }
......
...@@ -43,7 +43,7 @@ class Store extends Basic ...@@ -43,7 +43,7 @@ class Store extends Basic
} }
if (!empty($this->params['district'])) { if (!empty($this->params['district'])) {
$where['district'] = $this->params['district']; $where['province'] = $this->params['district'];
} }
//店长姓名 //店长姓名
......
...@@ -285,6 +285,7 @@ Route::group('api', [ ...@@ -285,6 +285,7 @@ Route::group('api', [
'convertCollectingBill' => [ 'api/ConvertOrder/convertCollectingBill', [ 'method' => 'post|get' ] ], 'convertCollectingBill' => [ 'api/ConvertOrder/convertCollectingBill', [ 'method' => 'post|get' ] ],
'houseTable' => [ 'api/TransferHouseInfo/table', [ 'method' => 'post|get' ] ], //转商铺表 'houseTable' => [ 'api/TransferHouseInfo/table', [ 'method' => 'post|get' ] ], //转商铺表
'houseImgTable' => [ 'api/TransferHouseInfo/houseImg', [ 'method' => 'post|get' ] ], //转楼盘表 'houseImgTable' => [ 'api/TransferHouseInfo/houseImg', [ 'method' => 'post|get' ] ], //转楼盘表
'agentHouse' => [ 'api/TransferHouseInfo/agentHouse', [ 'method' => 'post|get' ] ], //转楼盘表
]); ]);
Route::group('chat', [ Route::group('chat', [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment