diff --git a/api/controllers/wechat/Lichene.php b/api/controllers/wechat/Lichene.php index 94e1c69d..576e5511 100644 --- a/api/controllers/wechat/Lichene.php +++ b/api/controllers/wechat/Lichene.php @@ -221,7 +221,7 @@ Class Lichene extends HD_Controller 'userid' => $re['follow_user'][0]['userid'] ? $re['follow_user'][0]['userid'] : '', 'remark' => $re['follow_user'][0]['remark'] ? $re['follow_user'][0]['remark'] : '', 'mobile' => $mobile, - 'tags' => $tags, + //'tags' => $tags, 'c_time' => $re['follow_user'][0]['createtime'] ? $re['follow_user'][0]['createtime'] : time(), 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE), 'status' => 1, @@ -509,9 +509,9 @@ Class Lichene extends HD_Controller $param = $this->input->get(); $param['page'] = intval($param['page']); //获取配置了客户联系功能的成员列表 -// $re = $this->wx_qyapi->get_external_contact(array('url' => 'get_follow_user_list')); -// echo json_encode($re, JSON_UNESCAPED_UNICODE); -// exit; + //$re = $this->wx_qyapi->get_external_contact(array('url' => 'get_follow_user_list')); + //echo json_encode($re, JSON_UNESCAPED_UNICODE); + //exit; //读取成员 // $re = $this->wx_qyapi->get_external_contact(array('url' => 'user_get', 'userid' => 'DengBingWen')); // echo json_encode($re, JSON_UNESCAPED_UNICODE); @@ -527,20 +527,20 @@ Class Lichene extends HD_Controller // exit; ob_start(); //打开缓冲区 $follow_user = ["LiLiXiang", "ChenZongHui", "FangYanPing", "JiangYaLi", "DianCheDaRen", "LinFan", "ChenHuiCan01", "13507568055" - , "LiuXinXin_2", "caohui", "HuJianPing", "LiuChaHua", "GuoYangYang", "ZhengYongWei", "WangWei", "LiJianJie", "WanHuaFeng" - , "YuWei", "ChenYuYou", "ZengJiaMin", "ZengLingYan", "15859720661", "LiHuaiSong", "LaiDaoAi", "18605086929", "DuXiaoXia" - , "ChenHuiMin", "WuHaiLin", "LinGuoPu", "WeiJiaXing", "WangZhiJie", "ZhaoZhenRong", "SuYaQin", "LiTingTing", "LiFengCan" - , "ChenYingMing", "huanghong", "wangwenbin", "FuDeWang", "DongPingPing", "LiJiaQunGongYongShouJi", "LiMeiJin", "lanpeifang" - , "linxiaolong", "hekaihong", "ZhangQingYuan", "LiJiaQun", "ChenLiXin", "ZhangShanBang", "WuHuanZheng", "XuHang", "HuangJian" - , "YuZhen", "18750080006", "13859842421", "YouYongHuang", "ShaoYunFei", "ChenYingQin", "LuoHuaiJie", "WengQiZhang", "LiuShengHua" - , "LiuHaiQuan", "DengBingWen", "DongKaiJie", "jimmy", "HuangJunQiang", "LaiLianYing", "ZhangWei", "WuDianZi", "XuGuangYi" - , "ZhouJinBin", "ShaoBinHua", "FuYangYi", "LiZhengHui", "YeJiaChen", "YangYaQi", "ChenMei", "DianCheLiKe", "ChenCuiYun" - , "YuTing", "ZhangTengFei", "no.39", "ZhengYun", "HuangChenChen"]; + , "LiuXinXin_2", "caohui", "HuJianPing", "LiuChaHua", "GuoYangYang", "ZhengYongWei", "WangWei", "LiJianJie", "YuWei", "ChenYuYou" + , "ZengJiaMin", "ZengLingYan", "15859720661", "LiHuaiSong", "LaiDaoAi", "18605086929", "DuXiaoXia", "ChenHuiMin", "WuHaiLin" + , "LinGuoPu", "WeiJiaXing", "WangZhiJie", "ZhaoZhenRong", "SuYaQin", "LiTingTing", "LiFengCan", "ChenYingMing", "huanghong" + , "wangwenbin", "FuDeWang", "lxt", "DongPingPing", "LiJiaQunGongYongShouJi", "LiMeiJin", "lanpeifang", "linxiaolong", "hekaihong" + , "ZhangQingYuan", "LiJiaQun", "ChenLiXin", "ZhangShanBang", "WuHuanZheng", "XuHang", "HuangJian", "YuZhen", "18750080006" + , "13859842421", "YouYongHuang", "ShaoYunFei", "ChenYingQin", "LuoHuaiJie", "WengQiZhang", "LiuShengHua", "LiuHaiQuan" + , "DengBingWen", "DongKaiJie", "jimmy", "HuangJunQiang", "LaiLianYing", "ZhangWei", "WuDianZi", "XuGuangYi", "ZhouJinBin" + , "ShaoBinHua", "FuYangYi", "LiZhengHui", "YeJiaChen", "YangYaQi", "ChenMei", "DianCheLiKe", "ChenCuiYun", "YuTing", "ZhangTengFei" + , "no.39", "ZhengYun", "HuangChenChen"]; $count = count($follow_user); if ($param['page'] >= $count) { echo '
本次更新企业成员:'; echo '

