Skip to content

Commit

Permalink
72crm_9.0.1_20190517
Browse files Browse the repository at this point in the history
【重要提示】将更新包中的SQL文件(/public/sql/update_sql_190517.sql)执行导入,此sql文件只用于本次(版本号:72crm_9.0.1_20190517)升级,请勿重复执行。

新增:

1、新增办公、客户管理待办事项提醒

2、新增客户、联系人、线索数据查重功能

3、合同、回款的高级筛选中增加“审核状态”筛选

4、线索、客户、联系人列表模糊搜索增加手机号、电话

5、增加外国手机号格式

优化:

1、	新建办公审批-类型选择弹窗优化

2、	日志、审批、公告列表展示优化

3、	跟进记录、日志、任务描述、自定义字段多行文本中的输入框换行问题

4、	element-ui升级至最新版本

修复:

1、	合同翻页报错

2、	回款编号、回款日期筛选无效

3、	添加任务标签,提示“无权操作”

4、	合同高级筛选的“下单时间、合同开始时间、合同到期时间”筛选无效

5、	火狐浏览器上下滚动问题

6、	审批筛选时间问题
  • Loading branch information
WukongSoftware committed May 18, 2019
1 parent 50b65f7 commit e04d45a
Show file tree
Hide file tree
Showing 251 changed files with 3,750 additions and 461 deletions.
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

