0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

华为云服务器 Flexus X 搭建悟空 crm 管理系统——助力企业云上管理(解决 APP Referer 校验失败问题)

jf_81200783 来源:jf_81200783 作者:jf_81200783 2025-02-06 15:43 次阅读
加入交流群
微信小助手二维码

扫码添加小助手

加入工程师交流群

1、为什么我们企业会选择 Flexus 云服务器 X 实例来部署自己的 CRM 管理系统?

wKgZO2dwGomAUF-1AAQMm_QEWyA758.png

wKgZPGdwGomAftakAAPEYgUDXwE595.png

wKgZO2dwGomANR6vAAP2yoOokos952.png

因为基于华为云 Flexus X 实例搭建 CRM 管理平台,可以从容面对企业内部瞬息万变的业务压力变化

2、华为云服务器 Flexus X 方案及优势:

灵活伸缩

搭配弹性伸缩服务 AS 及负载均衡服务 ELB,可以实现基于业务负载的快速弹缩,从容应对多变的市场业务压力

数据可靠

搭配华为云数据库服务,存储电商持久化数据,使用方便,可靠性高

安全可靠

搭配 WAF、DDoS 等网络安全服务,实现对电商业务全方位安全防护,降低黑客入侵风险

wKgZPGdwGoqAMKRsAACHHBuyeu0501.png

wKgZO2dwGoqAGTsUAAHW1WAy7PQ120.png

3、在宝塔里面安装必要的环境 PHP7.3、Mysql5.6+、NGINX

wKgZPGdwGouAX7NeAAQYQfEOzu8911.png

wKgZO2dwGouAXmrEAAHV-f13P2Q168.png

4、安装搭建好,进入 CRM 管理界面:

wKgZPGdwGoyACKLoAAVdJSMEij0037.png

点击添加客户信息的时候就会发现,提示:

APP Referer 校验失败。请检查该 ak 设置的白名单与访问所有的域名是否一致。详情查看:http://lbsyun.baidu.com/apiconsole/key#

这是由于百度地图 api 接口没有配置好导致的问题出现

wKgZO2dwGoyAKkCYAAGNZlsunXE268.png

当配置好地图参数之后,就可以进行地区定位和使用附件客户等功能了

wKgZPGdwGoyAIaI2AAH_iklgCb0230.png

wKgZO2dwGo2AIiscAAKm5ZvT4b8354.png

wKgZPGdwGo2AYEvnAAdWGbi3_ik512.png

5、客户详情功能模块代码

public function read()

{

$customerModel = model('Customer');

$cutomerLogic = new CustomerLogic();

param=this->param;

userInfo=this->userInfo;

data=customerModel->getDataById(param[′id′],userInfo['id']);

if (!$data) {

return resultArray(['error' => $customerModel->getError()]);

}

//数据权限判断

$userModel = new appadminmodelUser();

authu​seri​ds=userModel->getUserByPer('crm', 'customer', 'read');

//读权限

roPre=userModel->rwPre(userInfo[′id′],data['ro_user_id'], $data['rw_user_id'], 'read');

rwPre=userModel->rwPre(userInfo[′id′],data['ro_user_id'], $data['rw_user_id'], 'update');

//判断是否客户池数据

wherePool=customerModel->getWhereByPool();

resPool=db(′crmc​ustomer′)−>alias(′customer′)−>where([′customeri​d′=>param['id']])->where($wherePool)->find();

if (!resPool && !in_array(data['owner_user_id'], auth_user_ids) && !roPre && !$rwPre) {

$authData['dataAuth'] = (int)0;

return resultArray(['data' => $authData]);

}

return resultArray(['data' => $data]);

}

6、编辑客户功能模块代码

public function update()

{

$customerModel = model('Customer');

param=this->param;

userInfo=this->userInfo;

//数据详情

data=customerModel->getDataById($param['id']);

if (!$data) {

return resultArray(['error' => $customerModel->getError()]);

}

param[′useri​d′]=userInfo['id'];

if (customerModel−>updateDataById(param, $param['id'])) {

return resultArray(['data' => '编辑成功']);

} else {

return resultArray(['error' => $customerModel->getError()]);

}

}

