工作台及场景获客字段同步
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\cunkebao\controller\plan;
|
||||
|
||||
use app\common\model\Device as DeviceModel;
|
||||
use app\common\model\DeviceWechatLogin as DeviceWechatLoginModel;
|
||||
use library\ResponseHelper;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
@@ -116,10 +118,53 @@ class GetAddFriendPlanDetailV1Controller extends Controller
|
||||
|
||||
// 解析JSON字段
|
||||
$sceneConf = json_decode($plan['sceneConf'], true) ?: [];
|
||||
$sceneConf['wechatGroups'] = $sceneConf['groupSelected'];
|
||||
$reqConf = json_decode($plan['reqConf'], true) ?: [];
|
||||
$reqConf['deveiceGroups'] = $reqConf['device'];
|
||||
$msgConf = json_decode($plan['msgConf'], true) ?: [];
|
||||
$tagConf = json_decode($plan['tagConf'], true) ?: [];
|
||||
|
||||
|
||||
if(!empty($sceneConf['wechatGroups'])){
|
||||
$groupList = Db::name('wechat_group')->alias('wg')
|
||||
->join('wechat_account wa', 'wa.wechatId = wg.ownerWechatId')
|
||||
->where('wg.id', 'in', $sceneConf['wechatGroups'])
|
||||
->order('wg.id', 'desc')
|
||||
->field('wg.id,wg.name as groupName,wg.ownerWechatId,wa.nickName,wa.avatar,wa.alias,wg.avatar as groupAvatar')
|
||||
->select();
|
||||
$sceneConf['wechatGroupsOptions'] = $groupList;
|
||||
}else{
|
||||
$sceneConf['wechatGroupsOptions'] = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!empty($reqConf['deveiceGroups'])){
|
||||
$deveiceGroupsOptions = DeviceModel::alias('d')
|
||||
->field([
|
||||
'd.id', 'd.imei', 'd.memo', 'd.alive',
|
||||
'l.wechatId',
|
||||
'a.nickname', 'a.alias', '0 totalFriend'
|
||||
])
|
||||
->leftJoin('device_wechat_login l', 'd.id = l.deviceId and l.alive =' . DeviceWechatLoginModel::ALIVE_WECHAT_ACTIVE . ' and l.companyId = d.companyId')
|
||||
->leftJoin('wechat_account a', 'l.wechatId = a.wechatId')
|
||||
->order('d.id desc')
|
||||
->whereIn('d.id',$reqConf['deveiceGroups'])
|
||||
->select();
|
||||
$reqConf['deveiceGroupsOptions'] = $deveiceGroupsOptions;
|
||||
}else{
|
||||
$reqConf['deveiceGroupsOptions'] = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unset(
|
||||
$reqConf['device'],
|
||||
$sceneConf['groupSelected'],
|
||||
);
|
||||
|
||||
// 合并数据
|
||||
$newData['messagePlans'] = $msgConf;
|
||||
$newData = array_merge($newData, $sceneConf, $reqConf, $tagConf, $plan);
|
||||
|
||||
Reference in New Issue
Block a user