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平…...

Linux 文件类型,目录与路径,文件与目录管理
文件类型 后面的字符表示文件类型标志 普通文件:-(纯文本文件,二进制文件,数据格式文件) 如文本文件、图片、程序文件等。 目录文件:d(directory) 用来存放其他文件或子目录。 设备…...

dify打造数据可视化图表
一、概述 在日常工作和学习中,我们经常需要和数据打交道。无论是分析报告、项目展示,还是简单的数据洞察,一个清晰直观的图表,往往能胜过千言万语。 一款能让数据可视化变得超级简单的 MCP Server,由蚂蚁集团 AntV 团队…...

回溯算法学习
一、电话号码的字母组合 import java.util.ArrayList; import java.util.List;import javax.management.loading.PrivateClassLoader;public class letterCombinations {private static final String[] KEYPAD {"", //0"", //1"abc", //2"…...

Linux 内存管理实战精讲:核心原理与面试常考点全解析
Linux 内存管理实战精讲:核心原理与面试常考点全解析 Linux 内核内存管理是系统设计中最复杂但也最核心的模块之一。它不仅支撑着虚拟内存机制、物理内存分配、进程隔离与资源复用,还直接决定系统运行的性能与稳定性。无论你是嵌入式开发者、内核调试工…...
A2A JS SDK 完整教程:快速入门指南
目录 什么是 A2A JS SDK?A2A JS 安装与设置A2A JS 核心概念创建你的第一个 A2A JS 代理A2A JS 服务端开发A2A JS 客户端使用A2A JS 高级特性A2A JS 最佳实践A2A JS 故障排除 什么是 A2A JS SDK? A2A JS SDK 是一个专为 JavaScript/TypeScript 开发者设计的强大库ÿ…...
LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》
这段 Python 代码是一个完整的 知识库数据库操作模块,用于对本地知识库系统中的知识库进行增删改查(CRUD)操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 📘 一、整体功能概述 该模块…...
Spring Boot + MyBatis 集成支付宝支付流程
Spring Boot MyBatis 集成支付宝支付流程 核心流程 商户系统生成订单调用支付宝创建预支付订单用户跳转支付宝完成支付支付宝异步通知支付结果商户处理支付结果更新订单状态支付宝同步跳转回商户页面 代码实现示例(电脑网站支付) 1. 添加依赖 <!…...

WebRTC调研
WebRTC是什么,为什么,如何使用 WebRTC有什么优势 WebRTC Architecture Amazon KVS WebRTC 其它厂商WebRTC 海康门禁WebRTC 海康门禁其他界面整理 威视通WebRTC 局域网 Google浏览器 Microsoft Edge 公网 RTSP RTMP NVR ONVIF SIP SRT WebRTC协…...

倒装芯片凸点成型工艺
UBM(Under Bump Metallization)与Bump(焊球)形成工艺流程。我们可以将整张流程图分为三大阶段来理解: 🔧 一、UBM(Under Bump Metallization)工艺流程(黄色区域ÿ…...
大模型真的像人一样“思考”和“理解”吗?
Yann LeCun 新研究的核心探讨:大语言模型(LLM)的“理解”和“思考”方式与人类认知的根本差异。 核心问题:大模型真的像人一样“思考”和“理解”吗? 人类的思考方式: 你的大脑是个超级整理师。面对海量信…...