Repository: qincrm/crm
Branch: main
Commit: 8586c15784be
Files: 100
Total size: 252.7 KB
Directory structure:
gitextract_m3jzydhx/
├── .github/
│ ├── actions/
│ │ └── build-docs/
│ │ ├── Dockerfile
│ │ └── entrypoint.sh
│ └── workflows/
│ ├── codecov.yml
│ ├── docs.yml
│ └── install.yml
├── .gitignore
├── LICENSE.md
├── README.md
├── app/
│ ├── Console/
│ │ ├── Commands/
│ │ │ ├── .gitkeep
│ │ │ ├── Assign.php
│ │ │ ├── Channel.php
│ │ │ └── Mobile.php
│ │ └── Kernel.php
│ ├── Events/
│ │ ├── Event.php
│ │ └── ExampleEvent.php
│ ├── Exceptions/
│ │ └── Handler.php
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── AssignController.php
│ │ │ ├── Controller.php
│ │ │ ├── CustomController.php
│ │ │ ├── NoticeController.php
│ │ │ ├── ProductController.php
│ │ │ ├── SystemRoleController.php
│ │ │ ├── SystemTeamController.php
│ │ │ ├── SystemUserController.php
│ │ │ └── UserController.php
│ │ └── Middleware/
│ │ └── AuthMiddleware.php
│ ├── Jobs/
│ │ ├── ExampleJob.php
│ │ └── Job.php
│ ├── Listeners/
│ │ └── ExampleListener.php
│ ├── Models/
│ │ ├── BaseModel.php
│ │ ├── Captcha.php
│ │ ├── Channel.php
│ │ ├── Constants.php
│ │ ├── Customer.php
│ │ ├── CustomerBack.php
│ │ ├── CustomerLog.php
│ │ ├── CustomerRemarkLog.php
│ │ ├── CustomerRuleConfig.php
│ │ ├── Excel/
│ │ │ └── CustomerModel.php
│ │ ├── Notice.php
│ │ ├── Product.php
│ │ ├── SystemDict.php
│ │ ├── SystemFields.php
│ │ ├── SystemLog.php
│ │ ├── SystemRight.php
│ │ ├── SystemRole.php
│ │ ├── SystemRoleRight.php
│ │ ├── SystemSetting.php
│ │ ├── SystemTeam.php
│ │ ├── SystemUser.php
│ │ └── SystemUserRole.php
│ ├── Providers/
│ │ ├── AppServiceProvider.php
│ │ ├── AuthServiceProvider.php
│ │ └── EventServiceProvider.php
│ ├── Services/
│ │ ├── AssignRule/
│ │ │ ├── Rule1.php
│ │ │ ├── Rule10.php
│ │ │ ├── Rule11.php
│ │ │ ├── Rule13.php
│ │ │ ├── Rule2.php
│ │ │ ├── Rule3.php
│ │ │ ├── Rule4.php
│ │ │ ├── Rule5.php
│ │ │ ├── Rule6.php
│ │ │ └── Rule7.php
│ │ ├── AssignService.php
│ │ ├── CustomerEditService.php
│ │ ├── CustomerService.php
│ │ ├── Hook/
│ │ │ └── LoginHook.php
│ │ ├── RightService.php
│ │ ├── SelectService.php
│ │ ├── ToolService.php
│ │ └── UserService.php
│ └── User.php
├── artisan
├── bootstrap/
│ └── app.php
├── composer.json
├── config/
│ ├── database.php
│ ├── logging.php
│ └── session.php
├── database/
│ ├── factories/
│ │ └── ModelFactory.php
│ ├── migrations/
│ │ └── .gitkeep
│ └── seeds/
│ └── DatabaseSeeder.php
├── docs/
│ └── README.md
├── install/
│ ├── crm.sql
│ └── nginx.conf
├── nginx.conf
├── package.json
├── phpunit.xml
├── public/
│ ├── .htaccess
│ ├── index.html
│ ├── index.php
│ └── resource/
│ └── template.xlsx
├── resources/
│ └── views/
│ └── .gitkeep
├── routes/
│ └── web.php
├── storage/
│ ├── app/
│ │ └── .gitignore
│ ├── framework/
│ │ ├── cache/
│ │ │ └── .gitignore
│ │ └── views/
│ │ └── .gitignore
│ └── logs/
│ └── .gitignore
└── tests/
├── ExampleTest.php
└── TestCase.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/actions/build-docs/Dockerfile
================================================
FROM phpdoc/phpdoc
LABEL "repository"="https://github.com/qincrm/crm"
LABEL "com.github.actions.name"="Build Docs"
LABEL "com.github.actions.description"="Build Docs with phpDocumentor"
LABEL "com.github.actions.icon"="file-text"
LABEL "com.github.actions.color"="blue"
# don't show errors
RUN echo "display_errors = Off" > $PHP_INI_DIR/conf.d/errors.ini
COPY entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
================================================
FILE: .github/actions/build-docs/entrypoint.sh
================================================
#!/bin/sh
set -eu
/opt/phpdoc/bin/phpdoc
================================================
FILE: .github/workflows/codecov.yml
================================================
name: codecov
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
================================================
FILE: .github/workflows/docs.yml
================================================
name: Docs
on:
push:
branches:
- master # disable
permissions: {}
jobs:
build_and_publish:
permissions:
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
name: Build and publish Docs
runs-on: ubuntu-latest
if: github.repository == 'qincrm/crm'
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Build Docs
uses: ./.github/actions/build-docs
- name: Publish Docs to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs
env:
BUILD_DIR: docs/
GH_PAT: ${{ secrets.GH_PAT }}
================================================
FILE: .github/workflows/install.yml
================================================
name: install
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP 7.1.3
uses: shivammathur/setup-php@v2
with:
php-version: '7.1.3'
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
# - name: Run test suite
# run: composer run-script test
================================================
FILE: .gitignore
================================================
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
.DS_Store
================================================
FILE: LICENSE.md
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
#
司跃CRM [![Code Climate][codeclimate-img-url]][codeclimate-url] [](https://github.com/qincrm/crm/actions/workflows/install.yml) [](https://lumen.laravel.com/) [](https://github.com/arco-design/arco-design)
[codeclimate-img-url]: https://codeclimate.com/github/qincrm/crm.svg
[codeclimate-url]: https://codeclimate.com/github/qincrm/crm
### 一、CRM系统服务介绍
1、提供适合各行业的CRM系统,支持个性字段定制
2、提升业务精细化运营程度,提高客户转化率,缩短客户成交周期,总体提升中介业绩产能30%以上
3、源码交付,独立服务器部署,让机构真正意义上拥有自己的CRM系统,把数据掌握在自己手中
4、系统一次部署,永久使用,不限坐席
5、灵活API接口配置,支持客户数据直接接入,支持实时撞库排重
6、支持移动端APP,提高工作效率
### 三、开源版 VS 收费版
||开源版|收费版|
| ------------- | ------------- | ------------- |
|首页|✅|✅|
|客户管理|✅|✅|
|新数据客户管理|✅|✅|
|无效客户管理|✅|✅|
|公共池客户管理|✅|✅|
|运营管理|✅|✅|
|产品管理|✅|✅|
|系统管理|✅|✅|
|任务审批流|❌|✅|
|渠道管理|❌|✅|
|数据报表|❌|✅|
|手机APP(一键外呼)|❌|✅|
|主管点评|❌|✅|
|上门登记二维码|❌|✅|
|前端源码|❌|✅|
|技术支持|❌|✅|
### 四、系统功能概览
![img1]
[img1]: https://github.com/qincrm/crm/raw/main/resources/1.png
### 五、系统功能简介
1、登录系统默认进入首页,首页展示当前登录用户名下数据概况,以及部分快捷操作按钮
* 如待办消息提醒、上级点评提醒、在线状态一键切换
![img2]
[img2]: https://github.com/qincrm/crm/raw/main/resources/2.png
2、我的审批,系统支持重要流程系统审批
* 我发起的审批,支持系统用户查看自己发起的流程,了解审批进度
* 我处理的审批,新审批消息及时提醒、快捷审批
![img3]
[img3]: https://github.com/qincrm/crm/raw/main/resources/3.png
3、客户管理
* 客户数据销售跟进仅可查看自己名下数据,上级可查看下级名下数据
* 全部客户展示销售顾问名下跟进的所有数据,分配后未跟进的数据,蓝色底色标记置顶优先展示,跟进后的数据不做特殊标记
* 公共池流转出的数据及从其他销售顾问名下流转的数据展示在再分配客户
* 渠道新数据分配,菜单展示数据条数提醒销售顾问及时跟进
* 工作台支持对客户基本信息、资质信息、星级、跟进状态维护;支持对客户进行锁定、标记重要、移入公海、添加待办、维护回款主管点评等操作
![img4]
[img4]: https://github.com/qincrm/crm/raw/main/resources/4.png
4、新数据公共池&公共池客户
* 渠道新数据无效销售顾问可分配时,数据流入公共池
* 公共池客户为按照系统配置流转规则流入公海的数据
* 公海数据支持批量划转、导入、分配等操作
5、数据管理
* 实时按渠道监控数据星级分布情况,辅助机构调整流量
![img5]
[img5]: https://github.com/qincrm/crm/raw/main/resources/5.png
6、数据管理—成本、回款、工作日志
* 工作日志按跟进顾问唯独量化销售工作量级,同时监控数据成本及回款情况,辅助机构精细化运营
* 按渠道统计数据的星级、转化情况,辅助机构选择优质渠道,降低获客成本
![img6]
[img6]: https://github.com/qincrm/crm/raw/main/resources/6.png
7、客户流转规则
* 支持自定义符合机构业务逻辑的客户流转规则,提升客户转化效率
![img7]
[img7]: https://github.com/qincrm/crm/raw/main/resources/7.png
8、销售顾问跟进数据权限
* 分数据类型设置销售顾问数据上限
![img8]
[img8]: https://github.com/qincrm/crm/raw/main/resources/8.png
9、渠道管理
* 统一管理系统API数据渠道,撞库渠道,支持增删渠道,快速接入新渠道
![img9]
[img9]: https://github.com/qincrm/crm/raw/main/resources/9.png
10、产品管理
* 支持维护机构合作产品信息,以及产品要求的信息,辅助销售顾问查看
![img10]
[img10]: https://github.com/qincrm/crm/raw/main/resources/10.png
11、用户管理
* 用户管理支持对系统用户增、删、改、查;调整用户权限及上下级关系
![img11]
[img11]: https://github.com/qincrm/crm/raw/main/resources/11.png
12、岗位管理
* 支持按照岗位分配系统权限,系统查看操作权限最小唯独为按钮级别
![img12]
[img12]: https://github.com/qincrm/crm/raw/main/resources/12.png
13、ip白名单管理
* 非系统白名单ip地址不可登录,有效控制风险
![img13]
[img13]: https://github.com/qincrm/crm/raw/main/resources/13.png
14、 移动APP
![img14]
[img14]: https://github.com/qincrm/crm/raw/main/resources/14.jpg
![img15]
[img15]: https://github.com/qincrm/crm/raw/main/resources/15.jpg
[下载地址](https://github.com/qincrm/crm/releases/download/1.0.0/app-release-v1.0.apk)
### 六、部署说明
* Nginx 1.22.0
* MySQL 5.7.39
* PHP-7.4.30
前端代码: https://github.com/qincrm/crm/releases/tag/1.0.1
NGINX配置: https://github.com/qincrm/crm/blob/main/install/nginx.conf
数据库文件: https://github.com/qincrm/crm/blob/main/install/crm.sql
### 七、联系我们
1、联系方式:iflooor(同微信)
2、详细问题请微信/电话咨询,可开通相关测试账号,可对系统进行功能演示说明
================================================
FILE: app/Console/Commands/.gitkeep
================================================
================================================
FILE: app/Console/Commands/Assign.php
================================================
get();
foreach ($rules as $rule) {
$rulename = $rule->name;
$config = json_decode($rule->config, true);
$status = $rule->status;
if ($status == 0) {
echo $rulename . ':配置关闭' . PHP_EOL;
continue;
}
$ruleClass = '\App\Services\AssignRule\Rule'.$rule->id;
if (!class_exists($ruleClass)) {
echo $rulename . ':找不到规则处理器' . PHP_EOL;
continue;
}
echo $rulename . ': 执行开始 ---> ';
$ruleStrategy = new $ruleClass;
$result = $ruleStrategy->handle($config);
if ($result['status'] != 1) {
echo '异常, '.$result['error'].PHP_EOL;
} else {
echo '执行结束'.PHP_EOL;
}
}
echo date('Y-m-d H:i:s') . ' end.......' . PHP_EOL;
}
}
================================================
FILE: app/Console/Commands/Channel.php
================================================
option('name');
$className = 'App\Services\Channel\\'.ucfirst($channelName).'Channel';
$channel = new $className();
$data = $channel->getData();
$customService = app(CustomerService::class);
foreach ($data as $item) {
$customService->addChannelCustomer($item);
}
}
}
================================================
FILE: app/Console/Commands/Mobile.php
================================================
select('id', 'mobile')->where('id', '>', $id)->orderby('id')->get();
foreach ($mobiles as $mobile) {
$id = $mobile->id;
$x = $model->select('anum')->where('id', '<', $mobile->id)->where('mobile', $mobile->mobile)->orderby('id' ,'desc')->take(1)->get()->toArray();
if ($x && $x[0]) {
if ($x[0]['anum'] == 0) {
$num = $x[0]['anum'] + 2;
} else {
$num = $x[0]['anum'] + 1;
}
$model->where('id', $id)->update(['anum' => $num]);
}
}
file_put_contents("/www/wwwlogs/mobilelog.txt", $id);
}
}
================================================
FILE: app/Console/Kernel.php
================================================
session()->get('user_id');
$params = $request->all();
$data = [];
// 加工下前端数据
foreach ($params['config']['types'] as $type) {
$data[$type] = strval($params['config'][$type."Limit"]);
}
// 保存权限
$model = new SystemUser();
$model = $model->find($params['id']);
DB::beginTransaction();
$oldAssignRight = $model->assign_rights;
$model->assign_rights = json_encode($data);
$flag = $model->save();
if ($flag && $oldAssignRight != $model->assign_rights) {
$logmodel = new SystemLog();
$logmodel->saveLog($logmodel::TYPE_ASSIGN, $params['id'], $oldAssignRight, $model->assign_rights, $userId, strval($params['config']['remark']));
}
DB::commit();
return $this->apiReturn(static::OK, $data);
}
/**
* 查看数据分配权限修改日志
*/
public function log(Request $request) {
$params = $request->all();
$logmodel = new SystemLog();
$list = $logmodel->getLogListById($logmodel::TYPE_ASSIGN, $params['id'], $params);
$service = app(AssignService::class);
$data['total'] = $logmodel->getLogCountById($logmodel::TYPE_ASSIGN, $params['id'], $params);
$model = new SystemUser();
$allUser = collect($model->getAllUserWithDel())->mapWithKeys(function ($item){
return [$item['id'] => $item['name']];
});
foreach ($list as $key => $item) {
$item['before'] = $service->genText($item['before']);
$item['after'] = $service->genText($item['after']);
$item['user'] = $allUser[$item['user_id']];
$list[$key] = $item;
}
$data['list'] = $list;
return $this->apiReturn(static::OK, $data);
}
/**
* 数据分配权限修改日志
*/
public function config(Request $request) {
$logmodel = new CustomerRuleConfig();
$dictModel = new SystemDict();
$list = $logmodel->where('is_del', 0)->orderby('myorder')->get();
foreach ($list as $key => $item) {
$config = json_decode($item['config'], true);
$item['config'] = $config;
$list[$key] = $item;
}
$data['list'] = $list;
$followStatus = $dictModel->getListByType($dictModel::TYPE_FOLLOW);
$starStatus = $dictModel->getListByType($dictModel::TYPE_STAR);
$data['followStatus'] = app(SelectService::class)->genSelectByKV($followStatus); // 城市
$data['starStatus'] = app(SelectService::class)->genSelectByKV($starStatus); // 城市
return $this->apiReturn(static::OK, $data);
}
/**
* 修改流转规则
*/
public function editrule (Request $request) {
$model = new CustomerRuleConfig();
$params = $request->all();
$rules = $params['rule'];
foreach ($rules as $rule) {
$model->where('id', $rule['id'])->update(['status' => $rule['status'], 'config' => json_encode($rule['config'])]);
}
return $this->apiReturn(static::OK, '修改成功');
}
/**
* 修改流转规则状态,开启或关闭
*/
public function setstatus(Request $request) {
$model = new CustomerRuleConfig();
$params = $request->all();
$model = $model->find($params['id']);
if (empty($model)) {
return $this->apiReturn(static::ERROR, [], '操作失败');
}
$model->status = $params['status'];
$model->save();
return $this->apiReturn(static::OK, '修改成功');
}
}
================================================
FILE: app/Http/Controllers/Controller.php
================================================
json([
'code' => $code,
'data' => $data,
'msg' => $msg
], $httpCode);
}
}
================================================
FILE: app/Http/Controllers/CustomController.php
================================================
session()->get('user_id');
$data = [];
$dictModel = new SystemDict();
$userModel = new SystemUser();
$customModel = new Customer();
$customerRemarkLog = new CustomerRemarkLog();
$teammodel = new SystemTeam();
$allTeamListSelect = $teammodel->getAllTeam();
$followTeamArray = collect($allTeamListSelect)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
// 获取客户维度的码表
$customGourpDict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
$data['cityList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_CITY]); // 城市
$data['followStatusList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_FOLLOW]); // 跟进状态
$data['starList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_STAR]); // 星级
$data['userFromList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_USER_FROM]); // 用户来源
$data['sourceList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_SOURCE]); // 渠道来源
$data['zizhiList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_QUALIFICATION]); // 资质说明
$data['teamList'] = app(SelectService::class)->genSelectByKV($followTeamArray); // 转成前端的select
// 筛选项
$params = $request->all();
$export = $params['export'];
$data['master'] = 0;
$followUserArray = app(RightService::class)->getCustomViews($userId);
if ($followUserArray == 'all') {
$followUserList = $userModel->getAllUser();
$followUserArray = collect($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$data['master'] = 1;
} else {
$params['users'] = array_keys($followUserArray);
}
$data['followUserList'] = app(SelectService::class)->genSelectByKV($followUserArray); // 转成前端的select
// 加工显示项目
$list = $customModel->getLists($params);
$customIds = [];
foreach ($list as $key => $item) {
$customIds[] = $item['id'];
$item['notFollowTime'] = app(CustomerService::class)->getNotFollowTime($item);
$item['apply_time'] = empty($item['apply_time']) ? '-' : date('Y-m-d H:i:s', $item['apply_time']);
$item['follow_time'] = empty($item['follow_time']) ? '-' : date('Y-m-d H:i:s', $item['follow_time']);
$item['assign_time'] = empty($item['assign_time']) ? '-' : date('Y-m-d H:i:s', $item['assign_time']);
$item['zizhi'] = app(CustomerService::class)->genZizhi($item);
if ($item['star'] == -1) {
$item['starcolor'] = 'lime';
} else {
$item['starcolor'] = Constants::TAG_COLOR[$item['star']] ?? '';
}
$item['star'] = $customGourpDict[$dictModel::TYPE_STAR][$item['star']] ?? '';
$item['fstatuscolor'] = Constants::TAG_COLOR[$item['follow_status']];
$item['follow_status'] = $customGourpDict[$dictModel::TYPE_FOLLOW][$item['follow_status']] ?? '-';
$item['user_from'] = $customGourpDict[$dictModel::TYPE_USER_FROM][$item['user_from']];
$item['source_id'] = $item['source'];
$item['source'] = $customGourpDict[$dictModel::TYPE_SOURCE][$item['source']];
$item['follow_user'] = $followUserArray[$item['follow_user_id']];
$item['age'] = empty($item['age']) ? '' : $item['age'];
$item['amount'] = $item['amount'] == 0 ? '' : intval($item['amount']);
$item['city'] = $customGourpDict[$dictModel::TYPE_CITY][$item['city']] ?? '-';
$remarks = $customerRemarkLog->getLogListByCustomerId($item['id'], $export ? 100 : 3);
$item['remark'] = implode($export ? "\n":"
", collect($remarks)->map(function($item) use ($followUserArray, $export) {
return $item->remark . ($export ? "[".$item->create_time.":".$followUserArray[$item['user_id']]."]" : "");
})->toArray());
$list[$key] = $item;
}
$data['list'] = $list;
$data['customIds'] = base64_encode(implode('-', $customIds));
$data['total'] = $customModel->getCount($params);
if ($export == 1) {
app(ToolService::class)->csv(
"我的客户",
[
"id" => "id",
"name" => "姓名",
"mobile" => "手机号",
"star" => "星级",
"source" => "渠道",
"follow_status" => "跟进状态",
"remark" => "跟进备注" ,
"follow_time" => "最新跟进时间" ,
],
$list
);
}
return $this->apiReturn(static::OK, $data);
}
/**
* 获取用户信息
*/
public function info(Request $request)
{
$userId = $request->session()->get('user_id');
$color = ['', 'green', 'blue', 'purple', 'pinkpurple', 'red'];
$params = $request->all();
$dictModel = new SystemDict();
$customModel = new Customer();
// 获取客户维度的码表
$customGourpDict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
$data['cityList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_CITY]); // 城市
$data['followStatusList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_FOLLOW]); // 跟进状态
$data['starList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_STAR]); // 星级
$data['userFromList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_USER_FROM]); // 用户来源
$data['sourceList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_SOURCE]); // 渠道来源
$data['zizhiList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_QUALIFICATION]); // 资质说明
$data['workList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_WORK]); // 工作类型
$data['noticesList'] = app(SelectService::class)->genSelectByKV($customGourpDict[$dictModel::TYPE_NOTICE]); // 通知类型
$logList = [];
if (isset($params['id']) && !empty($params['id'])) {
$model = $customModel->find($params['id']);
$followUserArray = app(RightService::class)->getCustomViews($userId);
// 防止越权
if (!in_array($model->follow_user_id, array_keys($followUserArray))) {
return $this->apiReturn(static::ERROR, [], '无客户权限');
}
ToolService::unsetEmptyField($model, ['sex', 'age', 'marry', 'work', 'live_area', 'household_area', 'income', 'amount', 'follow_status', 'star', 'city']);
unset($model['remark']);
// 客户操作日志大杂烩
$logmodel = new CustomerLog();
$logList = $logmodel->getLogListByCustomerId($params['id'], 100);
foreach ($logList as $key => $log) {
$log->color = $color[($log->type % 5) + 1];
$log->type = $logmodel::TYPE_MAPPING[$log->type]." (".$log->username.")";
$log->day = $log->create_time;
$logList[$key] = $log;
}
} else {
$model = new Customer();
}
$data['customInfo'] = $model;
$data['logList'] = $logList;
return $this->apiReturn(static::OK, $data);
}
/**
* 修改用户信息
*/
public function edit(Request $request)
{
$params = $request->all();
unset($params['notices']);
unset($params['update_time']);
$operUserId = $request->session()->get('user_id');
$service = app(CustomerEditService::class);
DB::beginTransaction();
if (isset($params['id'])) {
$result = $service->edit($params, $operUserId);
} else {
$result = $service->add($params, $operUserId);
}
if ($result['status'] == 1) {
DB::commit();
} else {
DB::rollBack();
return $this->apiReturn(static::ERROR, [], $result['error']);
}
return $this->apiReturn(static::OK, [], "操作成功");
}
/**
* 客户分配
*/
public function assign(Request $request)
{
$params = $request->all();
$operUserId = $request->session()->get('user_id');
$followUserId = $params['followUserId'];
$customIds = $params['customIds'];
$customService = app(CustomerService::class);
foreach ($customIds as $customId) {
if (!$customService->canAssign($customId)) {
$model = new Customer();
$custom = $model->find($customId);
return $this->apiReturn(static::ERROR, [], $custom['name']."(".$customId.")正在跟进中,暂时无法分配");
}
$flag = $customService->assign($customId, $followUserId, $operUserId);
if (!$flag) {
return $this->apiReturn(static::ERROR, [], "部分客户分配失败,请刷新重试");
}
}
return $this->apiReturn(static::OK);
}
/**
* 客户认领
*/
public function get(Request $request)
{
$params = $request->all();
$operUserId = $request->session()->get('user_id');
$customId = $params['id'];
$customService = app(CustomerService::class);
$userService = app(UserService::class);
$leftCount = $userService->getGetLeftTime($operUserId);
if ($leftCount <= 0) {
return $this->apiReturn(static::ERROR, [], "客户认领失败,超过今日认领上限");
}
if (!$customService->canAssign($customId)) {
$model = new Customer();
$custom = $model->find($customId);
return $this->apiReturn(static::ERROR, [], $custom['name']."(".$customId.")正在跟进中,暂时无法分配");
}
$flag = $customService->get($customId, $operUserId, $operUserId);
if (!$flag) {
return $this->apiReturn(static::ERROR, [], "客户认领失败,请刷新重试");
}
return $this->apiReturn(static::OK);
}
/**
* 分配记录LIST
*/
public function assignlist(Request $request)
{
$params = $request->all();
$userModel = new SystemUser();
$logModel = new CustomerLog();
$followUserList = $userModel->getAllUserWithDel();
$followUserArray = ($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$list = $logModel->getLogListByCustomerIdAndType($params['customId'], $logModel::TYPE_ASSIGN, $params);
foreach ($list as $key => $item) {
$item['old_user'] = $followUserArray[$item['before']];
$item['new_user'] = $followUserArray[$item['after']];
$item['oper_user'] = $followUserArray[$item['user_id']];
$item['type'] = CustomerService::ASSIGN_TYPE_MAPPING[$item['remark']];
$list[$key] = $item;
}
$data['list'] = $list;
$data['total'] = $logModel->getCountByCustomerIdAndType($params['customId'], $logModel::TYPE_ASSIGN);
return $this->apiReturn(static::OK, $data);
}
/**
* 跟进记录LIST
*/
public function followlist(Request $request)
{
$params = $request->all();
$dict = new SystemDict();
$userModel = new SystemUser();
$logModel = new CustomerLog();
$followUserList = $userModel->getAllUserWithDel();
$followUserArray = collect($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$list = $logModel->getLogListByCustomerIdAndType($params['customId'], $logModel::TYPE_FOLLOW, $params);
foreach ($list as $key => $item) {
$item['old_status'] = $customGourpDict[$dict::TYPE_FOLLOW][$item['before']];
$item['new_status'] = $customGourpDict[$dict::TYPE_FOLLOW][$item['after']];
$item['oper_user'] = $followUserArray[$item['user_id']];
$list[$key] = $item;
}
$data['list'] = $list;
$data['total'] = $logModel->getCountByCustomerIdAndType($params['customId'], $logModel::TYPE_FOLLOW);
return $this->apiReturn(static::OK, $data);
}
/**
* 星级变化记录
*/
public function starlist(Request $request)
{
$params = $request->all();
$dict = new SystemDict();
$userModel = new SystemUser();
$logModel = new CustomerLog();
$followUserList = $userModel->getAllUserWithDel();
$followUserArray = collect($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$list = $logModel->getLogListByCustomerIdAndType($params['customId'], $logModel::TYPE_STAR, $params);
foreach ($list as $key => $item) {
$item['old_value'] = $customGourpDict[$dict::TYPE_STAR][$item['before']];
$item['new_value'] = $customGourpDict[$dict::TYPE_STAR][$item['after']];
$item['oper_user'] = $followUserArray[$item['user_id']];
$list[$key] = $item;
}
$data['list'] = $list;
$data['total'] = $logModel->getCountByCustomerIdAndType($params['customId'], $logModel::TYPE_STAR);
return $this->apiReturn(static::OK, $data);
}
/**
* 锁定
*/
public function lock(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
DB::beginTransaction();
$model = Customer::find($params['id']);
$model->lock = $params['lock'];
$model->save();
$logmodel = new CustomerLog();
$logmodel->saveLog($model->lock == 1 ? $logmodel::TYPE_LOCK: $logmodel::TYPE_UNLOCK, $params['id'], '', '', $userId, '');
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 移入公海
*/
public function giveup(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$customService = app(CustomerService::class);
$customService->giveup($params['id'], $userId, '移入公海');
return $this->apiReturn(static::OK);
}
/**
* 批量移入公海
*/
public function batchgiveup(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$customIds = $params['customIds'];
DB::beginTransaction();
foreach ($customIds as $customId) {
$customService = app(CustomerService::class);
$customService->giveup($customId, $userId, '移入公海');
}
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 批量领取
*/
public function batchget(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$customIds = $params['customIds'];
$customService = app(CustomerService::class);
$userService = app(UserService::class);
$leftCount = $userService->getGetLeftTime($userId);
if ($leftCount < count($customIds)) {
return $this->apiReturn(static::ERROR, [], "认领失败,超过今日认领上限,今日剩余".$leftCount."认领名额");
}
DB::beginTransaction();
foreach ($customIds as $customId) {
if (!$customService->canAssign($customId)) {
$model = new Customer();
$custom = $model->find($customId);
return $this->apiReturn(static::ERROR, [], $custom['name']."(".$customId.")正在跟进中,暂时无法分配");
}
$customService->get($customId, $userId, $userId);
}
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 设为重要
*/
public function important(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
DB::beginTransaction();
$model = Customer::find($params['id']);
$model->important = $params['important'];
$model->save();
$logmodel = new CustomerLog();
$logmodel->saveLog($model->important == 1 ? $logmodel::TYPE_IMPORTANT : $logmodel::TYPE_NOT_IMPORTANT, $params['id'], '', '', $userId, '');
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 设为无效
*/
public function lahei(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$model = Customer::find($params['id']);
$model->status = $params['status'];
$model->save();
$logmodel = new CustomerLog();
$logmodel->saveLog($model->status == 1 ? $logmodel::TYPE_NOT_UNVALID : $logmodel::TYPE_UNVALID, $params['id'], '', '', $userId, '');
return $this->apiReturn(static::OK);
}
/**
* 批量导入用户
*/
public function upload(Request $request) {
$files = ($request->file());
$fileName = array_keys($files)[0];
if (!in_array($fileName, ['CustomerPool', 'CustomerNewpool'])) {
return $this->apiReturn(static::ERROR, [], "入口异常,请刷新重试");
}
try {
$data = Excel::toArray(new CustomerModel, $request->file($fileName))[0];
} catch (\Exception $e) {
return $this->apiReturn(static::ERROR, [], "文件格式异常请重试");
}
array_shift($data);
if (empty($data)) {
return $this->apiReturn(static::ERROR, [], "客户信息为空");
}
$service = app(\App\Services\CustomerService::class);
$error = [];
$customs = [];
$dict = new SystemDict();
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$index = 1;
$mobiles = [];
$times = 0;
$success = 0;
foreach ($data as $row) {
$customCheck = $service->genCustomByExcelRow($row, $customGourpDict);
if ($customCheck['status'] == 1) {
if ($fileName == 'CustomerNewpool') {
$customCheck['custom']['user_from'] = 1;
} else if ($fileName == 'CustomerPool') {
$customCheck['custom']['user_from'] = 2;
}
$customCheck['custom']['mobile_md5'] = md5($customCheck['custom']['mobile']);
$customCheck['custom']['source'] = intval(Constants::EXPORT_CHANNEL);
if (in_array($customCheck['custom']['mobile'], $mobiles) || count(Customer::where('mobile', $customCheck['custom']['mobile'])->get()) > 0) {
$times++;
} else {
$success++;
$customs[] = $customCheck['custom'];
}
} else {
$error[] = "第".$index."行:".implode(PHP_EOL, $customCheck['error']);
}
$index++;
}
if (empty($error)) {
(new Customer())->insert($customs);
return $this->apiReturn(static::OK, [], '导入成功'.$success.'个客户, 重复'.$times.'个');
} else {
return $this->apiReturn(static::ERROR, [], implode(PHP_EOL, $error));
}
}
/**
* 待办事项列表
*/
public function getNoticeList (Request $request) {
$params = $request->all();
$userId = $request->session()->get('user_id');
$customId = $params['id'];
$notice = new Notice();
$list = $notice->getListByUserIdAndCustomer($customId, $userId, 3);
$color = ['', 'green', 'blue', 'purple', 'pinkpurple', 'red'];
$dict = new SystemDict();
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
foreach ($list as $key => $item) {
$item['color'] = $color[$item['type']];
$item['type'] = $customGourpDict[$dict::TYPE_NOTICE][$item['type']];
$item['day'] = date('Y-m-d H:i:s', $item['date']);
$list[$key] = $item;
}
return $this->apiReturn(static::OK, ['list'=>$list]);
}
/**
* 增加代办事项
*/
public function addNotices(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$customId = $params['id'];
$notices = $params['notices'];
DB::beginTransaction();
foreach ($notices as $notice) {
if (empty($notice['date'])) {
DB::rollBack();
return $this->apiReturn(static::ERROR, [], "请选择日期");
}
if (empty($notice['remark'])) {
DB::rollBack();
return $this->apiReturn(static::ERROR, [], "请输入备注");
}
$noticeModel = new Notice();
$noticeModel->date = strtotime($notice['date']);
$noticeModel->custom_id = $customId;
$noticeModel->follow_user_id = $userId;
$noticeModel->type = $notice['type'];
$noticeModel->remark = $notice['remark'];
$flag = $noticeModel->save();
if (!$flag) {
DB::rollBack();
return $this->apiReturn(static::ERROR, [], "日程写入失败");
}
}
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 添加点评
*/
public function addDianping(Request $request) {
$params = $request->all();
$customId = $params['id'];
$userId = $request->session()->get('user_id');
$logmodel = new CustomerLog();
$logmodel->saveLog($logmodel::TYPE_DIANPING, $params['id'], '', '', $userId, $params['remark']);
$custom = Customer::find($customId);
$noticeModel = new Notice();
$noticeModel->date = time();
$noticeModel->custom_id = $customId;
$noticeModel->follow_user_id = $custom['follow_user_id'];
$noticeModel->type = 5;
$noticeModel->remark = $params['remark'];
$noticeModel->save();
DB::commit();
return $this->apiReturn(static::OK);
}
/**
* 添加回款
*/
public function addBack(Request $request) {
$params = $request->all();
$userId = $request->session()->get('user_id');
$customId = $params['id'];
$model = Customer::find($params['id']);
$backmodel = new CustomerBack();
if ($errorMsg = ToolService::checkParams($params, [
'date' => '放款时间',
'amount' => '放款金额',
'agency_fee' => '点位',
'realmoney' => '实际创收',
])) {
return $this->apiReturn(static::ERROR, [], $errorMsg);
}
$backmodel->custom_id = $params['id'];
$backmodel->date = strtotime($params['date']);
$backmodel->amount = $params['amount'];
$backmodel->fee = $params['agency_fee'];
$backmodel->real_amount = $params['realmoney'];
$backmodel->remark = $params['remark'];
$backmodel->cost = $params['cost'];
$backmodel->quanzheng = $params['quanzheng'];
$backmodel->apply_date = intval($model->apply_time);
$backmodel->apply_amount = floatval($model->amount);
$backmodel->follow_user_id = intval($model->follow_user_id);
$backmodel->oper_user_id = $userId;
$backmodel->hetong = $params['hetong'];
$backmodel->product_id= intval($params['product_id']);
$backmodel->status = 1;
$backmodel->save();
$logModel = new CustomerLog();
$logModel->saveLog($logModel::TYPE_BACK, $params['id'], '', '', $userId, "金额:".$params['amount']);
return $this->apiReturn(static::OK);
}
/**
* 编辑回款
*/
public function editBack(Request $request) {
$params = $request->all();
$userId = $request->session()->get('user_id');
$backmodel = new CustomerBack();
$backmodel = $backmodel->find($params['id']);
if (empty($params['id']) || empty($backmodel)) {
return $this->apiReturn(static::ERROR, [], "参数错误,请刷新重试");
}
if ($errorMsg = ToolService::checkParams($params, [
'date' => '放款时间',
'amount' => '放款金额',
'agency_fee' => '点位',
'realmoney' => '实际创收',
])) {
return $this->apiReturn(static::ERROR, [], $errorMsg);
}
$backmodel->date = strtotime($params['date']);
$backmodel->amount = $params['amount'];
$backmodel->fee = $params['agency_fee'];
$backmodel->real_amount = $params['realmoney'];
$backmodel->remark = $params['remark'];
$backmodel->cost = $params['cost'];
$backmodel->hetong = $params['hetong'];
$backmodel->product_id= intval($params['product_id']);
$backmodel->save();
return $this->apiReturn(static::OK);
}
/**
* 编辑回款
*/
public function delBack(Request $request) {
$params = $request->all();
$backmodel = new CustomerBack();
$backmodel = $backmodel->find(intval($params['id']));
$backmodel->delete();
return $this->apiReturn(static::OK);
}
/**
* 回款列表
*/
public function backlist(Request $request)
{
$params = $request->all();
$dict = new SystemDict();
$userModel = new SystemUser();
$model = new CustomerBack();
$followUserList = $userModel->getAllUserWithDel();
$followUserArray = collect($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$list = $model->getLists($params);
foreach ($list as $key => $item) {
$item['apply_amount'] = $item['apply_amount'] ? $item['apply_amount'] : '';
$item['fee'] = $item['fee'] . '%';
$item['apply_date'] = $item['apply_date'] ? date('Y-m-d H:i:s', $item['apply_date']) : '';
$item['date'] = $item['date'] ? date('Y-m-d H:i:s', $item['date']) : '';
$item['new_value'] = $customGourpDict[$dict::TYPE_STAR][$item['after']];
$item['oper_user'] = $followUserArray[$item['oper_user_id']];
$list[$key] = $item;
}
$data['list'] = $list;
$data['total'] = $model->getCount($params);
return $this->apiReturn(static::OK, $data);
}
/**
* 认领后未跟进
*/
public function follownum(Request $request)
{
$userId = $request->session()->get('user_id');
$data = ['custom_num'=>0, 'approve_num'=>0];
if ($userId > 0) {
$model = new Customer();
$data['custom_num'] = $model->getWaitForFollow($userId);
}
return $this->apiReturn(static::OK, $data);
}
/**
* 统计数据
*/
public function data(Request $request)
{
$userId = $request->session()->get('user_id');
$userModel = new SystemUser();
$customModel = new Customer();
$data = [];
// 筛选项
$params = $request->all();
$data['master'] = 0;
$followUserArray = app(RightService::class)->getCustomViews($userId);
if ($followUserArray == 'all') {
$followUserList = $userModel->getAllUser();
$followUserArray = collect($followUserList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
$data['master'] = 1;
} else {
$params['users'] = array_keys($followUserArray);
}
$data['followUserList'] = app(SelectService::class)->genSelectByKV($followUserArray); // 转成前端的select
$data['num1'] = $customModel->getCount(array_merge($params, ['notFollow'=>1]));
$data['num2'] = $customModel->getCount(array_merge($params, ['notFollow'=>3, 'star'=>6]));
$data['num3'] = $customModel->getCount(array_merge($params, ['notFollow'=>5, 'star'=>6]));
$data['num4'] = $customModel->getCount(array_merge($params, ['notFollow'=>7, 'star'=>6]));
$data['num5'] = $customModel->getCount(array_merge($params, ['notFollow'=>1, 'star'=>6]));
return $this->apiReturn(static::OK, $data);
}
}
================================================
FILE: app/Http/Controllers/NoticeController.php
================================================
session()->get('user_id');
$noticeModel = new Notice();
$dict = new SystemDict();
$list = $noticeModel->getUnRead($userId);
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$returnData = [];
foreach ($list as $item) {
$custom = Customer::find($item['custom_id']);
$returnData[] = [
'id' => $item['id'],
'type' => 'notice',
'title' => $customGourpDict[$dict::TYPE_NOTICE][$item['type']]."(".$custom['name'].")",
'ntype' => $item['type'],
'content' => $item['remark'],
'custom_id' => $item['custom_id'],
'time' => date('Y-m-d H:i:s', $item['date']),
];
}
return $this->apiReturn(static::OK, $returnData);
}
/**
* 获取通知信息
*/
public function list(Request $request)
{
$params = $request->all();
$userId = $request->session()->get('user_id');
$params['userId'] = $userId;
$noticeModel = new Notice();
$dict = new SystemDict();
$list = $noticeModel->getLists($params);
$customGourpDict = $dict->getListByGroup($dict::GROUP_CUSTOM); // 获取城市信息配置
$returnData = [];
foreach ($list as $key => $item) {
$custom = Customer::find($item->custom_id);
$item['name'] = $custom->name;
$item['type'] = $customGourpDict[$dict::TYPE_NOTICE][$item->type];
$item['time'] = date('Y-m-d H:i:s', $item->date);
$item['can_read'] = $item->date > time() ? false : true;
$list[$key] = $item;
}
$returnData['list'] = $list;
$returnData['total'] = $noticeModel->getCount($params);
return $this->apiReturn(static::OK, $returnData);
}
/**
* 读信息
*/
public function read(Request $request)
{
$noticeModel = new Notice();
$noticeModel->read($request->get('ids'));
return $this->apiReturn(static::OK);
}
}
================================================
FILE: app/Http/Controllers/ProductController.php
================================================
getLists($request->all());
$data['total'] = $model->getCount($request->all());
foreach ($list as $key=>$item) {
if ($item['amount1'] == 0) {$item['amount1'] = '?';}
if ($item['amount2'] == 0) {$item['amount2'] = '?';}
$item['amount'] = $item['amount1'] . ' - '. $item['amount2'];
}
$data['list'] = $list;
return $this->apiReturn(static::OK, $data);
}
/**
* 新增或编辑用户
*/
public function edit(Request $request) {
$params = $request->all();
$model = new Product();
if (isset($params['id'])) {
$model = $model->find($params['id']);
}
if ($params['amount1']&& $params['amount2'] && $params['amount1'] > $params['amount2']) {
return $this->apiReturn(static::ERROR, [], '最大额度必须大于最小额度');
}
$model->name = $params['name'];
$model->bank= $params['bank'];
$model->remark= $params['remark'];
$model->amount1 = floatval($params['amount1']);
$model->amount2 = floatval($params['amount2']);
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 获取用户信息
*/
public function info(Request $request) {
$params = $request->all();
$model = new Product();
$allUserListSelect = $model->getAllBank();
if (isset($params['id'])) {
$model = $model->find($params['id']);
if ($model['amount'] == 0) {$model['amount'] = '';}
if ($model['amount1'] == 0) {$model['amount1'] = '';}
if ($model['amount2'] == 0) {$model['amount2'] = '';}
}
$allUserListSelect = app(SelectService::class)->genSelectByK($allUserListSelect, 'bank'); // 转成前端的select
return $this->apiReturn(static::OK, ['teamInfo'=>$model, 'allUserListSelect' => $allUserListSelect]);
}
/**
* 新增或编辑用户
*/
public function del(Request $request) {
$params = $request->all();
$model = new Product();
$usermodel = new SystemUser();
if (empty($params['id'])) {
return $this->apiReturn(static::OK);
}
$usercount = $usermodel->getUserCountByProductid($params['id']);
if ($usercount > 0) {
return $this->apiReturn(static::ERROR, [], '该团队下还有用户,无法删除!');
}
$model = $model->find($params['id']);
$model->status = 0;
$model->save();
return $this->apiReturn(static::OK);
}
}
================================================
FILE: app/Http/Controllers/SystemRoleController.php
================================================
getLists($request->all());
$data['total'] = $model->getCount($request->all());
return $this->apiReturn(static::OK, $data);
}
/**
* 新增或编辑用户
*/
public function edit(Request $request) {
$params = $request->all();
$model = new SystemRole();
$rightModel = new SystemRight();
$rolerightModel = new SystemRoleRight();
if (isset($params['id'])) {
$model = $model->find($params['id']);
}
$model->name = $params['name'];
$model->views = $params['views'] ? $params['views'] : 1;
$model->fields = implode(",", array_merge((array)$params['fields1'] , (array)$params['fields2'] , (array)$params['fields3']));
$model->save();
// 处理权限
// 获取当当前的权限
$rights = $rightModel->getRightByRoleId($model->id);
$oldRights = [];
foreach ($rights as $right) {
$oldRights[] = $right->id;
}
// 获取新的权限
$newRights = array_merge((array)$params['rights'], (array)$params['halfrights']);
// 该新增的权限,改移除的权限
$delRights = array_diff($oldRights, $newRights);
$addRights = array_diff($newRights, $oldRights);
// 删除权限
$rolerightModel->deleteRights($model->id, $delRights);
$rolerightModel->addRights($model->id, $addRights);
return $this->apiReturn(static::OK);
}
/**
* 锁定角色
*/
public function lock(Request $request) {
$params = $request->all();
$model = SystemRole::find($params['id']);
$model->status = $params['status'];
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 获取用户信息
*/
public function info(Request $request) {
$params = $request->all();
$model = new SystemRole();
$rightModel = new SystemRight();
$fieldsModel = new SystemFields();
$selectFieldList = $fieldsModel->getSelect();
$service = app(RightService::class);
$selectRightList = $service->getRightTree();
if (isset($params['id']) && $params['id']) {
$model = $model->find($params['id']);
$fields = explode(',', $model['fields']);
$model['fields1'] = array_values(array_intersect($fields, array_keys($selectFieldList[1])));
$model['fields2'] = array_values(array_intersect($fields, array_keys($selectFieldList[2])));
$model['fields3'] = array_values(array_intersect($fields, array_keys($selectFieldList[3])));
($selectRightList['leafs'][] = 31);
$rights = app(ToolService::class)->objColumn($rightModel->getRightByRoleId($params['id']), 'id');
$model['rights']= array_values(array_intersect($rights, $selectRightList['leafs']));
$model['halfrights']= array_values(array_diff($rights, $selectRightList['leafs']));
}
return $this->apiReturn(static::OK, [
'roleInfo'=>$model,
'selectFieldList1' => app(SelectService::class)->genSelectByKV($selectFieldList[1]), // 转成前端的select
'selectFieldList2' => app(SelectService::class)->genSelectByKV($selectFieldList[2]), // 转成前端的select
'selectFieldList3' => app(SelectService::class)->genSelectByKV($selectFieldList[3]), // 转成前端的select
'selectRightList'=>$selectRightList['tree']
]);
}
/**
* 删除用户
*/
public function delete(Request $request) {
$params = $request->all();
$model = new SystemUserRole();
$count = $model->where('role_id', $params['id'])->count();
if ($count > 0) {
return $this->apiReturn(static::ERROR, [], '该账号还有'.$count.'个用户,请转移后再删除');
}
$model = SystemRole::find($params['id']);
$model->is_delete = 1;
$model->save();
return $this->apiReturn(static::OK);
}
}
================================================
FILE: app/Http/Controllers/SystemTeamController.php
================================================
getLists($request->all());
$usermodel = new SystemUser();
$allUserListSelect = $usermodel->getAllUserWithDel();
$allUserListSelect = app(SelectService::class)->genKv($allUserListSelect, 'id', 'name'); // 转成前端的select
$data['total'] = $model->getCount($request->all());
foreach ($list as $key => $item) {
$item['manager'] = $allUserListSelect[$item['manager_id']];
$item['usercount'] = $usermodel->getUserCountByTeamid($item['id']);
$list[$key] = $item;
}
$data['list'] = $list;
return $this->apiReturn(static::OK, $data);
}
/**
* 新增或编辑用户
*/
public function edit(Request $request) {
$params = $request->all();
$model = new SystemTeam();
if (isset($params['id'])) {
$model = $model->find($params['id']);
}
$model->name = $params['name'];
$model->manager_id = $params['manager_id'];
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 获取用户信息
*/
public function info(Request $request) {
$params = $request->all();
$model = new SystemTeam();
if (isset($params['id'])) {
$model = $model->find($params['id']);
$model['manager_id'] = empty($model['manager_id']) ? "" : intval($model['manager_id']);
}
$usermodel = new SystemUser();
$allUserListSelect = $usermodel->getAllUser();
$allUserListSelect = app(SelectService::class)->genSelect($allUserListSelect, 'id', 'name'); // 转成前端的select
return $this->apiReturn(static::OK, ['teamInfo'=>$model, 'allUserListSelect' => $allUserListSelect]);
}
/**
* 新增或编辑用户
*/
public function del(Request $request) {
$params = $request->all();
$model = new SystemTeam();
$usermodel = new SystemUser();
if (empty($params['id'])) {
return $this->apiReturn(static::OK);
}
$usercount = $usermodel->getUserCountByTeamid($params['id']);
if ($usercount > 0) {
return $this->apiReturn(static::ERROR, [], '该团队下还有用户,无法删除!');
}
$model = $model->find($params['id']);
$model->status = 0;
$model->save();
return $this->apiReturn(static::OK);
}
}
================================================
FILE: app/Http/Controllers/SystemUserController.php
================================================
getLists($request->all());
$data['total'] = $model->getCount($request->all());
$allTeamListSelect = $teammodel->getAllTeam();
$data['allTeamListSelect'] = app(SelectService::class)->genSelect($allTeamListSelect, 'id', 'name'); // 转成前端的select
foreach ($list as $key => $item) {
$item['assign_text'] = app(AssignService::class)->genText($item['assign_rights']);
$list[$key] = $item;
}
$data['list'] = $list;
return $this->apiReturn(static::OK, $data);
}
/**
* 新增或编辑用户
*/
public function edit(Request $request) {
$params = $request->all();
$model = new SystemUser();
$query = $model->where('mobile', $params['mobile'])->where('id', '!=', $params['id']);
if (isset($params['id'])) {
$query = $query->where('is_del', 0);
$model = $model->find($params['id']);
} else {
$defultPwd= "crm123456";
$model->password_salt = rand(100000, 999999);
$model->password = md5($defultPwd. $model->password_salt);
}
if (count($query->get()) > 0) {
return $this->apiReturn(static::ERROR, [], '手机号已存在');
}
$model->name = $params['name'];
$model->mobile = $params['mobile'];
$model->parent_id = intval($params['parent_id']);
$model->team_id= intval($params['team_id']);
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 锁定用户
*/
public function lock(Request $request) {
$params = $request->all();
$model = SystemUser::find($params['id']);
$model->status = $params['status'];
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 锁定用户
*/
public function resetpwd(Request $request) {
$params = $request->all();
$defultPwd= "crm123456";
$model = SystemUser::find($params['id']);
$model->password_salt = rand(100000, 999999);
$model->password = md5($defultPwd. $model->password_salt);
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 删除用户
*/
public function delete(Request $request) {
$params = $request->all();
$customModel = new Customer();
$count = $customModel->where('follow_user_id', $params['id'])->count();
if ($count > 0) {
return $this->apiReturn(static::ERROR, [], '该账号还有'.$count.'个跟进中的客户,请转移后再删除');
}
$model = SystemUser::find($params['id']);
$model->is_del = 1;
$model->save();
return $this->apiReturn(static::OK);
}
/**
* 获取用户信息
*/
public function info(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$model = new SystemUser();
$teammodel = new SystemTeam();
$allUserListSelect = $model->getAllUser($params['id']);
$allUserListSelect = app(SelectService::class)->genSelect($allUserListSelect, 'id', 'name'); // 转成前端的select
$allTeamListSelect = $teammodel->getAllTeam();
$allTeamListSelect = app(SelectService::class)->genSelect($allTeamListSelect, 'id', 'name'); // 转成前端的select
if (isset($params['id'])) {
$model = $model->find($params['id']);
$roleModel = new SystemRole();
$roles = $roleModel->getRoleByUserId($params['id']);
$model['roles'] = app(ToolService::class)->objColumn($roles, 'id');
if (empty($model['team_id'])) {unset($model['team_id']);}
if (empty($model['parent_id'])) {unset($model['parent_id']);}
}
$model['password'] = '';
$roleModel = new SystemRole();
$allRole = $roleModel->getRoleSelect();
$allUser = $model->getAllUser()->toArray();
$allUserId = array_column($allUser, 'id');
return $this->apiReturn(static::OK, ['userInfo'=>$model, 'allUserListSelect'=>$allUserListSelect, 'roleList'=>$allRole, 'allTeamListSelect'=>$allTeamListSelect,
'userTree' => app(UserService::class)->getUserTree(),
'allUserId' => $allUserId
]);
}
/**
* 获取用户角色信息
*/
public function role(Request $request) {
$params = $request->all();
$userId = $params['id'];
$roleModel = new SystemRole();
$userroleModel = new SystemUserRole();
$roles = $roleModel->getRoleByUserId($userId);
$oldRoleIds = app(ToolService::class)->objColumn($roles, 'id');
$newRoleIds = $params['roles'];
// 该新增的权限,改移除的权限
$delRoleIds = array_diff($oldRoleIds, $newRoleIds);
$addRoleIds = array_diff($newRoleIds, $oldRoleIds);
// 删除权限
$userroleModel->delRoles($userId, $delRoleIds);
$userroleModel->addRoles($userId, $addRoleIds);
return $this->apiReturn(static::OK);
}
/**
* 锁定用户
*/
public function online(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$model = SystemUser::find($userId);
$model->online = $params['online'] ? 1 : 0;
$model->save();
return $this->apiReturn(static::OK, [], '操作成功');
}
/**
* 系统设置
*/
public function setting(Request $request) {
$userId = $request->session()->get('user_id');
$params = $request->all();
$model = SystemSetting::find(1);
if ($request->isMethod('get')) {
$roleModel = new SystemRole();
$allRole = $roleModel->getRoleSelect();
$roles = explode(",", $model->role_id);
foreach ($roles as $key=>$r) {
$roles[$key] = intval($r);
}
return $this->apiReturn(static::OK, [
'setting'=>['ip'=>$model['ip'], 'time'=> [$model->stime.':00', $model->etime.":00"], 'role_id'=>$roles],
'roles' => $allRole
], '操作成功');
} else {
$model->ip = $params['ip'];
$model->stime = $params['time'][0];
$model->etime = $params['time'][1];
$model->role_id = implode(",", $params['role_id']);
$model->save();
return $this->apiReturn(static::OK, [], '操作成功');
}
}
}
================================================
FILE: app/Http/Controllers/UserController.php
================================================
all();
$userName = $params['username'];
$password = $params['password'];
$captcha = $params['captcha'];
if ($captcha != $request->session()->get('captcha')) {
return $this->apiReturn(static::ERROR, [], '验证码不正确');
}
if (empty($userName) || empty($password)) {
return $this->apiReturn(static::ERROR, [], "账号或密码错误");
}
$user = SystemUser::where('mobile', $userName)->where('status', 1)->where('is_del', 0)->first();
if (empty($user)) {
return $this->apiReturn(static::ERROR, [], "账号或密码错误");
} else if ($user->password != md5($password . $user->password_salt)) {
return $this->apiReturn(static::ERROR, [], "账号或密码错误");
}
if (!LoginHook::canLogin($user->id, $request)){
return $this->apiReturn(static::ERROR, [], "非法IP, 请联系管理员");
}
$page = LoginHook::getPage($user->id);
$request->session()->put('user_id', $user->id);
return $this->apiReturn(static::OK, ["token" => 12345, 'page' => $page]);
}
/**
* 退出
*/
public function logout(Request $request)
{
$request->flush();
return $this->apiReturn(static::OK);
}
/**
* 用户基本信息
*/
public function info(Request $request)
{
$teamModel = new SystemTeam();
$userModel = new SystemUser();
$noticeModel = new Notice();
$userId = $request->session()->get('user_id');
$userArray = $userModel->getAllUserMap();
$teamArray = $teamModel->getAllTeamMap();
$user = SystemUser::where('id', $userId)->first();
$data = [
"name" => $user->name,
"mobile" => $user->mobile,
"department" => $teamArray[$user->team_id],
"leader" => $userArray[$user->parent_id],
"avatar" => '/resource/av.png',
"online" => $user->online == 1 ? true : false,
'noticeCount' => $noticeModel->getUnReadCount($userId),
];
return $this->apiReturn(static::OK, $data);
}
/**
* 用户菜单
*/
public function menu(Request $request)
{
$userId = $request->session()->get('user_id');
$service = app(\App\Services\RightService::class);
$realMenus = ($service->getRightTree($userId)['tree']);
// 给一些通过的功能默认加上权限
$realMenus = array_merge($realMenus, $service->getDefaultRight());
return $this->apiReturn(static::OK, $realMenus);
}
/**
* 登录
*/
public function resetpassword(Request $request)
{
$params = $request->all();
$userId = $request->session()->get('user_id');
$oldpassword = $params['oldpassword'];
$newpassword = $params['newpassword'];
$user = SystemUser::find($userId);
if (empty($user)) {
return $this->apiReturn(static::ERROR, [], "操作异常,请刷新重试");
} else if ($user->password != md5($oldpassword . $user->password_salt)) {
return $this->apiReturn(static::ERROR, [], "旧密码输入错误");
}
$user->password = md5($newpassword . $user->password_salt);
$user->save();
return $this->apiReturn(static::OK);
}
/**
* 首页
*/
public function dashboard(Request $request)
{
$dict = new SystemDict();
$customGourpDict = $dict->getListByType($dict::TYPE_NOTICE); // 获取城市信息配置
$color = ['', 'green', 'blue', 'purple', 'pinkpurple', 'red'];
$userId = $request->session()->get('user_id');
$model = new Notice();
$noticeList = $model->getListByUserId($userId, 10);
foreach ($noticeList as $key => $notice) {
$custom = Customer::find($notice->custom_id);
$notice->color = $color[$notice->type];
$notice->type = $customGourpDict[$notice->type];
$notice->day = date('Y-m-d H:i:s', $notice->date);
$notice->remark = $notice->remark . " (客户姓名:" .$custom['name'] . ")";
$noticeList[$key] = $notice;
}
$users = [];
$followUserArray = app(RightService::class)->getCustomViews($userId);
if ($followUserArray != 'all') {
$users = array_keys($followUserArray);
}
$customModel = new Customer();
$backModel = new CustomerBack();
$paihangbang = $backModel->getPaihangbang();
$paihangbang2 = $backModel->getPaihangbang2();
$chartData = [];
foreach ($paihangbang2 as $item) {
$chartData [] = [
'value' => [$item->cnt],
'name' => $item->name
];
}
$index = 1;
$rightModel = new SystemRight();
$rights = $rightModel->getRightByUserId($userId);
$rights = array_column($rights, 'router');
foreach ($paihangbang as $key=>$item) {
$item->index = $index;
$paihangbang[$key] = $item;
if (!in_array('YejiAmount', $rights)) {
$item->amount = '';
}
if (!in_array('YejiRealAmount', $rights)) {
$item->real_amount = '';
}
$index ++;
}
return $this->apiReturn(static::OK, [
'customer' => $customModel->getMyCount(['users' => $users]),
'important' => $customModel->getMyCount(['users' => $users, 'important' => 1]),
'newcustomer' => $customModel->getMyCount(['users' => $users, 'new' => 1]),
'innercustomer' => $customModel->getMyCount(['users' => $users, 'inner' => 1]),
'followcustomer' => $customModel->getMyCount(['users' => $users, 'follow_status' => 1]),
'paihangbang' => $paihangbang,
'chartData' => $chartData,
'yeji_list' => [],
'order_list' => [],
'notice_list' => $noticeList
]);
}
/**
* 验证码
*/
public function captcha(Request $request) {
$c = new Captcha();
$c->create($request);
}
/**
* donoting
*/
public function donothing(Request $request) {
}
}
================================================
FILE: app/Http/Middleware/AuthMiddleware.php
================================================
session()->get('user_id', 0);
if (empty($userId)) {
echo json_encode(['code'=>50008, 'msg'=>'登录过期,请重新登录']);
exit;
}
$url = str_replace("/api/", "", $request->getPathInfo());
Log::info("IN1666510036 行为记录: " . $userId . " : " . $url . " : " . $request->ip());
if (!in_array($url, $this->whiteList)) {
$right = new SystemRight();
$menus = $right->getRightByUserId($userId);
$hasAuth = false;
foreach ($menus as $menu) {
if ($menu->url == $url ) {
$hasAuth = true;
break;
}
}
if (!$hasAuth) {
echo json_encode(['code'=>50000, "msg"=>"无操作权限"]);
exit;
}
}
$model = new SystemUserRole();
$roles = $model->getRoleByUserId($userId);
$rolesIds = array_column($roles, 'role_id');
$setting = SystemSetting::find(1);
if ($setting['ip']) {
$ip = explode(",", $setting['ip']) ;
if (!in_array($request->ip(), $ip) && !in_array(1, $rolesIds)) {
echo json_encode(['code'=>50008, 'msg' => '非法IP, 请联系管理员']);
exit;
}
}
return $next($request);
}
}
================================================
FILE: app/Jobs/ExampleJob.php
================================================
设置验证码图片大小的函数
$bgcolor = imagecolorallocate($image,255,255,255); //#ffffff
imagefill($image, 0, 0, $bgcolor);
$captcha_code = "";
for($i=0;$i<4;$i++){
//设置字体大小
$fontsize = 6;
//设置字体颜色,随机颜色
$fontcolor = imagecolorallocate($image, rand(0,120),rand(0,120), rand(0,120)); //0-120深颜色
//设置数字
$fontcontent = rand(0,9);
//10>.=连续定义变量
$captcha_code .= $fontcontent;
//设置坐标
$x = ($i*100/4)+rand(5,10);
$y = rand(5,10);
imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);
}
$request->session()->put('captcha', $captcha_code);
//10>存到session
//8>增加干扰元素,设置雪花点
for($i=0;$i<200;$i++){
//设置点的颜色,50-200颜色比数字浅,不干扰阅读
$pointcolor = imagecolorallocate($image,rand(50,200), rand(50,200), rand(50,200));
//imagesetpixel — 画一个单一像素
imagesetpixel($image, rand(1,99), rand(1,29), $pointcolor);
}
//9>增加干扰元素,设置横线
for($i=0;$i<4;$i++){
//设置线的颜色
$linecolor = imagecolorallocate($image,rand(80,220), rand(80,220),rand(80,220));
//设置线,两点一线
imageline($image,rand(1,99), rand(1,29),rand(1,99), rand(1,29),$linecolor);
}
//2>设置头部,image/png
header('Content-Type: image/png');
//3>imagepng() 建立png图形函数
imagepng($image);
//4>imagedestroy() 结束图形函数 销毁$image
imagedestroy($image);
}
}
================================================
FILE: app/Models/Channel.php
================================================
when(isset($params['name']) && $params['name'] !== "", function ($query) use ($params) {
return $query->where('name', 'like', '%'.$params['name'].'%');
})->when(isset($params['mobile']) && $params['mobile'] !== "", function ($query) use ($params) {
return $query->where('mobile', $params['mobile']);
})->when(isset($params['city']) && $params['city'] !== "", function ($query) use ($params) {
return $query->where('city', $params['city']);
})->when(isset($params['followUserId']) && $params['followUserId'] !== "", function ($query) use ($params) {
return $query->where('follow_user_id', $params['followUserId']);
})->when(isset($params['followStatus']) && $params['followStatus'] !== "", function($query) use ($params) {
return $query->where('follow_status', $params['followStatus']);
})->when(isset($params['star']) && $params['star'] !== "", function($query) use ($params) {
if ($params['star'] == 6) {
return $query->where('star', '>=', '2');
} else if ($params['star'] == 7) {
return $query->where('star', '>=', '3');
} else if ($params['star'] == 8) {
return $query->where('star', '>=', '4');
} else {
return $query->where('star', $params['star']);
}
})->when($params['custom_ids'], function($query) use ($params) {
return $query->whereIn('id', $params['custom_ids']);
})->when(isset($params['userFrom']) && $params['userFrom'] !== "", function($query) use ($params) {
return $query->where('user_from', $params['userFrom']);
})->when(isset($params['source']) && $params['source'] !== "", function($query) use ($params) {
return $query->where('source', $params['source']);
})->when(isset($params['channel']) && $params['channel'] !== "", function($query) use ($params) {
return $query->where('source', $params['channel']);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(1, $params['zizhi']), function($query) use ($params) {
return $query->where('house', "!=", 1);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(2, $params['zizhi']), function($query) use ($params) {
return $query->where('car', "!=", 1);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(3, $params['zizhi']), function($query) use ($params) {
return $query->where('policy', "!=", 1);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(4, $params['zizhi']), function($query) use ($params) {
return $query->where('insurance', "!=",1);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(5, $params['zizhi']), function($query) use ($params) {
return $query->where('funds', "!=",1);
})->when(isset($params['zizhi']) && is_array($params['zizhi']) && in_array(6, $params['zizhi']), function($query) use ($params) {
return $query->where('credit', 1);
})->when(isset($params['notFollow']) && $params['notFollow']!= '', function($query) use ($params) {
return $query->where('follow_user_id', '>', 0)
->where('assign_time', '<', time() - ($params['notFollow'] * 24 *3600))
->where('follow_time', '<', time() - ($params['notFollow'] * 24 *3600));
})->when(isset($params['createTime']) && !empty($params['createTime']) && is_array($params['createTime']), function($query) use ($params ) {
$query = $query->where('apply_time', '>', strtotime($params['createTime'][0]));
return $query->where('apply_time', '<', strtotime($params['createTime'][1]));
})->when(isset($params['followTime']) && !empty($params['followTime']) && is_array($params['followTime']), function($query) use ($params ) {
$query = $query->where('follow_time', '>', strtotime($params['followTime'][0]));
return $query->where('follow_time', '<', strtotime($params['followTime'][1]));
})->when($params['type'] == 'CustomerList', function($query) use ($params) {
return $query->where('follow_user_id', '>' , 0);
})->when($params['type'] == 'CustomerImportList', function($query) use ($params) {
$query = $query->where('follow_user_id', '>' , 0);
return $query->where('important', 1);
})->when($params['team_id'], function($query) use ($params) {
$teamModel = new SystemUser();
$userIds = $teamModel->getUserByTeamid($params['team_id'])->map(function($item) {return $item['id'];});
return $query->whereIn('follow_user_id', $userIds);
})->when($params['type'] == 'CustomerNewList', function($query) use ($params) {
$query = $query->where('follow_user_id', '>' , 0);
$query = $query->where('important', 0);
return $query->where('user_from', 1);
})->when($params['type'] == 'CustomerInnerList', function($query) use ($params) {
$query = $query->where('follow_user_id', '>' , 0);
$query = $query->where('important', 0);
return $query->where('user_from', '!=', 1);
})->when(isset($params['users']) && in_array($params['type'], ['CustomerImportList', 'CustomerInnerList', 'CustomerNewList', 'CustomerList']), function($query) use ($params) {
if ($params['users']) {
return $query->whereIn('follow_user_id', $params['users']);
} else {
return $query->where('follow_user_id', 99999999);
}
})->when($params['type'] == 'CustomerNewpool', function($query) use ($params) {
$query = $query->where('follow_user_id', 0);
return $query->where('user_from', 1);
})->when($params['type'] == 'CustomerPool', function($query) use ($params) {
$query = $query->where('follow_user_id', 0);
return $query->where('user_from', '!=', 1);
})->when($params['timeType'] == 1, function($query) use ($params) {
return $query->where('create_time', '>', date('Y-m-d 00:00:00'));
})->when($params['timeType'] == 2, function($query) use ($params) {
return $query->where('create_time', '>', date('Y-m-d 00:00:00', strtotime("-1 day")));
})->when($params['timeType'] == 3, function($query) use ($params) {
return $query->where('create_time', '>', date('Y-m-d 00:00:00', strtotime("-2 day")));
})->when($params['timeType'] == 4, function($query) use ($params) {
$time = time();
$monday = date('Y-m-d 00:00:00', ($time - ((date('w',$time) == 0 ? 7 : date('w',$time)) - 1) * 24 * 3600));
return $query->where('create_time', '>', $monday);
})->when($params['timeType'] == 5, function($query) use ($params) {
return $query->where('create_time', '>', date("Y-m-01 00:00:00"));
})->when($params['timeType'] == 6, function($query) use ($params) {
$query = $query->where('create_time', '>', $params['times'][0]. ' 00:00:00');
return $query->where('create_time', '<', $params['times'][1]. ' 00:00:00');
});
if ($params['type'] == 'CustomerUnvalid') {
$query = $query->where('status', 0);
} else {
$query = $query->where('status', 1);
}
return $query;
}
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->select('*', DB::raw('
(CASE WHEN follow_time > assign_time THEN 1 ELSE 0 END) as is_follow,
(CASE WHEN follow_time > assign_time THEN id ELSE assign_time END) as order_field
'))->orderByRaw("is_follow , order_field desc")->skip($offset)->take($params['pageSize'])->get()->toArray();
return $list;
}
public function getCount($params) {
return $this->_createWhere($params)->count();
}
public function _createChannelWhere($params) {
$query = $this->when($params['users'], function ($query) use ($params) {
return $query->whereIn('follow_user_id', $params['users']);
})->when($params['user_id'], function ($query) use ($params) {
return $query->where('follow_user_id', $params['user_id']);
})->when($params['team_id'], function ($query) use ($params) {
$teamModel = new SystemUser();
$userIds = $teamModel->getUserByTeamid($params['team_id'])->map(function($item) {return $item['id'];});
return $query->whereIn('follow_user_id', $userIds);
})->when($params['source'], function ($query) use ($params) {
return $query->where('source', $params['source']);
})->when($params['timeType'] == 1, function ($query) use ($params) {
return $query->where('create_time', '>', date('Y-m-d 00:00:00'));
})->when($params['timeType'] == 2, function ($query) use ($params) {
$query = $query->where('create_time', '>', date('Y-m-d 00:00:00', strtotime("-1 day")));
return $query->where('create_time', '<', date('Y-m-d 00:00:00'));
})->when($params['timeType'] == 3, function ($query) use ($params) {
return $query->where('create_time', '>', date('Y-m-d 00:00:00', strtotime("-2 day")));
})->when($params['timeType'] == 4, function ($query) use ($params) {
$time = time();
$monday = date('Y-m-d 00:00:00', ($time - ((date('w',$time) == 0 ? 7 : date('w',$time)) - 1) * 24 * 3600));
return $query->where('create_time', '>', $monday);
})->when($params['timeType'] == 5, function ($query) use ($params) {
return $query->where('create_time', '>', date("Y-m-01 00:00:00"));
})->when($params['timeType'] == 6, function ($query) use ($params) {
$query = $query->where('create_time', '>', $params['times'][0]. ' 00:00:00');
return $query->where('create_time', '<', $params['times'][1]. ' 23:59:59');
});
return $query;
}
public function getListsGroupByChannel($params) {
return $this->_createChannelWhere($params)->select('source', 'star', DB::raw('count(*) as cnt'))->groupBy('source', 'star')->get();
}
public function getListsGroupByChannel2($params) {
$list = $this->_createChannelWhere($params)->select('source', DB::raw('CASE follow_status WHEN 0 THEN 0 ELSE 1 END as follow_status1'), DB::raw('count(*) as cnt'))
->groupBy('source', 'follow_status1')->get();
return $list;
}
public function getMyCount($params) {
$query = $this->when($params['users'], function ($query) use ($params) {
return $query->whereIn('follow_user_id', $params['users']);
})->when($params['important'], function ($query) use ($params) {
return $query->where('important', $params['important']);
})->when($params['today'], function ($query) use ($params) {
return $query->where('assign_time', '>', strtotime(date('Y-m-d')));
})->when(isset($params['follow_status']) && $params['follow_status'] !== "", function ($query) use ($params) {
return $query->where('follow_status', $params['follow_status']);
})->when($params['new'], function ($query) use ($params) {
$query = $query->where('follow_user_id', '>' , 0);
$query = $query->where('important', 0);
return $query->where('user_from', 1);
})->when($params['inner'], function ($query) use ($params) {
$query = $query->where('follow_user_id', '>' , 0);
$query = $query->where('important', 0);
return $query->where('user_from', '!=', 1);
});
return $query->count();
}
public function getCustomerByChannelId($channel, $channelId) {
return $this->where('source', $channel)->get();
}
public function getWaitForFollow($userId) {
$sql = "select count(*) as cnt from customer where follow_user_id = ? and assign_time > follow_time and status = 1 and user_from = 1 and important = 0 and status = 1";
return intval(app('db')->select($sql, [$userId])[0]->cnt);
}
}
================================================
FILE: app/Models/CustomerBack.php
================================================
leftJoin('customer', 'customer_backs.custom_id', '=', 'customer.id')->where('customer_backs.status', 1);
if (isset($params['customId']) && !empty($params['customId'])) {
$query = $query->where('customer_backs.custom_id', $params['customId']);
}
if (isset($params['name']) && !empty($params['name'])) {
$query = $query->where('customer.name', $params['name']);
}
if (isset($params['mobile']) && !empty($params['mobile'])) {
$query = $query->where('customer.mobile', $params['mobile']);
}
if (isset($params['follow_user_id']) && !empty($params['follow_user_id'])) {
$query = $query->where('customer_backs.follow_user_id', $params['follow_user_id']);
}
if (isset($params['team_id']) && !empty($params['team_id'])) {
$teamModel = new SystemUser();
$userIds = $teamModel->getUserByTeamid($params['team_id'])->map(function($item) {return $item['id'];});
$query = $query->whereIn('customer_backs.follow_user_id', $userIds);
}
if (isset($params['applyTime']) && !empty($params['applyTime']) && is_array($params['applyTime']) ) {
$query = $query->where('apply_date', '>', strtotime($params['applyTime'][0]));
$query = $query->where('apply_date', '<', strtotime($params['applyTime'][1]));
}
if (isset($params['backTime']) && !empty($params['backTime']) && is_array($params['backTime']) ) {
$query = $query->where('date', '>', strtotime($params['backTime'][0]));
$query = $query->where('date', '<', strtotime($params['backTime'][1]));
}
return $query;
}
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->select("customer_backs.*", "customer.name", "customer.source", "customer.user_from")->orderBy("customer_backs.id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
public function getCount($params) {
return $this->_createWhere($params)->count();
}
/**
* 排行榜
*/
public function getPaihangbang() {
$sql = "SELECT a.follow_user_id,sum(a.amount) as amount,sum(a.real_amount) real_amount, b.name user_name, c.name team_name FROM `customer_backs` a,
system_user b left join system_team c on b.team_id = c.id
where a.follow_user_id = b.id and a.status = 1 and a.create_time > '".date("Y-m-01")."' group by a.follow_user_id order by real_amount desc limit 10";
return app('db')->select($sql);
}
/**
* 排行榜
*/
public function getPaihangbang2() {
$sql = "SELECT a.product_id, b.name, count(*) as cnt FROM `customer_backs` a,
product b
where a.product_id = b.id and a.status = 1 and a.create_time > '".date("Y-m-01")."' group by a.product_id";
return app('db')->select($sql);
}
}
================================================
FILE: app/Models/CustomerLog.php
================================================
'录入客户',
self::TYPE_IMPORTANT => '设置重要客户',
self::TYPE_NOT_IMPORTANT => '取消重要客户',
self::TYPE_LOCK => '锁定客户',
self::TYPE_UNLOCK => '解锁客户',
self::TYPE_GIVEUP => '移入公海',
self::TYPE_ASSIGN => '客户重分配',
self::TYPE_ASSIGN_NEW => '新数据分配',
self::TYPE_FOLLOW => '跟进',
self::TYPE_STAR => '星级变化',
self::TYPE_BACK => '回款成功',
self::TYPE_GET => '客户认领',
self::TYPE_EDIT => '客户资料修改',
self::TYPE_UNVALID=> '设为无效',
self::TYPE_NOT_UNVALID=> '设为有效',
self::TYPE_INTRO => '转介绍',
self::TYPE_DIANPING => '主管点评',
self::TYPE_CALL => '拨打电话',
];
public function saveLog($type, $id, $before, $after, $userId = 0, $remark = '') {
$this->type = $type;
$this->customer_id = $id;
$this->before = $before;
$this->after = $after;
$this->remark = $remark;
$this->user_id = $userId;
return $this->save();
}
public function getLogListByCustomerId($customerId, $limit) {
$dictModel = new SystemDict();
$userModel = new SystemUser();
$followUserArray = $userModel->getAllUserWithDelMap();
$dict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
$list = $this->where('customer_id', $customerId)->whereRaw('type not in ('.static::TYPE_CALL.')')->orderBy("id", "desc")->take($limit)->get();
foreach ($list as $key => $item) {
switch($item['type']) {
case static::TYPE_STAR:
$item['remark'] .= "(".$dict[$dictModel::TYPE_STAR][$item['before']]."->".$dict[$dictModel::TYPE_STAR][$item['after']].")";
break;
case static::TYPE_FOLLOW:
$item['remark'] .= "(".$dict[$dictModel::TYPE_FOLLOW][$item['before']]."->".$dict[$dictModel::TYPE_FOLLOW][$item['after']].")";
break;
case static::TYPE_ASSIGN:
$item['remark'] = CustomerService::ASSIGN_TYPE_MAPPING[$item['remark']] . "(".$followUserArray[$item['before']]."->".$followUserArray[$item['after']].")";
break;
case static::TYPE_ASSIGN_NEW:
$item['remark'] = CustomerService::ASSIGN_TYPE_MAPPING[$item['remark']] . "(".$followUserArray[$item['before']]."->".$followUserArray[$item['after']].")";
break;
case static::TYPE_GET:
$item['remark'] = CustomerService::ASSIGN_TYPE_MAPPING[$item['remark']] . "(".$followUserArray[$item['before']]."->".$followUserArray[$item['after']].")";
break;
case static::TYPE_INTRO:
$item['remark'] = $item['remark'];
break;
case static::TYPE_FOLLOW:
$custom = Customer::find($item['before']);
$item['remark'] = '转介绍('.$item['before'].'-'.$custom['name'].')';
break;
}
$item['username'] = $item['user_id'] ? $followUserArray[$item['user_id']] : '系统';
$list[$key] = $item;
}
return $list;
}
public function getLogListByCustomerIdAndType($customerId, $type, $params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->where('customer_id', $customerId)->where('type', $type)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
public function getCountByCustomerIdAndType($customerId, $type) {
return $this->where('customer_id', $customerId)->where('type', $type)->count();
}
public function getCountByUserIdAndTime($userId, $type, $startTime, $endTime) {
$sql = "SELECT count(distinct customer_id) as cnt, max(id) as id FROM customer_log where type = ?
and `after` = ? and create_time >= ? and create_time < ?";
return app('db')->select($sql, [$type, $userId, $startTime, $endTime]);
}
public function getLogListByUserIdAndType($userId, $type, $offset, $pageSize) {
$list = $this->where('user_id', $userId)->where('type', $type)->orderBy("id", "desc")->skip($offset)->take($pageSize)->get();
return $list;
}
}
================================================
FILE: app/Models/CustomerRemarkLog.php
================================================
customer_id = $id;
$this->remark = $remark;
$this->user_id = $userId;
return $this->save();
}
public function getLogListByCustomerId($customerId, $limit) {
$list = $this->where('customer_id', $customerId)->orderBy("id", "desc")->take($limit)->get();
return $list;
}
}
================================================
FILE: app/Models/CustomerRuleConfig.php
================================================
where('follow_user_id', $userId)->where('type', '!=', 5)->where('date', '<', time() + 24 * 3600)->where('date', '>', time())->where('is_read', 0)->take(10)->get()->toArray();
$data2 = $this->where('follow_user_id', $userId)->where('type', 5)->where('is_read', 0)->take(10)->get()->toArray();
return array_merge($data1, $data2);
}
public function read($ids) {
$this->wherein('id', $ids)->update(['is_read' => 1]);
return true;
}
public function getUnReadCount($userId) {
$num1 = $this->where('follow_user_id', $userId)->where('type', '!=', 5)->where('date', '<', time() + 24 * 3600)->where('date', '>', time())->where('is_read', 0)->count();
$num2 = $this->where('follow_user_id', $userId)->where('type', 5)->where('is_read', 0)->count();
return $num1 + $num2;
}
private function _createWhere($params) {
$query = $this;
if (isset($params['userId']) && !empty($params['userId'])) {
$query = $query->where('follow_user_id', $params['userId']);
}
if (isset($params['name']) && !empty($params['name'])) {
$customer = Customer::where('name', $params['name'])->get()->toArray()[0];
if ($customer && $customer['id']) {
$query = $query->where('custom_id', $customer['id']);
} else {
$query = $query->where('custom_id', 999999999999);
}
}
if (isset($params['time']) && !empty($params['time']) && is_array($params['time']) ) {
$query = $query->where('date', '>', strtotime($params['time'][0]));
$query = $query->where('date', '<', strtotime($params['time'][1]));
}
return $query;
}
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
public function getCount($params = []) {
return $this->_createWhere($params)->count();
}
public function getListByUserId($userId, $limit) {
$list = $this->where('follow_user_id', $userId)->orderBy("date", "desc")->take($limit)->get();
return $list;
}
public function getListByUserIdAndCustomer($customId, $userId, $limit) {
$list = $this->where('follow_user_id', $userId)->where('custom_id', $customId)->where('date', '>', time())->orderBy("date", "desc")->take($limit)->get();
return $list;
}
}
================================================
FILE: app/Models/Product.php
================================================
where('status', 1)->get();
}
public function getAllBank() {
return $this->select('bank')->groupBy('bank')->get();
}
private function _createWhere($params) {
$query = $this->where('status', 1);
if (isset($params['name']) && $params['name'] !== "") {
$query = $query->where(['name' => $params['name']]);
}
if (isset($params['status']) && $params['status'] !== "") {
$query = $query->where(['status' => $params['status']]);
}
return $query;
}
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
public function getCount($params) {
return $this->_createWhere($params)->count();
}
}
================================================
FILE: app/Models/SystemDict.php
================================================
where(['type'=>$type, 'status'=>1])->get();
$returnData = [];
foreach ($list as $item) {
$returnData[$item['tid']] = $item['name'];
}
return $returnData;
}
public function getListByGroup($group) {
$list = $this->where(['groups'=>$group, 'status'=>1])->get();
$returnData = [];
foreach ($list as $item) {
$returnData[$item['type']][$item['tid']] = $item['name'];
}
return $returnData;
}
}
================================================
FILE: app/Models/SystemFields.php
================================================
get();
$returnData = [ ];
foreach ($list as $item) {
$returnData[$item['type']][$item['name']] =$item['name_cn'] ;
}
return $returnData;
}
}
================================================
FILE: app/Models/SystemLog.php
================================================
type = $type;
$this->obj_id = $id;
$this->before = $before;
$this->after = $after;
$this->remark = $remark;
$this->user_id = $userId;
$this->save();
}
public function getLogListById($type, $id, $params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->where('type', $type)->where('obj_id', $id)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
public function getLogCountById($type, $id, $params) {
return $this->where('type', $type)->where('obj_id', $id)->count();
}
}
================================================
FILE: app/Models/SystemRight.php
================================================
select($sql, [$userId]);
}
public function getRightByRoleId($roleId) {
$sql = "SELECT a.* FROM `system_right` a, system_role_right b where a.id =b.right_id and a.status = 1 and b.role_id = ? group by a.id ";
return app('db')->select($sql, [$roleId]);
}
public function getAllRight() {
$sql = "SELECT a.* FROM `system_right` a where a.status = 1 order by a.parent_id, a.orders desc";
return app('db')->select($sql);
}
}
================================================
FILE: app/Models/SystemRole.php
================================================
'有效',
0 => '无效',
];
public $timestamps = false;
public function getRoleByUserId($userId) {
$sql = "SELECT c.* FROM system_role c, system_user_role d
where c.id = d.role_id and c.status = 1 and d.user_id = ? and c.status = 1 group by c.id";
return app('db')->select($sql, [$userId]);
}
public function getUserByRoleId($roleId) {
$sql = "SELECT c.* FROM system_user c, system_user_role d
where c.id = d.user_id and c.status = 1 and d.role_id = ? group by c.id";
return app('db')->select($sql, [$roleId]);
}
public function getRoleSelect() {
$list = $this->where('is_delete', 0)->where('status', 1)->get();
$returnData = [ ];
foreach ($list as $item) {
$returnData[] = [
'label' => $item['name'],
'value' => $item['id'],
];
}
return $returnData;
}
private function _createWhere($params) {
$query = $this;
$query = $query->where(['is_delete' => 0]);
if (isset($params['name']) && $params['name'] !== "") {
$query = $query->where(['name' => $params['name']]);
}
if (isset($params['status']) && $params['status'] !== "") {
$query = $query->where(['status' => $params['status']]);
}
return $query;
}
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
foreach ($list as $key => $item) {
$item['statusname'] = static::$statusMapping[$item['status']];
$list[$key] = $item;
}
return $list;
}
public function getCount($params) {
return $this->_createWhere($params)->count();
}
}
================================================
FILE: app/Models/SystemRoleRight.php
================================================
where('role_id', $roleId)->wherein('right_id', $rightIds)->delete();
}
public function addRights($roleId, $rightIds){
if (empty($rightIds)){
return true;
}
$rights = [];
foreach ($rightIds as $rightId) {
$rights[] = [
'role_id'=>$roleId,
'right_id'=>$rightId
];
}
return $this->insert($rights);
}
}
================================================
FILE: app/Models/SystemSetting.php
================================================
where('status', 1)->get();
}
/**
* 获取所有团队转成KV
*/
public function getAllTeamMap() {
$list = $this->getAllTeam();
return collect($list)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
}
/**
* 通用查询
*/
private function _createWhere($params) {
$query = $this->where('status', 1);
if (isset($params['name']) && $params['name'] !== "") {
$query = $query->where(['name' => $params['name']]);
}
if (isset($params['status']) && $params['status'] !== "") {
$query = $query->where(['status' => $params['status']]);
}
return $query;
}
/**
* 通用查询
*/
public function getLists($params) {
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
return $list;
}
/**
* 通用查询
*/
public function getCount($params) {
return $this->_createWhere($params)->count();
}
}
================================================
FILE: app/Models/SystemUser.php
================================================
'有效',
0 => '无效',
];
private function _createWhere($params) {
$query = $this;
$query = $query->where(['is_del' => 0]);
if (isset($params['name']) && $params['name'] !== "") {
$query = $query->where(['name' => $params['name']]);
}
if (isset($params['team_id']) && $params['team_id'] !== "") {
$query = $query->where(['team_id' => $params['team_id']]);
}
if (isset($params['status']) && $params['status'] !== "") {
$query = $query->where(['status' => $params['status']]);
}
if (isset($params['online']) && $params['online'] !== "") {
$query = $query->where(['online' => $params['online']]);
}
if (isset($params['mobile']) && $params['mobile'] !== "") {
$query = $query->where(['mobile' => $params['mobile']]);
}
return $query;
}
public function getLists($params) {
$roleModel = new SystemRole();
$teamModel = new SystemTeam();
$teams = $teamModel->getAllTeam();
$teams = collect($teams)->mapWithKeys(function($item){return [$item['id']=>$item['name']];});
$offset = ($params['current'] - 1) * $params['pageSize'];
$list = $this->_createWhere($params)->orderBy("id", "desc")->skip($offset)->take($params['pageSize'])->get();
foreach ($list as $key => $item) {
$roles = $roleModel->getRoleByUserId($item['id']);
$item['roles'] = implode(",", app(ToolService::class)->objColumn($roles, 'name'));
$item['team'] = $teams[$item->team_id];
$item['statusname'] = static::$statusMapping[$item['status']];
unset($item['password']);
$list[$key] = $item;
}
return $list;
}
public function getCount($params) {
return $this->_createWhere($params)->count();
}
public function getAllUserWithDel($userId = 0) {
return $this->where('id', '!=', $userId)->get();
}
public function getAllUserWithDelMap($userId = 0) {
$userList = $this->getAllUserWithDel($userId);
return collect($userList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
}
public function getAllUserTeamWithDelMap($userId = 0) {
$userList = $this->getAllUserWithDel($userId);
return collect($userList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['team_id']];
})->toArray();
}
public function getAllUser($userId = 0) {
return $this->where('status', 1)->where('is_del', 0)->where('id', '!=', $userId)->get();
}
public function getAllUserMap($userId = 0) {
$userList = $this->getAllUser($userId);
return collect($userList)->mapWithKeys(function ($item) {
return [$item['id'] => $item['name']];
})->toArray();
}
public function getAllUserByParentId($parentId = 0) {
return $this->where('status', 1)->where('is_del', 0)->where('parent_id', '=', $parentId)->get();
}
public function getUserCountByTeamid($teamId) {
return $this->where('team_id', $teamId)->where('is_del', 0)->count();
}
public function getUserByTeamid($teamId) {
return $this->where('team_id', $teamId)->where('is_del', 0)->get();
}
}
================================================
FILE: app/Models/SystemUserRole.php
================================================
where('user_id', $userId)->get()->toArray();
}
public function delRoles($userId, $roleIds){
if (empty($roleIds)){
return true;
}
return $this->where('user_id', $userId)->where('role_id', $roleIds)->delete();
}
public function addRoles($userId, $roleIds){
if (empty($roleIds)){
return true;
}
$roles = [];
foreach ($roleIds as $roleId) {
$roles[] = [
'role_id'=>$roleId,
'user_id'=>$userId
];
}
return $this->insert($roles);
}
}
================================================
FILE: app/Providers/AppServiceProvider.php
================================================
app->singleton(RightService::class, function ($app) {
return new RightService();
});
}
public function boot() {
error_reporting(E_ALL ^ E_NOTICE);//
}
}
================================================
FILE: app/Providers/AuthServiceProvider.php
================================================
app['auth']->viaRequest('api', function ($request) {
if ($request->input('api_token')) {
return User::where('api_token', $request->input('api_token'))->first();
}
});
}
}
================================================
FILE: app/Providers/EventServiceProvider.php
================================================
[
'App\Listeners\ExampleListener',
],
];
}
================================================
FILE: app/Services/AssignRule/Rule1.php
================================================
getAllAssignUser();
echo "RULE1: 新数据分配的所有用户" . json_encode($users).PHP_EOL;
// 获取所有新数据公共池用户
$model = new Customer();
$customers = $model->where('user_from', 1)->where('follow_user_id', 0)->get();
echo "RULE1: 一共" . count($customers) . "待分配用户" .PHP_EOL;
foreach ($customers as $customer) {
if (empty($users)) {
continue;
}
foreach ($users as $userId => $leftCount) {
$userIdStr = $userId;
$userId = intval($userId);
if ($leftCount <= 0) {
continue;
}
echo "RULE1: 分配" . $customer->id . ' --> ' . $userId .PHP_EOL;
$flag = $customService->assign($customer->id, $userId, 0, CustomerService::ASSIGN_TYPE_NEW);
$users[$userIdStr] = $leftCount - 1;
break;
}
// 把第一位的用户排到最后一位用作轮训
$key = array_keys($users);
$users[$key[0]] = array_shift($users);
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule10.php
================================================
1];
}
}
================================================
FILE: app/Services/AssignRule/Rule11.php
================================================
0];
}
$time = date('Y-m-d H:i:s', time() - $config['day'] * 3600 * 24);
$sql = "SELECT a.id FROM `customer` a , customer_log b where a.id = b.customer_id and `lock` = 1 and b.type = 4 group by a.id HAVING max(b.create_time) < ?"; // 星级为0且分配时间超过2天
echo $time;
$data = app('db')->select($sql, [$time]);
var_dump($data);
foreach ($data as $item) {
echo "RULE11: 锁定超过".$config['day']."天,流入公共池, id: ".$item->id.PHP_EOL;
DB::beginTransaction();
$model = Customer::find($item->id);
$model->lock = 0;
$model->save();
$logmodel = new CustomerLog();
$logmodel->saveLog($logmodel::TYPE_UNLOCK, $item->id, '', '', 0, '锁定超过'.$config['day'].'天');
DB::commit();
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule13.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['hour'] * 3600 * 24;
$sql = "select * from customer where follow_user_id > 0 and assign_time < ? and follow_time < ? and user_from != 1 and follow_time < assign_time";
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE13: 超过".$config['hour']."天没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '再分配客户超过'.$config['hour'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule2.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['hour'] * 3600;
$sql = "select * from customer where follow_user_id > 0 and assign_time < ? and follow_time < ? and follow_time < assign_time and user_from = 1";
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE2: 超过".$config['hour']."小时没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '新客户超过'.$config['hour'].'小时没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule3.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['day'] * 3600 * 24;
$field = $config['type'] == 1 ? 'follow_status' : 'star';
$sql = "select * from customer where ".$field." in (".implode(",", $config['values']).") and follow_user_id > 0 and assign_time < ? and follow_time < ?"; // 星级为0且分配时间超过2天
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE3: 超过".$config['day']."天没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '超过'.$config['day'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule4.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['day'] * 3600 * 24;
$field = $config['type'] == 1 ? 'follow_status' : 'star';
$sql = "select * from customer where ".$field." in (".implode(",", $config['values']).") and follow_user_id > 0 and assign_time < ? and follow_time < ?"; // 星级为0且分配时间超过2天
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
$customService->giveup($item->id, 0, '超过'.$config['day'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule5.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['day'] * 3600 * 24;
$field = $config['type'] == 1 ? 'follow_status' : 'star';
$sql = "select * from customer where ".$field." in (".implode(",", $config['values']).") and follow_user_id > 0 and assign_time < ? and follow_time < ?"; // 星级为0且分配时间超过2天
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE5: 超过".$config['day']."天没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '超过'.$config['day'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule6.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['day'] * 3600 * 24;
$field = $config['type'] == 1 ? 'follow_status' : 'star';
$sql = "select * from customer where ".$field." in (".implode(",", $config['values']).") and follow_user_id > 0 and assign_time < ? and follow_time < ?"; // 星级为0且分配时间超过2天
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE6: 超过".$config['day']."天没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '超过'.$config['day'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignRule/Rule7.php
================================================
0];
}
$customService = app(CustomerService::class);
$time = time() - $config['day'] * 3600 * 24;
$field = $config['type'] == 1 ? 'follow_status' : 'star';
$sql = "select * from customer where ".$field." in (".implode(",", $config['values']).") and follow_user_id > 0 and assign_time < ? and follow_time < ?"; // 星级为0且分配时间超过2天
$data = app('db')->select($sql, [$time, $time]);
foreach ($data as $item) {
echo "RULE7: 超过".$config['day']."天没有跟进,流入公共池, id: ".$item->id.PHP_EOL;
$customService->giveup($item->id, 0, '超过'.$config['day'].'天没有跟进,流入公共池');
}
return ['status'=>1];
}
}
================================================
FILE: app/Services/AssignService.php
================================================
"公共池领取数据",
"inner" => "内部流转分配数据",
"new" => "新数据分配"
];
/**
* 通过json生成文案
*
*/
public function genText($json) {
$data = json_decode($json, true);
$returnText = "";
if (empty($data)) {
return "";
}
foreach ($data as $key => $value) {
$returnText .= static::TYPE_MAPPING[$key] . "(每日上限:".$value."); ";
}
return $returnText;
}
}
================================================
FILE: app/Services/CustomerEditService.php
================================================
1, 'error'=>''];
$customModel = new Customer();
$service = app(CustomerService::class);
$customId = $params['id'];
$customModel = $customModel->find($params['id']);
$oldInfo = clone ($customModel);
$params['mobile_md5'] = md5($params['mobile']);
$flag = $customModel->update($params);
if (!$flag) {
$result = ['status'=>0, 'error'=>"基本信息保存失败"];
}
$diff = $service->diff($oldInfo, $customModel);
if ($diff['star']) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_STAR, $params['id'], $diff['star']['old'], $diff['star']['new'], $operUserId, $customModel->remark);
if (!$flag) {
$result = ['status'=>0, 'error'=>"星级变化保存失败"];
}
}
if ($diff['follow_status']) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_FOLLOW, $params['id'], $diff['follow_status']['old'], $diff['follow_status']['new'], $operUserId, $customModel->remark);
if (!$flag) {
$result = ['status'=>0, 'error'=>"跟进变化保存失败"];
}
$customModel->follow_time = time();
$customModel->save();
if (!$flag) {
$result = ['status'=>0, 'error'=>"跟进时间保存失败"];
}
} else if (!empty($params['remark'])) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_FOLLOW, $params['id'], intval($params['follow_status']), intval($params['follow_status']), $operUserId, $params['remark']);
if (!$flag) {
$result = ['status'=>0, 'error'=>"跟进变化保存失败"];
}
$customModel->follow_time = time();
$customModel->save();
if (!$flag) {
$result = ['status'=>0, 'error'=>"跟进时间保存失败"];
}
}
unset($diff['star']);
unset($diff['follow_status']);
if (count($diff) > 0) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_EDIT, $params['id'], '', '', $operUserId, '');
$logmodel = new SystemLog();
$logmodel->saveLog($logmodel::TYPE_EDIT, $params['id'], json_encode($diff), '', $operUserId, strval($params['config']['remark']));
}
if ($params['remark']) {
$customerRemarkLogModel = new CustomerRemarkLog();
$customerRemarkLogModel->saveLog($customId, $params['remark'], $operUserId);
}
return $result;
}
public function add($params, $operUserId) {
$customModel = new Customer();
$result = ['status'=>1, 'error'=>''];
$params['add_user_id'] = $operUserId;
$params['apply_time'] = time();
$params['assign_time'] = time();
// 转介绍
$params['user_from'] = empty($params['introid']) ? CustomerService::ASSIGN_TYPE_SELF : CustomerService::ASSIGN_TYPE_INTRO;
$params['follow_user_id'] = $operUserId;
$params['mobile_md5'] = md5($params['mobile']);
if ($params['follow_status']) {
$params['follow_time'] = time();
}
$custom = $customModel->create($params);
if (!$custom->id) {
$result = ['status'=>0, 'error'=>"客户录入失败"];
}
$logModel = new CustomerLog();
if ($params['introid']) {
$flag = $logModel->saveLog($logModel::TYPE_INTRO, $custom->id, $params['introid'], '', $operUserId, "转介绍");
$flag = $logModel->saveLog($logModel::TYPE_INTRO, $params['introid'], $custom->id, '', $operUserId, "转介绍");
} else {
$flag = $logModel->saveLog($logModel::TYPE_IN, $custom->id, '', '', $operUserId, "手动录入");
}
if (!$flag) {
$result = ['status'=>0, 'error'=>"客户录入失败"];
}
if ($params['star']) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_STAR, $custom->id, 0, $params['star'], $operUserId, strval($params['remark']));
if (!$flag) {
$result = ['status'=>0, 'error'=>"星级变化保存失败"];
}
}
if ($params['follow_status']) {
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_FOLLOW, $custom->id, 0, $params['follow_status'], $operUserId, strval($params['remark']));
if (!$flag) {
$result = ['status'=>0, 'error'=>"跟进变化保存失败"];
}
}
$customId = $custom->id;
if ($params['remark']) {
$customerRemarkLogModel = new CustomerRemarkLog();
$customerRemarkLogModel->saveLog($customId, $params['remark'], $operUserId);
}
return $result;
}
}
================================================
FILE: app/Services/CustomerService.php
================================================
'公共池分配',
self::ASSIGN_TYPE_INSIDE => '再分配',
self::ASSIGN_TYPE_NEW => '新数据分配',
self::ASSIGN_TYPE_SELF => '自主录入',
self::ASSIGN_TYPE_FOLLOW => '公共池认领',
self::ASSIGN_TYPE_INTRO => '转介绍',
];
const HOUSE_MAPPING = [
1=>'无房',
2=>'本地房',
3=>'外地房',
];
const CAR_MAPPING = [
2=>'有车',
1=>'无车',
];
const POLICY_MAPPING = [
2=>'有保单',
1=>'无保单',
];
const WAGE_MAPPING = [
2=>'有打卡工资',
1=>'无打卡工资',
];
const FUNDS_MAPPING = [
2=>'有公积金',
1=>'无公积金',
];
const INSURANCE_MAPPING = [
2=>'有社保',
1=>'无社保',
];
const CREDIT_MAPPING = [
1=>'无逾期',
2=>'有逾期',
];
/**
* 两个客户的diff
*/
public function diff($cust1, $cust2) {
$diff = [];
$fieldModel = new SystemFields();
$fields = $fieldModel->all()->map(function($item) {
return $item['name'];
})->toArray();
foreach ($fields as $field) {
if ($cust1->$field != $cust2->$field) {
$diff[$field] = [
'old' => $cust1->$field,
'new' => $cust2->$field
];
}
}
return ($diff);
}
public function canAssign($customId) {
$customModel = new Customer();
$custom = $customModel->find($customId);
$data = $customModel->where('mobile', $custom['mobile'])->where('follow_user_id', '>', 0)->where('id', '!=', $customId)->get()->toArray();
if ($data) {
return false;
} else {
return true;
}
}
/**
* 客户分配
*/
public function assign($customId, $followUserId, $operUserId = 0, $assignType = 0) {
DB::beginTransaction();
$customModel = new Customer();
$custom = $customModel->lockForUpdate()->find($customId);
$oldFollowUserId = $custom->follow_user_id;
if (empty($custom) || $oldFollowUserId == $followUserId || ($oldFollowUserId != 0 && $assignType == CustomerService::ASSIGN_TYPE_NEW)) {
// 新用户已经分配了退出
DB::rollBack();
return true;
}
if ($assignType == 0) {
if ($custom->follow_user_id == 0) {
$assignType = static::ASSIGN_TYPE_PUBLIC;
} else {
$assignType = static::ASSIGN_TYPE_INSIDE;
}
}
if ($custom->first_follow_user_id == 0) {
$custom->first_follow_user_id = $followUserId;
}
$result = true;
$custom->follow_user_id = $followUserId;
$custom->assign_time = time();
$custom->status = 1;
// 之前有跟进人变成内部流转
if ($oldFollowUserId != 0) {
$custom->user_from = 2;
}
$flag = $custom->save();
if (!$flag) {
$result = false;
}
$logModel = new CustomerLog();
$logType = $assignType == static::ASSIGN_TYPE_NEW ? $logModel::TYPE_ASSIGN_NEW : $logModel::TYPE_ASSIGN;
$flag = $logModel->saveLog($logType, $customId, $oldFollowUserId, $followUserId, $operUserId, $assignType);
if (!$flag) {
$result = false;
}
if ($result) {
DB::commit();
} else {
DB::rollBack();
}
return true;
}
/**
* 客户认领
*/
public function get($customId, $followUserId, $operUserId = 0, $assignType = 0) {
$customModel = new Customer();
$custom = $customModel->find($customId);
$oldFollowUserId = $custom->follow_user_id;
if (empty($custom) || $oldFollowUserId == $followUserId) {
return true;
}
if ($custom->follow_user_id != 0) {
return false;
}
DB::beginTransaction();
$result = true;
if ($custom->first_follow_user_id == 0) {
$custom->first_follow_user_id = $followUserId;
}
$custom->follow_user_id = $followUserId;
$custom->assign_time = time();
$custom->user_from = self::ASSIGN_TYPE_FOLLOW;
$flag = $custom->save();
if (!$flag) {
$result = false;
}
$logModel = new CustomerLog();
$flag = $logModel->saveLog($logModel::TYPE_GET, $customId, $oldFollowUserId, $followUserId, $operUserId, $assignType);
if (!$flag) {
$result = false;
}
if ($result) {
DB::commit();
} else {
DB::rollBack();
}
return true;
}
/**
* 移入公海
*/
public function giveup($customId, $userId = 0, $remark = "") {
$model = Customer::find($customId);
if ($model->follow_user_id == 0) {
return true;
}
$oldFollowUserId = $model->follow_user_id;
$model->follow_user_id = 0;
$model->user_from = 2;
DB::beginTransaction();
$model->save();
$logmodel = new CustomerLog();
$logmodel->saveLog($logmodel::TYPE_GIVEUP, $customId, $oldFollowUserId, $model->follow_user_id, $userId, $remark);
DB::commit();
return true;
}
/**
* 资质信息文案装换
*/
public function genZizhi($custom) {
$zizhis = [];
if ($custom['house'] && $custom['house'] != 1 && static::HOUSE_MAPPING[$custom['house']]) {
$zizhis[] = static::HOUSE_MAPPING[$custom['house']];
}
if ($custom['car'] && $custom['car'] != 1 && static::CAR_MAPPING[$custom['car']]) {
$zizhis[] = static::CAR_MAPPING[$custom['car']];
}
if ($custom['policy'] && $custom['policy'] != 1 && static::POLICY_MAPPING[$custom['policy']]) {
$zizhis[] = static::POLICY_MAPPING[$custom['policy']];
}
if ($custom['wage'] && $custom['wage'] != 1 && static::WAGE_MAPPING[$custom['wage']]) {
$zizhis[] = static::WAGE_MAPPING[$custom['wage']];
}
if ($custom['funds'] && $custom['funds'] != 1 && static::FUNDS_MAPPING[$custom['funds']]) {
$zizhis[] = static::FUNDS_MAPPING[$custom['funds']];
}
if ($custom['insurance'] && $custom['insurance'] != 1 && static::INSURANCE_MAPPING[$custom['insurance']]) {
$zizhis[] = static::INSURANCE_MAPPING[$custom['insurance']];
}
if ($custom['credit'] && $custom['credit'] == 1 && static::CREDIT_MAPPING[$custom['credit']]) {
$zizhis[] = static::CREDIT_MAPPING[$custom['credit']];
}
return implode("/", $zizhis);
}
/**
* 多少天没有跟进
*/
public function getNotFollowTime($custom) {
$lastTime = max(intval($custom['assign_time']), intval($custom['follow_time']));
if ($lastTime < 1) {
return '';
}
$cha = time() - $lastTime;
$data = intval($cha / ( 24 * 3600));
$hour = intval(($cha % ( 24 * 3600)) / 3600);
return $data. '天'.$hour .'小时';
}
/**
* 解析excel
*/
public function genCustomByExcelRow($row, $dict) {
$returnData = [
'status' => 0,
'error' => [],
'custom' => []
];
if (!$row[0]) {
$returnData['error'][] = '姓名不能为空';
}
$returnData['custom']['name'] = $row[0];
if (!$row[1]) {
$returnData['error'][] = '手机号不能为空';
}
if (!empty($row[1]) && !preg_match("/^1[3456789]\d{9}$/", $row[1])) {
$returnData['error'][] = '手机号格式不正确';
}
$returnData['custom']['mobile'] = $row[1];
$returnData['custom']['age'] = intval($row[2]);
$row[3] = trim($row[3]);
$row[6] = trim($row[6]);
$row[7] = trim($row[7]);
$row[8] = trim($row[8]);
$row[9] = trim($row[9]);
$row[10] = trim($row[10]);
$row[11] = trim($row[11]);
$row[12] = trim($row[12]);
if (!empty($row[3]) && empty(array_flip($dict[SystemDict::TYPE_CITY])[$row[3]])) {
$returnData['error'][] = '找不到对应的城市';
}
$returnData['city'] = intval(array_flip($dict[SystemDict::TYPE_CITY])[$row[3]]);
$returnData['custom']['amount'] = floatval($row[4]);
if (empty($row['5'])) {
$applyTime = time();
} else {
$applyTime = strtotime($row['5']);
}
if (!$applyTime) {
$returnData['error'][] = '申请时间格式不对';
}
$returnData['custom']['apply_time'] = $applyTime;
if (!empty($row[6]) && empty(array_flip(static::HOUSE_MAPPING)[$row[6]])) {
$returnData['error'][] = '找不到对应的房产信息类型';
}
$returnData['custom']['house'] = intval(array_flip(static::HOUSE_MAPPING)[$row[6]]);
if (!empty($row[7]) && empty(array_flip(static::CAR_MAPPING)[$row[7]])) {
$returnData['error'][] = '找不到对应的车辆信息类型';
}
$returnData['custom']['car'] = intval(array_flip(static::CAR_MAPPING)[$row[7]]);
if (!empty($row[8]) && empty(array_flip(static::POLICY_MAPPING)[$row[8]])) {
$returnData['error'][] = '找不到对应的保单信息类型';
}
$returnData['custom']['policy'] = intval(array_flip(static::POLICY_MAPPING)[$row[8]]);
if (!empty($row[9]) && empty(array_flip(static::WAGE_MAPPING)[$row[9]])) {
$returnData['error'][] = '找不到对应的打卡工资信息类型';
}
$returnData['custom']['wage'] = intval(array_flip(static::WAGE_MAPPING)[$row[9]]);
if (!empty($row[10]) && empty(array_flip(static::FUNDS_MAPPING)[$row[10]])) {
$returnData['error'][] = '找不到对应的公积金信息类型';
}
$returnData['custom']['funds'] = intval(array_flip(static::FUNDS_MAPPING)[$row[10]]);
if (!empty($row[11]) && empty(array_flip(static::INSURANCE_MAPPING)[$row[11]])) {
$returnData['error'][] = '找不到对应的社保信息类型';
}
$returnData['custom']['insurance'] = intval(array_flip(static::INSURANCE_MAPPING)[$row[11]]);
if (!empty($row[12]) && empty(array_flip(static::CREDIT_MAPPING)[$row[12]])) {
$returnData['error'][] = '找不到对应的信用情况信息类型';
}
$returnData['custom']['credit'] = intval(array_flip(static::CREDIT_MAPPING)[$row[12]]);
if (empty($returnData['error'])) {
$returnData['status'] = 1;
}
return $returnData;
}
/**
* 新增渠道过来的用户
*/
public function addChannelCustomer($custom) {
$id = 0;
$hasInfo = Customer::where('source', $custom['source'])->where('channel_id', $custom['channel_id'])->get()->toArray();
// 判断客户已经存在
if (empty($hasInfo)) {
$customService = app(CustomerService::class);
$userService = app(UserService::class);
$item['mobile_md5'] = md5($custom['mobile']);
// 写客户信息表
$id = (new Customer())->insertGetId($item);
$users = $userService->getAllAssignUser();
// 遍历所有可以对接客户的销售
foreach ($users as $userId => $leftCount) {
$userId = intval($userId);
// 销售今天没有名额了
if ($leftCount <= 0) {
continue;
}
Log::info("addChannelCustomer 分配" . $id . " --> " . $userId);
$customService->assign($id, $userId, 0, CustomerService::ASSIGN_TYPE_NEW);
break;
}
}
return $id;
}
}
================================================
FILE: app/Services/Hook/LoginHook.php
================================================
getRoleByUserId($userId);
$rolesIds = array_column($roles, 'role_id');
$setting = SystemSetting::find(1);
if ($setting['ip']) {
$ip = explode(",", $setting['ip']) ;
if (!in_array($request->ip(), $ip) && !in_array(1, $rolesIds)) {
return false;
}
}
return true;
}
/**
* 获取用户第一个能打开的页面
*/
public static function getPage($userId) {
$service = app(\App\Services\RightService::class);
$realMenus = ($service->getRightTree($userId)['tree']);
foreach ($realMenus as $menu) {
return $menu['path'];
}
return '';
}
}
================================================
FILE: app/Services/RightService.php
================================================
0) {
$rights = $rightModel->getRightByUserId($userId);
} else {
$rights = $rightModel->getAllRight();
}
$notParentRights = [];
$realRights = [];
foreach ($rights as $right) {
$item = [
'id' => $right->id,
'title' => $right->name_cn,
'value' => $right->name_cn,
'key' => $right->id,
'path' => $right->router,
'name' => $right->router,
'parent_id' => $right->parent_id,
'meta' => [
'locale' => $right->name,
'icon' => $right->icon,
'hideInMenu' => $right->hide_in_menu ? true : false,
'requiresAuth' => true
]
];
if ($right->parent_id > 0) {
if (isset($realRights[$right->parent_id]) && $realRights[$right->parent_id]) {
// 有上级才能有下级权限
$realRights[$right->parent_id]['children'][$right->id] = $item;
} else {
$notParentRights[$right->parent_id][] = $item;
}
} else {
$realRights[$right->id] = $item;
}
}
$returnRights = [];
$leafs = [];
foreach ($realRights as $id => $levelOneRights) {
if (!empty($levelOneRights['children'])) {
$tempRights = [];
foreach ($levelOneRights['children'] as $subid => $levelTwoRights) {
if (!empty($notParentRights[$subid])) {
$levelTwoRights['children'] = $notParentRights[$subid];
foreach ($levelTwoRights['children'] as $levelThreeRights) {
$leafs[] = $levelThreeRights['id'];
}
} else {
$leafs[] = $subid;
}
$tempRights[] = $levelTwoRights;
}
$levelOneRights['children'] = $tempRights;
} else {
$leafs[] = $id;
}
$returnRights[] = $levelOneRights;
}
return [
'tree' => $returnRights,
'leafs' => $leafs
];
}
/**
* 默认默认开放的权限
*/
public function getDefaultRight()
{
return [
[
'key' => 9999,
'path' => 'Usersetting',
'name' => 'Usersetting',
'parent_id' => 0,
'meta' => [
'locale' => 'menu.nothing',
'hideInMenu' => true,
'requiresAuth' => true
]
],
[
'key' => 9998,
'path' => 'NoticeList',
'name' => 'NoticeList',
'parent_id' => 0,
'meta' => [
'locale' => 'menu.nothing',
'hideInMenu' => true,
'requiresAuth' => true
]
],
[
'key' => 9997,
'path' => 'Working',
'name' => 'Working',
'parent_id' => 0,
'meta' => [
'locale' => 'menu.nothing',
'icon' => "",
'hideInMenu' => true,
'requiresAuth' => true
]
]
];
}
/**
* 获取某个账号的可见客户权限
*/
public function getCustomViews($userId) {
// 如果有角色是可以查看所有客户权限,直接返回all
$model = new SystemRole();
$userModel = new SystemUser();
$roles = $model->getRoleByUserId($userId);
foreach ($roles as $role) {
if ($role->views == 1) {
return $userModel->getAllUserMap();
}
}
// 如果只能查看下级权限,递归查询下级
$allUserId = [];
$this->getSubUserids($userId, $allUserId);
$user = $userModel->find($userId);
$allUserId[$userId] = $user->name;
return $allUserId;
}
/**
* 获取下一级的用户
*/
public function getSubUserids($userId, &$nowSubUserids = [], $time = 0) {
if ($time > 20 ) {
return [];
}
$model = new SystemUser();
$subIds = $model->getAllUserByParentId($userId)->mapWithKeys(
function($item) {
return [$item->id => $item->name];
}
)->toArray();
$time++;
foreach ($subIds as $subId => $name) {
if (in_array($subId, $nowSubUserids)) {
continue;
}
$nowSubUserids[$subId] = $name;
$this->getSubUserids($subId, $nowSubUserids, $time);
}
}
}
================================================
FILE: app/Services/SelectService.php
================================================
$item[$value],
'label' => $item[$label],
];
}
return $returnData;
}
/**
* 构造前端的select
*
*/
public function genSelectByKV($data) {
$returnData = [];
foreach ($data as $key=>$value) {
$returnData[] = [
'value' => $key,
'label' => $value,
];
}
return $returnData;
}
/**
* 构造前端的select
*
*/
public function genSelectByVK($data) {
$returnData = [];
foreach ($data as $key=>$value) {
$returnData[] = [
'value' => $value,
'label' => $key,
];
}
return $returnData;
}
/**
* 构造前端的select
*
*/
public function genSelectByK($data, $k) {
$returnData = [];
foreach ($data as $value) {
$returnData[] = [
'value' => $value[$k],
'label' => $value[$k],
];
}
return $returnData;
}
}
================================================
FILE: app/Services/ToolService.php
================================================
$key;
} else {
$returnData[$item->$key] = $item;
}
}
return $returnData;
}
/**
* 简化sql
*/
public static function checkParams($params, $notNull = []) {
foreach ($notNull as $key => $value) {
if (empty($params[$key])) {
return "请输入".$value;
}
}
return '';
}
/**
* 简化sql
*/
public static function ifQueryEq($query, $params, $field, $sqlfield = '') {
$sqlfield = $sqlfield == '' ? $field : $sqlfield;
if (isset($params[$field]) && $params[$field] !== "") {
$query = $query->where($sqlfield, $params[$field]);
}
return $query;
}
/**
* 清理空字段
*/
public static function unsetEmptyField($model, $fields = []) {
foreach ($fields as $field) {
if (empty($model[$field])) unset($model[$field]);
}
return $model;
}
/**
* 导出csv
*/
public function csv($downname, $header, $data) {
$tempfile = "/tmp/".time().".csv";
$fp = fopen($tempfile, 'w+');//生成CSV文件
$row = [];
foreach($header as $k => $v) {
$row[] = iconv("UTF-8", "GB2312//IGNORE", $v);
}
fputcsv($fp, $row);//生成报表头,
foreach ($data as $item) {
$row = [];
foreach (array_keys($header) as $key) {
$row[] = iconv("UTF-8", "GB2312//IGNORE", strval($item[$key]));
}
fputcsv($fp, $row);
}
fclose($fp);//关闭操作文件
header("Content-Type: text/csv;charset=utf-8");
header("Content-Disposition: attachment; filename=".$downname.'-'.date('Ymd').".csv");
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Expires:0');
header('Pragma:public');
ob_start();//对输出数据进行压缩,可减少用户下载时候的等待时间
echo file_get_contents($tempfile);
ob_end_flush();//结束压缩
exit;
}
}
================================================
FILE: app/Services/UserService.php
================================================
where('status', 1)->where('is_del', 0)->where('online', 1)->get();
$retUser = [];
$sort1 = [];
$sort2 = [];
foreach ($users as $user) {
$config = json_decode($user['assign_rights'], true);
if ($config["new"] > 0) {
$count = $logmodel->getCountByUserIdAndTime($user['id'], CustomerLog::TYPE_ASSIGN_NEW, date('Y-m-d 00:00:00'), date('Y-m-d 00:00:00', strtotime('+1 day')))[0];
$leftCount = $config["new"] - $count->cnt;
$sort1[] = intval($count->id);
$sort2[] = $leftCount;
$retUser[$user['id'].'-UID'] = $leftCount;
}
}
array_multisort($sort1, SORT_ASC, $sort2, SORT_DESC, $retUser);
return $retUser;
}
/**
* 获取有认领剩余次数
*/
public function getGetLeftTime($userId) {
$model = new SystemUser();
$logmodel = new CustomerLog();
$user = $model->find($userId);
$config = json_decode($user['assign_rights'], true);
$leftCount = 0;
if ($config["public"] > 0) {
$count = $logmodel->getCountByUserIdAndTime($user['id'], CustomerLog::TYPE_GET, date('Y-m-d 00:00:00'), date('Y-m-d 00:00:00', strtotime('+1 day')))[0];
$leftCount = $config["public"] - $count->cnt;
}
return $leftCount;
}
/**
* 获取权限树
*
* @param userId 信贷员id
*/
public function getUserTree($userId = 0, $userIds = [])
{
$model = new SystemUser();
$users = $model->getAllUserByParentId($userId);
$list = [];
foreach ($users as $user) {
if (in_array($user->id, $userIds)) {
continue;
}
$userIds[] = $user->id;
$item = [
'title' => $user->name,
'key' => $user->id,
];
$children = $this->getUserTree($user->id, $userIds);
if ($children) {
$item['children'] = $children;
}
$list[] = $item;
}
return $list;
}
}
================================================
FILE: app/User.php
================================================
make(
'Illuminate\Contracts\Console\Kernel'
);
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
================================================
FILE: bootstrap/app.php
================================================
bootstrap();
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
);
$app->withFacades();
$app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
|
*/
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(Illuminate\Session\SessionManager::class, function () use ($app) {
return $app->loadComponent('session', Illuminate\Session\SessionServiceProvider::class, 'session');
});
$app->singleton('session.store', function () use ($app) {
return $app->loadComponent('session', Illuminate\Session\SessionServiceProvider::class, 'session.store');
});
/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/
$app->middleware([
Illuminate\Session\Middleware\StartSession::class,
]);
$app->routeMiddleware([
'auth' => App\Http\Middleware\AuthMiddleware::class,
]);
$app->alias('Excel', Maatwebsite\Excel\Facades\Excel::class);
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
$app->register(App\Providers\AppServiceProvider::class);
$app->register(Maatwebsite\Excel\ExcelServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
return $app;
================================================
FILE: composer.json
================================================
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1.3",
"guzzlehttp/guzzle": "^6.5",
"illuminate/session": "^5.8",
"laravel/lumen-framework": "5.8.*",
"league/flysystem": "^1.0",
"maatwebsite/excel": "^3.0",
"workerman/workerman": "^4.1"
},
"require-dev": {
"fzaninotto/faker": "^1.4",
"phpunit/phpunit": "^7.0",
"mockery/mockery": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
================================================
FILE: config/database.php
================================================
'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'crm',
'username' => 'crm',
'password' => '123456',
'charset' => 'utf8mb4',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
],
]
];
================================================
FILE: config/logging.php
================================================
env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => '/www/wwwlogs/crmapp/app.log',
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
================================================
FILE: config/session.php
================================================
'file',
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => '/www/wwwroot/session',
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => '',
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => "",
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'crm_session' ,
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => '',
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => false,
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
================================================
FILE: database/factories/ModelFactory.php
================================================
define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->email,
];
});
================================================
FILE: database/migrations/.gitkeep
================================================
================================================
FILE: database/seeds/DatabaseSeeder.php
================================================
call('UsersTableSeeder');
}
}
================================================
FILE: docs/README.md
================================================
为action自动生成文档创建
================================================
FILE: install/crm.sql
================================================
CREATE TABLE `channel` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(200) NOT NULL DEFAULT '' COMMENT '渠道名,与dict type = 6一至',
`en_name` varchar(20) NOT NULL DEFAULT '',
`type` int(11) NOT NULL DEFAULT '0' COMMENT '1-实时推 2-定时拉',
`config` text COMMENT '渠道配置',
`token` text,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`remark` varchar(512) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '状态',
`cost` float NOT NULL DEFAULT '0' COMMENT '渠道成本'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='渠道';
CREATE TABLE `customer` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(128) NOT NULL DEFAULT '' COMMENT '姓名',
`mobile_jiami` varchar(128) NOT NULL DEFAULT '' COMMENT '加密手机号',
`city` int(11) NOT NULL DEFAULT '0' COMMENT '城市',
`star` int(11) NOT NULL DEFAULT '0' COMMENT '星级',
`source` varchar(11) DEFAULT '0' COMMENT '渠道来源',
`user_from` int(11) NOT NULL DEFAULT '1' COMMENT '客户来源',
`age` int(11) NOT NULL DEFAULT '0' COMMENT '年龄',
`amount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '申请金额',
`sex` int(11) NOT NULL DEFAULT '0' COMMENT '客户性别',
`live_province` int(11) NOT NULL DEFAULT '0' COMMENT '居住-省',
`live_city` int(11) NOT NULL DEFAULT '0' COMMENT '居住-市',
`live_county` int(11) NOT NULL DEFAULT '0' COMMENT '居住-县',
`live_address` varchar(200) NOT NULL DEFAULT '' COMMENT '居住-地址',
`household_province` int(11) NOT NULL DEFAULT '0' COMMENT '户籍-省',
`household_city` int(11) NOT NULL DEFAULT '0' COMMENT '户籍-市',
`household_county` int(11) NOT NULL DEFAULT '0' COMMENT '户籍-县',
`household_address` varchar(200) NOT NULL DEFAULT '' COMMENT '户籍-地址',
`marry` int(11) NOT NULL DEFAULT '0' COMMENT '婚姻状况',
`work` int(11) NOT NULL DEFAULT '0' COMMENT '职业',
`company` varchar(200) NOT NULL DEFAULT '' COMMENT '单位',
`income` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '年收入',
`house` int(11) NOT NULL DEFAULT '0' COMMENT '房产信息',
`car` int(11) NOT NULL DEFAULT '0' COMMENT '车辆信息',
`policy` int(11) NOT NULL DEFAULT '0' COMMENT '保单信息',
`funds` int(11) NOT NULL DEFAULT '0' COMMENT '公积金',
`insurance` int(11) NOT NULL DEFAULT '0' COMMENT '社保信息',
`wage` int(11) NOT NULL DEFAULT '0' COMMENT '打卡工资',
`credit` int(11) NOT NULL DEFAULT '0' COMMENT '信用信息',
`qualification` varchar(2000) NOT NULL DEFAULT '' COMMENT '资质描述',
`remark` varchar(2000) NOT NULL DEFAULT '' COMMENT '备注信息',
`follow_time` int(11) NOT NULL DEFAULT '0' COMMENT '跟进时间',
`follow_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '跟进人ID',
`follow_status` int(11) NOT NULL DEFAULT '0' COMMENT '状态',
`assign_time` int(11) NOT NULL DEFAULT '0' COMMENT '分配时间',
`household_area` int(11) NOT NULL DEFAULT '0' COMMENT '地区',
`live_area` int(11) NOT NULL DEFAULT '0' COMMENT '地区',
`apply_time` int(11) NOT NULL DEFAULT '0',
`create_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '修改时间',
`add_user_id` int(11) NOT NULL DEFAULT '0',
`status` int(11) NOT NULL DEFAULT '1',
`important` int(11) NOT NULL DEFAULT '0' COMMENT '重要客户 0-否 1-是',
`lock` int(11) NOT NULL DEFAULT '0' COMMENT '锁定',
`channel_id` varchar(100) NOT NULL DEFAULT '' COMMENT '渠道用户id',
`first_follow_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '第一个跟进的人',
`mobile_md5` varchar(100) NOT NULL DEFAULT '',
`introid` int(11) NOT NULL DEFAULT '0',
`cost` float NOT NULL DEFAULT '0',
`family` int(11) NOT NULL DEFAULT '0',
`credit_detail` int(11) NOT NULL DEFAULT '0',
`anum` int(11) NOT NULL DEFAULT '0',
`giveup_time` int(11) NOT NULL DEFAULT '0',
`popup` int(11) NOT NULL DEFAULT '0',
`car_info` varchar(64) NOT NULL DEFAULT '',
`house_type` varchar(100) DEFAULT '' COMMENT '房屋类型',
`house_status` varchar(100) NOT NULL DEFAULT '' COMMENT '房屋状态 ',
`company_type` varchar(100) NOT NULL DEFAULT '' COMMENT '单位性质',
`deposit_amount` varchar(100) NOT NULL DEFAULT '' COMMENT '合计公积金月缴额(单位和个人)',
`cont_last_times` varchar(100) NOT NULL DEFAULT '' COMMENT '连续缴存月数',
`is_follow` int(11) NOT NULL DEFAULT '0',
`mobile` varchar(120) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户信息';
CREATE TABLE `customer_backs` (
`id` int(11) UNSIGNED NOT NULL,
`custom_id` int(11) NOT NULL DEFAULT '0' COMMENT '客户id',
`apply_date` int(11) NOT NULL DEFAULT '0' COMMENT '申请时间',
`apply_amount` int(11) NOT NULL DEFAULT '0' COMMENT '申请金额',
`date` int(11) NOT NULL DEFAULT '0' COMMENT '放款时间',
`amount` int(11) NOT NULL DEFAULT '0' COMMENT '放款金额',
`fee` float NOT NULL DEFAULT '0' COMMENT '手续费收入',
`follow_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '跟进人id',
`oper_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '操作人id',
`real_amount` float NOT NULL DEFAULT '0' COMMENT '收入',
`remark` varchar(1024) NOT NULL DEFAULT '' COMMENT '备注',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`status` int(11) NOT NULL DEFAULT '1',
`cost` float NOT NULL DEFAULT '0' COMMENT '成本',
`hetong` varchar(100) NOT NULL DEFAULT '' COMMENT '合同编号\r\n',
`quanzheng` int(11) NOT NULL DEFAULT '0' COMMENT '权证',
`product_id` varchar(100) NOT NULL DEFAULT '' COMMENT '产品id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跟进日志';
CREATE TABLE `customer_log` (
`id` int(11) UNSIGNED NOT NULL,
`customer_id` int(11) NOT NULL DEFAULT '0' COMMENT '客户id',
`type` int(11) NOT NULL DEFAULT '0',
`before` varchar(256) NOT NULL DEFAULT '' COMMENT '旧值',
`after` varchar(256) NOT NULL DEFAULT '' COMMENT '新值',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '操作人id',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '1-有效 0-无效',
`remark` varchar(2000) NOT NULL DEFAULT '0' COMMENT '备注',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跟进日志';
CREATE TABLE `customer_remark_log` (
`id` int(11) UNSIGNED NOT NULL,
`customer_id` int(11) NOT NULL DEFAULT '0' COMMENT '客户id',
`remark` varchar(2048) NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '操作人id',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '1-有效 0-无效',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='备注日志';
CREATE TABLE `customer_rule_config` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '名',
`config` varchar(2000) NOT NULL DEFAULT '' COMMENT '配置',
`status` int(11) NOT NULL DEFAULT '1',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_del` int(11) NOT NULL DEFAULT '0',
`context` text,
`myorder` float NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置';
INSERT INTO `customer_rule_config` (`id`, `name`, `config`, `status`, `create_time`, `update_time`, `is_del`, `context`, `myorder`) VALUES
(1, '新数据分配规则', '[]', 1, '2022-07-30 13:35:46', '2023-04-03 22:33:41', 0, '', 1),
(2, '客户自动流入公共池规则', '{\"hour\":\"0.5\"}', 0, '2022-07-30 13:35:46', '2022-12-08 09:49:47', 0, '', 2),
(3, '客户自动流入公共池规则', '{\"values\":[1,3,4,6,5,2,7,8,9,12],\"type\":\"1\",\"day\":\"3\"}', 1, '2022-07-30 13:35:46', '2023-01-02 16:51:55', 0, '', 3),
(4, '客户自动流入公共池规则', '{\"values\":[],\"type\":\"1\",\"day\":\"\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 4),
(5, '客户自动流入公共池规则', '{\"values\":[],\"type\":\"2\",\"day\":\"\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 5),
(6, '客户自动流入公共池规则', '{\"values\":[],\"type\":\"2\",\"day\":\"\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 6),
(7, '客户自动流入公共池规则', '{\"values\":[],\"type\":\"2\",\"day\":\"\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 7),
(8, '公共池客户领取规则', '{\"type\":2,\"day\":\"7\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 8),
(9, '公共池客户领取规则', '{\"type\":1}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 9),
(10, '公海数据分配规则', '{\"day\":\"\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:12:14', 0, '', 10),
(11, '客户锁定规则', '{\"day\":\"15\",\"num\":\"1\"}', 1, '2022-07-30 13:35:46', '2022-12-08 10:32:04', 0, '', 11),
(12, '客户数量规则', '{\"num\":\"300\"}', 0, '2022-07-30 13:35:46', '2022-12-08 09:49:47', 0, '', 12),
(13, '客户自动流入公共池规则', '{\"hour\":\"3\"}', 0, '2022-07-30 13:35:46', '2022-11-02 22:42:17', 0, '', 2.1),
(14, '客户数量规则', '{\"num\":\"300\"}', 0, '2022-07-30 13:35:46', '2022-12-08 09:49:47', 0, '', 12),
(15, '客户数量规则', '{\"num\":\"122\"}', 0, '2022-07-30 13:35:46', '2023-04-16 17:30:48', 0, '', 12);
CREATE TABLE `dict` (
`id` int(11) UNSIGNED NOT NULL,
`type` int(11) NOT NULL DEFAULT '0' COMMENT '类型',
`tid` int(11) NOT NULL DEFAULT '0' COMMENT 'id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '名字',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`status` int(11) NOT NULL DEFAULT '1',
`groups` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据字典';
INSERT INTO `dict` (`id`, `type`, `tid`, `name`, `create_time`, `update_time`, `status`, `groups`) VALUES
(1, 1, 1, '北京', '2022-06-19 14:37:58', '2022-07-09 08:33:54', 1, 1),
(2, 1, 2, '上海', '2022-06-19 14:37:58', '2022-07-09 08:33:56', 1, 1),
(3, 2, 1, '职员', '2022-06-19 14:39:10', '2022-07-09 08:33:58', 1, 1),
(4, 2, 2, '企业主', '2022-06-19 14:39:10', '2022-07-09 08:34:00', 1, 1),
(5, 3, 1, '未受理', '2022-06-19 14:37:58', '2022-10-29 15:05:05', 1, 1),
(6, 4, 5, '5星', '2022-07-09 08:49:10', '2022-07-09 08:50:21', 1, 1),
(7, 4, 4, '4星', '2022-07-09 08:49:10', '2022-07-09 08:49:10', 1, 1),
(11, 4, 3, '3星', '2022-07-09 08:49:59', '2022-07-09 08:49:59', 1, 1),
(12, 4, 2, '2星', '2022-07-09 08:49:59', '2022-07-09 08:49:59', 1, 1),
(13, 4, 1, '1星', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(14, 5, 1, '新数据', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(16, 5, 2, '再分配', '2022-07-09 08:50:13', '2022-10-23 10:04:13', 1, 1),
(17, 5, 3, '公共池分配', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(18, 5, 4, '自己录入', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(19, 6, 1, '12', '2022-07-09 08:50:13', '2023-04-24 16:47:58', 1, 1),
(21, 6, 2, '抖音', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(22, 7, 1, '有房', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(28, 7, 2, '有车', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(29, 7, 3, '有保单', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(30, 7, 4, '有社保', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(31, 7, 5, '有公积金', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(32, 7, 6, '无逾期', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(33, 8, 1, '客户回访', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(37, 8, 2, '客户邀约', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(38, 8, 3, '客户上门', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(39, 8, 4, '提交资料', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(40, 3, 2, '待跟进', '2022-06-19 14:37:58', '2022-10-29 15:05:11', 1, 1),
(41, 1, 3, '深圳', '2022-06-19 14:37:58', '2022-07-09 08:33:56', 1, 1),
(42, 1, 4, '重庆', '2022-06-19 14:37:58', '2022-07-09 08:33:56', 1, 1),
(43, 1, 5, '天津', '2022-06-19 14:37:58', '2022-07-09 08:33:56', 1, 1),
(44, 1, 6, '海口', '2022-06-19 14:37:58', '2022-07-09 08:33:56', 1, 1),
(45, 6, 3, '微博', '2022-07-09 08:50:13', '2022-07-09 08:50:24', 1, 1),
(47, 3, 3, '电话未接通', '2022-06-19 14:37:58', '2022-10-29 15:05:16', 1, 1),
(48, 3, 4, '意向客户', '2022-06-19 14:37:58', '2022-10-29 15:05:21', 1, 1),
(49, 3, 5, '资质不符', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(51, 5, 5, '公共池认领', '2022-07-09 08:50:13', '2022-10-23 10:04:13', 1, 1),
(57, 5, 6, '转介绍', '2022-07-09 08:50:13', '2022-10-23 10:04:13', 1, 1),
(58, 3, 6, '邀约中', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(59, 3, 7, '已约见', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(60, 3, 8, '待签约', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(61, 3, 9, '已签约', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(62, 3, 10, '进件审批', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(63, 3, 11, '审批通过', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(64, 3, 12, '审批否决', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
(65, 3, 13, '成功放款', '2022-06-19 14:37:58', '2022-10-29 15:05:27', 1, 1),
-- --------------------------------------------------------
--
-- 表的结构 `notice`
--
CREATE TABLE `notice` (
`id` int(11) UNSIGNED NOT NULL,
`custom_id` int(11) NOT NULL DEFAULT '0' COMMENT '客户id',
`type` int(11) NOT NULL DEFAULT '0' COMMENT '类型',
`date` int(11) NOT NULL DEFAULT '0' COMMENT '时间',
`follow_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '跟进人id',
`remark` varchar(2000) NOT NULL DEFAULT '' COMMENT '备注',
`is_read` int(11) DEFAULT '0',
`status` int(11) NOT NULL DEFAULT '1',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跟进日志';
-- --------------------------------------------------------
--
-- 表的结构 `product`
--
CREATE TABLE `product` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(200) NOT NULL DEFAULT '' COMMENT '名称',
`bank` varchar(200) NOT NULL DEFAULT '' COMMENT '机构',
`amount` float NOT NULL DEFAULT '0' COMMENT '额度',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '0-离线 1-在线',
`remark` varchar(20000) NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建人',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`amount2` float NOT NULL DEFAULT '0',
`amount1` float NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品';
-- --------------------------------------------------------
--
-- 表的结构 `system_field`
--
CREATE TABLE `system_field` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`type` int(11) NOT NULL DEFAULT '1' COMMENT '分组',
`name_cn` varchar(50) NOT NULL DEFAULT '' COMMENT '中文名',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统字段';
--
-- 转存表中的数据 `system_field`
--
INSERT INTO `system_field` (`id`, `name`, `type`, `name_cn`, `create_time`, `update_time`) VALUES
(3, 'name', 1, '姓名', '2022-06-19 14:42:25', '2022-06-19 14:42:25'),
(4, 'mobile', 1, '手机号', '2022-06-19 14:42:25', '2022-06-19 14:42:25'),
(11, 'city', 1, '城市', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(12, 'star', 2, '星级', '2022-07-09 17:39:48', '2022-07-16 16:53:32'),
(13, 'source', 3, '渠道来源', '2022-07-09 17:39:48', '2022-07-16 16:53:35'),
(14, 'user_from', 3, '客户来源', '2022-07-09 17:39:48', '2022-07-16 16:53:37'),
(15, 'age', 1, '年龄', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(16, 'amount', 1, '申请金额', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(17, 'sex', 1, '客户性别', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(26, 'marry', 1, '婚姻状况', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(27, 'work', 1, '职业', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(28, 'company', 1, '单位', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(29, 'income', 1, '年收入', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(30, 'house', 2, '房产信息', '2022-07-09 17:39:48', '2022-07-16 16:54:20'),
(31, 'car', 2, '车辆信息', '2022-07-09 17:39:48', '2022-07-16 16:54:23'),
(32, 'policy', 2, '保单信息', '2022-07-09 17:39:48', '2022-07-16 16:54:25'),
(33, 'funds', 2, '公积金', '2022-07-09 17:39:48', '2022-07-16 16:54:29'),
(34, 'insurance', 1, '社保信息', '2022-07-09 17:39:48', '2022-07-09 17:39:48'),
(35, 'wage', 2, '打卡工资', '2022-07-09 17:39:48', '2022-07-16 16:54:50'),
(36, 'credit', 2, '信用信息', '2022-07-09 17:39:48', '2022-07-16 16:54:47'),
(39, 'follow_time', 3, '跟进时间', '2022-07-09 17:39:48', '2022-07-16 16:54:40'),
(40, 'follow_user_id', 3, '跟进人ID', '2022-07-09 17:39:48', '2022-07-16 16:54:54'),
(41, 'follow_status', 3, '状态', '2022-07-09 17:39:48', '2022-07-16 16:54:57'),
(42, 'assign_time', 3, '分配时间', '2022-07-09 17:39:48', '2022-07-16 16:54:59'),
(45, 'apply_time', 3, '申请时间', '2022-07-09 17:39:48', '2022-07-16 16:55:07');
-- --------------------------------------------------------
--
-- 表的结构 `system_log`
--
CREATE TABLE `system_log` (
`id` int(11) UNSIGNED NOT NULL,
`type` int(11) NOT NULL DEFAULT '0' COMMENT '类型',
`obj_id` int(11) NOT NULL DEFAULT '0',
`before` varchar(1024) NOT NULL DEFAULT '',
`after` varchar(1024) NOT NULL DEFAULT '',
`remark` varchar(256) NOT NULL DEFAULT '' COMMENT '备注',
`user_id` int(11) NOT NULL DEFAULT '0',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户';
-- --------------------------------------------------------
--
-- 表的结构 `system_right`
--
CREATE TABLE `system_right` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`name_cn` varchar(100) NOT NULL DEFAULT '',
`url` varchar(50) NOT NULL DEFAULT '' COMMENT '后端url',
`router` varchar(50) NOT NULL DEFAULT '' COMMENT '前段router',
`icon` varchar(50) NOT NULL DEFAULT '' COMMENT '图标',
`type` int(11) NOT NULL DEFAULT '1' COMMENT '类型 1-菜单 2-功能',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '上级id',
`orders` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
`status` int(11) NOT NULL DEFAULT '1',
`hide_in_menu` int(11) NOT NULL DEFAULT '0' COMMENT '是否隐藏\r\n',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统权限';
--
-- 转存表中的数据 `system_right`
--
INSERT INTO `system_right` (`id`, `name`, `name_cn`, `url`, `router`, `icon`, `type`, `parent_id`, `orders`, `status`, `hide_in_menu`, `create_time`, `update_time`) VALUES
(1, 'menu.system', '系统管理', 'system', 'User', 'icon-command', 1, 0, 0, 1, 0, '2022-06-19 14:44:19', '2022-09-11 23:16:02'),
(2, 'menu.system.user', '用户管理', 'system/user/list', 'User', '', 1, 1, 3, 1, 0, '2022-06-19 14:45:15', '2022-07-06 11:37:25'),
(3, 'menu.system.role', '角色管理', 'system/role/list', 'Role', '', 1, 1, 2, 1, 0, '2022-06-19 14:45:46', '2022-07-06 11:37:28'),
(4, 'menu.system.team', '团队管理', 'system/team/list', 'Team', '', 1, 1, 1, 1, 0, '2022-06-19 14:49:09', '2022-07-06 21:51:37'),
(5, 'menu.dashboard', '首页', 'dashboard', 'Workplace', 'icon-home\r\n', 1, 0, 11, 1, 0, '2022-06-25 09:13:09', '2022-10-29 15:43:48'),
(6, 'menu.customer', '客户管理', 'customer', 'CustomerList', 'icon-user-group', 1, 0, 9, 1, 0, '2022-06-25 09:13:09', '2022-09-11 23:15:11'),
(7, 'menu.customer.importcustomer', '重要客户', 'dashboard', 'CustomerImportList', '', 1, 6, 8, 1, 0, '2022-06-25 09:13:34', '2022-07-15 21:46:30'),
(8, 'menu.customer.innercustomer', '内部流转客户', 'customer', 'CustomerInnerList', '', 1, 6, 7, 1, 0, '2022-06-25 09:13:34', '2022-07-15 21:46:35'),
(9, 'menu.customer.newcustomer', '新客户', 'dashboard', 'CustomerNewList', '', 1, 6, 6, 1, 0, '2022-06-25 09:14:00', '2022-07-15 21:46:39'),
(10, 'menu.operate', '运营管理', 'customer', 'Follow', 'icon-computer', 1, 0, 4, 1, 0, '2022-06-25 09:14:00', '2022-09-11 23:15:47'),
(12, 'menu.customer.genjin', '全部客户', 'custom/list', 'CustomerList', '', 1, 6, 9, 1, 0, '2022-06-25 09:15:30', '2022-07-09 21:18:45'),
(20, 'menu.operate.follow', '客户流转管理', 'operate/assign/config', 'Follow', '', 1, 10, 9, 1, 0, '2022-06-25 09:18:25', '2022-07-30 13:55:04'),
(21, 'menu.operate.assign', '客户分配管理', 'system/user/list', 'Assign', '', 1, 10, 8, 1, 0, '2022-06-25 09:18:25', '2022-07-19 12:47:43'),
(23, 'menu.system.user.edit', '编辑', 'system/user/edit', 'Useredit', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:28'),
(24, 'menu.system.user.preview', '查看', 'system/user/info', 'Userpreview', '', 1, 2, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:22'),
(25, 'menu.system.user.lock', '冻结', 'system/user/lock', 'Userlock', '', 1, 2, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:17'),
(26, 'menu.system.user.role', '权限设置', 'system/user/role', 'Userrole', '', 1, 2, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 13:39:43'),
(27, 'menu.system.role.edit', '编辑', 'system/role/edit', 'Roleedit', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:31'),
(28, 'menu.system.role.lock', '冻结', 'system/role/lock', 'Rolelock', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:33'),
(29, 'menu.system.role.previe', '查看', 'system/role/info', 'Rolepreview', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:35'),
(30, 'menu.system.team.edit', '编辑', 'system/team/edit', 'Teamedit', '', 1, 4, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:41:17'),
(31, 'menu.system.team.perview', '查看', 'system/team/info', 'Teampreview', '', 1, 4, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:41:20'),
(32, 'menu.customer.genjin.customedit', '录入客户', 'custom/edit', 'CustomerEdit', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(33, 'menu.customer.genjin.custompreivew', '查看客户', 'custom/info', 'CustomerPreview', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(34, 'menu.customer.genjin.customassign', '分配客户', 'custom/assign', 'CustomerAssign', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(35, 'menu.customer.genjin.customassignlist', '分配客户历史', 'custom/assignlist', 'CustomerAssignList', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(36, 'menu.customer.genjin.customfollowlist', '跟进客户历史', 'custom/followlist', 'CustomerFollowList', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(37, 'menu.customer.genjin.customstarlist', '星级变更历史', 'custom/starlist', 'CustomerStarList', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(38, 'menu.customer.genjin.customlahei', '拉黑客户', 'custom/lahei', 'CustomerLahei', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(39, 'menu.customer.genjin.custombatchupload', '批量上传客户', 'custom/upload', 'CustomerBatchUploadNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:16'),
(40, 'menu.newpool', '新数据公共池', 'custom/newpool', 'CustomerNewpool', 'icon-user', 1, 0, 8, 1, 0, '2022-06-19 14:44:19', '2022-07-15 22:11:23'),
(41, 'menu.pool', '公共池客户', 'custom/pool', 'CustomerPool', 'icon-public', 1, 0, 7, 1, 0, '2022-06-19 14:44:19', '2022-07-15 22:11:53'),
(42, 'menu.custom.unvalid', '无效客户', 'custom/unvalid', 'CustomerUnvalid', 'icon-bug', 1, 0, 6, 1, 0, '2022-06-19 14:44:19', '2022-07-15 22:12:13'),
(43, 'menu.system.user.resetpwd', '重置密码', 'system/user/resetpwd', 'UserResetpwd', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:28'),
(44, 'menu.customer.genjin.customedit', '跟进客户', 'custom/edit', 'CustomerFollow', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(45, 'menu.customer.genjin.customget', '认领客户', 'custom/get', 'CustomerGetNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:23'),
(46, 'menu.operate.assignperview', '查看', 'operate/assign/info', 'Assignpreview', '', 1, 21, 8, 1, 1, '2022-06-25 09:18:25', '2022-07-19 12:49:59'),
(47, 'menu.operate.assignedit', '编辑数据权限', 'operate/assign/edit', 'Assignedit', '', 1, 21, 8, 1, 1, '2022-06-25 09:18:25', '2022-07-19 12:50:01'),
(48, 'menu.operate.assignlog', '查看日志', 'operate/assign/log', 'Assignlog', '', 1, 21, 8, 1, 1, '2022-06-25 09:18:25', '2022-07-19 12:50:02'),
(49, 'menu.customer.genjin.customerimportant', '标记重要', 'custom/important', 'CustomerImportant', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-19 19:44:37'),
(50, 'menu.customer.genjin.customerlock', '锁定客户\r\n', 'custom/lock', 'CustomerLock', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-19 19:44:37'),
(51, 'menu.customer.genjin.customergiveup', '移入公海', 'custom/giveup', 'CustomerGiveup', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-19 19:44:37'),
(52, 'menu.customer.genjin.customeraddnotice', '添加待办', 'custom/addnotices', 'CustomerAddNotice', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-21 21:32:51'),
(53, 'menu.customer.genjin.customeraddback', '添加回款', 'custom/submitback', 'CustomerAddBack', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-21 22:28:33'),
(54, 'menu.customer.genjin.custombacklist', '回款历史', 'custom/backlist', 'CustomerBackList', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(55, 'menu.system.team.del', '删除', 'system/team/del', 'Teamdel', '', 1, 4, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:41:17'),
(57, 'menu.operate.follow.editrule', '编辑规则', 'operate/assign/editrule', 'Follow', '', 1, 20, 9, 1, 1, '2022-06-25 09:18:25', '2022-07-30 14:39:18'),
(58, 'menu.operate.follow.setstatus', '修改规则状态', 'operate/assign/setstatus', 'Follow', '', 1, 20, 9, 1, 1, '2022-06-25 09:18:25', '2022-07-30 14:39:20'),
(59, 'menu.customer.genjin.customerbatchgiveup', '批量移入公海', 'custom/batchgiveup', 'BatchCustomerGiveup', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-19 19:44:37'),
(60, 'menu.customer.genjin.customerbatchget', '批量认领', 'custom/batchget', 'BatchCustomerGetNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:25'),
(62, 'menu.system.role.previe', '业绩排行-姓名', 'Nothing', 'YejiName', '', 1, 5, 2, 1, 1, '2022-06-19 14:45:15', '2022-09-17 14:38:48'),
(63, 'menu.system.role.previe', '业绩排行-团队', 'Nothing', 'YejiTeam', '', 1, 5, 3, 1, 1, '2022-06-19 14:45:15', '2022-09-17 14:38:49'),
(64, 'menu.system.role.previe', '业绩排行-业绩金额', 'Nothing', 'YejiAmount', '', 1, 5, 4, 1, 1, '2022-06-19 14:45:15', '2022-09-17 14:38:51'),
(65, 'menu.system.role.previe', '业绩排行-实际创收', 'Nothing', 'YejiRealAmount', '', 1, 5, 5, 1, 1, '2022-06-19 14:45:15', '2022-09-17 14:38:52'),
(66, 'menu.system.role.previe', '首页内容', 'Nothing', 'Nothing', '', 1, 5, 1, 1, 1, '2022-06-19 14:45:15', '2022-09-17 14:38:46'),
(67, 'menu.customer.genjin.customedit', '编辑客户', 'custom/edit', 'CustomerEditNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:27'),
(68, 'menu.customer.genjin.custompreivew', '查看客户', 'custom/info', 'CustomerPreviewNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:29'),
(69, 'menu.customer.genjin.customassign', '分配客户', 'custom/assign', 'CustomerAssignNewPool', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31'),
(70, 'menu.customer.genjin.custombatchupload', '批量上传客户', 'custom/upload', 'CustomerBatchUploadPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:16'),
(71, 'menu.customer.genjin.customget', '认领客户', 'custom/get', 'CustomerGetPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:23'),
(72, 'menu.customer.genjin.customerbatchget', '批量认领', 'custom/batchget', 'BatchCustomerGetPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:25'),
(73, 'menu.customer.genjin.customedit', '编辑客户', 'custom/edit', 'CustomerEditPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:27'),
(74, 'menu.customer.genjin.custompreivew', '查看客户', 'custom/info', 'CustomerPreviewPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:29'),
(75, 'menu.customer.genjin.customassign', '分配客户', 'custom/assign', 'CustomerAssignPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31'),
(76, 'menu.customer.genjin.customassign', '客户列表', 'Nothing', 'Nothing', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31'),
(77, 'menu.customer.genjin.customassign', '客户列表', 'Nothing', 'Nothing', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31'),
(81, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerExport', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(82, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerNewpoolExport', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(83, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerPoolExport', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(84, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerUnvalidExport', '', 1, 42, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(85, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerImportExport', '', 1, 7, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(86, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerInnerExport', '', 1, 8, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(87, 'menu.customer.genjin.export', '导出客户', 'custom/export', 'CustomerNewExport', '', 1, 9, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(88, 'menu.customer.genjin.customassign', '查询', 'Nothing', 'Nothing', '', 2, 7, 1, 1, 1, '2022-06-25 09:15:30', '2022-09-20 22:09:56'),
(90, 'menu.customer.genjin.customassign', '查询', 'Nothing', 'Nothing', '', 2, 8, 1, 1, 1, '2022-06-25 09:15:30', '2022-09-20 22:09:56'),
(91, 'menu.customer.genjin.customassign', '查询', 'Nothing', 'Nothing', '', 2, 9, 1, 1, 1, '2022-06-25 09:15:30', '2022-10-15 16:08:05'),
(92, 'menu.customer.genjin.customassign', '查询', 'Nothing', 'Nothing', '', 2, 42, 1, 1, 1, '2022-06-25 09:15:30', '2022-10-15 17:58:15'),
(93, 'menu.system.user.delete', '删除', 'system/user/delete', 'Userdelete', '', 1, 2, 0, 1, 1, '2022-06-19 14:45:15', '2022-10-15 16:51:45'),
(94, 'menu.customer.genjin.customassign', '分配客户', 'custom/assign', 'CustomerAssignUnvalid', '', 1, 42, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31'),
(95, 'menu.system.user.delete', '删除', 'system/role/delete', 'Roledelete', '', 1, 3, 0, 1, 1, '2022-06-19 14:45:15', '2022-10-15 16:51:45'),
(96, 'menu.system.setting', '系统配置', 'system/setting', 'Setting', '', 1, 1, 0, 1, 0, '2022-06-19 14:45:46', '2022-10-27 22:28:00'),
(97, 'menu.customer.genjin.customerintro', '转介绍', 'custom/intro', 'CustomerIntro', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-19 19:44:37'),
(108, 'menu.system.product', '产品管理', 'system/product/list', 'Product', 'icon-apps', 1, 0, 1, 1, 0, '2022-06-19 14:49:09', '2022-11-01 23:14:20'),
(109, 'menu.system.product.edit', '编辑', 'system/product/edit', 'ProductEdit', '', 1, 108, 0, 1, 1, '2022-06-19 14:45:15', '2022-11-01 22:26:20'),
(110, 'menu.system.product.perview', '查看', 'system/product/info', 'ProductView', '', 1, 108, 0, 1, 1, '2022-06-19 14:45:15', '2022-11-01 22:26:23'),
(111, 'menu.customer.genjin.customdianping', '主管点评', 'custom/dianping', 'CustomerDianping', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-11-03 21:57:07'),
(112, 'menu.customer.genjin.customeditmobile', '修改手机号', 'custom/editmobile', 'CustomerEditMobile', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-11-03 21:57:07'),
(114, 'menu.system.user.onoffline', '上下线', 'system/user/onoffline', 'OnoffLine', '', 1, 2, 0, 1, 1, '2022-06-19 14:45:15', '2022-07-06 23:40:17'),
(118, 'menu.customer.pool.add', '录入客户', 'custom/edit', 'CustomerPoolAdd', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(119, 'menu.customer.pool.add', '录入客户', 'custom/edit', 'CustomerNewpoolAdd', '', 1, 40, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(120, 'menu.customer.customerimportassign', '分配', 'custom/assign', 'CustomerImportAssign', '', 1, 7, 9, 1, 1, '2022-06-25 09:15:30', '2023-04-13 22:45:33'),
(121, 'menu.customer.customerimportassign', '分配', 'custom/assign', 'CustomerInnerAssign', '', 1, 8, 9, 1, 1, '2022-06-25 09:15:30', '2023-04-13 22:45:36'),
(123, 'menu.customer.genjin.customcleanassign', '清理并分配客户', 'custom/cleanassign', 'CustomerCleanAssign', '', 1, 12, 9, 1, 1, '2022-06-25 09:15:30', '2022-07-09 10:40:29'),
(124, 'menu.customer.genjin.customcleanassign', '清理并分配客户', 'custom/cleanassign', 'CustomerCleanAssignPool', '', 1, 41, 9, 1, 1, '2022-06-25 09:15:30', '2022-09-17 16:40:31');
-- --------------------------------------------------------
--
-- 表的结构 `system_role`
--
CREATE TABLE `system_role` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`views` int(11) NOT NULL DEFAULT '1' COMMENT '可见范围 1-所有 2-上下级',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '1- 有效 0-无效',
`fields` text COMMENT '可见字段\r\n可见字段',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_delete` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色';
--
-- 转存表中的数据 `system_role`
--
INSERT INTO `system_role` (`id`, `name`, `views`, `status`, `fields`, `create_time`, `update_time`, `is_delete`) VALUES
(1, '系统管理员', 1, 1, 'name,mobile,city,age,amount,sex,marry,work,company,income,insurance,star,house,car,policy,funds,wage,credit,source,follow_time,follow_status,assign_time,apply_time,user_from,follow_user_id', '2022-06-19 14:03:45', '2023-05-06 10:01:50', 0);
-- --------------------------------------------------------
--
-- 表的结构 `system_role_field`
--
CREATE TABLE `system_role_field` (
`id` int(11) UNSIGNED NOT NULL,
`role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色id',
`field_id` int(11) NOT NULL DEFAULT '0' COMMENT '字段id',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统角色字段';
-- --------------------------------------------------------
--
-- 表的结构 `system_role_right`
--
CREATE TABLE `system_role_right` (
`id` int(11) UNSIGNED NOT NULL,
`right_id` int(11) NOT NULL DEFAULT '0' COMMENT '权限id',
`role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色id',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户';
--
-- 转存表中的数据 `system_role_right`
--
INSERT INTO `system_role_right` (`id`, `right_id`, `role_id`, `create_time`, `update_time`) VALUES
(74, 1, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(75, 2, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(76, 3, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(80, 7, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(81, 8, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(82, 9, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(83, 10, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(84, 11, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(86, 13, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(87, 14, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(88, 15, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(89, 16, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(90, 17, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(91, 18, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(92, 19, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(93, 20, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(94, 21, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(96, 23, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(97, 24, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(98, 25, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(99, 26, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(100, 27, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(101, 28, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(102, 29, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(103, 30, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(104, 31, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(177, 6, 1, '2022-07-11 07:46:39', '2022-07-11 07:46:39'),
(178, 40, 1, '2022-07-15 21:50:50', '2022-07-15 21:50:50'),
(186, 41, 1, '2022-07-15 21:52:53', '2022-07-15 21:52:53'),
(188, 22, 1, '2022-07-15 22:13:27', '2022-07-15 22:13:27'),
(189, 4, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(198, 43, 1, '2022-07-17 16:31:19', '2022-07-17 16:31:19'),
(201, 46, 1, '2022-07-19 12:48:49', '2022-07-19 12:48:49'),
(202, 47, 1, '2022-07-19 12:48:49', '2022-07-19 12:48:49'),
(203, 48, 1, '2022-07-19 12:48:49', '2022-07-19 12:48:49'),
(210, 55, 1, '2022-07-24 11:44:06', '2022-07-24 11:44:06'),
(211, 56, 1, '2022-07-24 17:40:14', '2022-07-24 17:40:14'),
(275, 57, 1, '2022-07-30 14:38:42', '2022-07-30 14:38:42'),
(276, 58, 1, '2022-07-30 14:38:42', '2022-07-30 14:38:42'),
(281, 61, 1, '2022-09-11 23:57:36', '2022-09-11 23:57:36'),
(288, 66, 1, '2022-09-17 14:38:20', '2022-09-17 14:38:20'),
(289, 5, 1, '2022-09-17 14:38:20', '2022-09-17 14:38:20'),
(290, 65, 1, '2022-09-17 14:47:34', '2022-09-17 14:47:34'),
(291, 64, 1, '2022-09-17 14:47:34', '2022-09-17 14:47:34'),
(292, 63, 1, '2022-09-17 14:47:34', '2022-09-17 14:47:34'),
(293, 62, 1, '2022-09-17 14:47:34', '2022-09-17 14:47:34'),
(303, 76, 1, '2022-09-17 16:58:07', '2022-09-17 16:58:07'),
(304, 77, 1, '2022-09-17 16:58:07', '2022-09-17 16:58:07'),
(305, 69, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(306, 68, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(307, 67, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(308, 39, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(309, 45, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(310, 60, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(311, 70, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(312, 71, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(313, 72, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(314, 73, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(315, 74, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(316, 75, 1, '2022-09-17 17:02:22', '2022-09-17 17:02:22'),
(318, 79, 1, '2022-09-20 22:10:47', '2022-09-20 22:10:47'),
(319, 78, 1, '2022-09-20 22:24:29', '2022-09-20 22:24:29'),
(320, 80, 1, '2022-09-26 22:59:05', '2022-09-26 22:59:05'),
(322, 88, 1, '2022-10-15 16:08:25', '2022-10-15 16:08:25'),
(323, 90, 1, '2022-10-15 16:08:25', '2022-10-15 16:08:25'),
(324, 91, 1, '2022-10-15 16:08:25', '2022-10-15 16:08:25'),
(325, 85, 1, '2022-10-15 16:09:42', '2022-10-15 16:09:42'),
(326, 86, 1, '2022-10-15 16:12:11', '2022-10-15 16:12:11'),
(327, 87, 1, '2022-10-15 16:12:23', '2022-10-15 16:12:23'),
(328, 82, 1, '2022-10-15 16:12:48', '2022-10-15 16:12:48'),
(329, 83, 1, '2022-10-15 16:13:37', '2022-10-15 16:13:37'),
(330, 42, 1, '2022-10-15 16:14:49', '2022-10-15 16:14:49'),
(331, 84, 1, '2022-10-15 16:14:49', '2022-10-15 16:14:49'),
(333, 93, 1, '2022-10-15 16:52:24', '2022-10-15 16:52:24'),
(334, 94, 1, '2022-10-23 09:53:56', '2022-10-23 09:53:56'),
(335, 92, 1, '2022-10-23 09:53:56', '2022-10-23 09:53:56'),
(336, 95, 1, '2022-10-23 10:17:52', '2022-10-23 10:17:52'),
(337, 96, 1, '2022-10-27 22:21:58', '2022-10-27 22:21:58'),
(339, 98, 1, '2022-10-29 10:43:38', '2022-10-29 10:43:38'),
(340, 99, 1, '2022-10-29 10:43:38', '2022-10-29 10:43:38'),
(341, 100, 1, '2022-10-29 13:22:56', '2022-10-29 13:22:56'),
(342, 101, 1, '2022-10-29 13:22:56', '2022-10-29 13:22:56'),
(347, 102, 1, '2022-10-31 21:19:51', '2022-10-31 21:19:51'),
(350, 107, 1, '2022-10-31 21:19:51', '2022-10-31 21:19:51'),
(351, 103, 1, '2022-10-31 21:19:51', '2022-10-31 21:19:51'),
(352, 104, 1, '2022-10-31 21:19:51', '2022-10-31 21:19:51'),
(353, 108, 1, '2022-11-01 22:26:33', '2022-11-01 22:26:33'),
(354, 109, 1, '2022-11-01 22:26:33', '2022-11-01 22:26:33'),
(355, 110, 1, '2022-11-01 22:26:33', '2022-11-01 22:26:33'),
(518, 117, 1, '2022-07-10 01:34:54', '2022-07-10 01:34:54'),
(519, 119, 1, '2023-04-02 00:23:41', '2023-04-02 00:23:41'),
(520, 118, 1, '2023-04-02 00:23:41', '2023-04-02 00:23:41'),
(521, 120, 1, '2023-04-13 22:44:39', '2023-04-13 22:44:39'),
(522, 121, 1, '2023-04-13 22:44:39', '2023-04-13 22:44:39'),
(553, 12, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(554, 32, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(555, 33, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(556, 34, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(557, 35, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(558, 36, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(559, 37, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(560, 38, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(561, 44, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(562, 49, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(563, 50, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(564, 51, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(565, 52, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(566, 53, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(567, 54, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(568, 59, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(569, 81, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(570, 97, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(571, 111, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(572, 112, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(573, 115, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(574, 116, 1, '2023-04-25 16:27:10', '2023-04-25 16:27:10'),
(575, 106, 1, '2023-04-25 16:28:43', '2023-04-25 16:28:43'),
(576, 105, 1, '2023-04-25 16:28:43', '2023-04-25 16:28:43'),
(577, 122, 1, '2023-04-26 10:14:03', '2023-04-26 10:14:03'),
(578, 123, 1, '2023-05-03 20:22:46', '2023-05-03 20:22:46'),
(579, 124, 1, '2023-05-03 20:22:46', '2023-05-03 20:22:46'),
(580, 114, 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00');
-- --------------------------------------------------------
--
-- 表的结构 `system_setting`
--
CREATE TABLE `system_setting` (
`id` int(11) UNSIGNED NOT NULL,
`ip` varchar(200) NOT NULL DEFAULT '' COMMENT 'ip',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`role_id` varchar(100) NOT NULL DEFAULT '',
`etime` varchar(100) NOT NULL DEFAULT '',
`stime` varchar(100) NOT NULL DEFAULT '',
`clean` int(11) DEFAULT '0' COMMENT '清理任务'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统配置表';
--
-- 转存表中的数据 `system_setting`
--
INSERT INTO `system_setting` (`id`, `ip`, `create_time`, `update_time`, `role_id`, `etime`, `stime`, `clean`) VALUES
(1, '', '2022-10-27 22:19:09', '2023-04-26 10:15:00', '1', '22:50:04', '09:00:00', 1);
-- --------------------------------------------------------
--
-- 表的结构 `system_team`
--
CREATE TABLE `system_team` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
`manager_id` varchar(50) NOT NULL DEFAULT '' COMMENT '管理员id',
`status` int(11) NOT NULL DEFAULT '1',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统团队';
-- --------------------------------------------------------
--
-- 表的结构 `system_user`
--
CREATE TABLE `system_user` (
`id` int(11) UNSIGNED NOT NULL,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`mobile` varchar(50) NOT NULL DEFAULT '' COMMENT '手机号',
`password` varchar(50) NOT NULL DEFAULT '' COMMENT '密码',
`team_id` int(11) NOT NULL DEFAULT '0' COMMENT '团队id',
`password_salt` varchar(50) NOT NULL DEFAULT '' COMMENT '密码盐',
`status` int(11) NOT NULL DEFAULT '1' COMMENT '状态:0-无效 1-有效',
`parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '上级',
`assign_rights` varchar(256) NOT NULL DEFAULT '' COMMENT '分配\r\n权限配置',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_del` int(11) NOT NULL DEFAULT '0',
`online` int(11) NOT NULL DEFAULT '1',
`token_time` int(11) NOT NULL DEFAULT '0',
`token` varchar(64) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户';
--
-- 转存表中的数据 `system_user`
--
INSERT INTO `system_user` (`id`, `name`, `mobile`, `password`, `team_id`, `password_salt`, `status`, `parent_id`, `assign_rights`, `create_time`, `update_time`, `is_del`, `online`, `token_time`, `token`) VALUES
(1, '黄晓明', '18211000000', 'd83a3aaa1c9ee44bd622f40dff1bec3a', 1, '960479', 1, 13, '{\"public\":\"60\",\"inner\":\"33\"}', '2022-06-19 14:55:40', '2023-03-21 21:53:57', 0, 1, 1679406837, 'b1cfdf2a4ff27e63f7f605cb67e0e59a');
-- --------------------------------------------------------
--
-- 表的结构 `system_user_role`
--
CREATE TABLE `system_user_role` (
`id` int(11) UNSIGNED NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
`role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色id',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统用户';
--
-- 转存表中的数据 `system_user_role`
--
INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES
(1, 1, 1, '2022-11-09 15:47:06', '2022-11-09 15:49:53');
ALTER TABLE `channel`
ADD PRIMARY KEY (`id`);
ALTER TABLE `customer`
ADD PRIMARY KEY (`id`) USING BTREE,
ADD KEY `idx_mm` (`mobile_md5`),
ADD KEY `mobile_jiami` (`mobile_jiami`),
ADD KEY `follow_user_id` (`follow_user_id`,`user_from`,`is_follow`,`assign_time`) USING BTREE,
ADD KEY `follow_user_id_2` (`follow_user_id`,`follow_time`,`is_follow`,`assign_time`),
ADD KEY `follow_user_id_3` (`follow_user_id`,`apply_time`,`is_follow`,`assign_time`),
ADD KEY `follow_user_id_4` (`follow_user_id`,`assign_time`,`follow_time`,`follow_status`);
ALTER TABLE `customer_backs`
ADD PRIMARY KEY (`id`);
ALTER TABLE `customer_log`
ADD PRIMARY KEY (`id`),
ADD KEY `create_time` (`customer_id`,`create_time`) USING BTREE,
ADD KEY `idx_ac` (`after`(255),`create_time`,`type`,`customer_id`) USING BTREE,
ADD KEY `user_id` (`user_id`,`type`,`id`),
ADD KEY `type` (`type`,`after`(255),`create_time`);
ALTER TABLE `customer_remark_log`
ADD PRIMARY KEY (`id`),
ADD KEY `customer_id` (`customer_id`),
ADD KEY `user_id` (`user_id`);
ALTER TABLE `customer_rule_config`
ADD PRIMARY KEY (`id`);
ALTER TABLE `dict`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `tid` (`type`,`tid`);
ALTER TABLE `notice`
ADD PRIMARY KEY (`id`);
ALTER TABLE `product`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_field`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);
ALTER TABLE `system_log`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_right`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_role`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_role_field`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_role_right`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_setting`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_team`
ADD PRIMARY KEY (`id`);
ALTER TABLE `system_user`
ADD PRIMARY KEY (`id`),
ADD KEY `mobile` (`mobile`) USING BTREE;
ALTER TABLE `system_user_role`
ADD PRIMARY KEY (`id`);
ALTER TABLE `channel`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `customer`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `customer_backs`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `customer_log`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `customer_remark_log`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `customer_rule_config`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
ALTER TABLE `dict`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=71;
ALTER TABLE `notice`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `product`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `system_field`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;
ALTER TABLE `system_log`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `system_right`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=125;
ALTER TABLE `system_role`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `system_role_field`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `system_role_right`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=581;
ALTER TABLE `system_team`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `system_user`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `system_user_role`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
================================================
FILE: install/nginx.conf
================================================
server
{
listen 80;
server_name #ip#;
index index.html index.php;
root /www/wwwroot/crm/public;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-74.conf;
#PHP-INFO-END
client_max_body_size 50m;
location ~ /api {
rewrite ^(.*)$ /index.php break;
fastcgi_pass unix:/tmp/php-cgi-74.sock;
fastcgi_param SCRIPT_FILENAME /www/wwwroot/crm/public/index.php;
include fastcgi.conf;
}
location ~ /resource {
root /www/wwwroot/crm/public;
}
location / {
rewrite ^(.*)$ /index.html break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
#禁止在证书验证目录放入敏感文件
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
return 403;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
access_log /www/wwwlogs/crm.log main;
error_log /www/wwwlogs/crm.error.log;
}
================================================
FILE: nginx.conf
================================================
server {
listen 80;
server_name 139.198.191.172 ;
index index.html;
root /data/www/crm4/public/;
client_max_body_size 50m;
location ~ /api {
rewrite ^(.*)$ /index.php break;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /data/www/crm4/public/index.php;
include fastcgi.conf;
}
location ~ /resource {
root /data/www/crm4/public;
}
location / {
rewrite ^(.*)$ /index.html break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
================================================
FILE: package.json
================================================
{
"name": "arco-design-pro-vue",
"description": "Arco Design Pro for Vue",
"version": "1.0.0",
"private": true,
"author": "ArcoDesign Team",
"license": "MIT",
"scripts": {
"dev": "vite --config ./config/vite.config.dev.ts",
"build": "vue-tsc --noEmit && vite build --config ./config/vite.config.prod.ts && rm -fr ../crm/public/assets && cp -r ./dist/* ../crm/public",
"report": "cross-env REPORT=true npm run build",
"preview": "npm run build && vite preview --host",
"type:check": "vue-tsc --noEmit --skipLibCheck",
"lint-staged": "npx lint-staged",
"prepare": "husky install",
"line": "cp -r ./dist/* ../crm/public"
},
"lint-staged": {
"*.{js,ts,jsx,tsx}": [
"prettier --write",
"eslint --fix"
],
"*.vue": [
"stylelint --fix",
"prettier --write",
"eslint --fix"
],
"*.{less,css}": [
"stylelint --fix",
"prettier --write"
]
},
"dependencies": {
"@arco-design/web-vue": "^2.30.2",
"@types/mockjs": "^1.0.4",
"@vueuse/core": "^7.3.0",
"axios": "^0.24.0",
"build": "^0.1.4",
"dayjs": "^1.10.7",
"echarts": "^5.2.2",
"lodash": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.9",
"query-string": "^7.0.1",
"vue": "^3.2.31",
"vue-echarts": "^6.0.0",
"vue-i18n": "^9.2.0-beta.17",
"vue-router": "^4.0.14"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^12.0.1",
"@types/lodash": "^4.14.177",
"@types/nprogress": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"@vitejs/plugin-vue": "^1.9.4",
"@vitejs/plugin-vue-jsx": "^1.2.0",
"@vue/babel-plugin-jsx": "^1.1.1",
"cross-env": "^7.0.3",
"eslint": "^8.7.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^8.3.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^11.2.6",
"mockjs": "^1.1.0",
"prettier": "^2.2.1",
"rollup-plugin-visualizer": "^5.6.0",
"stylelint": "^13.8.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-order": "^4.1.0",
"typescript": "^4.5.5",
"unplugin-vue-components": "^0.19.3",
"vite": "^2.6.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.3.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-style-import": "1.4.1",
"vite-svg-loader": "^3.1.0",
"vue-tsc": "^0.34.15"
},
"engines": {
"node": ">=14.0.0"
},
"resolutions": {
"bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3",
"gifsicle": "5.2.0"
}
}
================================================
FILE: phpunit.xml
================================================