7、删除客户功能模块代码

public function delete()

{

param=this->param;

$user = new ApiCommon();

userInfo=user->userInfo;

// 是否客户池

if ($param['isSeas'] == 1) {

$permission = checkPerByAction('crm', 'customer', 'poolDelete');

} else {

$permission = checkPerByAction('crm', 'customer', 'delete');

}

if ($permission == false) {

return resultArray(['error' => '无权操作']);

}

$customerModel = model('Customer');

$userModel = new appadminmodelUser();

$recordModel = new appadminmodelRecord();

$fileModel = new appadminmodelFile();

$actionRecordModel = new appadminmodelActionRecord();

if (!is_array($param['id'])) {

customeri​d[]=param['id'];

} else {

customeri​d=param['id'];

}

$delIds = [];

$errorMessage = [];

//数据权限判断

authu​seri​ds=userModel->getUserByPer('crm', 'customer', 'delete');

//判断是否客户池数据(客户池数据只有管理员可以删)

adminId=userModel->getAdminId();

wherePool=customerModel->getWhereByPool();

foreach (customeri​dask => $v) {

$isDel = true;

//数据详情

data=db(′crmc​ustomer′)−>where([′customeri​d′=>v])->find();

if (!$data) {

$isDel = false;

errorMessage[]=′id为′.v . '的客户删除失败,错误原因:' . $customerModel->getError();

}

resPool=db(′crmc​ustomer′)−>alias(′customer′)−>where([′customeri​d′=>v])->where($wherePool)->find();

if (!resPool && !in_array(data['owner_user_id'], auth_user_ids) && isDel) {

$isDel = false;

$errorMessage[] = '无权操作';

}

// 公海 (原逻辑,公海仅允许管理员删除,修改为授权,不再限制)

// if (resPool && !in_array(data['owner_user_id'],$adminId)) {

// $isDel = false;

// errorMessage[]=′名称为′.data['name'].'的客户删除失败,错误原因:无权操作';

// }

//有商机、合同、联系人则不能删除

if ($isDel) {

resBusiness=db(′crmb​usiness′)−>where([′customeri​d′=>v])->find();

if ($resBusiness) {

$isDel = false;

$errorMessage[] = '客户下存在商机,不能删除';

}

}

if ($isDel) {

resContacts=db(′crmc​ontacts′)−>where([′customeri​d′=>v])->find();

if ($resContacts) {

$isDel = false;

// errorMessage[]=′名称为′.data['name'] . '的客户删除失败,错误原因:客户下存在联系人,不能删除';

$errorMessage[] = '客户下存在联系人,不能删除';

}

}

if ($isDel) {

resContract=db(′crmc​ontract′)−>where([′customeri​d′=>v])->find();

if ($resContract) {

$isDel = false;

$errorMessage[] = '客户下存在合同,不能删除';

}

}

if ($isDel) {

delIds[]=v;

}

}

dataInfo=customerModel->where('customer_id', ['in', $delIds])->select();

if ($delIds) {

delRes=customerModel->delDatas($delIds);

if (!$delRes) {

return resultArray(['error' => $customerModel->getError()]);

}

// 删除客户扩展数据

db('crm_customer_data')->whereIn('customer_id', $delIds)->delete();

// 删除跟进记录

recordModel−>delDataByTypes(2,delIds);

// 删除关联附件

fileModel−>delRFileByModule(′crmc​ustomer′,delIds);

// 删除关联操作记录

actionRecordModel−>delDataById([′types′=>′crmc​ustomer′,′actioni​d′=>delIds]);

foreach (dataInfoask => $v) {

RecordActionLog(userInfo[′id′],′crmc​ustomer′,′delete′,v['name'], '', '', '删除了客户:' . $v['name']);

}

}

if ($errorMessage) {

return resultArray(['error' => $errorMessage]);

} else {

return resultArray(['data' => '删除成功']);

}

}