QQ群交流群⑩群:[486745026](https:////shang.qq.com/wpa/qunwpa?idkey=f4687b809bf63f08f707aa1c56dee8dbcb9526237c429c4532222021d65bf83c)

微信交流群(一二群已满,请加三五群)


<img src="https://gitee.com/uploads/images/2019/0424/145109_b9d476e1_345098.png" width="400">

悟空CRM采用全新的前后端分离模式,本仓库代码中已集成前端vue打包后文件,可免去打包操作

Expand Down Expand Up @@ -85,20 +89,8 @@ PHP >= 5.6.0 (暂不支持PHP7及以上版本)

以下为悟空CRM9.0 部分功能系统截图



![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g1.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g2.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g3.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g4.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g5.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g6.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g7.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g8.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g9.png)
![](https://github.com/72crm/72crm/blob/master/ux/intro_img/g10.png)



![](https://gitee.com/uploads/images/2019/0404/203155_47f691bc_345098.png "g3.png")
![](https://gitee.com/uploads/images/2019/0404/203205_b8545907_345098.png "g4.png")
![](https://gitee.com/uploads/images/2019/0404/203229_81b5c962_345098.png "g6.png")


2 changes: 1 addition & 1 deletion application/admin/model/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function requestData()
protected function fmtRequest( $request = [] )
{
$pageType = $request['pageType'] ? 'all' : ''; //all全部(不分页)
$page = 0;
$page = 1;
if (isset($request['page']) && is_numeric($request['page']) ) {
$page = $request['page'];
unset($request['page']);
Expand Down
17 changes: 15 additions & 2 deletions application/admin/model/Excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,30 @@ public function importExcel($file, $param)

//实例化主文件
vendor("phpexcel.PHPExcel");

// set_time_limit(300);
// ini_set("memory_limit","1024M");

// $cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_wincache;
// $cacheSettings = array( 'memcacheServer' => 'localhost',
// 'memcachePort' => 11211,
// 'cacheTime' => 600
// );
// \PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);

$objPHPExcel = new \phpexcel();

if ($ext =='xlsx') {
$objWriter = new \PHPExcel_Writer_Excel2007($objPHPExcel);
$objRender = \PHPExcel_IOFactory::createReader('Excel2007');
// $objRender->setReadDataOnly(true);
$ExcelObj = $objRender->load($savePath);
} else if ($ext =='xls') {
} elseif ($ext =='xls') {
$objWriter = new \PHPExcel_Writer_Excel5($objPHPExcel);
$objRender = \PHPExcel_IOFactory::createReader('Excel5');
// $objRender->setReadDataOnly(true);
$ExcelObj = $objRender->load($savePath);
} else if ($ext=='csv') {
} elseif ($ext=='csv') {
$objWriter = new \PHPExcel_Reader_CSV($objPHPExcel);
//默认输入字符集
$objWriter->setInputEncoding('UTF-8');
Expand Down
16 changes: 15 additions & 1 deletion application/admin/model/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ public function field($param, $dataInfo = [])
}
if ($param['action'] == 'excel') {
$map['form_type'] = array('not in',['file','form','user','structure']);
}
}
if ($param['action'] == 'index') {
$map['form_type'] = array('not in',['file','form']);
}

$map['types_id'] = $types_id;
$order = 'order_id asc, field_id asc';
Expand Down Expand Up @@ -716,6 +719,17 @@ public function fieldSearch($param)
->field('field,name,form_type,setting')
->order('order_id asc, field_id asc, update_time desc')
->select();
if (in_array($types,['crm_contract','crm_receivables'])) {
$field_arr = [
'0' => [
'field' => 'check_status',
'name' => '审核状态',
'form_type' => 'select',
'setting' => '待审核'.chr(10).'审核中'.chr(10).'审核通过'.chr(10).'审核失败'.chr(10).'已撤回'
]
];
$field_list = array_merge($field_list, $field_arr);
}
foreach ($field_list as $k=>$v) {
//处理setting内容
$setting = [];
Expand Down
6 changes: 4 additions & 2 deletions application/admin/model/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public function getDataList($param)
$biRules = [];
$rules = stringToArray($val['rules']) ? : [];
foreach ($rules as $k1=>$v1) {
if ($v1 < 62) {
$ruleInfo = [];
$ruleInfo = db('admin_rule')->where(['id' => $v1])->find();
if ($ruleInfo['types'] == 2) {
$crmRules[] = $v1;
} else {
} elseif ($ruleInfo['types'] == 6) {
$biRules[] = $v1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/admin/model/Scene.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function getDataById($id = '', $user_id, $types = '')
{
$where = [];
$where['scene_id'] = $id;
$where['user_id'] = [['=',$user_id],['=',0],'or'];
// $where['user_id'] = [['=',$user_id],['=',0],'or'];
$data = db('admin_scene')->where($where)->find();
if (!$types) {
$types = $data['types'] ? : '';
Expand Down
4 changes: 2 additions & 2 deletions application/admin/model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function getDataList($request)
$list[$k]['status_name'] = $v['status'] ? $this->statusArr[$v['status']] : '停用';
//角色
$groupsArr = $this->get($v['id'])->groups;
$groups = '';
$groupids = '';
$groups = [];
$groupids = [];
foreach ($groupsArr as $key=>$val) {
$groups[] = $val['title'];
$groupids[] = $val['id'];
Expand Down
4 changes: 2 additions & 2 deletions application/bi/model/Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function getWhereByMoney($whereArr)
*/
function getSortByMoney($whereArr)
{
$money = db('crm_contract')->group('owner_user_id')->field('owner_user_id,sum(money) as money')->where($whereArr)->select();
$money = db('crm_contract')->group('owner_user_id')->field('owner_user_id,sum(money) as money')->order('money desc')->where($whereArr)->select();
return $money;
}
/**
Expand All @@ -56,7 +56,7 @@ function getSortByMoney($whereArr)
*/
function getSortByCount($whereArr)
{
$money = db('crm_contract')->group('owner_user_id')->field('owner_user_id,count(contract_id) as count')->where($whereArr)->select();
$money = db('crm_contract')->group('owner_user_id')->field('owner_user_id,count(contract_id) as count')->order('count desc')->where($whereArr)->select();
return $money;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion application/bi/model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ function getOptionByField($whereArr)
*/
function getSortByCount($whereArr)
{
$count = db('crm_customer')->group('owner_user_id')->field('owner_user_id,count(customer_id) as count')->where($whereArr)->select();
$count = db('crm_customer')->group('owner_user_id')->field('owner_user_id,count(customer_id) as count')->order('count desc')->where($whereArr)->select();
return $count;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion application/bi/model/Examine.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Examine extends Common
*/
public function getSortByExamine($whereArr)
{
$count = db('oa_examine')->group('create_user_id')->field('create_user_id,count(examine_id) as count')->where($whereArr)->select();
$count = db('oa_examine')->group('create_user_id')->field('create_user_id,count(examine_id) as count')->order('count desc')->where($whereArr)->select();
return $count;
}
}
2 changes: 1 addition & 1 deletion application/bi/model/Receivables.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Receivables extends Common
*/
function getSortByMoney($whereArr)
{
$money = db('crm_receivables')->group('owner_user_id')->field('owner_user_id,sum(money) as money')->where($whereArr)->select();
$money = db('crm_receivables')->group('owner_user_id')->field('owner_user_id,sum(money) as money')->order('money desc')->where($whereArr)->select();
return $money;
}
/**
Expand Down
4 changes: 2 additions & 2 deletions application/bi/model/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function getRecordNum($whereArr){
*/
function getSortByCount($whereArr)
{
$count = db('admin_record')->group('create_user_id')->field('create_user_id,count(record_id) as count')->where($whereArr)->select();
$count = db('admin_record')->group('create_user_id')->field('create_user_id,count(record_id) as count')->order('count desc')->where($whereArr)->select();
return $count;
}
/**
Expand All @@ -105,7 +105,7 @@ function getSortByCustomer($whereArr)
foreach ($list as $key => $value) {
$where = array();
$where['create_user_id'] = array('eq',$value['create_user_id']);
$list[$key]['count'] = count(db('admin_record')->group('types_id')->field('count(types_id) as count')->where($where)->select());
$list[$key]['count'] = count(db('admin_record')->group('types_id')->field('count(types_id) as count')->order('count desc')->where($where)->select());
}
return $list;
}
Expand Down
43 changes: 31 additions & 12 deletions application/common.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
error_reporting(E_ERROR | E_PARSE );
/**
* 行为绑定
*/
Expand Down Expand Up @@ -127,6 +126,7 @@ function money_view($money)
function where_arr($array = [], $m = '', $c = '', $a = '')
{
$userModel = new UserModel();
$checkStatusArray = ['待审核' => '0','审核中'=>'1','审核通过'=>'2','审核失败'=>'3','已撤回'=>'4'];
//查询自定义字段模块多选字段类型
$check_field_arr = [];
//特殊字段
Expand Down Expand Up @@ -155,7 +155,8 @@ function where_arr($array = [], $m = '', $c = '', $a = '')
if ($k == 'contacts_name') {
$k = 'name';
$c = 'contacts.';
}
}
if ($k == 'check_status' && is_array($v)) $v = $checkStatusArray[$v['value']] ? : $v;
if (is_array($v)) {
if ($v['state']) {
$address_where[] = '%'.$v['state'].'%';
Expand All @@ -181,18 +182,15 @@ function where_arr($array = [], $m = '', $c = '', $a = '')
}
} elseif (!empty($v['start_date']) || !empty($v['end_date'])) {
if ($v['start_date'] && $v['end_date']) {
$where[$c.$k] = ['between', [strtotime($v['start_date']), strtotime($v['end_date'])]];
$where[$c.$k] = ['between', [$v['start_date'], $v['end_date']]];
} elseif ($v['start_date']) {
$where[$c.$k] = ['egt', strtotime($v['start_date'])];
$where[$c.$k] = ['egt', $v['start_date']];
} else {
$where[$c.$k] = ['elt', strtotime($v['end_date']+86399)];
$where[$c.$k] = ['elt', $v['end_date']];
}
} elseif (!empty($v['value'])) {
if (in_array($k, $check_field_arr)) {
$where[$c.$k] = field($v['value'], 'contains');
} elseif (($c == 'business' || $c == 'business.') && $k == 'type_id') {
$where[$c.'type_id'] = field($v['type_id'], 'eq');
$where[$c.'status_id'] = field($v['status_id'], 'eq');
} else {
$where[$c.$k] = field($v['value'], $v['condition']);
}
Expand Down Expand Up @@ -590,12 +588,10 @@ function updateActionLog($user_id, $types, $action_id, $oldData = [], $newData =
$structureModel = new \app\admin\model\Structure();
$field_arr = $fieldModel->getField(['types' => $types,'unFormType' => ['file','form']]); //获取字段属性
$newFieldArr = array();
$unField = ['update_time','create_time']; //定义过滤字段
foreach ($field_arr as $k=>$v) {
if (!in_array($v['field'],$unField)) {
$newFieldArr[$v['field']] = $v;
}
$newFieldArr[$v['field']] = $v;
}
$unField = ['update_time']; //定义过滤字段
$message = [];
$un_form_type = ['file','form'];
foreach ($differentData as $k=>$v) {
Expand Down Expand Up @@ -1342,4 +1338,27 @@ function setconfig($pat, $rep)
} else {
return flase;
}
}

/**
* 处理 字符串转数组 入库
* @author zhi
* @param [type] $data 字符串
* @return [type] $setting 转数组后
*/
function setting($data)
{
$setting = 'array(';
$i = 0;
$options = explode(' ',$data);
$s = array();
foreach($options as $v){
$v = trim(str_replace(chr(13),'',trim($v)));
if($v != '' && !in_array($v ,$s)){
$i++;
$setting .= "$i=>'$v',";
$s[] = $v;
}
}
return $setting = substr($setting,0,strlen($setting) -1 ) .')';
}
70 changes: 68 additions & 2 deletions application/crm/controller/Contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use app\admin\controller\ApiCommon;
use think\Hook;
use think\Request;
use think\Db;

class Contacts extends ApiCommon
{
Expand Down Expand Up @@ -62,7 +63,18 @@ public function save()
$param['create_user_id'] = $userInfo['id'];
$param['owner_user_id'] = $userInfo['id'];

if ($contactsModel->createData($param)) {
if ($data = $contactsModel->createData($param)) {
//关联 联系人与商机 客户添加与商机添加联系人可共用此接口
$business_id = $param['business_id']?$param['business_id']:0;
if($business_id != 0){
$data['cancel_or_relation'] = 1;// 1:关联 0取消
$data['business_id'] = $business_id;
if ($res = Db::name('crm_contacts_business')->data($data)->insert()) {
return resultArray(['data' => '添加成功']);
} else {
return resultArray(['error' => Db::name('crm_contacts_business')->getError()]);
}
}
return resultArray(['data' => '添加成功']);
} else {
return resultArray(['error' => $contactsModel->getError()]);
Expand Down Expand Up @@ -300,5 +312,59 @@ public function excelImport()
return resultArray(['error'=>$excelModel->getError()]);
}
return resultArray(['data'=>'导入成功']);
}
}
/**
* 联系人 关联/取消关联 商机
* @return [type] [description]
*/
public function relation()
{
$param = $this->param;
// $param['cancel_or_relation'] = 1;// 1:关联 0取消
// $param['contacts_id'] = 1;
// $param['business_id'] = 7;
$id = Db::name('crm_contacts_business')->where(['contacts_id' => ['eq',$param['contacts_id']],'business_id' => ['eq',$param['business_id']]])->column('id');
if($id){
if ($res = Db::name('crm_contacts_business')->where('id',$id[0])->update($param)) {
return resultArray(['data' => $res]);
} else {
return resultArray(['error' => Db::name('crm_contacts_business')->getError()]);
}
}else{
if ($res = Db::name('crm_contacts_business')->data($param)->insert()) {
return resultArray(['data' => $res]);
} else {
return resultArray(['error' => Db::name('crm_contacts_business')->getError()]);
}
}
}
/**
* 关联展示 联系人模块展示商机 商机模块展示联系人
* @return [type] [description]
*/
public function relationInfo()
{
$param = $this->param;
if(empty($param['contacts_id']) && empty($param['business_id'])){
$errorMessage[] = '参数错误!';
return resultArray(['error' => $errorMessage]);
}else{
if($param['contacts_id']){
$businessModel = model('Business');
$list = Db::name('crm_contacts_business')->field('business_id')->where(['cancel_or_relation' => ['eq',1],'contacts_id' => ['eq',$param['contacts_id']]])->select();
foreach ($list as $key => $value) {
$data = $businessModel->getDataById($value['business_id']);
$list[$key][] = $data;
}
}else{
$contactsModel = model('Contacts');
$list = Db::name('crm_contacts_business')->field('business_id')->where(['cancel_or_relation' => ['eq',1],'business_id' => ['eq',$param['business_id']]])->select();
foreach ($list as $key => $value) {
$data = $contactsModel->getDataById($value['business_id']);
$list[$key][] = $data;
}
}
return resultArray(['data' => $list]);
}
}
}
Loading

0 comments on commit e04d45a

Please sign in to comment.