当前位置: 首页 > news >正文

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 免费了,手把手构建“儿童绘本”应用实战&#xff08…...

[数据结构] 哈希结构的哈希冲突解决哈希冲突

标题:[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题第一问的详细求解过程以及对应论文部分已经完成&#xff…...

OpenHarmony鸿蒙开发( Beta5.0)智能手表应用开发实践

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

共享单车轨迹数据分析:以厦门市共享单车数据为例(一)

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

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

4--SpringBootWeb-请求响应

目录 postman 1.简单参数 请求参数名与形参变量名一致时 请求参数名与形参变量名不一致时 2.实体参数 简单实体对象 复杂实体对象 3.数组集合参数 数组 集合 4.日期参数 5.JSON参数 6.路径参数 1 2 postman Postman值一款功能强大的网页调试与发送网页HTTP请求的…...

电脑点击关机之后,又自动重启开机了。根本就关不了?

前言 有个小姐姐说,她家的电脑好生奇怪:点击【关机】按钮之后,电脑提示【正在关机】,过了几秒,电脑又自动开机了…… 好家伙!也就是说关机和重启根本就没区别,电脑完全无法断电。 最后忍无可…...

强化网络安全:通过802.1X协议保障远程接入设备安全认证

随着远程办公和移动设备的普及,企业网络面临着前所未有的安全挑战。为了确保网络的安全性,同时提供无缝的用户体验,我们的 ASP 身份认证平台引入了先进的 802.1X 认证协议,确保只有经过认证的设备才能接入您的网络。本文档将详细介…...

链动2+1模式AI智能名片S2B2C商城小程序源码在社群商业价值构建中的应用探索

摘要:在数字经济浪潮的推动下,社群作为商业生态的核心组成部分,其商业价值正以前所未有的速度增长。本文深入探讨了如何通过“链动21模式AI智能名片S2B2C商城小程序源码”这一前沿技术工具,深度挖掘并优化社群的商业价值。通过详细…...

基于SpringBoot+Vue+MySQL的校园周边美食探索及分享平台

系统背景 在当今数字化时代,校园生活正日益融入信息技术的浪潮之中,学生们对于便捷、高效且富有趣味性的生活方式有着越来越高的追求。特别是在饮食文化方面,随着校园周边餐饮业态的日益丰富,学生们渴望一个能够集美食探索、分享与…...

“设计模式双剑合璧:工厂模式与策略模式在支付系统中的完美结合”

工厂模式(Factory Pattern)和策略模式(Strategy Pattern)都是常见的设计模式,但它们解决的问题和应用场景不同。下面是它们的区别: 1. 目的不同: 工厂模式(Factory Pattern&#xf…...

第二百一十九节 JPA 教程 - JPA 字段映射示例

JPA 教程 - JPA 字段映射示例 当将 Java bean 字段映射到数据库列时,我们可以选择标记字段,标记 getter 方法并标记两者。 标记字段 以下代码来自 Professor.java。 它显示如何将主键列标记为 Java bean 字段标识。 package cn.w3cschool.common; im…...

目标检测-YOLOv6

YOLOv6 YOLOv6 是 YOLO 系列的一个新版本,相比 YOLOv5 进行了大量的优化与改进。YOLOv6 的设计目标是在提高模型检测精度的同时,进一步优化速度和效率,特别是在推理速度和部署便捷性方面。它采用了更先进的网络架构和优化技巧,在…...

Java面向对象与多态

目录 Java面向对象与多态 多态介绍 形成多态的前提 多态下成员访问的特点 成员变量 成员方法 访问特点总结 多态对比普通继承 普通继承优点与缺点 多态优点与缺点 向上转型与向下转型 向下转型存在的问题 多态接口练习 Java面向对象与多态 多态介绍 在前面学习到…...

redis分布式锁和lua脚本

业务场景:多个线程对共同资源的访问:库存超卖/用户重复下单的原因 解决方法一:利用jvm内置锁,将非原子性操作变成原子性操作 Synchronized锁的是对象,对象必须是单例的。锁的是this,代表当前所在的类,这个…...