8、客户信息详情界面

wKgZO2dwGo6AHhO3AAYzBI7FGsQ994.png

9、客户转移功能

public function transfer()

{

param=this->param;

userInfo=this->userInfo;

$customerModel = model('Customer');

$businessModel = model('Business');

$contractModel = model('Contract');

$contactsModel = model('Contacts');

$settingModel = model('Setting');

$customerConfigModel = model('CustomerConfig');

$userModel = new appadminmodelUser();

if (!$param['owner_user_id']) {

return resultArray(['error' => '变更负责人不能为空']);

}

if (!param[′customeri​d′]∣∣!isa​rray(param['customer_id'])) {

return resultArray(['error' => '请选择需要转移的客户']);

}

isr​emove=(param['is_remove'] == 2) ? 2 : 1;

type=param['type'] == 2 ?: 1;

types=param['types'] ?: [];

$data = [];

data[′owneru​seri​d′]=param['owner_user_id'];

$data['update_time'] = time();

$data['follow'] = '待跟进';

# 获取客户的时间

$data['obtain_time'] = time();

ownerUserName=userModel->getUserNameById($param['owner_user_id']);

$errorMessage = [];

foreach (param[′customeri​d′]ascustomer_id) {

customerInfo=db(′crmc​ustomer′)−>where([′customeri​d′=>customer_id])->find();

if (!$customerInfo) {

errorMessage[]=′名称:为《′.customerInfo['name'] . '》的客户转移失败,错误原因:数据不存在;';

continue;

}

$resCustomer = true;

//权限判断

if (!customerModel−>checkData(customer_id)) {

errorMessage[]=customerInfo['name'] . '转移失败,错误原因:无权限;';

continue;

}

//拥有客户数上限检测

if (!customerConfigModel−>checkData(param['owner_user_id'], 1)) {

errorMessage[]=customerInfo['name'] . '转移失败,错误原因:' . $customerConfigModel->getError();

continue;

}

//团队成员

$teamData = [];

teamData[′type′]=type; //权限 1 只读 2 读写

teamData[′useri​d′]=[customerInfo['owner_user_id']]; //协作人

$teamData['types'] = 'crm_customer'; //类型

teamData[′typesi​d′]=customer_id; //类型 ID

teamData[′isd​el′]=(is_remove == 1) ? 1 : '';

res=settingModel->createTeamData($teamData);

# 处理分配标识,待办事项专用

$data['is_allocation'] = 1;

resCustomer=db(′crmc​ustomer′)−>where([′customeri​d′=>customer_id])->update($data);

if (!$resCustomer) {

errorMessage[]=customerInfo['name'] . '转移失败,错误原因:数据出错;';

continue;

} else {

# 处理转移时,负责人出现在只读和读写成员列表中

$customerArray = [];

teamCustomer=db(′crmc​ustomer′)−>field([′owneru​seri​d′,′rou​seri​d′,′rwu​seri​d′])−>where(′customeri​d′,customer_id)->find();

if (!empty($teamCustomer['ro_user_id'])) {

customerRo=arrayToString(arrayd​iff(stringToArray(teamCustomer['ro_user_id']), [$teamCustomer['owner_user_id']]));

customerArray[′rou​seri​d′]=customerRo;

}

if (!empty($teamCustomer['rw_user_id'])) {

customerRo=arrayToString(arrayd​iff(stringToArray(teamCustomer['rw_user_id']), [$teamCustomer['owner_user_id']]));

customerArray[′rwu​seri​d′]=customerRo;

}

db('crm_customer')->where('customer_id', customeri​d)−>update(customerArray);

}

if (in_array('crm_contacts', $types)) {

$contactsIds = [];

contactsIds=db(′crmc​ontacts′)−>where([′customeri​d′=>customer_id])->column('contacts_id');

if ($contactsIds) {

resContacts=contactsModel->transferDataById(contactsIds,param['owner_user_id'], type,is_remove);

if ($resContacts !== true) {

errorMessage[]=resContacts;

continue;

}

}

}

//商机、合同转移

if (in_array('crm_business', $types)) {

$businessIds = [];

businessIds=db(′crmb​usiness′)−>where([′customeri​d′=>customer_id])->column('business_id');

if ($businessIds) {

resBusiness=businessModel->transferDataById(businessIds,param['owner_user_id'], type,is_remove);

if ($resBusiness !== true) {

errorMessage=errorMessage ? array_merge(errorMessage,resBusiness) : $resBusiness;

continue;

}

}

}

if (in_array('crm_contract', $types)) {

$contractIds = [];

contractIds=db(′crmc​ontract′)−>where([′customeri​d′=>customer_id])->column('contract_id');

if ($contractIds) {

resContract=contractModel->transferDataById(contractIds,param['owner_user_id'], type,is_remove);

if ($resContract !== true) {

errorMessage=errorMessage ? array_merge(errorMessage,resContract) : $resContract;

continue;

}

}

}

//修改记录

updateActionLog(userInfo[′id′],′crmc​ustomer′,customer_id, '', '', '将客户转移给:' . $ownerUserName);

RecordActionLog(userInfo[′id′],′crmc​ustomer′,′transfer′,customerInfo['name'], '', '', '将客户:' . customerInfo[′name′].′转移给:′.ownerUserName);

}

if (!$errorMessage) {

return resultArray(['data' => '转移成功']);

} else {

return resultArray(['error' => $errorMessage]);

}

}

