828华为云征文|华为云服务器Flexus X搭建悟空crm管理系统——助力企业云上管理(解决APP Referer校验失败问题)
1、为什么我们企业会选择Flexus云服务器X实例来部署自己的CRM管理系统?
因为基于华为云Flexus X实例搭建CRM管理平台,可以从容面对企业内部瞬息万变的业务压力变化
2、华为云服务器Flexus X方案及优势:
灵活伸缩
搭配弹性伸缩服务AS及负载均衡服务ELB,可以实现基于业务负载的快速弹缩,从容应对多变的市场业务压力
数据可靠
搭配华为云数据库服务,存储电商持久化数据,使用方便,可靠性高
安全可靠
搭配WAF、DDoS等网络安全服务,实现对电商业务全方位安全防护,降低黑客入侵风险
3、在宝塔里面安装必要的环境PHP7.3、Mysql5.6+、NGINX
4、安装搭建好,进入CRM管理界面:
点击添加客户信息的时候就会发现,提示:
APP Referer校验失败。请检查该ak设置的白名单与访问所有的域名是否一致。详情查看:http://lbsyun.baidu.com/apiconsole/key#
这是由于百度地图api接口没有配置好导致的问题出现
当配置好地图参数之后,就可以进行地区定位和使用附件客户等功能了
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 \app\admin\model\User();$auth_user_ids = $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('crm_customer')->alias('customer')->where(['customer_id' => $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['user_id'] = $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 \app\admin\model\User();$recordModel = new \app\admin\model\Record();$fileModel = new \app\admin\model\File();$actionRecordModel = new \app\admin\model\ActionRecord();if (!is_array($param['id'])) {$customer_id[] = $param['id'];} else {$customer_id = $param['id'];}$delIds = [];$errorMessage = [];//数据权限判断$auth_user_ids = $userModel->getUserByPer('crm', 'customer', 'delete');//判断是否客户池数据(客户池数据只有管理员可以删)$adminId = $userModel->getAdminId();$wherePool = $customerModel->getWhereByPool();foreach ($customer_id as $k => $v) {$isDel = true;//数据详情$data = db('crm_customer')->where(['customer_id' => $v])->find();if (!$data) {$isDel = false;$errorMessage[] = 'id为' . $v . '的客户删除失败,错误原因:' . $customerModel->getError();}$resPool = db('crm_customer')->alias('customer')->where(['customer_id' => $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('crm_business')->where(['customer_id' => $v])->find();if ($resBusiness) {$isDel = false;$errorMessage[] = '客户下存在商机,不能删除';}}if ($isDel) {$resContacts = db('crm_contacts')->where(['customer_id' => $v])->find();if ($resContacts) {$isDel = false;// $errorMessage[] = '名称为' . $data['name'] . '的客户删除失败,错误原因:客户下存在联系人,不能删除';$errorMessage[] = '客户下存在联系人,不能删除';}}if ($isDel) {$resContract = db('crm_contract')->where(['customer_id' => $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('crm_customer', $delIds);// 删除关联操作记录$actionRecordModel->delDataById(['types' => 'crm_customer', 'action_id' => $delIds]);foreach ($dataInfo as $k => $v) {RecordActionLog($userInfo['id'], 'crm_customer', 'delete', $v['name'], '', '', '删除了客户:' . $v['name']);}}if ($errorMessage) {return resultArray(['error' => $errorMessage]);} else {return resultArray(['data' => '删除成功']);}}
8、客户信息详情界面
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 \app\admin\model\User();if (!$param['owner_user_id']) {return resultArray(['error' => '变更负责人不能为空']);}if (!$param['customer_id'] || !is_array($param['customer_id'])) {return resultArray(['error' => '请选择需要转移的客户']);}$is_remove = ($param['is_remove'] == 2) ? 2 : 1;$type = $param['type'] == 2 ?: 1;$types = $param['types'] ?: [];$data = [];$data['owner_user_id'] = $param['owner_user_id'];$data['update_time'] = time();$data['follow'] = '待跟进';# 获取客户的时间$data['obtain_time'] = time();$ownerUserName = $userModel->getUserNameById($param['owner_user_id']);$errorMessage = [];foreach ($param['customer_id'] as $customer_id) {$customerInfo = db('crm_customer')->where(['customer_id' => $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['user_id'] = [$customerInfo['owner_user_id']]; //协作人$teamData['types'] = 'crm_customer'; //类型$teamData['types_id'] = $customer_id; //类型ID$teamData['is_del'] = ($is_remove == 1) ? 1 : '';$res = $settingModel->createTeamData($teamData);# 处理分配标识,待办事项专用$data['is_allocation'] = 1;$resCustomer = db('crm_customer')->where(['customer_id' => $customer_id])->update($data);if (!$resCustomer) {$errorMessage[] = $customerInfo['name'] . '转移失败,错误原因:数据出错;';continue;} else {# 处理转移时,负责人出现在只读和读写成员列表中$customerArray = [];$teamCustomer = db('crm_customer')->field(['owner_user_id', 'ro_user_id', 'rw_user_id'])->where('customer_id', $customer_id)->find();if (!empty($teamCustomer['ro_user_id'])) {$customerRo = arrayToString(array_diff(stringToArray($teamCustomer['ro_user_id']), [$teamCustomer['owner_user_id']]));$customerArray['ro_user_id'] = $customerRo;}if (!empty($teamCustomer['rw_user_id'])) {$customerRo = arrayToString(array_diff(stringToArray($teamCustomer['rw_user_id']), [$teamCustomer['owner_user_id']]));$customerArray['rw_user_id'] = $customerRo;}db('crm_customer')->where('customer_id', $customer_id)->update($customerArray);}if (in_array('crm_contacts', $types)) {$contactsIds = [];$contactsIds = db('crm_contacts')->where(['customer_id' => $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('crm_business')->where(['customer_id' => $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('crm_contract')->where(['customer_id' => $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'], 'crm_customer', $customer_id, '', '', '将客户转移给:' . $ownerUserName);RecordActionLog($userInfo['id'], 'crm_customer', 'transfer', $customerInfo['name'], '', '', '将客户:' . $customerInfo['name'] . '转移给:' . $ownerUserName);}if (!$errorMessage) {return resultArray(['data' => '转移成功']);} else {return resultArray(['error' => $errorMessage]);}}
企业CRM管理系统部署上线之后,我们可以在华为云的控制台可以观察监控着CPU使用情况、内存、磁盘等等一切运作情况。华为云真的是性能强大、安全、稳定的云产品!!!
华为云828 为企业提供多行业场景解决方案及企业专属优惠,助力企业实现数字化转型升级,大家赶紧去选购吧!!
相关文章:

828华为云征文|华为云服务器Flexus X搭建悟空crm管理系统——助力企业云上管理(解决APP Referer校验失败问题)
1、为什么我们企业会选择Flexus云服务器X实例来部署自己的CRM管理系统? 因为基于华为云Flexus X实例搭建CRM管理平台,可以从容面对企业内部瞬息万变的业务压力变化 2、华为云服务器Flexus X方案及优势: 灵活伸缩 搭配弹性伸缩服务AS及负载均…...

计算机毕业设计选题推荐-健康健身追踪系统-运动健身系统-Java/Python项目实战
✨作者主页:IT毕设梦工厂✨ 个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。 ☑文末获取源码☑ 精彩专栏推荐⬇⬇⬇ Java项目 Py…...

FPGA开发:初识FPGA × 开发环境
FPGA是什么? FPGA的全称是现场可编程门阵列(Field Programmable Gate Array),一种以数字电路为主的集成芯片,属于可编程逻辑器件PLD的一种。简单来说,就是能用代码编程,直接修改FPGA芯片中数字…...
电脑驱动分类
电脑驱动程序(驱动程序)是操作系统与硬件设备之间的桥梁,用于使操作系统能够识别并与硬件设备进行通信。以下是常见的驱动分类: 1. 设备驱动程序 显示驱动程序:控制显卡和显示器的显示功能,负责图形渲染和…...
理解C++全局对象析构顺序与 IPC 资源管理:避免 coredump
文章目录 0. 概述1. 问题背景2. 问题分析3. 解决方案:手动释放资源4. 深入剖析:为什么手动调用 reset() 有效?5. 延伸思考:如何避免全局对象带来的问题?6. 总结 0. 概述 在编写 C 程序时,使用全局或静态对…...

云计算之大数据(下)
目录 一、Hologres 1.1 产品定义 1.2 产品架构 1.3 Hologres基本概念 1.4 最佳实践 - Hologres分区表 1.5 最佳实践 - 分区字段设置 1.6 最佳实践 - 设置字段类型 1.7 最佳实践 - 存储属性设置 1.8 最佳实践 - 分布键设置 1.9 最佳实践 - 聚簇键设置 1.10 最佳实践 -…...
硬件工程师笔试面试知识器件篇——二极管
目录 4、二极管 4.1、基础 二极管原理图 二极管实物图 4.1.1、基本特性 4.1.2、常见类型 4.1.3、工作原理 4.1.4、应用领域 4.2、相关问题 4.2.1、二极管的PN结是如何形成的? 4.2.2、发光二极管(LED)的工作原理是什么? 4.2.3、在电子电路中,二极管通常如何应用?…...

操作系统安全保护
操作系统安全概述 概念:满足安全策略要求,具有响应安全机制及安全功符合特定安全标准,在一定约束条件下 能抵御常见网络安全威胁,保障自身安全运行及资源安全 安全等级:根据安全功能和安全保障要求分为 用户自主保护…...

STM32硬件篇:W25Q64
W25Q64简介 W25Qxx系列是一种低成本、小型化、使用简单(使用SPI通信协议)的非易失性(掉电不丢失)存储器,常用于数据存储、字库存储、固件程序存储等场景。 【注意】W25Qxx芯片只支持SPI的模式0和模式3。 存储介质&am…...

uni-app 获取当前位置的经纬度以及地址信息
文章目录 uni.getLocation(objc)获取经纬度和地址调试结果问题 uni-app 获取当前位置的经纬度以及地址信息 uni.getLocation(objc) uni-app官方文档定位API: uni.getLocation(OBJECT) uni.getLocation({type: wgs84,success: function (res) {console.log(当前位置的经度&…...
【CSS】尺寸单位
在 CSS 中,常见的尺寸单位有以下几种: 像素(px): 这是最常用的绝对单位。例如 width: 200px; 表示宽度为 200 像素。像素是固定的尺寸,不会随着屏幕分辨率或设备的不同而变化。 备注: 在不同的…...

Agent(智能体)和 MetaGPT,一句话实现整个需求应用代码
前面 2 篇文章,我们使用文生文、文生图和文生音频三个大模型共同实现了图文并茂的儿童绘本故事和绘本故事音频需求: 第一篇 根据主题生成儿童绘本故事:GLM-4-Flash 大模型 API 免费了,手把手构建“儿童绘本”应用实战(…...

[数据结构] 哈希结构的哈希冲突解决哈希冲突
标题:[C] 哈希结构的哈希冲突 && 解决哈希冲突 水墨不写bug 目录 一、引言 1.哈希 2.哈希冲突 3.哈希函数 二、解决哈希冲突 1.闭散列 I,线性探测 II,二次探测 2.开散列 正文开始: 一、引言 哈希表是一种非常实用而…...
Wimdows使用Appium IOS自动化
启动appium服务器: appium -a 127.0.0.1 -p 4724 配置 { "platformName": "iOS", "appium:platformVersion": "16.5.1", "appium:deviceName": "(★StatTrak™) |午夜黑(崭新出厂&#…...

C语言深度剖析--不定期更新的第四弹
哈哈哈哈哈哈,今天一天两更! void关键字 void关键字不能用来定义变量,原因是void本身就被编译器解释为空类型,编译器强制地不允许定义变量 定义变量的本质是:开辟空间 而void 作为空类型,理论上不应该开…...

【手撕数据结构】八大排序神功(上)
目录 冒泡排序【有点拉胯】动图演示:思路解析单趟算法图解代码详解性能优化复杂度分析 直接插入排序【还阔以】动图演示思路解析代码分析与讲解复杂度分析 希尔排序【有点强】动图演示思路讲解排序过程总览代码分析讲解复杂度分析 堆排序【太有石粒啦】动图演示堆的概念与结构向…...

【2024高教社杯全国大学生数学建模竞赛】B题模型建立求解
目录 1问题重述1.1问题背景1.2研究意义1.3具体问题 2总体分析3模型假设4符号说明(等四问全部更新完再写)5模型的建立与求解5.1问题一模型的建立与求解5.1.1问题的具体分析5.1.2模型的准备 目前B题第一问的详细求解过程以及对应论文部分已经完成ÿ…...

OpenHarmony鸿蒙开发( Beta5.0)智能手表应用开发实践
样例简介 本项目是基于BearPi套件开发的智能儿童手表系统,该系统通过与GSM模块(型号:SIM808)的通信来实现通话和定位功能。 智能儿童手表系统可以通过云和手机建立连接,同步时间和获取天气信息,通过手机下…...

共享单车轨迹数据分析:以厦门市共享单车数据为例(一)
共享单车数据作为交通大数据的一个重要组成部分,在现代城市交通管理和规划中发挥着越来越重要的作用。通过对共享单车的数据进行深入分析,城市管理者和规划者能够获得大量有价值的洞察,这些洞察不仅有助于了解城市居民的日常出行模式…...

SprinBoot+Vue在线商城微信小程序的设计与实现
目录 1 项目介绍2 项目截图3 核心代码3.1 Controller3.2 Service3.3 Dao3.4 application.yml3.5 SpringbootApplication3.5 Vue3.6 uniapp代码 4 数据库表设计5 文档参考6 计算机毕设选题推荐7 源码获取 1 项目介绍 博主个人介绍:CSDN认证博客专家,CSDN平…...

【大模型RAG】拍照搜题技术架构速览:三层管道、两级检索、兜底大模型
摘要 拍照搜题系统采用“三层管道(多模态 OCR → 语义检索 → 答案渲染)、两级检索(倒排 BM25 向量 HNSW)并以大语言模型兜底”的整体框架: 多模态 OCR 层 将题目图片经过超分、去噪、倾斜校正后,分别用…...

【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 初始化服务器)
服务端执行命令请求的过程 【专栏简介】【技术大纲】【专栏目标】【目标人群】1. Redis爱好者与社区成员2. 后端开发和系统架构师3. 计算机专业的本科生及研究生 初始化服务器1. 初始化服务器状态结构初始化RedisServer变量 2. 加载相关系统配置和用户配置参数定制化配置参数案…...
在 Nginx Stream 层“改写”MQTT ngx_stream_mqtt_filter_module
1、为什么要修改 CONNECT 报文? 多租户隔离:自动为接入设备追加租户前缀,后端按 ClientID 拆分队列。零代码鉴权:将入站用户名替换为 OAuth Access-Token,后端 Broker 统一校验。灰度发布:根据 IP/地理位写…...
Java - Mysql数据类型对应
Mysql数据类型java数据类型备注整型INT/INTEGERint / java.lang.Integer–BIGINTlong/java.lang.Long–––浮点型FLOATfloat/java.lang.FloatDOUBLEdouble/java.lang.Double–DECIMAL/NUMERICjava.math.BigDecimal字符串型CHARjava.lang.String固定长度字符串VARCHARjava.lang…...
unix/linux,sudo,其发展历程详细时间线、由来、历史背景
sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...

BCS 2025|百度副总裁陈洋:智能体在安全领域的应用实践
6月5日,2025全球数字经济大会数字安全主论坛暨北京网络安全大会在国家会议中心隆重开幕。百度副总裁陈洋受邀出席,并作《智能体在安全领域的应用实践》主题演讲,分享了在智能体在安全领域的突破性实践。他指出,百度通过将安全能力…...

用机器学习破解新能源领域的“弃风”难题
音乐发烧友深有体会,玩音乐的本质就是玩电网。火电声音偏暖,水电偏冷,风电偏空旷。至于太阳能发的电,则略显朦胧和单薄。 不知你是否有感觉,近两年家里的音响声音越来越冷,听起来越来越单薄? —…...
C++.OpenGL (14/64)多光源(Multiple Lights)
多光源(Multiple Lights) 多光源渲染技术概览 #mermaid-svg-3L5e5gGn76TNh7Lq {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-3L5e5gGn76TNh7Lq .error-icon{fill:#552222;}#mermaid-svg-3L5e5gGn76TNh7Lq .erro…...

零知开源——STM32F103RBT6驱动 ICM20948 九轴传感器及 vofa + 上位机可视化教程
STM32F1 本教程使用零知标准板(STM32F103RBT6)通过I2C驱动ICM20948九轴传感器,实现姿态解算,并通过串口将数据实时发送至VOFA上位机进行3D可视化。代码基于开源库修改优化,适合嵌入式及物联网开发者。在基础驱动上新增…...

系统掌握PyTorch:图解张量、Autograd、DataLoader、nn.Module与实战模型
本文较长,建议点赞收藏,以免遗失。更多AI大模型应用开发学习视频及资料,尽在聚客AI学院。 本文通过代码驱动的方式,系统讲解PyTorch核心概念和实战技巧,涵盖张量操作、自动微分、数据加载、模型构建和训练全流程&#…...