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

Docker 离线安装指南
参考文章 1、确认操作系统类型及内核版本 Docker依赖于Linux内核的一些特性,不同版本的Docker对内核版本有不同要求。例如,Docker 17.06及之后的版本通常需要Linux内核3.10及以上版本,Docker17.09及更高版本对应Linux内核4.9.x及更高版本。…...

日语AI面试高效通关秘籍:专业解读与青柚面试智能助攻
在如今就业市场竞争日益激烈的背景下,越来越多的求职者将目光投向了日本及中日双语岗位。但是,一场日语面试往往让许多人感到步履维艰。你是否也曾因为面试官抛出的“刁钻问题”而心生畏惧?面对生疏的日语交流环境,即便提前恶补了…...

基于uniapp+WebSocket实现聊天对话、消息监听、消息推送、聊天室等功能,多端兼容
基于 UniApp + WebSocket实现多端兼容的实时通讯系统,涵盖WebSocket连接建立、消息收发机制、多端兼容性配置、消息实时监听等功能,适配微信小程序、H5、Android、iOS等终端 目录 技术选型分析WebSocket协议优势UniApp跨平台特性WebSocket 基础实现连接管理消息收发连接…...

对WWDC 2025 Keynote 内容的预测
借助我们以往对苹果公司发展路径的深入研究经验,以及大语言模型的分析能力,我们系统梳理了多年来苹果 WWDC 主题演讲的规律。在 WWDC 2025 即将揭幕之际,我们让 ChatGPT 对今年的 Keynote 内容进行了一个初步预测,聊作存档。等到明…...

Module Federation 和 Native Federation 的比较
前言 Module Federation 是 Webpack 5 引入的微前端架构方案,允许不同独立构建的应用在运行时动态共享模块。 Native Federation 是 Angular 官方基于 Module Federation 理念实现的专为 Angular 优化的微前端方案。 概念解析 Module Federation (模块联邦) Modul…...

C++ 求圆面积的程序(Program to find area of a circle)
给定半径r,求圆的面积。圆的面积应精确到小数点后5位。 例子: 输入:r 5 输出:78.53982 解释:由于面积 PI * r * r 3.14159265358979323846 * 5 * 5 78.53982,因为我们只保留小数点后 5 位数字。 输…...

【开发技术】.Net使用FFmpeg视频特定帧上绘制内容
目录 一、目的 二、解决方案 2.1 什么是FFmpeg 2.2 FFmpeg主要功能 2.3 使用Xabe.FFmpeg调用FFmpeg功能 2.4 使用 FFmpeg 的 drawbox 滤镜来绘制 ROI 三、总结 一、目的 当前市场上有很多目标检测智能识别的相关算法,当前调用一个医疗行业的AI识别算法后返回…...

dify打造数据可视化图表
一、概述 在日常工作和学习中,我们经常需要和数据打交道。无论是分析报告、项目展示,还是简单的数据洞察,一个清晰直观的图表,往往能胜过千言万语。 一款能让数据可视化变得超级简单的 MCP Server,由蚂蚁集团 AntV 团队…...
rnn判断string中第一次出现a的下标
# coding:utf8 import torch import torch.nn as nn import numpy as np import random import json""" 基于pytorch的网络编写 实现一个RNN网络完成多分类任务 判断字符 a 第一次出现在字符串中的位置 """class TorchModel(nn.Module):def __in…...

面向无人机海岸带生态系统监测的语义分割基准数据集
描述:海岸带生态系统的监测是维护生态平衡和可持续发展的重要任务。语义分割技术在遥感影像中的应用为海岸带生态系统的精准监测提供了有效手段。然而,目前该领域仍面临一个挑战,即缺乏公开的专门面向海岸带生态系统的语义分割基准数据集。受…...