成功更新 ' . $count . ' 人'; - echo '

点击将再次更新企业成员>>>'; + echo '

点击将再次更新企业成员>>>'; exit; } $userid = $follow_user[$param['page']]; @@ -553,7 +553,7 @@ Class Lichene extends HD_Controller } } echo '
成功更新企业成员:' . $userid; - header('refresh:3;url=/wechat/liche/tem_external_contact?page=' . ($param['page'] + 1)); + header('refresh:3;url=/wechat/lichene/tem_external_contact?page=' . ($param['page'] + 1)); ob_end_flush();//输出全部内容到浏览器 } @@ -567,10 +567,14 @@ Class Lichene extends HD_Controller $external_userid = $value['external_contact']['external_userid']; if ($external_userid) { $re_qy = $this->mdWechatqy->get(['userid' => $userid, 'external_userid' => $external_userid]); - $jsondata = array(); + $jsondata = []; $jsondata['external_contact'] = $value['external_contact'] ? $value['external_contact'] : ''; $jsondata['follow_info'] = $value['follow_info'] ? $value['follow_info'] : ''; - $tags = $value['follow_info']['tag_id']; + $remark_mobiles = $value['follow_info']['remark_mobiles']; + $mobile = ''; + if ($remark_mobiles && $remark_mobiles != '[]' && is_array($remark_mobiles)) { + $mobile = $remark_mobiles[0];//取第一个手机号 + } $addData = array( 'external_userid' => $value['external_contact']['external_userid'], 'name' => $value['external_contact']['name'], @@ -578,7 +582,7 @@ Class Lichene extends HD_Controller 'unionid' => $value['external_contact']['unionid'] ? $value['external_contact']['unionid'] : '', 'userid' => $value['follow_info']['userid'] ? $value['follow_info']['userid'] : '', 'remark' => $value['follow_info']['remark'] ? $value['follow_info']['remark'] : '', - 'tags' => $tags && $tags != '[]' ? implode(',', $tags) : '', + 'mobile' => $mobile, 'c_time' => $value['follow_info']['createtime'] ? $value['follow_info']['createtime'] : time(), 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE), 'status' => 1, @@ -626,7 +630,7 @@ Class Lichene extends HD_Controller 'unionid' => $re['external_contact']['unionid'] ? $re['external_contact']['unionid'] : '', 'userid' => $re['follow_user'][0]['userid'] ? $re['follow_user'][0]['userid'] : '', 'remark' => $re['follow_user'][0]['remark'] ? $re['follow_user'][0]['remark'] : '', - 'tags' => $re['follow_user'][0]['tags'] ? $re['follow_user'][0]['tags'] : '', + //'tags' => $re['follow_user'][0]['tags'] ? $re['follow_user'][0]['tags'] : '', 'c_time' => $re['follow_user'][0]['createtime'] ? $re['follow_user'][0]['createtime'] : time(), 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE), 'status' => 1, diff --git a/home/controllers/h5/Persona.php b/home/controllers/h5/Persona.php index bd090b79..09c12d38 100644 --- a/home/controllers/h5/Persona.php +++ b/home/controllers/h5/Persona.php @@ -64,7 +64,7 @@ class Persona extends CI_Controller $this->load->model('receiver/receiver_customer_tagdata_model', 'mdCustomerTagdata'); $c_id = $of_id = $of2_id = $buddy_type = 0; $of_id_index = -1; - $tagList = $res_td = $sources = $userInfo = []; + $tagList = $res_td = $sources = $userInfo = []; $tag_data = $tags_name = $description = ''; if (!$params['external_userid']) { $this->show_json(400, '加载失败请重试~'); @@ -137,6 +137,11 @@ class Persona extends CI_Controller $tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : ''; } } + if (!$c_id && $params['user_id']) { + $this->load->model('app/app_lichene_qy_model', 'mdWechatqy'); + $re_qy = $this->mdWechatqy->get(['userid' => $params['user_id'], 'external_userid' => $params['external_userid']]); + $re_qy && $buddy_type = $re_qy['buddy_type']; + } } $userInfo['c_id'] = $c_id; //标签 @@ -217,6 +222,7 @@ class Persona extends CI_Controller $this->load->library('receiver/customers_entity'); $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); $this->load->model('receiver/receiver_customer_tagdata_model', 'mdCustomerTagdata'); + $this->load->model('app/app_lichene_qy_model', 'mdWechatqy'); $c_id = $userInfo['c_id']; $result = $re_cus = ''; if ($c_id) {//已存在客户,更新资料 @@ -293,6 +299,9 @@ class Persona extends CI_Controller $this->mdCustomerTagdata->add_batch($add_tag); } } + //更新企微用户好友类型 + $this->mdWechatqy->update(['buddy_type' => $params['buddy_type']], ['external_userid' => $userInfo['external_userid'] + , 'userid' => $userInfo['userid']]); //企微操作 $remark_mobiles = $userInfo['mobile'] ? [$userInfo['mobile']] : ''; $description = $params['of_title'] ? $params['of_title'] : '';