企业 CRM 管理系统部署上线之后,我们可以在华为云的控制台可以观察监控着 CPU 使用情况、内存、磁盘等等一切运作情况。华为云真的是性能强大、安全、稳定的云产品!!!

wKgZPGdwGo6Acs3PAAbOhPW06uc881.png

华为云 828 为企业提供多行业场景解决方案及企业专属优惠,助力企业实现数字化转型升级,大家赶紧去选购吧!!

wKgZO2dwGo-AURnbAAiZKqAl9wg120.png

wKgZPGdwGo-AAQDDAAU6TUWxJbI845.png

————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/csdndddsd/article/details/141969901

审核编辑 黄宇

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 服务器
    +关注

    关注

    13

    文章

    10108

    浏览量

    90969
  • 华为云
    +关注

    关注

    3

    文章

    2805

    浏览量

    19106
收藏 人收藏
加入交流群
微信小助手二维码

扫码添加小助手

加入工程师交流群

    评论

    相关推荐
    热点推荐

    Flexus 服务器 X 实例实践:安装 Tasks.md 任务管理工具

    引言 在数字化时代,高效的任务管理至关重要。华为一直以卓越的技术和服务引领行业发展,其 Flexus
    的头像 发表于 01-17 09:45 3426次阅读
    <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例实践:安装 Tasks.md 任务<b class='flag-5'>管理</b>工具

    华为 Flexus 服务器 X 实例之 openEuler 系统搭建 MaxKB 开源知识库问答系统

    及个人开发者快速构建高效、灵活的应用环境。本文将详细介绍如何利用华为 Flexus 服务器 X
    的头像 发表于 01-17 09:44 1850次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例之 openEuler <b class='flag-5'>系统</b>下<b class='flag-5'>搭建</b> MaxKB 开源知识库问答<b class='flag-5'>系统</b>

    Flexus 服务器 X 实例部署 Docker 管理仪表板 DweebUI

    引言 在当今的数字化业务环境中,华为以其卓越的技术实力脱颖而出。华为 Flexus
    的头像 发表于 01-14 09:27 1149次阅读
    <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例部署 Docker <b class='flag-5'>管理</b>仪表板 DweebUI

    使用华为 Flexus 服务器 X 搭建部署茶叶商城小程序 uniapp

    、砍价、秒杀、会员、分销等等功能一个茶叶商城小程序。 后端使用 ThinkPHP,前端使用 UniApp,数据库采用 MySQL,并结合 Redis 缓存技术。 ���《华为 Flexus
    的头像 发表于 01-13 13:35 804次阅读
    使用<b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> <b class='flag-5'>搭建</b>部署茶叶商城小程序 uniapp

    构建企业级文件管理系统,轻松搭建 Seafile 社区版存储解决方案

    。在828 华为企业节之际,利用 Flexus X
    的头像 发表于 01-13 11:14 3561次阅读
    构建<b class='flag-5'>企业</b>级文件<b class='flag-5'>管理</b><b class='flag-5'>系统</b>,轻松<b class='flag-5'>搭建</b> Seafile 社区版<b class='flag-5'>云</b>存储解决方案

    基于华为 Flexus 服务器 X 实例快速搭建 Halo 博客平台

    前言         华为作为领先的服务提供商,一直致力于为企业提供卓越的计算
    的头像 发表于 01-08 11:46 864次阅读
    基于<b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例快速<b class='flag-5'>搭建</b> Halo 博客平台

    华为 Flexus 服务器 X 实例之 openEuler 系统下部署 dufs 文件服务器

    一、Flexus 服务器 X 实例介绍 1.1 Flexus
    的头像 发表于 01-08 11:45 933次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例之 openEuler <b class='flag-5'>系统</b>下部署 dufs 文件<b class='flag-5'>服务器</b>

    华为 Flexus 服务器 X 实例部署 Servas 自托管书签管理工具

    一、Flexus 服务器 X 实例介绍 1.1 Flexus
    的头像 发表于 01-08 11:44 858次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例部署 Servas 自托管书签<b class='flag-5'>管理</b>工具

    华为 Flexus 服务器 X 实例部署 Note Mark 笔记工具

    前言 华为 Flexus 服务器 X 实例作为专为中小
    的头像 发表于 01-02 13:42 771次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例部署 Note Mark 笔记工具

    华为 Flexus 服务器 X 实例的使用教程

    引言 选择一款性价比高、性能强劲的服务器是 IT 技术人员常面临的问题。华为Flexus
    的头像 发表于 12-30 09:16 1122次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例的使用教程

    华为 Flexus 服务器 X 实例:在 openEuler 系统搭建 MySQL 主从复制

    前言 本文将介绍如何在华为 Flexus 服务器 X 实例
    的头像 发表于 12-30 09:11 731次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例:在 openEuler <b class='flag-5'>系统</b>下<b class='flag-5'>搭建</b> MySQL 主从复制

    Flexus 服务器 X 实例:在 Docker 环境下搭建 java 开发环境

    引言 在科技飞速发展的时代,计算成为推动各行业进步的重要力量。华为凭借其强大的技术实力和创新精神,始终走在行业前沿。华为
    的头像 发表于 12-30 09:07 893次阅读
    <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例:在 Docker 环境下<b class='flag-5'>搭建</b> java 开发环境

    基于华为 Flexus 服务器 X 实例部搭建 Halo 博客平台

    署 Halo 博客平台,充分发挥其稳定可靠的服务优势。通过这一实践,我们将展示如何利用华为的强大支持,实现博客平台的高效搭建
    的头像 发表于 12-26 09:40 851次阅读
    基于<b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例部<b class='flag-5'>搭建</b> Halo 博客平台

    基于华为 Flexus 服务器 X 实例搭建 Linux 学习环境

    前言 在当今信息技术日新月异的时代,华为 Flexus 服务器 X 实例以其强劲的性能和高性
    的头像 发表于 12-25 17:10 919次阅读
    基于<b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例<b class='flag-5'>搭建</b> Linux 学习环境

    华为 Flexus 服务器 X 实例的购买及使用体验

    价比服务。其中,华为 Flexus 服务器
    的头像 发表于 12-24 17:26 1021次阅读
    <b class='flag-5'>华为</b><b class='flag-5'>云</b> <b class='flag-5'>Flexus</b> <b class='flag-5'>云</b><b class='flag-5'>服务器</b> <b class='flag-5'>X</b> 实例的购买及使用体验