mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 21:40:50 +00:00
【程序目录】更新开源v6.0
This commit is contained in:
parent
8c9c838bd6
commit
0965feef02
32
crmeb/.env
32
crmeb/.env
@ -1,32 +0,0 @@
|
||||
APP_DEBUG = false
|
||||
|
||||
[APP]
|
||||
DEFAULT_TIMEZONE = Asia/Shanghai
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 127.0.0.1
|
||||
HOSTPORT = 3306
|
||||
USERNAME = crmeb
|
||||
PASSWORD = 123456
|
||||
DATABASE = crmeb
|
||||
PREFIX = eb_
|
||||
CHARSET = utf8mb4
|
||||
DEBUG = true
|
||||
|
||||
[LANG]
|
||||
default_lang = zh-cn
|
||||
|
||||
[CACHE]
|
||||
DRIVER = file
|
||||
CACHE_PREFIX = cache_674d7bb7920f1:
|
||||
CACHE_TAG_PREFIX = cache_tag_674d7bb7920f1:
|
||||
|
||||
[REDIS]
|
||||
REDIS_HOSTNAME = 127.0.0.1
|
||||
PORT = 6379
|
||||
REDIS_PASSWORD =
|
||||
SELECT = 0
|
||||
|
||||
[QUEUE]
|
||||
QUEUE_NAME = 674d7bb7920f1
|
||||
@ -1,5 +1,6 @@
|
||||
version=CRMEB-KY v5.6.3.1
|
||||
version_code=563
|
||||
platform=gitee
|
||||
version=CRMEB-KY v6.0.0
|
||||
version_code=600
|
||||
platform=GITEE
|
||||
spread_uid=0
|
||||
app_id=ze7x9rxsv09l6pvsyo
|
||||
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI
|
||||
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI
|
||||
@ -1,4 +1,4 @@
|
||||
CRMEB v5 后端程序目录
|
||||
CRMEB-KY v6.0.0 后端程序目录
|
||||
===============
|
||||
|
||||
## docker一键运行
|
||||
@ -25,10 +25,10 @@ docker run -d --name crmeb \
|
||||
> 详细说明请到 [帮助文档](https://gitee.com/ZhongBangKeJi/CRMEB/blob/master/help/docker/README.md) 查看。
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
> 运行环境要求PHP7.1-7.4。
|
||||
|
||||
## 安装
|
||||
|
||||
## 一键安装
|
||||
上传你的代码,站点入口目录设置/public
|
||||
在浏览器中输入你的域名或IP(例如:www.yourdomain.com),
|
||||
@ -93,11 +93,6 @@ http://域名/admin
|
||||
默认账号:admin 密码:crmeb.com
|
||||
|
||||
|
||||
## 消息队列
|
||||
```sh
|
||||
php think queue:listen --queue
|
||||
```
|
||||
|
||||
## 定时任务
|
||||
在自动收货,库存预警等功能使用到
|
||||
```sh
|
||||
@ -292,6 +287,10 @@ ThinkPHP6.0遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如
|
||||
[TP6开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
|
||||
|
||||
|
||||
## 参与开发
|
||||
|
||||
请参阅 [CRMEB](https://github.com/crmeb/CRMEB)。
|
||||
|
||||
## 版权信息
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -1,4 +1,15 @@
|
||||
# app 目录结构说明
|
||||
### 系统目录介绍优化方案
|
||||
|
||||
#### 1. 引言
|
||||
在优化系统目录介绍时,我们的目标是使目录结构更加清晰、易于理解,并突出每个目录的核心功能和作用。
|
||||
|
||||
#### 2. 目录结构优化概述
|
||||
我们将通过以下几个步骤来优化目录介绍:
|
||||
- **明确目录层级**:清晰展示主目录与子目录的关系。
|
||||
- **突出核心功能**:简要概括每个目录的主要作用和包含的文件类型。
|
||||
- **增加示例或用途说明**:对于关键目录,提供简短的示例或用途描述,帮助开发者快速理解。
|
||||
|
||||
#### 3. 优化后的目录介绍
|
||||
|
||||
## 目录结构
|
||||
|
||||
@ -26,16 +37,60 @@
|
||||
└── service.php # 服务配置
|
||||
```
|
||||
|
||||
## 目录说明
|
||||
##### app/
|
||||
- **核心目录**:存放应用程序的核心代码和资源。
|
||||
- **包含内容**:业务逻辑、控制器、模型、视图等。
|
||||
|
||||
- **adminapi/** - 后台管理端API接口模块
|
||||
- **api/** - 移动端API接口模块
|
||||
- **dao/** - 数据访问对象层,负责数据库操作
|
||||
- **http/** - HTTP中间件相关文件
|
||||
- **jobs/** - 异步队列任务处理
|
||||
- **kefuapi/** - 客服系统API接口
|
||||
- **lang/** - 多语言包文件
|
||||
- **listener/** - 事件监听器,处理系统事件
|
||||
- **model/** - 数据模型层,定义数据结构和业务逻辑
|
||||
- **services/** - 业务服务层,封装复杂业务逻辑
|
||||
- **subscribes/** - 事件订阅器
|
||||
###### app/adminapi/
|
||||
- **功能**:管理端应用控制器。
|
||||
- **用途**:处理管理端用户请求、业务逻辑和数据交互。
|
||||
- **示例**:管理员登录、权限管理等。
|
||||
|
||||
###### app/api/
|
||||
- **功能**:用户端应用控制器。
|
||||
- **用途**:处理用户端请求、业务逻辑和数据交互。
|
||||
- **示例**:用户注册、商品浏览等。
|
||||
|
||||
###### app/dao/
|
||||
- **功能**:数据访问对象(DAO)。
|
||||
- **用途**:封装数据访问操作,提供统一接口。
|
||||
- **文件类型**:类文件。
|
||||
|
||||
###### app/http/
|
||||
- **功能**:HTTP请求和响应跨域中间键。
|
||||
- **用途**:处理跨域请求,确保前后端通信顺畅。
|
||||
|
||||
###### app/jobs/
|
||||
- **功能**:消息队列任务。
|
||||
- **用途**:处理异步任务,如邮件发送、数据同步等。
|
||||
|
||||
###### app/kefuapi/
|
||||
- **功能**:客服端应用控制器。
|
||||
- **用途**:处理客服端请求、业务逻辑和数据交互。
|
||||
- **示例**:客服聊天、工单处理等。
|
||||
|
||||
###### app/lang/
|
||||
- **功能**:语言包。
|
||||
- **用途**:支持多语言功能,提供不同语言的文本资源。
|
||||
|
||||
###### app/listener/
|
||||
- **功能**:事件监听器。
|
||||
- **用途**:监听和处理系统事件,如用户登录、订单生成等。
|
||||
|
||||
###### app/model/
|
||||
- **功能**:模型类。
|
||||
- **用途**:封装数据访问操作,提供统一接口。
|
||||
- **与dao区别**:模型类更侧重于业务逻辑层面的数据操作。
|
||||
|
||||
###### app/outapi/
|
||||
- **功能**:对外接口应用控制器。
|
||||
- **用途**:处理外部系统请求、业务逻辑和数据交互。
|
||||
- **示例**:第三方支付回调、API对接等。
|
||||
|
||||
###### app/service/
|
||||
- **功能**:服务类。
|
||||
- **用途**:封装业务逻辑和数据交互操作,提供统一服务接口。
|
||||
- **示例**:用户服务、订单服务等。
|
||||
|
||||
#### 4. 结语
|
||||
通过上述优化,我们使`app`目录及其子目录的介绍更加清晰、条理分明。每个目录的核心功能和用途都得到了突出展示,有助于开发者快速理解和定位代码。同时,增加的示例和用途说明也进一步降低了理解门槛,提升了开发效率。
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
crmeb/app/adminapi这个目录主要是后台管理系统的API接口文件。
|
||||
|
||||
具体来说:
|
||||
|
||||
- adminapi目录下的文件都是后台管理系统的控制器(Controller)文件,这些控制器被用来处理后台系统的各种请求。
|
||||
|
||||
- 每一个控制器文件对应后台管理系统某个功能模块,比如AuthController处理认证模块请求,StoreProduct处理商品模块请求等。
|
||||
|
||||
- 控制器内有各种方法,这些方法就相当于API接口,可以处理GET、POST请求,返回JSON数据。
|
||||
|
||||
- 浏览器或APP在调用这些API接口时,会发送请求到相应的控制器方法,例如登录接口请求到Login文件的login方法。
|
||||
|
||||
- 控制器处理完请求后,通过返回Response对象返回处理结果给浏览器或APP。
|
||||
|
||||
所以简单来说,adminapi目录负责后台管理系统的所有API接口,这些接口被APP或前端调用来完成各种管理操作,如查询数据、添加修改删除等。开发者在新增后台功能时,也需要在此目录增加对应的控制器和接口。
|
||||
|
||||
它实际上负责后台系统的通信交互层,解耦了后端逻辑和前端展示,采用 RESTful规范设计。
|
||||
|
||||
# adminapi 目录结构说明
|
||||
|
||||
## 目录结构
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -118,14 +118,23 @@ if (!function_exists('attr_format')) {
|
||||
$title = array_column($arr, 'value');
|
||||
$result = [];
|
||||
|
||||
// 当属性数组不为空时,进行格式化组合
|
||||
if ($len > 0) {
|
||||
// 当属性种类大于1时,需要笛卡尔积组合
|
||||
if ($len > 1) {
|
||||
// 先取第一组属性详情作为初始结果
|
||||
$result = $arr[0]['detail'];
|
||||
// 依次与后续每一组属性详情做两两组合
|
||||
for ($i = 0; $i < $len - 1; $i++) {
|
||||
// 保存当前结果集,用于下一轮循环
|
||||
$temp = $result;
|
||||
// 清空结果,准备重新收集新组合
|
||||
$result = [];
|
||||
// 遍历上一轮得到的所有组合
|
||||
foreach ($temp as $item) {
|
||||
// 将当前组合与下一组属性详情逐个拼接
|
||||
foreach ($arr[$i + 1]['detail'] as $datum) {
|
||||
// 如果元素是数组,取value值拼接;否则直接拼接
|
||||
if (is_array($item)) {
|
||||
$result[] = trim($item['value']) . ',' . trim($datum['value']);
|
||||
} else {
|
||||
@ -135,7 +144,9 @@ if (!function_exists('attr_format')) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 仅有一种属性时,直接取出该组所有属性值
|
||||
foreach ($arr[0]['detail'] as $item) {
|
||||
// 同样区分数组与非数组,统一取value或直接取值
|
||||
if (is_array($item)) {
|
||||
$result[] = trim($item['value']);
|
||||
} else {
|
||||
@ -144,6 +155,7 @@ if (!function_exists('attr_format')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 返回组合后的属性值列表与属性名称列表
|
||||
return [$result, $title];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -83,7 +83,7 @@ class Common extends AuthController
|
||||
]);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
return app('json')->fail(400330);
|
||||
return app('json')->fail('授权成功,写入数据库失败,请检查数据库链接配置');
|
||||
}
|
||||
return app('json')->success(['status' => 1, 'copyright' => $res['data']['copyright'], 'authCode' => $authCode, 'day' => 0, 'force_reminder' => $upgradeStatus['force_reminder'] ?? 0]);
|
||||
default:
|
||||
@ -106,23 +106,23 @@ class Common extends AuthController
|
||||
['captcha', ''],
|
||||
]);
|
||||
if (!$data['company_name']) {
|
||||
return app('json')->fail(400331);
|
||||
return app('json')->fail('请填写公司名称');
|
||||
}
|
||||
if (!$data['domain_name']) {
|
||||
return app('json')->fail(400332);
|
||||
return app('json')->fail('请填写授权域名');
|
||||
}
|
||||
|
||||
if (!$data['phone']) {
|
||||
return app('json')->fail(400333);
|
||||
return app('json')->fail('请填写手机号码');
|
||||
}
|
||||
if (!$data['order_id']) {
|
||||
return app('json')->fail(400334);
|
||||
return app('json')->fail('请填写订单id');
|
||||
}
|
||||
if (!$data['captcha']) {
|
||||
return app('json')->fail(400137);
|
||||
return app('json')->fail('请填写验证码');
|
||||
}
|
||||
$services->authApply($data);
|
||||
return app('json')->success(400335);
|
||||
return app('json')->success('申请授权成功');
|
||||
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ class Common extends AuthController
|
||||
]);
|
||||
}
|
||||
CacheService::clear();
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -405,7 +405,7 @@ class Common extends AuthController
|
||||
['keyword', ''],
|
||||
], true);
|
||||
if (empty($keyword)) {
|
||||
return app('json')->fail(400239, '关键字不能为空');
|
||||
return app('json')->fail('请输入关键字', '关键字不能为空');
|
||||
}
|
||||
|
||||
// 获取系统菜单服务实例
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -23,6 +23,11 @@ use app\services\system\admin\SystemAdminServices;
|
||||
class Login extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var SystemAdminServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* Login constructor.
|
||||
* @param App $app
|
||||
@ -72,7 +77,7 @@ class Login extends AuthController
|
||||
aj_captcha_check_one($captchaType, $token, $pointJson);
|
||||
return app('json')->success();
|
||||
} catch (\Throwable $e) {
|
||||
return app('json')->fail(400336);
|
||||
return app('json')->fail('验证码错误');
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,12 +102,12 @@ class Login extends AuthController
|
||||
try {
|
||||
aj_captcha_check_two($captchaType, $captchaVerification);
|
||||
} catch (\Throwable $e) {
|
||||
return app('json')->fail(400336);
|
||||
return app('json')->fail('验证码错误');
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(trim($password)) < 6 || strlen(trim($password)) > 32) {
|
||||
return app('json')->fail(400762);
|
||||
return app('json')->fail('账号密码必须是在6到32位之间');
|
||||
}
|
||||
|
||||
$this->validate(['account' => $account, 'pwd' => $password], \app\adminapi\validate\setting\SystemAdminValidata::class, 'get');
|
||||
@ -110,10 +115,10 @@ class Login extends AuthController
|
||||
if (!$result) {
|
||||
$num = CacheService::get('login_captcha', 1);
|
||||
if ($num > 1) {
|
||||
return app('json')->fail(400140, ['login_captcha' => 1]);
|
||||
return app('json')->fail('账号或密码错误', ['login_captcha' => 1]);
|
||||
}
|
||||
CacheService::set('login_captcha', $num + 1, 60);
|
||||
return app('json')->fail(400140, ['login_captcha' => 0]);
|
||||
return app('json')->fail('账号或密码错误', ['login_captcha' => 0]);
|
||||
}
|
||||
CacheService::delete('login_captcha');
|
||||
return app('json')->success($result);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -16,7 +16,6 @@ use app\Request;
|
||||
use app\services\system\attachment\SystemAttachmentServices;
|
||||
use app\services\system\SystemRouteServices;
|
||||
use crmeb\services\CacheService;
|
||||
use think\facade\Env;
|
||||
use think\Response;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -74,20 +73,20 @@ class PublicController
|
||||
], true);
|
||||
$service = app()->make(SystemAttachmentServices::class);
|
||||
if (CacheService::get('scan_upload') != $uploadToken) {
|
||||
return app('json')->fail(410086);
|
||||
return app('json')->fail('配置已更改或token已失效');
|
||||
}
|
||||
$service->upload((int)$pid, $file, $upload_type, $type, '', $uploadToken);
|
||||
return app('json')->success(100032);
|
||||
return app('json')->success('上传成功');
|
||||
}
|
||||
|
||||
public function import(Request $request)
|
||||
{
|
||||
$filePath = $request->param('file_path', '');
|
||||
if (empty($filePath)) {
|
||||
return app('json')->fail(12894);
|
||||
return app('json')->fail('文件不存在');
|
||||
}
|
||||
app()->make(SystemRouteServices::class)->import($filePath);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,6 +124,7 @@ class PublicController
|
||||
['name' => '.version', 'require' => '读写', 'value' => is_readable(root_path() . '.version') && is_writable(root_path() . '.version')],
|
||||
['name' => '.constant', 'require' => '读写', 'value' => is_readable(root_path() . '.constant') && is_writable(root_path() . '.constant')],
|
||||
];
|
||||
|
||||
if (function_exists('exec')) {
|
||||
$workermanOutput = $timerOutput = $queueOutput = [];
|
||||
// exec("ps aux | grep 'php think workerman' | grep -v grep", $workermanOutput);
|
||||
@ -175,6 +175,7 @@ class PublicController
|
||||
['name' => '消息队列', 'require' => '开启', 'value' => file_exists(root_path('runtime') . '.queue')],
|
||||
];
|
||||
}
|
||||
|
||||
return app('json')->success($info);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* @author: liaofei<136327134@qq.com>
|
||||
* @day: 2020/9/12
|
||||
@ -10,8 +19,7 @@ class Test
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -22,6 +22,11 @@ use think\facade\App;
|
||||
*/
|
||||
class AgentLevel extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var AgentLevelServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* AgentLevel constructor.
|
||||
* @param App $app
|
||||
@ -42,10 +47,12 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 获取请求参数,包括状态和关键词
|
||||
$where = $this->request->getMore([
|
||||
['status', ''],
|
||||
['keyword', '']
|
||||
]);
|
||||
// 调用服务层获取等级列表
|
||||
return app('json')->success($this->services->getLevelList($where));
|
||||
}
|
||||
|
||||
@ -56,6 +63,7 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
// 调用服务层创建添加表单
|
||||
return app('json')->success($this->services->createForm());
|
||||
}
|
||||
|
||||
@ -65,6 +73,7 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['name', ''],
|
||||
['grade', 0],
|
||||
@ -72,19 +81,22 @@ class AgentLevel extends AuthController
|
||||
['one_brokerage_percent', 0],
|
||||
['two_brokerage_percent', 0],
|
||||
['status', 0]]);
|
||||
if (!$data['name']) return app('json')->fail(400200);
|
||||
if (!$data['grade']) return app('json')->fail(400201);
|
||||
if (!$data['image']) return app('json')->fail(400202);
|
||||
if (!$data['name']) return app('json')->fail('请输入等级名称');
|
||||
if (!$data['grade']) return app('json')->fail('请输入等级');
|
||||
if (!$data['image']) return app('json')->fail('请选择等级图标');
|
||||
// 验证二级返佣比例是否大于一级
|
||||
if ($data['two_brokerage_percent'] > $data['one_brokerage_percent']) {
|
||||
return app('json')->fail(400203);
|
||||
return app('json')->fail('二级返佣比例不能大于一级');
|
||||
}
|
||||
// 检查等级是否已存在
|
||||
$grade = $this->services->get(['grade' => $data['grade'], 'is_del' => 0]);
|
||||
if ($grade) {
|
||||
return app('json')->fail(400204);
|
||||
return app('json')->fail('当前等级已存在');
|
||||
}
|
||||
$data['add_time'] = time();
|
||||
// 保存数据
|
||||
$this->services->save($data);
|
||||
return app('json')->success(400205);
|
||||
return app('json')->success('添加等级成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,6 +116,7 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
// 调用服务层创建编辑表单
|
||||
return app('json')->success($this->services->editForm((int)$id));
|
||||
}
|
||||
|
||||
@ -117,6 +130,7 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['name', ''],
|
||||
['grade', 0],
|
||||
@ -124,18 +138,22 @@ class AgentLevel extends AuthController
|
||||
['one_brokerage_percent', 0],
|
||||
['two_brokerage_percent', 0],
|
||||
['status', 0]]);
|
||||
if (!$data['name']) return app('json')->fail(400200);
|
||||
if (!$data['grade']) return app('json')->fail(400201);
|
||||
if (!$data['image']) return app('json')->fail(400202);
|
||||
if (!$data['name']) return app('json')->fail('请输入等级名称');
|
||||
if (!$data['grade']) return app('json')->fail('请输入等级');
|
||||
if (!$data['image']) return app('json')->fail('请选择等级图标');
|
||||
// 验证二级返佣比例是否大于一级
|
||||
if ($data['two_brokerage_percent'] > $data['one_brokerage_percent']) {
|
||||
return app('json')->fail(400203);
|
||||
return app('json')->fail('二级返佣比例不能大于一级');
|
||||
}
|
||||
if (!$levelInfo = $this->services->getLevelInfo((int)$id)) return app('json')->fail(400206);
|
||||
// 检查编辑的等级是否存在
|
||||
if (!$levelInfo = $this->services->getLevelInfo((int)$id)) return app('json')->fail('编辑的等级不存在');
|
||||
// 检查等级是否重复
|
||||
$grade = $this->services->get(['grade' => $data['grade'], 'is_del' => 0]);
|
||||
if ($grade && $grade['id'] != $id) {
|
||||
return app('json')->fail(400204);
|
||||
return app('json')->fail('当前等级已存在');
|
||||
}
|
||||
|
||||
// 更新等级信息
|
||||
$levelInfo->name = $data['name'];
|
||||
$levelInfo->grade = $data['grade'];
|
||||
$levelInfo->image = $data['image'];
|
||||
@ -143,7 +161,7 @@ class AgentLevel extends AuthController
|
||||
$levelInfo->two_brokerage_percent = $data['two_brokerage_percent'];
|
||||
$levelInfo->status = $data['status'];
|
||||
$levelInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,20 +174,20 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
//检查分销等级数据是否存在
|
||||
$levelInfo = $this->services->getLevelInfo((int)$id);
|
||||
if ($levelInfo) {
|
||||
//更新数据为已删除
|
||||
$res = $this->services->update($id, ['is_del' => 1]);
|
||||
if (!$res)
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
//删除该等级的任务为已删除
|
||||
/** @var AgentLevelTaskServices $agentLevelTaskServices */
|
||||
$agentLevelTaskServices = app()->make(AgentLevelTaskServices::class);
|
||||
$agentLevelTaskServices->update(['level_id' => $id], ['is_del' => 1]);
|
||||
}
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,9 +198,10 @@ class AgentLevel extends AuthController
|
||||
*/
|
||||
public function set_status($id = 0, $status = '')
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
// 更新状态
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,7 +212,7 @@ class AgentLevel extends AuthController
|
||||
public function getTaskNumForm($id)
|
||||
{
|
||||
// 判断任务ID是否为0,若为0则返回错误信息
|
||||
if ($id == 0) return app('json')->fail(100100);
|
||||
if ($id == 0) return app('json')->fail('参数错误');
|
||||
// 调用服务层获取任务表单数量
|
||||
$result = $this->services->getTaskNumForm($id);
|
||||
// 返回成功信息和任务表单数量
|
||||
@ -213,6 +232,6 @@ class AgentLevel extends AuthController
|
||||
]);
|
||||
// 调用服务层设置任务数量
|
||||
$res = $this->services->setTaskNum($id, $data);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -22,6 +22,11 @@ use think\facade\App;
|
||||
*/
|
||||
class AgentLevelTask extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var AgentLevelTaskServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* AgentLevelTask constructor.
|
||||
* @param App $app
|
||||
@ -42,16 +47,18 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 获取请求参数:等级ID、状态、关键词
|
||||
$where = $this->request->getMore([
|
||||
['id', 0],
|
||||
['status', ''],
|
||||
['keyword', '']
|
||||
]);
|
||||
if (!$where['id']) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$where['level_id'] = $where['id'];
|
||||
unset($where['id']);
|
||||
// 调用服务层获取等级任务列表
|
||||
return app('json')->success($this->services->getLevelTaskList($where));
|
||||
}
|
||||
|
||||
@ -62,11 +69,13 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
// 获取等级ID
|
||||
[$level_id] = $this->request->postMore([
|
||||
['level_id', 0]], true);
|
||||
if (!$level_id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
// 调用服务层创建添加表单
|
||||
return app('json')->success($this->services->createForm((int)$level_id));
|
||||
}
|
||||
|
||||
@ -79,6 +88,7 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['level_id', 0],
|
||||
['name', ''],
|
||||
@ -87,18 +97,21 @@ class AgentLevelTask extends AuthController
|
||||
['desc', 0],
|
||||
['sort', 0],
|
||||
['status', 0]]);
|
||||
if (!$data['level_id']) return app('json')->fail(100100);
|
||||
if (!$data['name']) return app('json')->fail(400207);
|
||||
if (!$data['type']) return app('json')->fail(400208);
|
||||
if (!$data['number']) return app('json')->fail(400209);
|
||||
if (!$data['level_id']) return app('json')->fail('参数错误');
|
||||
if (!$data['name']) return app('json')->fail('请输入任务名称');
|
||||
if (!$data['type']) return app('json')->fail('请选择任务类型');
|
||||
if (!$data['number']) return app('json')->fail('请输入限定数量');
|
||||
// 检查任务类型是否有效
|
||||
$this->services->checkTypeTask(0, $data);
|
||||
$data['add_time'] = time();
|
||||
// 保存任务数据
|
||||
$this->services->save($data);
|
||||
// 更新等级的任务数量
|
||||
$levelInfo = app()->make(AgentLevelServices::class)->get((int)$data['level_id']);
|
||||
$levelInfo->task_num = $levelInfo->task_num + 1;
|
||||
$levelInfo->task_total_num = $levelInfo->task_total_num + 1;
|
||||
$levelInfo->save();
|
||||
return app('json')->success(400210);
|
||||
return app('json')->success('添加任务成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,6 +131,7 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
// 调用服务层创建编辑表单
|
||||
return app('json')->success($this->services->editForm((int)$id));
|
||||
}
|
||||
|
||||
@ -131,6 +145,7 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['name', ''],
|
||||
['type', ''],
|
||||
@ -138,11 +153,14 @@ class AgentLevelTask extends AuthController
|
||||
['desc', 0],
|
||||
['sort', 0],
|
||||
['status', 0]]);
|
||||
if (!$data['name']) return app('json')->fail(400207);
|
||||
if (!$data['type']) return app('json')->fail(400208);
|
||||
if (!$data['number']) return app('json')->fail(400209);
|
||||
if (!$levelTaskInfo = $this->services->getLevelTaskInfo((int)$id)) return app('json')->fail(400211);
|
||||
if (!$data['name']) return app('json')->fail('请输入任务名称');
|
||||
if (!$data['type']) return app('json')->fail('请选择任务类型');
|
||||
if (!$data['number']) return app('json')->fail('请输入限定数量');
|
||||
// 检查任务是否存在
|
||||
if (!$levelTaskInfo = $this->services->getLevelTaskInfo((int)$id)) return app('json')->fail('编辑的任务不存在');
|
||||
// 检查任务类型是否有效
|
||||
$this->services->checkTypeTask((int)$id, $data);
|
||||
// 更新任务信息
|
||||
$levelTaskInfo->name = $data['name'];
|
||||
$levelTaskInfo->type = $data['type'];
|
||||
$levelTaskInfo->number = $data['number'];
|
||||
@ -150,7 +168,7 @@ class AgentLevelTask extends AuthController
|
||||
$levelTaskInfo->sort = $data['sort'];
|
||||
$levelTaskInfo->status = $data['status'];
|
||||
$levelTaskInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,21 +181,23 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$levelTaskInfo = $this->services->getLevelTaskInfo((int)$id);
|
||||
if ($levelTaskInfo) {
|
||||
// 标记删除
|
||||
$res = $this->services->update($id, ['is_del' => 1]);
|
||||
if ($res) {
|
||||
// 更新等级的任务数量
|
||||
$levelInfo = app()->make(AgentLevelServices::class)->get((int)$levelTaskInfo['level_id']);
|
||||
$levelInfo->task_num = $levelInfo->task_num - 1;
|
||||
$levelInfo->task_total_num = $levelInfo->task_total_num - 1;
|
||||
if ($levelInfo->task_num <= 0) $levelInfo->task_num = $levelInfo->task_total_num;
|
||||
$levelInfo->save();
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,9 +208,10 @@ class AgentLevelTask extends AuthController
|
||||
*/
|
||||
public function set_status($id = 0, $status = '')
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
// 更新状态
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -23,6 +23,11 @@ use think\facade\App;
|
||||
*/
|
||||
class AgentManage extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var AgentManageServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* AgentManage constructor.
|
||||
* @param App $app
|
||||
@ -43,10 +48,12 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 获取请求参数:昵称、日期范围
|
||||
$where = $this->request->getMore([
|
||||
['nickname', ''],
|
||||
['data', ''],
|
||||
]);
|
||||
// 调用服务层获取分销商列表
|
||||
return app('json')->success($this->services->agentSystemPage($where));
|
||||
}
|
||||
|
||||
@ -59,10 +66,12 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function get_badge()
|
||||
{
|
||||
// 获取请求参数
|
||||
$where = $this->request->getMore([
|
||||
['data', '', '', 'time'],
|
||||
['nickname', ''],
|
||||
]);
|
||||
// 返回分销统计数据
|
||||
return app('json')->success(['res' => $this->services->getSpreadBadge($where)]);
|
||||
}
|
||||
|
||||
@ -72,12 +81,14 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function get_stair_list()
|
||||
{
|
||||
// 获取请求参数:用户ID、日期范围、昵称、类型(一级/二级)
|
||||
$where = $this->request->getMore([
|
||||
['uid', 0],
|
||||
['data', ''],
|
||||
['nickname', ''],
|
||||
['type', '']
|
||||
]);
|
||||
// 调用服务层获取推广人列表
|
||||
return app('json')->success($this->services->getStairList($where));
|
||||
}
|
||||
|
||||
@ -87,12 +98,14 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function get_stair_badge()
|
||||
{
|
||||
// 获取请求参数
|
||||
$where = $this->request->getMore([
|
||||
['uid', ''],
|
||||
['data', ''],
|
||||
['nickname', ''],
|
||||
['type', ''],
|
||||
]);
|
||||
// 返回推广人统计数据
|
||||
return app('json')->success(['res' => $this->services->getSairBadge($where)]);
|
||||
}
|
||||
|
||||
@ -105,12 +118,14 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function get_stair_order_list()
|
||||
{
|
||||
// 获取请求参数
|
||||
$where = $this->request->getMore([
|
||||
['uid', 0],
|
||||
['data', ''],
|
||||
['order_id', ''],
|
||||
['type', ''],
|
||||
]);
|
||||
// 调用服务层获取推广订单列表
|
||||
return app('json')->success($this->services->getStairOrderList((int)$where['uid'], $where));
|
||||
}
|
||||
|
||||
@ -122,18 +137,19 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function look_code($uid = '', $action = '')
|
||||
{
|
||||
if (!$uid || !$action) return app('json')->fail(100100);
|
||||
if (!$uid || !$action) return app('json')->fail('参数错误');
|
||||
try {
|
||||
// 动态调用方法
|
||||
if (method_exists($this, $action)) {
|
||||
$res = $this->$action($uid);
|
||||
if ($res)
|
||||
return app('json')->success($res);
|
||||
else
|
||||
return app('json')->fail(100016);
|
||||
return app('json')->fail('获取失败');
|
||||
} else
|
||||
return app('json')->fail(100029);
|
||||
return app('json')->fail('暂无此方法');
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail(400212, ['line' => $e->getLine(), 'messag' => $e->getMessage()]);
|
||||
return app('json')->fail('获取推广二维码失败,请检查您的微信配置', ['line' => $e->getLine(), 'messag' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,11 +160,12 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function wechant_code($uid)
|
||||
{
|
||||
// 调用服务层生成公众号二维码
|
||||
$qr_code = $this->services->wechatCode((int)$uid);
|
||||
if (isset($qr_code['url']))
|
||||
return ['code_src' => $qr_code['url']];
|
||||
else
|
||||
return app('json')->fail(100016);
|
||||
return app('json')->fail('获取失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,8 +175,9 @@ class AgentManage extends AuthController
|
||||
public function look_xcx_code($uid = '')
|
||||
{
|
||||
if (!strlen(trim($uid))) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
// 调用服务层生成小程序二维码
|
||||
return app('json')->success($this->services->lookXcxCode((int)$uid));
|
||||
}
|
||||
|
||||
@ -170,7 +188,8 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function look_h5_code($uid = '')
|
||||
{
|
||||
if (!strlen(trim($uid))) return app('json')->fail(100100);
|
||||
if (!strlen(trim($uid))) return app('json')->fail('参数错误');
|
||||
// 调用服务层生成H5二维码
|
||||
return app('json')->success($this->services->lookH5Code((int)$uid));
|
||||
}
|
||||
|
||||
@ -181,8 +200,9 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function delete_spread($uid)
|
||||
{
|
||||
if (!$uid) app('json')->fail(100100);
|
||||
return app('json')->success($this->services->delSpread((int)$uid) ? 100014 : 100015);
|
||||
if (!$uid) app('json')->fail('参数错误');
|
||||
// 调用服务层解除推广权限
|
||||
return app('json')->success($this->services->delSpread((int)$uid) ? '设置成功' : '设置失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,29 +212,32 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function editSpread(UserServices $services)
|
||||
{
|
||||
// 获取请求参数:用户ID、上级推广人ID
|
||||
[$uid, $spreadUid] = $this->request->postMore([
|
||||
[['uid', 'd'], 0],
|
||||
[['spread_uid', 'd'], 0],
|
||||
], true);
|
||||
if (!$uid || !$spreadUid) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
if ($uid == $spreadUid) {
|
||||
return app('json')->fail(400213);
|
||||
return app('json')->fail('上级推广人不能为自己');
|
||||
}
|
||||
// 获取用户信息
|
||||
$userInfo = $services->get($uid);
|
||||
if (!$userInfo) {
|
||||
return app('json')->fail(400214);
|
||||
return app('json')->fail('用户不存在');
|
||||
}
|
||||
// 验证上级用户是否存在
|
||||
if (!$services->count(['uid' => $spreadUid])) {
|
||||
return app('json')->fail(400215);
|
||||
return app('json')->fail('上级用户不存在');
|
||||
}
|
||||
if ($userInfo->spread_uid == $spreadUid) {
|
||||
return app('json')->fail(400216);
|
||||
return app('json')->fail('当前推广人已经是所选人');
|
||||
}
|
||||
$spreadInfo = $services->get($spreadUid);
|
||||
if ($spreadInfo->spread_uid == $uid) {
|
||||
return app('json')->fail(400217);
|
||||
return app('json')->fail('上级推广人不能为自己下级');
|
||||
}
|
||||
//之前的上级减少推广人数
|
||||
if ($userInfo->spread_uid) {
|
||||
@ -222,15 +245,17 @@ class AgentManage extends AuthController
|
||||
$oldSpread->spread_count = $oldSpread->spread_count - 1;
|
||||
$oldSpread->save();
|
||||
}
|
||||
// 新上级增加推广人数
|
||||
$spreadInfo->spread_count = $spreadInfo->spread_count + 1;
|
||||
$spreadInfo->save();
|
||||
// 更新用户推广关系
|
||||
$userInfo->spread_uid = $spreadUid;
|
||||
$userInfo->spread_time = time();
|
||||
$userInfo->division_id = $spreadInfo->division_id;
|
||||
$userInfo->agent_id = $spreadInfo->agent_id;
|
||||
$userInfo->staff_id = $spreadInfo->staff_id;
|
||||
$userInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,8 +265,9 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function delete_system_spread($uid)
|
||||
{
|
||||
if (!$uid) app('json')->fail(100100);
|
||||
return app('json')->success($this->services->delSystemSpread((int)$uid) ? 100019 : 100020);
|
||||
if (!$uid) app('json')->fail('参数错误');
|
||||
// 调用服务层取消推广资格
|
||||
return app('json')->success($this->services->delSystemSpread((int)$uid) ? '取消成功' : '取消失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +282,8 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function getLevelForm(AgentLevelServices $services, $uid)
|
||||
{
|
||||
if (!$uid) app('json')->fail(100100);
|
||||
if (!$uid) app('json')->fail('参数错误');
|
||||
// 调用AgentLevelServices获取表单
|
||||
return app('json')->success($services->levelForm((int)$uid));
|
||||
}
|
||||
|
||||
@ -270,13 +297,15 @@ class AgentManage extends AuthController
|
||||
*/
|
||||
public function giveAgentLevel(AgentLevelServices $services)
|
||||
{
|
||||
// 获取参数:用户ID、等级ID
|
||||
[$uid, $id] = $this->request->postMore([
|
||||
[['uid', 'd'], 0],
|
||||
[['id', 'd'], 0],
|
||||
], true);
|
||||
if (!$uid || !$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($services->givelevel((int)$uid, (int)$id) ? 400218 : 400219);
|
||||
// 调用AgentLevelServices赠送等级
|
||||
return app('json')->success($services->givelevel((int)$uid, (int)$id) ? '赠送成功' : '赠送失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -25,6 +25,11 @@ use think\facade\App;
|
||||
*/
|
||||
class Division extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var DivisionServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* Division constructor.
|
||||
* @param App $app
|
||||
@ -45,6 +50,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionList()
|
||||
{
|
||||
// 获取请求参数
|
||||
$where = $this->request->getMore([
|
||||
['division_type', 0],
|
||||
['keyword', '']
|
||||
@ -52,6 +58,7 @@ class Division extends AuthController
|
||||
if ($where['division_type'] == 2) {
|
||||
$where['division_id'] = $this->adminInfo['division_id'];
|
||||
}
|
||||
// 调用服务层获取事业部列表
|
||||
$data = $this->services->getDivisionList($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
@ -65,10 +72,12 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionDownList()
|
||||
{
|
||||
// 获取参数:事业部类型、用户ID
|
||||
[$type, $uid] = $this->request->getMore([
|
||||
['division_type', 0],
|
||||
['uid', 0],
|
||||
], true);
|
||||
// 调用服务层获取下级列表
|
||||
$data = $this->services->divisionDownList($type, $uid);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
@ -81,6 +90,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionCreate($uid)
|
||||
{
|
||||
// 调用服务层获取事业部表单
|
||||
return app('json')->success($this->services->getDivisionForm((int)$uid));
|
||||
}
|
||||
|
||||
@ -90,6 +100,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionSave()
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['uid', 0],
|
||||
['aid', 0],
|
||||
@ -103,8 +114,9 @@ class Division extends AuthController
|
||||
['roles', []],
|
||||
['image', []]
|
||||
]);
|
||||
// 保存事业部数据
|
||||
$this->services->divisionSave($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,6 +127,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionAgentCreate($uid)
|
||||
{
|
||||
// 调用服务层获取代理商表单
|
||||
return app('json')->success($this->services->getDivisionAgentForm((int)$uid));
|
||||
}
|
||||
|
||||
@ -128,6 +141,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionAgentSave(UserServices $userServices)
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->postMore([
|
||||
['division_id', 0],
|
||||
['uid', 0],
|
||||
@ -139,17 +153,20 @@ class Division extends AuthController
|
||||
['image', []],
|
||||
]);
|
||||
if ((int)$data['uid'] == 0) $data['uid'] = $data['image']['uid'];
|
||||
// 验证用户信息
|
||||
$userInfo = $userServices->getUserInfo($data['uid'], 'is_division,is_agent,is_staff');
|
||||
if (!$userInfo) throw new AdminException(100100);
|
||||
if (!$userInfo) throw new AdminException('参数错误');
|
||||
if ($data['edit'] == 0) {
|
||||
if ($userInfo['is_division']) throw new AdminException('此用户是事业部,请勿添加为代理商');
|
||||
if ($userInfo['is_agent']) throw new AdminException('此用户是代理商,无法重复添加');
|
||||
if ($userInfo['is_staff']) throw new AdminException('此用户是下级员工,无法添加为代理商');
|
||||
// 验证事业部信息
|
||||
$divisionUserInfo = $userServices->count(['uid' => (int)$data['division_id'], 'is_division' => 1, 'division_id' => $data['division_id']]);
|
||||
if (!$divisionUserInfo) throw new AdminException(100100);
|
||||
if (!$divisionUserInfo) throw new AdminException('参数错误');
|
||||
}
|
||||
// 保存代理商数据
|
||||
$this->services->divisionAgentSave($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,8 +177,9 @@ class Division extends AuthController
|
||||
*/
|
||||
public function setDivisionStatus($status, $uid)
|
||||
{
|
||||
// 调用服务层设置状态
|
||||
$this->services->setDivisionStatus($status, $uid);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,8 +190,9 @@ class Division extends AuthController
|
||||
*/
|
||||
public function delDivision($type, $uid)
|
||||
{
|
||||
// 调用服务层删除事业部/代理商
|
||||
$this->services->delDivision($type, $uid);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,6 +204,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function AdminApplyList()
|
||||
{
|
||||
// 获取请求参数
|
||||
$where = $this->request->getMore([
|
||||
['uid', 0],
|
||||
['division_id', 0],
|
||||
@ -196,6 +216,7 @@ class Division extends AuthController
|
||||
$where['division_id'] = $this->adminInfo['division_id'];
|
||||
/** @var DivisionAgentApplyServices $applyServices */
|
||||
$applyServices = app()->make(DivisionAgentApplyServices::class);
|
||||
// 获取申请列表
|
||||
$data = $applyServices->AdminApplyList($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
@ -211,6 +232,7 @@ class Division extends AuthController
|
||||
{
|
||||
/** @var DivisionAgentApplyServices $applyServices */
|
||||
$applyServices = app()->make(DivisionAgentApplyServices::class);
|
||||
// 获取审核表单
|
||||
$data = $applyServices->examineApply($id, $type);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
@ -224,6 +246,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function applyAgentSave()
|
||||
{
|
||||
// 获取审核参数
|
||||
$data = $this->request->getMore([
|
||||
['type', 0],
|
||||
['id', 0],
|
||||
@ -234,8 +257,9 @@ class Division extends AuthController
|
||||
]);
|
||||
/** @var DivisionAgentApplyServices $applyServices */
|
||||
$applyServices = app()->make(DivisionAgentApplyServices::class);
|
||||
// 保存审核结果
|
||||
$data = $applyServices->applyAgentSave($data);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,8 +271,9 @@ class Division extends AuthController
|
||||
{
|
||||
/** @var DivisionAgentApplyServices $applyServices */
|
||||
$applyServices = app()->make(DivisionAgentApplyServices::class);
|
||||
// 删除申请记录
|
||||
$applyServices->delApply($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,6 +287,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionStaffCreate($uid)
|
||||
{
|
||||
// 调用服务层获取员工表单
|
||||
return app('json')->success($this->services->getDivisionStaffForm((int)$uid));
|
||||
}
|
||||
|
||||
@ -277,14 +303,16 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionStaffSave()
|
||||
{
|
||||
// 获取并验证请求数据
|
||||
$data = $this->request->getMore([
|
||||
['uid', 0],
|
||||
['division_percent', 0],
|
||||
['agent_id', 0],
|
||||
['image', []],
|
||||
]);
|
||||
// 保存员工数据
|
||||
$this->services->divisionStaffSave($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,6 +324,7 @@ class Division extends AuthController
|
||||
*/
|
||||
public function divisionStatistics()
|
||||
{
|
||||
// 获取请求参数:类型、时间、分页、排序
|
||||
[$type, $time, $page, $limit, $sort, $order] = $this->request->getMore([
|
||||
['type', 0],
|
||||
['time', ''],
|
||||
@ -305,6 +334,7 @@ class Division extends AuthController
|
||||
['order', 'desc'],
|
||||
], true);
|
||||
$time = $time != '' ? explode('-', $time) : [];
|
||||
// 获取统计数据
|
||||
$data = $this->services->divisionStatistics($type, $time, $page, $limit, $sort, $order);
|
||||
return app('json')->success($data);
|
||||
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\agent;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
@ -8,12 +16,26 @@ use think\facade\App;
|
||||
|
||||
class SpreadApply extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var SpreadApplyServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* SpreadApply constructor.
|
||||
* @param App $app
|
||||
* @param SpreadApplyServices $services
|
||||
*/
|
||||
public function __construct(App $app, SpreadApplyServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function applyList()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
@ -23,6 +45,13 @@ class SpreadApply extends AuthController
|
||||
return app('json')->success($this->services->applyList($where));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核申请
|
||||
* @param $id
|
||||
* @param $uid
|
||||
* @param $status
|
||||
* @return mixed
|
||||
*/
|
||||
public function applyExamine($id, $uid, $status)
|
||||
{
|
||||
[$refusal_reason] = $this->request->postMore([
|
||||
@ -32,6 +61,11 @@ class SpreadApply extends AuthController
|
||||
return app('json')->success($status == 1 ? '审核通过' : '拒绝成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除申请
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function applyDelete($id)
|
||||
{
|
||||
$this->services->applyDelete($id);
|
||||
|
||||
@ -0,0 +1,273 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\application\routine;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\services\system\NodeEnvironmentServices;
|
||||
use app\services\wechat\RoutineCIServices;
|
||||
use think\facade\App;
|
||||
|
||||
/**
|
||||
* 小程序 CI 自动化上传控制器
|
||||
*
|
||||
* 功能概述:
|
||||
* 本控制器提供微信小程序代码自动化上传的 API 接口,基于微信官方的 miniprogram-ci 工具实现。
|
||||
* 通过这些接口,管理员可以在后台直接将小程序代码上传到微信服务器,无需使用微信开发者工具。
|
||||
*
|
||||
* 主要功能:
|
||||
* 1. 环境检测 - 检测服务器是否已安装 Node.js 和 miniprogram-ci
|
||||
* 2. 安装指南 - 提供不同操作系统的环境安装说明
|
||||
* 3. 配置管理 - 管理小程序上传密钥和 AppId 配置
|
||||
* 4. 代码上传 - 将小程序代码上传到微信开发版
|
||||
* 5. 预览功能 - 生成小程序预览二维码进行测试
|
||||
*
|
||||
* 使用前提:
|
||||
* - 服务器已安装 Node.js (>=14.0.0) 和 npm
|
||||
* - 已全局安装 miniprogram-ci (npm install miniprogram-ci -g)
|
||||
* - 已在微信公众平台获取小程序代码上传密钥
|
||||
* - 服务器 PHP 的 exec() 函数未被禁用
|
||||
*
|
||||
* @see https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html 微信官方 CI 文档
|
||||
* @package app\adminapi\controller\v1\application\routine
|
||||
*/
|
||||
class RoutineCI extends AuthController
|
||||
{
|
||||
/**
|
||||
* Node.js 环境检测服务实例
|
||||
*
|
||||
* 用于检测服务器环境是否满足小程序上传的要求:
|
||||
* - Node.js 版本检测
|
||||
* - npm 可用性检测
|
||||
* - miniprogram-ci 安装状态检测
|
||||
* - 操作系统类型识别
|
||||
*
|
||||
* @var NodeEnvironmentServices
|
||||
*/
|
||||
protected $envServices;
|
||||
|
||||
/**
|
||||
* 小程序 CI 核心服务实例
|
||||
*
|
||||
* 处理小程序代码上传的核心业务逻辑:
|
||||
* - 上传密钥管理
|
||||
* - 项目文件准备
|
||||
* - 执行 miniprogram-ci 命令
|
||||
* - 生成预览二维码
|
||||
*
|
||||
* @var RoutineCIServices
|
||||
*/
|
||||
protected $ciServices;
|
||||
|
||||
/**
|
||||
* 构造方法 - 初始化服务依赖
|
||||
*
|
||||
* 通过依赖注入方式注入所需的服务类实例,
|
||||
* ThinkPHP 的容器会自动解析并注入这些依赖。
|
||||
*
|
||||
* @param App $app ThinkPHP 应用实例
|
||||
* @param NodeEnvironmentServices $envServices 环境检测服务
|
||||
* @param RoutineCIServices $ciServices CI 上传服务
|
||||
*/
|
||||
public function __construct(App $app, NodeEnvironmentServices $envServices, RoutineCIServices $ciServices)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->envServices = $envServices;
|
||||
$this->ciServices = $ciServices;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器运行环境状态
|
||||
*
|
||||
* 检测并返回小程序上传所需的所有环境信息,前端根据返回结果
|
||||
* 展示环境就绪状态或引导用户完成环境配置。
|
||||
*
|
||||
* 返回数据结构:
|
||||
* - os: 操作系统信息 (family, type, version)
|
||||
* - node: Node.js 状态 (installed, version, path, meets_requirement)
|
||||
* - npm: npm 状态 (installed, version)
|
||||
* - miniprogram_ci: CI工具状态 (installed, version)
|
||||
* - ready: 布尔值,环境是否完全就绪
|
||||
* - can_install: 是否支持自动安装
|
||||
* - exec_enabled: exec函数是否可用
|
||||
* - message: 提示信息
|
||||
*
|
||||
* @return mixed JSON 响应,包含完整的环境状态信息
|
||||
*/
|
||||
public function environment()
|
||||
{
|
||||
$data = $this->envServices->getEnvironmentStatus();
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取环境安装指南
|
||||
*
|
||||
* 根据服务器操作系统类型返回对应的 Node.js 和 miniprogram-ci 安装步骤。
|
||||
* 支持的操作系统: CentOS/RHEL、Ubuntu/Debian、macOS、Windows
|
||||
*
|
||||
* 返回数据结构:
|
||||
* - title: 指南标题 (如 "CentOS/RHEL 安装指南")
|
||||
* - steps: 安装步骤数组,包含命令行指令
|
||||
* - script_url: 一键安装脚本的 URL 地址
|
||||
*
|
||||
* @return mixed JSON 响应,包含适合当前系统的安装指南
|
||||
*/
|
||||
public function installGuide()
|
||||
{
|
||||
$guide = $this->envServices->getInstallGuide();
|
||||
return app('json')->success($guide);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序上传配置状态
|
||||
*
|
||||
* 返回当前的上传配置信息,用于前端展示配置状态和引导配置流程。
|
||||
*
|
||||
* 返回数据结构:
|
||||
* - app_id: 小程序 AppId
|
||||
* - app_id_configured: AppId 是否已配置
|
||||
* - private_key_exists: 上传密钥文件是否存在
|
||||
* - private_key_path: 密钥文件存储路径
|
||||
* - project_path: 小程序项目路径
|
||||
* - project_exists: 项目目录是否存在
|
||||
*
|
||||
* @return mixed JSON 响应,包含上传配置状态信息
|
||||
*/
|
||||
public function uploadConfig()
|
||||
{
|
||||
$config = $this->ciServices->getUploadConfig();
|
||||
return app('json')->success($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存小程序代码上传密钥
|
||||
*
|
||||
* 接收并保存从微信公众平台下载的小程序代码上传密钥。
|
||||
* 密钥用于 miniprogram-ci 工具的身份验证,确保只有授权用户才能上传代码。
|
||||
*
|
||||
* 请求参数:
|
||||
* - key_content: string, 必填,RSA 私钥内容 (以 -----BEGIN RSA PRIVATE KEY----- 开头)
|
||||
*
|
||||
* 密钥获取方式:
|
||||
* 微信公众平台 -> 开发管理 -> 开发设置 -> 小程序代码上传 -> 下载密钥
|
||||
*
|
||||
* 安全说明:
|
||||
* - 密钥文件保存在 config/routine_private.key
|
||||
* - 文件权限设置为 0600,仅所有者可读写
|
||||
* - 请勿将密钥文件提交到版本控制系统
|
||||
*
|
||||
* @return mixed JSON 响应,成功返回提示信息,失败返回错误原因
|
||||
*/
|
||||
public function savePrivateKey()
|
||||
{
|
||||
// 获取 POST 请求中的密钥内容
|
||||
$keyContent = $this->request->post('key_content', '');
|
||||
|
||||
// 验证密钥内容不能为空
|
||||
if (empty($keyContent)) {
|
||||
return app('json')->fail('请提供密钥内容');
|
||||
}
|
||||
|
||||
// 调用服务层保存密钥(服务层会验证密钥格式)
|
||||
$this->ciServices->savePrivateKey($keyContent);
|
||||
return app('json')->success('密钥保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传小程序代码到微信开发版
|
||||
*
|
||||
* 将本地小程序项目代码上传到微信服务器的开发版本。
|
||||
* 上传成功后,可在微信公众平台的版本管理中看到新上传的开发版本。
|
||||
*
|
||||
* 请求参数:
|
||||
* - version: string, 必填,版本号,格式为 x.x.x (如 1.0.0)
|
||||
* - desc: string, 可选,版本描述,默认为 "版本 {version}"
|
||||
* - is_live: int, 可选,是否开启直播功能,0=关闭 1=开启,默认关闭
|
||||
*
|
||||
* 执行流程:
|
||||
* 1. 验证版本号格式
|
||||
* 2. 检查运行环境 (Node.js、密钥文件等)
|
||||
* 3. 准备项目文件 (复制、替换配置)
|
||||
* 4. 执行 miniprogram-ci upload 命令
|
||||
* 5. 返回上传结果
|
||||
*
|
||||
* 返回数据结构:
|
||||
* - success: 是否成功
|
||||
* - version: 版本号
|
||||
* - desc: 版本描述
|
||||
* - message: 提示信息
|
||||
* - output: 命令执行输出
|
||||
*
|
||||
* @return mixed JSON 响应,包含上传结果信息
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
// 批量获取请求参数
|
||||
[$version, $desc, $isLive] = $this->request->postMore([
|
||||
['version', ''], // 版本号
|
||||
['desc', ''], // 版本描述
|
||||
['is_live', 0], // 是否开启直播
|
||||
], true);
|
||||
|
||||
// 验证版本号必填
|
||||
if (empty($version)) {
|
||||
return app('json')->fail('请输入版本号');
|
||||
}
|
||||
|
||||
// 验证版本号格式:必须是 x.x.x 格式 (如 1.0.0, 2.1.3)
|
||||
if (!preg_match('/^\d+\.\d+\.\d+$/', $version)) {
|
||||
return app('json')->fail('版本号格式错误,请使用 x.x.x 格式');
|
||||
}
|
||||
|
||||
// 调用服务层执行上传
|
||||
$result = $this->ciServices->upload($version, $desc, (bool)$isLive);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序预览二维码
|
||||
*
|
||||
* 生成小程序预览二维码,扫码后可在手机上预览小程序效果。
|
||||
* 预览版本不会影响线上版本,适合开发测试使用。
|
||||
*
|
||||
* 请求参数:
|
||||
* - page_path: string, 可选,预览的页面路径 (如 pages/index/index)
|
||||
* 为空时默认预览首页
|
||||
*
|
||||
* 执行流程:
|
||||
* 1. 检查运行环境
|
||||
* 2. 准备项目文件
|
||||
* 3. 执行 miniprogram-ci preview 命令
|
||||
* 4. 生成二维码图片
|
||||
* 5. 返回二维码图片 URL
|
||||
*
|
||||
* 返回数据结构:
|
||||
* - success: 是否成功
|
||||
* - qrcode_url: 二维码图片的访问 URL
|
||||
* - message: 提示信息
|
||||
* - output: 命令执行输出
|
||||
*
|
||||
* 注意事项:
|
||||
* - 预览二维码有效期较短,过期需重新生成
|
||||
* - 只有小程序的开发者和体验者才能扫码预览
|
||||
*
|
||||
* @return mixed JSON 响应,包含预览二维码信息
|
||||
*/
|
||||
public function preview()
|
||||
{
|
||||
// 获取预览页面路径参数
|
||||
$pagePath = $this->request->post('page_path', '');
|
||||
|
||||
// 调用服务层生成预览二维码
|
||||
$result = $this->ciServices->preview($pagePath);
|
||||
return app('json')->success($result);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\application\routine;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
@ -36,13 +44,13 @@ class RoutineScheme extends AuthController
|
||||
['expire_num', 0],
|
||||
]);
|
||||
$this->services->schemeSave($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
public function schemeDel($id)
|
||||
{
|
||||
$res = $this->services->delete($id);
|
||||
if (!$res) return app('json')->fail(100008);
|
||||
return app('json')->success(100002);
|
||||
if (!$res) return app('json')->fail('删除失败');
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -52,7 +52,7 @@ class RoutineTemplate extends AuthController
|
||||
public function syncSubscribe()
|
||||
{
|
||||
if (!sys_config('routine_appId') || !sys_config('routine_appsecret')) {
|
||||
throw new AdminException(400236);
|
||||
throw new AdminException('请先配置小程序appid、appSecret等参数');
|
||||
}
|
||||
|
||||
$list = MiniProgramService::getSubscribeTemplateList();
|
||||
@ -65,7 +65,7 @@ class RoutineTemplate extends AuthController
|
||||
SyncMessageJob::dispatch('SyncSubscribe', [$key, $content]);
|
||||
}
|
||||
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ class RoutineTemplate extends AuthController
|
||||
['name', ''],
|
||||
['is_live', 0]
|
||||
], true);
|
||||
if (sys_config('routine_appId', '') == '') throw new AdminException(400236);
|
||||
if (sys_config('routine_appId', '') == '') throw new AdminException('请先配置小程序appid、appSecret等参数');
|
||||
try {
|
||||
@unlink(public_path() . 'statics/download/routine.zip');
|
||||
//拷贝源文件
|
||||
@ -183,7 +183,7 @@ class RoutineTemplate extends AuthController
|
||||
} else {
|
||||
$res = false;
|
||||
}
|
||||
if (!$res) throw new ValidateException(400237);
|
||||
if (!$res) throw new ValidateException('二维码生成失败');
|
||||
$upload = UploadService::init(1);
|
||||
if ($upload->to('routine/code')->setAuthThumb(false)->stream((string)$res['res'], $name) === false) {
|
||||
return $upload->getError();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -51,8 +51,8 @@ class Menus extends AuthController
|
||||
{
|
||||
$buttons = request()->post('button/a', []);
|
||||
if(strlen($buttons[0]['name']) > 15) return app('json')->fail('菜单名称不能大于5个字');
|
||||
if (!count($buttons)) return app('json')->fail(400238);
|
||||
if (!count($buttons)) return app('json')->fail('请添加至少一个按钮');
|
||||
$this->services->saveMenu($buttons);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -48,7 +48,7 @@ class Reply extends AuthController
|
||||
$where = $this->request->getMore([
|
||||
['key', ''],
|
||||
]);
|
||||
if ($where['key'] == '') return app('json')->fail(100100);
|
||||
if ($where['key'] == '') return app('json')->fail('参数错误');
|
||||
$info = $this->services->getDataByKey($where['key']);
|
||||
return app('json')->success(compact('info'));
|
||||
}
|
||||
@ -96,19 +96,19 @@ class Reply extends AuthController
|
||||
]);
|
||||
try {
|
||||
if (!isset($data['key']) && empty($data['key']))
|
||||
return app('json')->fail(400239);
|
||||
return app('json')->fail('请输入关键字');
|
||||
if (!isset($data['type']) && empty($data['type']))
|
||||
return app('json')->fail(400240);
|
||||
return app('json')->fail('请选择回复类型');
|
||||
if (!in_array($data['type'], $this->services->replyType()))
|
||||
return app('json')->fail(400241);
|
||||
return app('json')->fail('回复类型有误');
|
||||
|
||||
if (!isset($data['data']) || !is_array($data['data']))
|
||||
return app('json')->fail(400242);
|
||||
return app('json')->fail('回复消息参数有误');
|
||||
$res = $this->services->redact($data['data'], $id, $data['key'], $data['type'], $data['status']);
|
||||
if (!$res)
|
||||
return app('json')->fail(100006);
|
||||
return app('json')->fail('保存失败');
|
||||
else
|
||||
return app('json')->success(100000, $data);
|
||||
return app('json')->success('保存成功', $data);
|
||||
} catch (HttpException $e) {
|
||||
return app('json')->fail($e->getMessage());
|
||||
}
|
||||
@ -122,16 +122,16 @@ class Reply extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->services->delete($id)) {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
} else {
|
||||
/** @var WechatKeyServices $keyServices */
|
||||
$keyServices = app()->make(WechatKeyServices::class);
|
||||
$res = $keyServices->delete($id, 'reply_id');
|
||||
if (!$res) {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,9 +142,9 @@ class Reply extends AuthController
|
||||
*/
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
$this->services->update($id, ['status' => $status], 'id');
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,13 +158,13 @@ class Reply extends AuthController
|
||||
public function code_reply($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail('100100');
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
/** @var QrcodeServices $qrcode */
|
||||
$qrcode = app()->make(QrcodeServices::class);
|
||||
$code = $qrcode->getForeverQrcode('reply', $id);
|
||||
if (!$code['ticket']) {
|
||||
return app('json')->fail(400237);
|
||||
return app('json')->fail('二维码生成失败');
|
||||
}
|
||||
return app('json')->success($code->toArray());
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -76,9 +76,9 @@ class WechatNewsCategory extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,14 +94,14 @@ class WechatNewsCategory extends AuthController
|
||||
try {
|
||||
$id = [];
|
||||
$countList = count($data['list']);
|
||||
if (!$countList) return app('json')->fail(400243);
|
||||
if (!$countList) return app('json')->fail('请添加图文');
|
||||
/** @var ArticleServices $services */
|
||||
$services = app()->make(ArticleServices::class);
|
||||
foreach ($data['list'] as $k => $v) {
|
||||
if ($v['title'] == '') return app('json')->fail(400244);
|
||||
if ($v['author'] == '') return app('json')->fail(400245);
|
||||
if ($v['content'] == '') return app('json')->fail(400246);
|
||||
if ($v['synopsis'] == '') return app('json')->fail(400247);
|
||||
if ($v['title'] == '') return app('json')->fail('标题不能为空');
|
||||
if ($v['author'] == '') return app('json')->fail('作者不能为空');
|
||||
if ($v['content'] == '') return app('json')->fail('正文不能为空');
|
||||
if ($v['synopsis'] == '') return app('json')->fail('摘要不能为空');
|
||||
$v['status'] = 1;
|
||||
$v['add_time'] = time();
|
||||
if ($v['id']) {
|
||||
@ -119,8 +119,8 @@ class WechatNewsCategory extends AuthController
|
||||
}
|
||||
$countId = count($id);
|
||||
if ($countId != $countList) {
|
||||
if ($data['id']) return app('json')->fail(100007);
|
||||
else return app('json')->fail(100022);
|
||||
if ($data['id']) return app('json')->fail('修改失败');
|
||||
else return app('json')->fail('添加失败');
|
||||
} else {
|
||||
$newsCategory['cate_name'] = $data['list'][0]['title'];
|
||||
$newsCategory['new_id'] = implode(',', $id);
|
||||
@ -129,14 +129,14 @@ class WechatNewsCategory extends AuthController
|
||||
$newsCategory['status'] = 1;
|
||||
if ($data['id']) {
|
||||
$this->services->update($data['id'], $newsCategory, 'id');
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
} else {
|
||||
$this->services->save($newsCategory);
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return app('json')->fail(100101);
|
||||
return app('json')->fail('非法操作');
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ class WechatNewsCategory extends AuthController
|
||||
['id', 0],
|
||||
['user_ids', '']
|
||||
]);
|
||||
if (!$data['id']) return app('json')->fail(100100);
|
||||
if (!$data['id']) return app('json')->fail('参数错误');
|
||||
$list = $this->services->getWechatNewsItem($data['id']);
|
||||
$wechatNews = [];
|
||||
if ($list) {
|
||||
@ -180,12 +180,12 @@ class WechatNewsCategory extends AuthController
|
||||
}
|
||||
}
|
||||
if (!count($errorLog)) {
|
||||
return app('json')->success(100030);
|
||||
return app('json')->success('发送成功');
|
||||
} else {
|
||||
return app('json')->fail(100031);
|
||||
return app('json')->fail('发送失败');
|
||||
}
|
||||
} else {
|
||||
return app('json')->fail(100031);
|
||||
return app('json')->fail('发送失败');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -71,7 +71,7 @@ class WechatQrcode extends AuthController
|
||||
['cate_name', '']
|
||||
]);
|
||||
$this->qrcodeCateServices->saveData($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ class WechatQrcode extends AuthController
|
||||
public function delCate($id)
|
||||
{
|
||||
$this->qrcodeCateServices->delCate($id);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +103,7 @@ class WechatQrcode extends AuthController
|
||||
['time', 0],
|
||||
]);
|
||||
$this->wechatQrcodeServices->saveQrcode($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ class WechatQrcode extends AuthController
|
||||
*/
|
||||
public function qrcodeInfo($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$info = $this->wechatQrcodeServices->qrcodeInfo($id);
|
||||
return app('json')->success($info);
|
||||
}
|
||||
@ -140,9 +140,9 @@ class WechatQrcode extends AuthController
|
||||
*/
|
||||
public function delQrcode($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->wechatQrcodeServices->update($id, ['is_del' => 1]);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,9 +153,9 @@ class WechatQrcode extends AuthController
|
||||
*/
|
||||
public function setStatus($id, $status)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->wechatQrcodeServices->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -46,7 +46,7 @@ class WechatTemplate extends AuthController
|
||||
public function syncSubscribe()
|
||||
{
|
||||
if (!sys_config('wechat_appid') || !sys_config('wechat_appsecret')) {
|
||||
throw new AdminException(400248);
|
||||
throw new AdminException('请先配置微信公众号appid、appSecret等参数');
|
||||
}
|
||||
|
||||
$tempIds = $this->services->getTempId('wechat');
|
||||
@ -59,6 +59,6 @@ class WechatTemplate extends AuthController
|
||||
foreach ($tempKeys as $key => $content) {
|
||||
SyncMessageJob::dispatch('SyncWechat', [$key, $content['wechat_content']]);
|
||||
}
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -78,7 +78,7 @@ class Article extends AuthController
|
||||
['status', 1]
|
||||
]);
|
||||
$this->service->save($data);
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +92,7 @@ class Article extends AuthController
|
||||
*/
|
||||
public function read($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$info = $this->service->read($id);
|
||||
return app('json')->success($info);
|
||||
}
|
||||
@ -104,9 +104,9 @@ class Article extends AuthController
|
||||
*/
|
||||
public function delete($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->service->del($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,15 +116,15 @@ class Article extends AuthController
|
||||
*/
|
||||
public function relation($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
list($product_id) = $this->request->postMore([
|
||||
['product_id', 0]
|
||||
], true);
|
||||
$res = $this->service->bindProduct($id, $product_id);
|
||||
if ($res) {
|
||||
return app('json')->success(400300);
|
||||
return app('json')->success('关联成功');
|
||||
} else {
|
||||
return app('json')->fail(400301);
|
||||
return app('json')->fail('关联失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,12 +135,12 @@ class Article extends AuthController
|
||||
*/
|
||||
public function unrelation($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$res = $this->service->bindProduct($id);
|
||||
if ($res) {
|
||||
return app('json')->success(100019);
|
||||
return app('json')->success('取消成功');
|
||||
} else {
|
||||
return app('json')->fail(100020);
|
||||
return app('json')->fail('取消失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -82,13 +82,13 @@ class ArticleCategory extends AuthController
|
||||
['status', 0]
|
||||
]);
|
||||
if (!$data['title']) {
|
||||
return app('json')->fail(400100);
|
||||
return app('json')->fail('请填写分类名称');
|
||||
}
|
||||
$data['add_time'] = time();
|
||||
$this->service->save($data);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
CacheService::delete('ARTICLE_CATEGORY_PC');
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ class ArticleCategory extends AuthController
|
||||
*/
|
||||
public function edit($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->service->createForm($id));
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class ArticleCategory extends AuthController
|
||||
$this->service->update($data);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
CacheService::delete('ARTICLE_CATEGORY_PC');
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,11 +134,11 @@ class ArticleCategory extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->service->del($id);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
CacheService::delete('ARTICLE_CATEGORY_PC');
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,11 +150,11 @@ class ArticleCategory extends AuthController
|
||||
*/
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
$this->service->setStatus($id, $status);
|
||||
CacheService::delete('ARTICLE_CATEGORY');
|
||||
CacheService::delete('ARTICLE_CATEGORY_PC');
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -80,7 +80,7 @@ class Diy extends AuthController
|
||||
if (isset($v['goodsList']['list']) && $v['goodsList']['list'] && $v['tabConfig']['tabVal'] == 1) {
|
||||
$limitMax = config('database.page.limitMax', 50);
|
||||
if (count($v['goodsList']['list']) > $limitMax) {
|
||||
return app('json')->fail(400350);
|
||||
return app('json')->fail('您设置得商品个数超出系统限制');
|
||||
}
|
||||
$v['ids'] = array_column($v['goodsList']['list'], 'id');
|
||||
$v['goodsList']['list'] = [];
|
||||
@ -91,7 +91,7 @@ class Diy extends AuthController
|
||||
$data['value'] = json_encode($value);
|
||||
$data['version'] = uniqid();
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,7 +125,7 @@ class Diy extends AuthController
|
||||
if (isset($item['goodsList']['list']) && is_array($item['goodsList']['list'])) {
|
||||
$limitMax = config('database.page.limitMax', 50);
|
||||
if (isset($item['numConfig']['val']) && isset($item['tabConfig']['tabVal']) && $item['tabConfig']['tabVal'] == 0 && $item['numConfig']['val'] > $limitMax) {
|
||||
return app('json')->fail(400350);
|
||||
return app('json')->fail('您设置得商品个数超出系统限制');
|
||||
}
|
||||
$item['goodsList']['ids'] = array_column($item['goodsList']['list'], 'id');
|
||||
unset($item['goodsList']['list']);
|
||||
@ -145,7 +145,7 @@ class Diy extends AuthController
|
||||
} elseif (isset($value['d_goodList']['goodsList']['list'])) {
|
||||
$limitMax = config('database.page.limitMax', 50);
|
||||
if (isset($value['d_goodList']['numConfig']['val']) && isset($value['d_goodList']['tabConfig']['tabVal']) && $value['d_goodList']['tabConfig']['tabVal'] == 0 && $value['d_goodList']['numConfig']['val'] > $limitMax) {
|
||||
return app('json')->fail(400350);
|
||||
return app('json')->fail('您设置得商品个数超出系统限制');
|
||||
}
|
||||
$value['d_goodList']['goodsList']['ids'] = array_column($value['d_goodList']['goodsList']['list'], 'id');
|
||||
unset($value['d_goodList']['goodsList']['list']);
|
||||
@ -171,7 +171,7 @@ class Diy extends AuthController
|
||||
$data['type'] = 2;
|
||||
$data['is_diy'] = 1;
|
||||
$data['version'] = uniqid();
|
||||
return app('json')->success($id ? 100001 : 100000, ['id' => $this->services->saveData($id, $data)]);
|
||||
return app('json')->success($id ? '修改成功' : '保存成功', ['id' => $this->services->saveData($id, $data)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ class Diy extends AuthController
|
||||
public function del($id)
|
||||
{
|
||||
$this->services->del($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,7 +193,7 @@ class Diy extends AuthController
|
||||
public function setStatus($id)
|
||||
{
|
||||
$this->services->setStatus($id);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,12 +210,12 @@ class Diy extends AuthController
|
||||
*/
|
||||
public function getInfo(int $id, StoreProductServices $services, StoreSeckillServices $seckillServices, StoreCombinationServices $combinationServices, StoreBargainServices $bargainServices)
|
||||
{
|
||||
if (!$id) throw new AdminException(100100);
|
||||
if (!$id) throw new AdminException('参数错误');
|
||||
$info = $this->services->get($id);
|
||||
if ($info) {
|
||||
$info = $info->toArray();
|
||||
} else {
|
||||
throw new AdminException(400351);
|
||||
throw new AdminException('模板不存在');
|
||||
}
|
||||
if (!$info['value']) return app('json')->success(compact('info'));
|
||||
$info['value'] = json_decode($info['value'], true);
|
||||
@ -267,12 +267,12 @@ class Diy extends AuthController
|
||||
*/
|
||||
public function getDiyInfo($id, StoreProductServices $services)
|
||||
{
|
||||
if (!$id) throw new AdminException(100100);
|
||||
if (!$id) throw new AdminException('参数错误');
|
||||
$info = $this->services->get($id);
|
||||
if ($info) {
|
||||
$info = $info->toArray();
|
||||
} else {
|
||||
throw new AdminException(400351);
|
||||
throw new AdminException('模板不存在');
|
||||
}
|
||||
$info['value'] = json_decode($info['value'], true);
|
||||
if ($info['value']) {
|
||||
@ -452,15 +452,15 @@ class Diy extends AuthController
|
||||
*/
|
||||
public function Recovery($id)
|
||||
{
|
||||
if (!$id) throw new AdminException(100100);
|
||||
if (!$id) throw new AdminException('参数错误');
|
||||
$info = $this->services->get($id);
|
||||
if ($info) {
|
||||
$info->value = $info->default_value;
|
||||
$info->update_time = time();
|
||||
$info->save();
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
throw new AdminException(400351);
|
||||
throw new AdminException('模板不存在');
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,13 +498,13 @@ class Diy extends AuthController
|
||||
$data = $this->request->postMore([
|
||||
['name', ''],
|
||||
]);
|
||||
if (!$data['name']) app('json')->fail(400352);
|
||||
if (!$data['name']) app('json')->fail('请输入页面名称');
|
||||
$data['version'] = '1.0';
|
||||
$data['add_time'] = time();
|
||||
$data['type'] = 0;
|
||||
$data['is_diy'] = 1;
|
||||
$this->services->save($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -514,15 +514,15 @@ class Diy extends AuthController
|
||||
*/
|
||||
public function setRecovery($id)
|
||||
{
|
||||
if (!$id) throw new AdminException(100100);
|
||||
if (!$id) throw new AdminException('参数错误');
|
||||
$info = $this->services->get($id);
|
||||
if ($info) {
|
||||
$info->default_value = $info->value;
|
||||
$info->update_time = time();
|
||||
$info->save();
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
throw new AdminException(100026);
|
||||
throw new AdminException('数据不存在');
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,15 +575,15 @@ class Diy extends AuthController
|
||||
*/
|
||||
public function colorChange($status, $type)
|
||||
{
|
||||
if (!$status) throw new AdminException(100100);
|
||||
if (!$status) throw new AdminException('参数错误');
|
||||
$info = $this->services->get(['template_name' => $type, 'type' => 1]);
|
||||
if ($info) {
|
||||
$info->value = $status;
|
||||
$info->update_time = time();
|
||||
$info->save();
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
throw new AdminException(100026);
|
||||
throw new AdminException('数据不存在');
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ class Diy extends AuthController
|
||||
['routine_my_menus', []]
|
||||
]);
|
||||
$this->services->memberSaveData($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -657,7 +657,7 @@ class Diy extends AuthController
|
||||
/** @var CacheServices $cacheServices */
|
||||
$cacheServices = app()->make(CacheServices::class);
|
||||
$cacheServices->setDbCache('open_adv', $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\diy;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
@ -148,4 +156,65 @@ class DiyPro extends AuthController
|
||||
$this->services->importDIYData($content);
|
||||
return app('json')->success('导入成功');
|
||||
}
|
||||
|
||||
public function textField()
|
||||
{
|
||||
$user = [
|
||||
['label' => '用户名称', 'value' => 'nickname'],
|
||||
['label' => '用户id', 'value' => 'uid'],
|
||||
['label' => '用户头像', 'value' => 'image'],
|
||||
['label' => '商品收藏', 'value' => 'collection_num'],
|
||||
['label' => '商品加购', 'value' => 'cart_num'],
|
||||
['label' => '订单总数', 'value' => 'order_num'],
|
||||
['label' => '我的积分', 'value' => 'integral'],
|
||||
['label' => '我的余额', 'value' => 'now_money'],
|
||||
['label' => '我的佣金', 'value' => 'brokerage_price'],
|
||||
['label' => '未读消息', 'value' => 'unread_msg_num'],
|
||||
];
|
||||
|
||||
$article = [
|
||||
['label' => '文章标题', 'value' => 'title'],
|
||||
['label' => '文章id', 'value' => 'id'],
|
||||
['label' => '文章封面', 'value' => 'image'],
|
||||
['label' => '文章分类', 'value' => 'cid_name'],
|
||||
['label' => '文章简介', 'value' => 'synopsis'],
|
||||
['label' => '文章浏览量', 'value' => 'visit'],
|
||||
['label' => '添加时间', 'value' => 'add_time'],
|
||||
];
|
||||
|
||||
$coupon = [
|
||||
['label' => '优惠券名称', 'value' => 'coupon_title'],
|
||||
['label' => '优惠券id', 'value' => 'id'],
|
||||
['label' => '优惠券类型', 'value' => 'type'],
|
||||
['label' => '优惠券面值', 'value' => 'coupon_price'],
|
||||
['label' => '优惠券状态', 'value' => 'status'],
|
||||
['label' => '领取时间', 'value' => 'receive_time'],
|
||||
['label' => '使用时间', 'value' => 'use_time'],
|
||||
['label' => '使用门槛', 'value' => 'use_min_price'],
|
||||
['label' => '发放数量', 'value' => 'receive_count'],
|
||||
['label' => '添加时间', 'value' => 'add_time'],
|
||||
];
|
||||
|
||||
$product = [
|
||||
['label' => '商品名称', 'value' => 'store_name'],
|
||||
['label' => '商品id', 'value' => 'id'],
|
||||
['label' => '商品图片', 'value' => 'image'],
|
||||
['label' => '商品简介', 'value' => 'store_info'],
|
||||
['label' => '商品单位', 'value' => 'unit_name'],
|
||||
['label' => '商品分类', 'value' => 'cate_name'],
|
||||
['label' => '商品库存', 'value' => 'stock'],
|
||||
['label' => '商品售价', 'value' => 'price'],
|
||||
['label' => '商品最高售价', 'value' => 'max_price'],
|
||||
['label' => '商品最低售价', 'value' => 'min_price'],
|
||||
['label' => '商品原价', 'value' => 'ot_price'],
|
||||
['label' => '商品最高原价', 'value' => 'max_ot_price'],
|
||||
['label' => '商品最低原价', 'value' => 'min_ot_price'],
|
||||
['label' => '商品起购数量', 'value' => 'min_qty'],
|
||||
['label' => '商品销量', 'value' => 'sales'],
|
||||
['label' => '商品访问量', 'value' => 'browse'],
|
||||
['label' => '商品添加时间', 'value' => 'add_time'],
|
||||
];
|
||||
|
||||
return app('json')->success(compact('user', 'article', 'coupon', 'product'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -16,6 +16,7 @@ use app\services\diy\DiyProServices;
|
||||
use app\services\diy\DiyServices;
|
||||
use app\services\diy\PageCategoryServices;
|
||||
use app\services\diy\PageLinkServices;
|
||||
use app\services\diy\ThemeServices;
|
||||
use app\services\product\product\StoreCategoryServices;
|
||||
use think\facade\App;
|
||||
|
||||
@ -53,10 +54,10 @@ class PageLink extends AuthController
|
||||
*/
|
||||
public function getLinks($cate_id, PageCategoryServices $pageCategoryServices)
|
||||
{
|
||||
if (!$cate_id) return app('json')->fail(100100);
|
||||
if (!$cate_id) return app('json')->fail('参数错误');
|
||||
$category = $pageCategoryServices->get((int)$cate_id);
|
||||
if (!$category) {
|
||||
return app('json')->fail(400103);
|
||||
return app('json')->fail('分类不存在');
|
||||
}
|
||||
switch ($category['type']) {
|
||||
case 'special':
|
||||
@ -88,17 +89,17 @@ class PageLink extends AuthController
|
||||
['name', ''],
|
||||
['url', '']
|
||||
]);
|
||||
if (!$cate_id || !$data['name'] || !$data['url']) return app('json')->fail(100100);
|
||||
if (!$cate_id || !$data['name'] || !$data['url']) return app('json')->fail('参数错误');
|
||||
$category = $pageCategoryServices->get((int)$cate_id);
|
||||
if (!$category) {
|
||||
return app('json')->fail(400103);
|
||||
return app('json')->fail('分类不存在');
|
||||
}
|
||||
$data['cate_id'] = $cate_id;
|
||||
$data['add_time'] = time();
|
||||
if (!$this->services->save($data)) {
|
||||
return app('json')->fail(100022);
|
||||
return app('json')->fail('添加失败');
|
||||
}
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,9 +109,9 @@ class PageLink extends AuthController
|
||||
*/
|
||||
public function del($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->del($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
public function getLinkCategory()
|
||||
@ -147,13 +148,13 @@ class PageLink extends AuthController
|
||||
if (!$cate_id) return app('json')->fail('参数错误');
|
||||
$category = $pageCategoryServices->get((int)$cate_id);
|
||||
if (!$category) {
|
||||
return app('json')->fail(400103);
|
||||
return app('json')->fail('分类不存在');
|
||||
}
|
||||
switch ($category['type']) {
|
||||
case 'special':
|
||||
/** @var DiyProServices $diyServices */
|
||||
$diyProServices = app()->make(DiyProServices::class);
|
||||
$data = $diyProServices->getList('link');
|
||||
/** @var ThemeServices $themeServices */
|
||||
$themeServices = app()->make(ThemeServices::class);
|
||||
$data = $themeServices->getMicroPageList();
|
||||
break;
|
||||
case 'product_category':
|
||||
/** @var StoreCategoryServices $storeCategoryServices */
|
||||
|
||||
549
crmeb/app/adminapi/controller/v1/diy/Theme.php
Normal file
549
crmeb/app/adminapi/controller/v1/diy/Theme.php
Normal file
@ -0,0 +1,549 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\diy;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\jobs\ThemeExportJob;
|
||||
use app\services\activity\coupon\StoreCouponIssueServices;
|
||||
use app\services\article\ArticleServices;
|
||||
use app\services\diy\ThemeDownloadServices;
|
||||
use app\services\diy\ThemeServices;
|
||||
use app\services\product\product\StoreProductServices;
|
||||
use SplFileInfo;
|
||||
use think\facade\App;
|
||||
|
||||
/**
|
||||
* 主题管理控制器
|
||||
* 处理主题的列表、详情、保存、导入导出等功能
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
class Theme extends AuthController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ThemeServices 主题服务类
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* 注入 ThemeServices 服务
|
||||
* @param App $app 应用容器实例
|
||||
* @param ThemeServices $services 主题服务实例
|
||||
*/
|
||||
public function __construct(App $app, ThemeServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主题列表
|
||||
* 支持根据标题、类型、状态筛选
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
public function getThemeList()
|
||||
{
|
||||
// 获取请求参数,设置默认值
|
||||
$where = $this->request->getMore([
|
||||
['title', ''],
|
||||
['type', ''],
|
||||
['page_type', ''],
|
||||
['is_del', 0],
|
||||
]);
|
||||
// 调用服务层获取列表数据
|
||||
$data = $this->services->getThemeList($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主题详情
|
||||
* @param int $id 主题ID
|
||||
* @param string $type 查询类型(可选)
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
public function getThemeInfo($id, $type = '')
|
||||
{
|
||||
$data = $this->services->getThemeInfo($id, $type);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存主题基本信息
|
||||
* @param int $id 主题ID
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
public function saveTheme($id)
|
||||
{
|
||||
$data = $this->request->getMore([
|
||||
['tid', 0],
|
||||
['title', ''],
|
||||
['type', ''],
|
||||
['value', ''],
|
||||
['page_type', 'theme'],
|
||||
]);
|
||||
$id = $this->services->saveTheme($id, $data);
|
||||
return app('json')->success('保存成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存主题标题信息
|
||||
* @param int $id 主题ID
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
public function saveThemeTitle($id)
|
||||
{
|
||||
$data = $this->request->getMore([
|
||||
['tid', 0],
|
||||
['title', ''],
|
||||
['info', ''],
|
||||
['page_type', 'theme'],
|
||||
]);
|
||||
$id = $this->services->saveThemeTitle($id, $data);
|
||||
return app('json')->success('保存成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存主题图片信息
|
||||
* @param int $id 主题ID
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/12/18
|
||||
*/
|
||||
public function saveThemeImage($id)
|
||||
{
|
||||
$data = $this->request->getMore([
|
||||
['image', ''],
|
||||
['type', ''],
|
||||
]);
|
||||
$id = $this->services->saveThemeImage($id, $data);
|
||||
return app('json')->success('保存成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义组件-文章列表
|
||||
* 用于DIY页面选择文章组件的数据源
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \ReflectionException
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/1/12
|
||||
*/
|
||||
public function getThemeArticleList()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['ids', ''],
|
||||
['cid', ''],
|
||||
['order', 0],
|
||||
['sort', 0],
|
||||
['limit', 10],
|
||||
]);
|
||||
$data = app()->make(ArticleServices::class)->getThemeArticle($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义组件-优惠券列表
|
||||
* 用于DIY页面选择优惠券组件的数据源
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/1/13
|
||||
*/
|
||||
public function getThemeCouponList()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['ids', ''],
|
||||
['type', ''],
|
||||
['user_type', ''],
|
||||
['send_type', ''],
|
||||
['is_min_price', 0],
|
||||
['min_price', 0],
|
||||
['start_time', ''],
|
||||
['end_time', ''],
|
||||
['order', 0],
|
||||
['sort', 0],
|
||||
['limit', 10],
|
||||
]);
|
||||
$data = app()->make(StoreCouponIssueServices::class)->getThemeCoupon($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义组件-商品列表
|
||||
* 用于DIY页面选择商品组件的数据源
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/1/13
|
||||
*/
|
||||
public function getThemeProductList()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['ids', ''],
|
||||
['cate_ids', ''],
|
||||
['order', 0],
|
||||
['sort', 0],
|
||||
['limit', 10],
|
||||
]);
|
||||
$data = app()->make(StoreProductServices::class)->getThemeProduct($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出主题数据
|
||||
* 1. 在 eb_theme_download 中写入一条待处理记录(不含 download_url)
|
||||
* 2. 将实际打包任务推入队列异步执行
|
||||
* 3. 队列完成后回填 download_url
|
||||
*
|
||||
* @param int $id 主题ID
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/3/10
|
||||
*/
|
||||
public function exportTheme($id)
|
||||
{
|
||||
// 判断是否使用 Redis 缓存且开启了消息队列
|
||||
$queueEnabled = sys_config('queue_open', 0) == 1 && \think\facade\Env::get('cache.driver', 'file') == 'redis';
|
||||
if (!$queueEnabled) {
|
||||
return app('json')->fail('导出功能需要开启 Redis 缓存并开启消息队列,请先到系统设置中开启对应配置');
|
||||
}
|
||||
|
||||
$id = (int)$id;
|
||||
|
||||
// 1. 查询主题基本信息,获取标题
|
||||
$info = $this->services->getThemeInfo($id);
|
||||
|
||||
// 2. 创建主题打包目录
|
||||
$dir = public_path() . 'theme/download/' . $id . '/';
|
||||
if (!is_dir($dir)) mkdir($dir, 0755, true);
|
||||
|
||||
// 3. 清理打包目录,防止数据污染
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
foreach ($iterator as $fileInfo) {
|
||||
if ($fileInfo->isDir()) {
|
||||
@rmdir($fileInfo->getRealPath());
|
||||
} else {
|
||||
@unlink($fileInfo->getRealPath());
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 创建主题图片目录
|
||||
$imagesDir = $dir . 'images/';
|
||||
if (!is_dir($imagesDir)) mkdir($imagesDir, 0755, true);
|
||||
|
||||
// 5. 向 eb_theme_download 写入待处理记录(download_url 暂不填写)
|
||||
/** @var ThemeDownloadServices $themeDownloadServices */
|
||||
$themeDownloadServices = app()->make(ThemeDownloadServices::class);
|
||||
$recordId = $themeDownloadServices->addDownloadRecord($id, $info['title'], '');
|
||||
|
||||
// 6. 将打包任务推入队列
|
||||
ThemeExportJob::dispatch('export', [$info, $recordId]);
|
||||
|
||||
return app('json')->success('正在导出中,请勿操作页面!', ['record_id' => $recordId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主题导出记录
|
||||
* 前端轮询该接口,待 download_url 不为空时说明队列已完成
|
||||
*
|
||||
* @param int $record_id 下载记录ID
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/3/10
|
||||
*/
|
||||
public function getExportRecord($record_id)
|
||||
{
|
||||
/** @var ThemeDownloadServices $themeDownloadServices */
|
||||
$themeDownloadServices = app()->make(ThemeDownloadServices::class);
|
||||
$record = $themeDownloadServices->getDownloadInfo((int)$record_id);
|
||||
return app('json')->success([
|
||||
'download_url' => $record['download_url'] ?? '',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入主题
|
||||
* 上传 Zip 包,解压并还原主题配置
|
||||
* 1. 解压 Zip 包到 theme/import/
|
||||
* 2. 读取 config.json
|
||||
* 3. 提取包内图片移动到 uploads/theme/ 目录
|
||||
* 4. 递归遍历配置,修正图片路径并替换域名
|
||||
*
|
||||
* @return \think\Response
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/1/15
|
||||
*/
|
||||
public function importTheme()
|
||||
{
|
||||
// 1 获取文件
|
||||
[$importUrl] = $this->request->postMore([
|
||||
['url', ''],
|
||||
], true);
|
||||
$realPath = public_path() . $importUrl;
|
||||
if (!file_exists($realPath)) return app('json')->fail('文件不存在');
|
||||
|
||||
// 2. 解压文件到 theme/import/ 目录
|
||||
$dir = 'theme/import/';
|
||||
if (!is_dir($dir)) mkdir($dir, 0755, true);
|
||||
// 清理导入目录,防止数据污染
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
/** @var SplFileInfo $fileInfo */
|
||||
foreach ($iterator as $fileInfo) {
|
||||
if ($fileInfo->isDir()) {
|
||||
@rmdir($fileInfo->getRealPath());
|
||||
} else {
|
||||
@unlink($fileInfo->getRealPath());
|
||||
}
|
||||
}
|
||||
$zip = new \ZipArchive();
|
||||
$zip->open($realPath);
|
||||
$zip->extractTo($dir);
|
||||
$zip->close();
|
||||
|
||||
// 3. 读取解压后的 config.json 文件
|
||||
$configPath = $dir . 'config.json';
|
||||
if (!file_exists($configPath)) return app('json')->fail('文件不存在');
|
||||
$config = json_decode(file_get_contents($configPath), true);
|
||||
if (!is_array($config)) return app('json')->fail('文件内容错误');
|
||||
|
||||
// 4. 处理图片资源迁移
|
||||
// 将压缩包里面的所有图片,移动到 uploads/theme/{时间戳}/ 文件夹下
|
||||
$timestamp = date('YmdHis');
|
||||
$themeDir = 'uploads/theme/' . $timestamp . '/';
|
||||
if (!is_dir($themeDir)) mkdir($themeDir, 0755, true);
|
||||
|
||||
$rootPath = realpath($dir);
|
||||
$imageMap = []; // 记录相对路径到新上传路径的映射
|
||||
|
||||
// 递归扫描解压目录中的所有图片
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS)
|
||||
);
|
||||
foreach ($iterator as $fileInfo) {
|
||||
if ($fileInfo->isDir()) continue;
|
||||
$filePath = $fileInfo->getRealPath();
|
||||
// 跳过配置文件
|
||||
if (basename($filePath) === 'config.json') continue;
|
||||
// 只处理指定扩展名的图片
|
||||
if (!preg_match('/\.(png|jpe?g|gif|webp|svg)$/i', $filePath)) continue;
|
||||
|
||||
// 获取文件相对于解压根目录的相对路径
|
||||
$relative = ltrim(str_replace($rootPath, '', $filePath), DIRECTORY_SEPARATOR);
|
||||
$basename = basename($filePath);
|
||||
|
||||
// 目标路径
|
||||
$target = $themeDir . $basename;
|
||||
// 移动/复制文件
|
||||
if (@copy($filePath, $target)) {
|
||||
$imageMap[$relative] = $target; // 记录映射:包内相对路径 => 新系统路径
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 准备域名替换的基础 URL
|
||||
$siteUrl = rtrim(sys_config('site_url'), '/');
|
||||
$siteParts = parse_url($siteUrl);
|
||||
$base = '';
|
||||
if ($siteParts && isset($siteParts['host'])) {
|
||||
$scheme = $siteParts['scheme'] ?? 'http';
|
||||
$base = $scheme . '://' . $siteParts['host'];
|
||||
if (isset($siteParts['port'])) {
|
||||
$base .= ':' . $siteParts['port'];
|
||||
}
|
||||
}
|
||||
|
||||
$rewriteArray = function (&$data) use (&$rewriteArray, $imageMap, $base) {
|
||||
if (!is_array($data)) return;
|
||||
|
||||
foreach ($data as $k => &$v) {
|
||||
if (is_array($v)) {
|
||||
$rewriteArray($v);
|
||||
} elseif (is_string($v)) {
|
||||
$decoded = json_decode($v, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
|
||||
$rewriteArray($decoded);
|
||||
$v = json_encode($decoded, JSON_UNESCAPED_UNICODE);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查是否在图片映射表中(处理本地导入的图片)
|
||||
// 如果在映射表中,说明该图片已从压缩包解压并上传到 uploads/theme/ 目录
|
||||
// 此时需要将其路径替换为带当前站点域名的完整 URL
|
||||
if (isset($imageMap[$v])) {
|
||||
if ($base !== '') {
|
||||
// 拼接域名 + 新路径
|
||||
$v = rtrim($base, '/') . '/' . ltrim($imageMap[$v], '/');
|
||||
} else {
|
||||
// 如果无法获取域名,则仅使用相对路径
|
||||
$v = $imageMap[$v];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 兼容处理 exportTheme 导出时带有的 theme/download/ 前缀
|
||||
// 导出时,home_image 等字段被赋值为 theme/download/xxx.png
|
||||
// 而压缩包内的文件实际上是 xxx.png,导致直接匹配 imageMap 失败
|
||||
// 因此需要去掉 theme/download/ 前缀再次尝试匹配
|
||||
if (strpos($v, 'theme/download/') === 0) {
|
||||
$rel = substr($v, strlen('theme/download/'));
|
||||
if (isset($imageMap[$rel])) {
|
||||
if ($base !== '') {
|
||||
// 同样拼接域名 + 新路径
|
||||
$v = rtrim($base, '/') . '/' . ltrim($imageMap[$rel], '/');
|
||||
} else {
|
||||
$v = $imageMap[$rel];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理域名替换(将旧域名的链接替换为当前站点域名)
|
||||
// 防止导入的主题配置中包含旧站点的域名,导致图片无法加载
|
||||
|
||||
$parts = parse_url($v);
|
||||
if (!$parts || !isset($parts['host']) || $base === '') {
|
||||
continue;
|
||||
}
|
||||
$path = $parts['path'] ?? '';
|
||||
$query = isset($parts['query']) ? '?' . $parts['query'] : '';
|
||||
$fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
|
||||
$v = rtrim($base, '/') . $path . $query . $fragment;
|
||||
}
|
||||
}
|
||||
unset($v);
|
||||
};
|
||||
|
||||
// 执行替换逻辑
|
||||
$rewriteArray($config);
|
||||
|
||||
// 执行数据写入
|
||||
$themeId = $this->services->importThemeData($config);
|
||||
|
||||
// 返回成功
|
||||
return app('json')->success('导入成功', ['theme_id' => $themeId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 使用主题
|
||||
* @param int $id 主题ID
|
||||
* @return array
|
||||
*/
|
||||
public function useTheme(int $id)
|
||||
{
|
||||
$this->services->useTheme($id);
|
||||
return app('json')->success('使用成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 使用主题数据
|
||||
* @param array $data 主题数据
|
||||
* @return array
|
||||
*/
|
||||
public function useThemeData($id)
|
||||
{
|
||||
[$theme_id, $type] = $this->request->getMore([
|
||||
['theme_id', 0],
|
||||
['type', ''],
|
||||
], true);
|
||||
$this->services->useThemeData($id, $theme_id, $type);
|
||||
return app('json')->success('使用成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取正在使用的主题
|
||||
* @return array
|
||||
*/
|
||||
public function getUsingTheme()
|
||||
{
|
||||
$theme = $this->services->getUsingTheme();
|
||||
return app('json')->success($theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 还原主题
|
||||
* @param int $id 主题ID
|
||||
* @return array
|
||||
*/
|
||||
public function restoreTheme(int $id)
|
||||
{
|
||||
$this->services->restoreTheme($id);
|
||||
return app('json')->success('还原成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除主题
|
||||
* @param int $id 主题ID
|
||||
* @return array
|
||||
*/
|
||||
public function deleteTheme(int $id)
|
||||
{
|
||||
$this->services->deleteTheme($id);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微页面数据列表
|
||||
* @return \think\Response JSON格式的响应
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2026/1/20
|
||||
*/
|
||||
public function getMicroPageList()
|
||||
{
|
||||
$data = $this->services->getMicroPageList();
|
||||
return app('json')->success($data);
|
||||
}
|
||||
}
|
||||
120
crmeb/app/adminapi/controller/v1/diy/ThemeModule.php
Normal file
120
crmeb/app/adminapi/controller/v1/diy/ThemeModule.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\diy;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\services\diy\ThemeModuleServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use think\facade\App;
|
||||
|
||||
/**
|
||||
* 主题组件管理
|
||||
*/
|
||||
class ThemeModule extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var ThemeModuleServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @param App $app
|
||||
* @param ThemeModuleServices $services
|
||||
*/
|
||||
public function __construct(App $app, ThemeModuleServices $services)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件列表
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['type', ''],
|
||||
]);
|
||||
$data = $this->services->getModuleList($where);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件详情
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function read(int $id)
|
||||
{
|
||||
if (!$id) {
|
||||
throw new AdminException('参数错误');
|
||||
}
|
||||
$info = $this->services->getModuleInfo($id);
|
||||
return app('json')->success($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组件
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$data = $this->request->postMore([
|
||||
['type', ''],
|
||||
['data', ''],
|
||||
]);
|
||||
$id = $this->services->saveModule(0, $data);
|
||||
return app('json')->success('保存成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑组件
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function update(int $id)
|
||||
{
|
||||
if (!$id) {
|
||||
throw new AdminException('参数错误');
|
||||
}
|
||||
$data = $this->request->postMore([
|
||||
['type', ''],
|
||||
['data', ''],
|
||||
]);
|
||||
$this->services->saveModule($id, $data);
|
||||
return app('json')->success('保存成功', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组件
|
||||
* @param int $id
|
||||
* @return \think\Response
|
||||
*/
|
||||
public function delete(int $id)
|
||||
{
|
||||
if (!$id) {
|
||||
throw new AdminException('参数错误');
|
||||
}
|
||||
$this->services->deleteModule($id);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -455,4 +455,28 @@ class ExportExcel extends AuthController
|
||||
$data = $services->getExportData(['batch_card_id' => $id]);
|
||||
return app('json')->success($this->service->memberCard($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销订单导出
|
||||
* @param StoreOrderServices $services
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/9/9
|
||||
*/
|
||||
public function verifyOrder(StoreOrderServices $services)
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['data', '', '', 'time'],
|
||||
['real_name', ''],
|
||||
['store_id', ''],
|
||||
['type', ''],
|
||||
['field_key', ''],
|
||||
]);
|
||||
$data = $services->getOrderList($where + ['status' => 6], ['*'], ['store', 'staff']);
|
||||
return app('json')->success($this->service->verifyOrder($data['data']));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -61,7 +61,7 @@ class SystemAttachment extends AuthController
|
||||
['ids', '']
|
||||
], true);
|
||||
$this->service->del($ids);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ class SystemAttachment extends AuthController
|
||||
['menu_name', '']
|
||||
], true);
|
||||
$res = $this->service->upload((int)$pid, $file, $upload_type, $type, $menuName);
|
||||
return app('json')->success(100032, ['src' => $res]);
|
||||
return app('json')->success('上传成功', ['src' => $res]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +92,7 @@ class SystemAttachment extends AuthController
|
||||
['images', '']
|
||||
]);
|
||||
$this->service->move($data);
|
||||
return app('json')->success(100034);
|
||||
return app('json')->success('移动成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,10 +104,10 @@ class SystemAttachment extends AuthController
|
||||
{
|
||||
$realName = $this->request->post('real_name', '');
|
||||
if (!$realName) {
|
||||
return app('json')->fail(400104);
|
||||
return app('json')->fail('文件名称不能为空');
|
||||
}
|
||||
$this->service->update($id, ['real_name' => $realName]);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,7 +198,7 @@ class SystemAttachment extends AuthController
|
||||
['images', []]
|
||||
]);
|
||||
$this->service->onlineUpload($data);
|
||||
return app('json')->success(100032);
|
||||
return app('json')->success('上传成功');
|
||||
}
|
||||
|
||||
public function videoDataSave()
|
||||
@ -221,6 +221,6 @@ class SystemAttachment extends AuthController
|
||||
1,
|
||||
$data['video_name']
|
||||
);;
|
||||
return app('json')->success(100032);
|
||||
return app('json')->success('上传成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -83,10 +83,10 @@ class SystemAttachmentCategory extends AuthController
|
||||
]);
|
||||
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400100);
|
||||
return app('json')->fail('请填写分类名称');
|
||||
}
|
||||
$this->service->save($data);
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,16 +113,16 @@ class SystemAttachmentCategory extends AuthController
|
||||
]);
|
||||
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400100);
|
||||
return app('json')->fail('请填写分类名称');
|
||||
}
|
||||
if ($data['pid'] == $id) {
|
||||
return app('json')->fail('上级分类不能是自己');
|
||||
}
|
||||
$info = $this->service->get($id);
|
||||
$count = $this->service->count(['pid' => $id]);
|
||||
if ($count && $info['pid'] != $data['pid']) return app('json')->fail(400105);
|
||||
if ($count && $info['pid'] != $data['pid']) return app('json')->fail('该分类有下级分类,无法修改上级');
|
||||
$this->service->update($id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,6 +133,6 @@ class SystemAttachmentCategory extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
$this->service->del($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -87,7 +87,7 @@ class Finance extends AuthController
|
||||
*/
|
||||
public function get_extract_list($id = '')
|
||||
{
|
||||
if ($id == '') return app('json')->fail(100100);
|
||||
if ($id == '') return app('json')->fail('参数错误');
|
||||
$where = $this->request->getMore([
|
||||
['start_time', ''],
|
||||
['end_time', ''],
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -50,9 +50,9 @@ class UserBalance extends AuthController
|
||||
[$mark] = $this->request->postMore([
|
||||
['mark', '']
|
||||
], true);
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if ($mark === '') return app('json')->fail(400106);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
if ($mark === '') return app('json')->fail('备注不能为空');
|
||||
$this->services->recordRemark($id, $mark);
|
||||
return app('json')->success(100024);
|
||||
return app('json')->success('备注成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -61,7 +61,7 @@ class UserExtract extends AuthController
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100026);
|
||||
if (!$id) return app('json')->fail('数据不存在');
|
||||
return app('json')->success($this->services->edit((int)$id));
|
||||
}
|
||||
|
||||
@ -73,10 +73,10 @@ class UserExtract extends AuthController
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$id = (int)$id;
|
||||
$UserExtract = $this->services->getExtract($id);
|
||||
if (!$UserExtract) app('json')->fail(100026);
|
||||
if (!$UserExtract) app('json')->fail('数据不存在');
|
||||
if ($UserExtract['extract_type'] == 'alipay') {
|
||||
$data = $this->request->postMore([
|
||||
'real_name',
|
||||
@ -84,9 +84,9 @@ class UserExtract extends AuthController
|
||||
'extract_price',
|
||||
'alipay_code',
|
||||
]);
|
||||
if (!$data['real_name']) return app('json')->fail(400107);
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail(400108);
|
||||
if (!$data['alipay_code']) return app('json')->fail(400109);
|
||||
if (!$data['real_name']) return app('json')->fail('请输入姓名');
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
|
||||
if (!$data['alipay_code']) return app('json')->fail('请输入支付宝账号');
|
||||
} else if ($UserExtract['extract_type'] == 'weixin') {
|
||||
$data = $this->request->postMore([
|
||||
'real_name',
|
||||
@ -94,8 +94,8 @@ class UserExtract extends AuthController
|
||||
'extract_price',
|
||||
'wechat',
|
||||
]);
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail(400108);
|
||||
if (!$data['wechat']) return app('json')->fail(400110);
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
|
||||
if (!$data['wechat']) return app('json')->fail('请输入微信账号');
|
||||
} else {
|
||||
$data = $this->request->postMore([
|
||||
'real_name',
|
||||
@ -104,12 +104,12 @@ class UserExtract extends AuthController
|
||||
'bank_code',
|
||||
'bank_address',
|
||||
]);
|
||||
if (!$data['real_name']) return app('json')->fail(400107);
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail(400108);
|
||||
if (!$data['bank_code']) return app('json')->fail(400111);
|
||||
if (!$data['bank_address']) return app('json')->fail(400112);
|
||||
if (!$data['real_name']) return app('json')->fail('请输入姓名');
|
||||
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
|
||||
if (!$data['bank_code']) return app('json')->fail('请输入银行卡号');
|
||||
if (!$data['bank_address']) return app('json')->fail('请输入开户行');
|
||||
}
|
||||
return app('json')->success($this->services->update($id, $data) ? 100001 : 100007);
|
||||
return app('json')->success($this->services->update($id, $data) ? '修改成功' : '修改失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,12 +119,12 @@ class UserExtract extends AuthController
|
||||
*/
|
||||
public function refuse($id)
|
||||
{
|
||||
if (!$id) app('json')->fail(100100);
|
||||
if (!$id) app('json')->fail('参数错误');
|
||||
$data = $this->request->postMore([
|
||||
['message', '']
|
||||
]);
|
||||
if ($data['message'] == '') return app('json')->fail(400113);
|
||||
return app('json')->success($this->services->refuse((int)$id, $data['message']) ? 100014 : 100015);
|
||||
if ($data['message'] == '') return app('json')->fail('拒绝理由不能为空');
|
||||
return app('json')->success($this->services->refuse((int)$id, $data['message']) ? '设置成功' : '设置失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,7 +134,7 @@ class UserExtract extends AuthController
|
||||
*/
|
||||
public function adopt($id)
|
||||
{
|
||||
if (!$id) app('json')->fail(100100);
|
||||
if (!$id) app('json')->fail('参数错误');
|
||||
$res = $this->services->adopt((int)$id);
|
||||
if ($res) {
|
||||
if ($res === 'v3_extract') {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -52,8 +52,8 @@ class UserRecharge extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
return app('json')->success($this->services->delRecharge((int)$id) ? 100002 : 100008);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->delRecharge((int)$id) ? '删除成功' : '删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ class UserRecharge extends AuthController
|
||||
*/
|
||||
public function refund_edit($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100026);
|
||||
if (!$id) return app('json')->fail('数据不存在');
|
||||
return app('json')->success($this->services->refund_edit((int)$id));
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class UserRecharge extends AuthController
|
||||
$data = $this->request->postMore([
|
||||
'refund_price',
|
||||
]);
|
||||
if (!$id) return app('json')->fail(100026);
|
||||
return app('json')->success($this->services->refund_update((int)$id, $data['refund_price']) ? 100036 : 100037);
|
||||
if (!$id) return app('json')->fail('数据不存在');
|
||||
return app('json')->success($this->services->refund_update((int)$id, $data['refund_price']) ? '退款成功' : '退款失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -70,9 +70,9 @@ class Express extends AuthController
|
||||
'code',
|
||||
['sort', 0],
|
||||
['is_show', 0]]);
|
||||
if (!$data['name']) return app('json')->fail(400400);
|
||||
if (!$data['name']) return app('json')->fail('请输入公司名称');
|
||||
$this->services->save($data);
|
||||
return app('json')->success(400401);
|
||||
return app('json')->success('添加公司成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,18 +102,18 @@ class Express extends AuthController
|
||||
['code_name', ''],
|
||||
['sort', 0],
|
||||
['is_show', 0]]);
|
||||
if (!$expressInfo = $this->services->get($id)) return app('json')->fail(100026);
|
||||
if (!$expressInfo = $this->services->get($id)) return app('json')->fail('数据不存在');
|
||||
if ($expressInfo['net'] == 1 && !$data['net_name']) {
|
||||
return app('json')->fail(400404);
|
||||
return app('json')->fail('请输入取件网点');
|
||||
}
|
||||
if ($expressInfo['check_man'] == 1 && !$data['courier_name']) {
|
||||
return app('json')->fail(500001);
|
||||
return app('json')->fail('请输入承载快递员名');
|
||||
}
|
||||
if ($expressInfo['partner_name'] == 1 && !$data['customer_name']) {
|
||||
return app('json')->fail(500002);
|
||||
return app('json')->fail('请输入客户账户名称');
|
||||
}
|
||||
if ($expressInfo['is_code'] == 1 && !$data['code_name']) {
|
||||
return app('json')->fail(500003);
|
||||
return app('json')->fail('请输入电子面单承载编号');
|
||||
}
|
||||
$expressInfo->account = $data['account'];
|
||||
$expressInfo->key = $data['key'];
|
||||
@ -125,7 +125,7 @@ class Express extends AuthController
|
||||
$expressInfo->is_show = $data['is_show'];
|
||||
$expressInfo->status = 1;
|
||||
$expressInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,12 +135,12 @@ class Express extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$res = $this->services->delete($id);
|
||||
if (!$res)
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,9 +151,9 @@ class Express extends AuthController
|
||||
*/
|
||||
public function set_status($id = 0, $status = '')
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
$this->services->update($id, ['is_show' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,6 +163,6 @@ class Express extends AuthController
|
||||
public function syncExpress()
|
||||
{
|
||||
$this->services->syncExpress();
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -100,53 +100,53 @@ class StoreService extends AuthController
|
||||
['nickname', ''],
|
||||
['status', 1],
|
||||
]);
|
||||
if ($data['image'] == '') return app('json')->fail(400250);
|
||||
if ($data['image'] == '') return app('json')->fail('请选择用户');
|
||||
$data['uid'] = $data['image']['uid'];
|
||||
/** @var UserServices $userService */
|
||||
$userService = app()->make(UserServices::class);
|
||||
$userInfo = $userService->get($data['uid']);
|
||||
if ($data['phone'] == '') {
|
||||
if (!$userInfo['phone']) {
|
||||
throw new AdminException(400251);
|
||||
throw new AdminException('该用户没有绑定手机号,请手动填写');
|
||||
} else {
|
||||
$data['phone'] = $userInfo['phone'];
|
||||
}
|
||||
} else {
|
||||
if (!check_phone($data['phone'])) {
|
||||
throw new AdminException(400252);
|
||||
throw new AdminException('手机号格式错误');
|
||||
}
|
||||
}
|
||||
if ($data['nickname'] == '') $data['nickname'] = $userInfo['nickname'];
|
||||
$data['avatar'] = $data['image']['image'];
|
||||
if ($this->services->count(['uid' => $data['uid']])) {
|
||||
return app('json')->fail(400253);
|
||||
return app('json')->fail('客服已存在');
|
||||
}
|
||||
unset($data['image']);
|
||||
$data['add_time'] = time();
|
||||
if (!$data['account']) {
|
||||
return app('json')->fail(400254);
|
||||
return app('json')->fail('请输入账号');
|
||||
}
|
||||
if (!preg_match('/^[a-zA-Z0-9]{4,30}$/', $data['account'])) {
|
||||
return app('json')->fail(400255);
|
||||
return app('json')->fail('账号必须为数字或者字母的组合4-30位');
|
||||
}
|
||||
if (!$data['password']) {
|
||||
return app('json')->fail(400256);
|
||||
return app('json')->fail('请输入密码');
|
||||
}
|
||||
if (!preg_match('/^[0-9a-z_$]{6,20}$/i', $data['password'])) {
|
||||
return app('json')->fail(400257);
|
||||
return app('json')->fail('密码必须为数字或者字母的组合6-20位');
|
||||
}
|
||||
if ($this->services->count(['phone' => $data['phone']])) {
|
||||
return app('json')->fail(400258);
|
||||
return app('json')->fail('该手机号的客服已存在');
|
||||
}
|
||||
if ($this->services->count(['account' => $data['account']])) {
|
||||
return app('json')->fail(400259);
|
||||
return app('json')->fail('该客服账号已存在');
|
||||
}
|
||||
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||
$res = $this->services->save($data);
|
||||
if ($res) {
|
||||
return app('json')->success(400260);
|
||||
return app('json')->success('客服添加成功');
|
||||
} else {
|
||||
return app('json')->fail(400261);
|
||||
return app('json')->fail('客服添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,33 +181,33 @@ class StoreService extends AuthController
|
||||
]);
|
||||
$customer = $this->services->get((int)$id);
|
||||
if (!$customer) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
if ($data["nickname"] == '') {
|
||||
return app('json')->fail(400262);
|
||||
return app('json')->fail('客服名称不能为空');
|
||||
}
|
||||
if (!check_phone($data['phone'])) {
|
||||
return app('json')->fail(400252);
|
||||
return app('json')->fail('手机号格式错误');
|
||||
}
|
||||
if ($customer['phone'] != $data['phone'] && $this->services->count(['phone' => $data['phone']])) {
|
||||
return app('json')->fail(400258);
|
||||
return app('json')->fail('该手机号的客服已存在');
|
||||
}
|
||||
if ($data['password']) {
|
||||
if (!preg_match('/^[0-9a-z_$]{6,16}$/i', $data['password'])) {
|
||||
return app('json')->fail(400257);
|
||||
return app('json')->fail('密码必须为数字或者字母的组合6-20位');
|
||||
}
|
||||
if (!$data['true_password']) {
|
||||
return app('json')->fail(400263);
|
||||
return app('json')->fail('请输入确认密码');
|
||||
}
|
||||
if ($data['password'] != $data['true_password']) {
|
||||
return app('json')->fail(400264);
|
||||
return app('json')->fail('两次输入的密码不一致');
|
||||
}
|
||||
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||
} else {
|
||||
unset($data['password']);
|
||||
}
|
||||
$this->services->update($id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,9 +218,9 @@ class StoreService extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,16 +232,16 @@ class StoreService extends AuthController
|
||||
*/
|
||||
public function set_status(UserServices $services, $id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
$info = $this->services->get($id, ['status', 'uid']);
|
||||
if (!$services->count(['uid' => $info['uid']])) {
|
||||
$info->status = 1;
|
||||
$info->save();
|
||||
return app('json')->fail(400265);
|
||||
return app('json')->fail('用户不存在,客服将强制禁止登录');
|
||||
}
|
||||
$info->status = $status;
|
||||
$info->save();
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +256,7 @@ class StoreService extends AuthController
|
||||
{
|
||||
$uid = $this->services->value(['id' => $id], 'uid');
|
||||
if (!$uid) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
return app('json')->success($this->services->getChatUser((int)$uid));
|
||||
}
|
||||
@ -305,10 +305,10 @@ class StoreService extends AuthController
|
||||
{
|
||||
$serviceInfo = $services->get($id);
|
||||
if (!$serviceInfo) {
|
||||
return app('json')->fail(400266);
|
||||
return app('json')->fail('登录的客服不存在');
|
||||
}
|
||||
if (!$serviceInfo->account || !$serviceInfo->password) {
|
||||
return app('json')->fail(400267);
|
||||
return app('json')->fail('请先填写客服账号和密码再尝试进入客服平台');
|
||||
}
|
||||
return app('json')->success($services->authLogin($serviceInfo->account));
|
||||
}
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* @author: 吴汐
|
||||
* @email: 442384644@qq.com
|
||||
@ -63,7 +72,7 @@ class StoreServiceAutoReply extends AuthController
|
||||
['status', 1],
|
||||
]);
|
||||
app()->make(WechatReplyServices::class)->autoReplySave($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,6 +86,6 @@ class StoreServiceAutoReply extends AuthController
|
||||
public function autoReplyDel($id)
|
||||
{
|
||||
app()->make(WechatReplyServices::class)->autoReplyDel($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -64,7 +64,7 @@ class StoreServiceFeedback extends AuthController
|
||||
public function edit($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($this->services->editForm((int)$id));
|
||||
}
|
||||
@ -81,14 +81,14 @@ class StoreServiceFeedback extends AuthController
|
||||
['status', 0],
|
||||
]);
|
||||
if (!$id || !($feedInfo = $this->services->get($id))) {
|
||||
return app('json')->fail(400268);
|
||||
return app('json')->fail('反馈内容不存在');
|
||||
}
|
||||
$feedInfo->make = $data['make'];
|
||||
if ($data['status']) {
|
||||
$feedInfo->status = $data['status'];
|
||||
}
|
||||
$feedInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,12 +100,12 @@ class StoreServiceFeedback extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
if ($this->services->delete($id)) {
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -81,12 +81,12 @@ class StoreServiceSpeechcraft extends AuthController
|
||||
$data['add_time'] = time();
|
||||
$data['kefu_id'] = 0;
|
||||
if ($this->services->count(['message' => $data['message']])) {
|
||||
return app('json')->fail(400269);
|
||||
return app('json')->fail('话术不能重复添加');
|
||||
}
|
||||
if ($this->services->save($data)) {
|
||||
return app('json')->success(400270);
|
||||
return app('json')->success('创建话术成功');
|
||||
} else {
|
||||
return app('json')->fail(400271);
|
||||
return app('json')->fail('创建话术失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ class StoreServiceSpeechcraft extends AuthController
|
||||
{
|
||||
$info = $this->services->get($id);
|
||||
if (!$info) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
return app('json')->success($info);
|
||||
}
|
||||
@ -136,12 +136,12 @@ class StoreServiceSpeechcraft extends AuthController
|
||||
$this->validate($data, StoreServiceSpeechcraftValidata::class);
|
||||
$message = $this->services->get(['message' => $data['message']]);
|
||||
if ($message && $message['id'] != $id) {
|
||||
return app('json')->fail(400269);
|
||||
return app('json')->fail('话术不能重复添加');
|
||||
}
|
||||
if ($this->services->update($id, $data)) {
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
} else {
|
||||
return app('json')->fail(100007);
|
||||
return app('json')->fail('修改失败');
|
||||
}
|
||||
|
||||
}
|
||||
@ -154,12 +154,12 @@ class StoreServiceSpeechcraft extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id || !($info = $this->services->get($id))) {
|
||||
return app('json')->fail(400272);
|
||||
return app('json')->fail('删除的话术不存在');
|
||||
}
|
||||
if ($info->delete()) {
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -74,18 +74,18 @@ class StoreServiceSpeechcraftCate extends AuthController
|
||||
]);
|
||||
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400100);
|
||||
return app('json')->fail('请填写分类名称');
|
||||
}
|
||||
|
||||
if ($this->services->count(['name' => $data['name'], 'type' => 1, 'owner_id' => 0])) {
|
||||
return app('json')->fail(400101);
|
||||
return app('json')->fail('该分类已存在');
|
||||
}
|
||||
|
||||
$data['add_time'] = time();
|
||||
$data['type'] = 1;
|
||||
|
||||
$this->services->save($data);
|
||||
return app('json')->success(100021);
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,17 +115,17 @@ class StoreServiceSpeechcraftCate extends AuthController
|
||||
[['sort', 'd'], 0],
|
||||
]);
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400100);
|
||||
return app('json')->fail('请填写分类名称');
|
||||
}
|
||||
|
||||
$cateInfo = $this->services->get($id);
|
||||
if (!$cateInfo) {
|
||||
return app('json')->fail(400103);
|
||||
return app('json')->fail('分类不存在');
|
||||
}
|
||||
$cateInfo->name = $data['name'];
|
||||
$cateInfo->sort = $data['sort'];
|
||||
$cateInfo->save();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,12 +135,12 @@ class StoreServiceSpeechcraftCate extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if ($id == 0) return app('json')->fail(400273);
|
||||
if ($id == 0) return app('json')->fail('系统分类不能删除');
|
||||
$cateInfo = $this->services->get($id);
|
||||
if (!$cateInfo) {
|
||||
return app('json')->fail(400103);
|
||||
return app('json')->fail('分类不存在');
|
||||
}
|
||||
$cateInfo->delete();
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,13 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* @author: 吴汐
|
||||
* @email: 442384644@qq.com
|
||||
@ -98,7 +107,7 @@ class SignRewards extends AuthController
|
||||
['exp', 0]
|
||||
]);
|
||||
$this->services->saveRewards($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,6 +121,6 @@ class SignRewards extends AuthController
|
||||
public function delRewards($id)
|
||||
{
|
||||
$this->services->delete($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -86,23 +86,23 @@ class StoreAdvance extends AuthController
|
||||
$storeSeckillService = app()->make(StoreSeckillServices::class);
|
||||
$res1 = $storeSeckillService->count(['product_id' => $data['product_id'], 'is_del' => 0, 'status' => 1, 'seckill_time' => 1]);
|
||||
if ($res1) {
|
||||
throw new AdminException(400506);
|
||||
throw new AdminException('商品参与其他活动开启,无法开启预售');
|
||||
}
|
||||
/** @var StoreBargainServices $storeBargainService */
|
||||
$storeBargainService = app()->make(StoreBargainServices::class);
|
||||
$res2 = $storeBargainService->count(['product_id' => $data['product_id'], 'is_del' => 0, 'status' => 1, 'bargain_time' => 1]);
|
||||
if ($res2) {
|
||||
throw new AdminException(400506);
|
||||
throw new AdminException('商品参与其他活动开启,无法开启预售');
|
||||
}
|
||||
/** @var StoreCombinationServices $storeCombinationService */
|
||||
$storeCombinationService = app()->make(StoreCombinationServices::class);
|
||||
$res3 = $storeCombinationService->count(['product_id' => $data['product_id'], 'is_del' => 0, 'is_show' => 1, 'pinkIngTime' => 1]);
|
||||
if ($res3) {
|
||||
throw new AdminException(400506);
|
||||
throw new AdminException('商品参与其他活动开启,无法开启预售');
|
||||
}
|
||||
}
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,9 +125,9 @@ class StoreAdvance extends AuthController
|
||||
{
|
||||
$res = $this->services->update($id, ['is_del' => 1]);
|
||||
if ($res) {
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,9 +141,9 @@ class StoreAdvance extends AuthController
|
||||
{
|
||||
$res = $this->services->update($id, ['status' => $status]);
|
||||
if ($res) {
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail(100015);
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -95,20 +95,20 @@ class StoreBargain extends AuthController
|
||||
if ($data['section_time']) {
|
||||
[$start_time, $end_time] = $data['section_time'];
|
||||
if (strtotime($end_time) < time()) {
|
||||
return app('json')->fail(400507);
|
||||
return app('json')->fail('活动结束时间不能小于当前时间');
|
||||
}
|
||||
}
|
||||
$bragain = [];
|
||||
if ($id) {
|
||||
$bragain = $this->services->get((int)$id);
|
||||
if (!$bragain) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
}
|
||||
//限制编辑
|
||||
if ($data['copy'] == 0 && $bragain) {
|
||||
if ($bragain['stop_time'] < time()) {
|
||||
return app('json')->fail(400508);
|
||||
return app('json')->fail('活动已结束,请重新添加或复制');
|
||||
}
|
||||
}
|
||||
if ($data['copy'] == 1) {
|
||||
@ -116,7 +116,7 @@ class StoreBargain extends AuthController
|
||||
unset($data['copy']);
|
||||
}
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +141,7 @@ class StoreBargain extends AuthController
|
||||
/** @var StoreBargainUserServices $bargainUserService */
|
||||
$bargainUserService = app()->make(StoreBargainUserServices::class);
|
||||
$bargainUserService->userBargainStatusFail($id, true);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,7 +163,7 @@ class StoreBargain extends AuthController
|
||||
}
|
||||
}
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -116,31 +116,31 @@ class StoreCombination extends AuthController
|
||||
if ($data['section_time']) {
|
||||
[$start_time, $end_time] = $data['section_time'];
|
||||
if (strtotime($end_time) < time()) {
|
||||
return app('json')->fail(400507);
|
||||
return app('json')->fail('活动结束时间不能小于当前时间');
|
||||
}
|
||||
}
|
||||
$combination = [];
|
||||
if ($id) {
|
||||
$combination = $this->services->get((int)$id);
|
||||
if (!$combination) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
}
|
||||
//限制编辑
|
||||
if ($data['copy'] == 0 && $combination) {
|
||||
if ($combination['stop_time'] < time()) {
|
||||
return app('json')->fail(400508);
|
||||
return app('json')->fail('活动已结束,请重新添加或复制');
|
||||
}
|
||||
}
|
||||
if ($data['num'] < $data['once_num']) {
|
||||
return app('json')->fail(400500);
|
||||
return app('json')->fail('限制单次购买数量不能大于总购买数量');
|
||||
}
|
||||
if ($data['copy'] == 1) {
|
||||
$id = 0;
|
||||
unset($data['copy']);
|
||||
}
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +151,7 @@ class StoreCombination extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
$this->services->update($id, ['is_del' => 1]);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -77,7 +77,7 @@ class StoreCouponIssue extends AuthController
|
||||
['user_type', 1],
|
||||
]);
|
||||
$res = $this->services->saveCoupon($data);
|
||||
if ($res) return app('json')->success(100000);
|
||||
if ($res) return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ class StoreCouponIssue extends AuthController
|
||||
public function status($id, $status)
|
||||
{
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ class StoreCouponIssue extends AuthController
|
||||
*/
|
||||
public function copy($id = 0)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$info = $this->services->get($id);
|
||||
if ($info) $info = $info->toArray();
|
||||
if ($info['receive_type'] == 1 || $info['receive_type'] == 3) {
|
||||
@ -142,7 +142,7 @@ class StoreCouponIssue extends AuthController
|
||||
$storeProductService = app()->make(StoreProductCouponServices::class);
|
||||
//删除商品关联这个优惠券
|
||||
$storeProductService->delete(['issue_coupon_id' => $id]);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -56,20 +56,20 @@ class StoreCouponUser extends AuthController
|
||||
['id', 0],
|
||||
['uid', '']
|
||||
]);
|
||||
if (!$data['id']) return app('json')->fail(100100);
|
||||
if (!$data['id']) return app('json')->fail('参数错误');
|
||||
/** @var StoreCouponIssueServices $issueService */
|
||||
$issueService = app()->make(StoreCouponIssueServices::class);
|
||||
$coupon = $issueService->get($data['id']);
|
||||
if (!$coupon) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
} else {
|
||||
$coupon = $coupon->toArray();
|
||||
}
|
||||
$user = explode(',', $data['uid']);
|
||||
if (!$issueService->setCoupon($coupon, $user))
|
||||
return app('json')->fail(100031);
|
||||
return app('json')->fail('发送失败');
|
||||
else
|
||||
return app('json')->success(100030);
|
||||
return app('json')->success('发送成功');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -96,7 +96,7 @@ class StoreSeckill extends AuthController
|
||||
]);
|
||||
$this->validate($data, \app\adminapi\validate\marketing\StoreSeckillValidate::class, 'save');
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ class StoreSeckill extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->update($id, ['is_del' => 1]);
|
||||
/** @var StoreProductAttrValueServices $storeProductAttrValueServices */
|
||||
$storeProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
|
||||
@ -114,7 +114,7 @@ class StoreSeckill extends AuthController
|
||||
if ($unique) {
|
||||
CacheService::delete('seckill_' . $unique . '_1');
|
||||
}
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +132,7 @@ class StoreSeckill extends AuthController
|
||||
}
|
||||
}
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -74,7 +74,7 @@ class StoreIntegral extends AuthController
|
||||
if ($id) {
|
||||
$integral = $this->services->get((int)$id);
|
||||
if (!$integral) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
}
|
||||
if ($data['copy'] == 1) {
|
||||
@ -82,7 +82,7 @@ class StoreIntegral extends AuthController
|
||||
unset($data['copy']);
|
||||
}
|
||||
$this->services->saveData($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +96,7 @@ class StoreIntegral extends AuthController
|
||||
[['is_show', 'd'], 0]
|
||||
]);
|
||||
$this->services->saveBatchData($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ class StoreIntegral extends AuthController
|
||||
public function set_show($id, $is_show)
|
||||
{
|
||||
$this->services->update($id, ['is_show' => $is_show]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,9 +130,9 @@ class StoreIntegral extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->update($id, ['is_del' => 1]);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -97,9 +97,9 @@ class StoreIntegralOrder extends AuthController
|
||||
['where', []],
|
||||
], true);
|
||||
if ($this->services->delOrders($ids)) {
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,9 +111,9 @@ class StoreIntegralOrder extends AuthController
|
||||
public function del($id)
|
||||
{
|
||||
if ($this->services->delOrder($id)) {
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else {
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class StoreIntegralOrder extends AuthController
|
||||
['fictitious_content', '']//虚拟发货内容
|
||||
]);
|
||||
$this->services->delivery((int)$id, $data);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,19 +153,19 @@ class StoreIntegralOrder extends AuthController
|
||||
*/
|
||||
public function take_delivery($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$order = $this->services->get($id);
|
||||
if (!$order)
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
if ($order['status'] == 3)
|
||||
return app('json')->fail(400114);
|
||||
return app('json')->fail('不能重复收货');
|
||||
if ($order['status'] == 2)
|
||||
$data['status'] = 3;
|
||||
else
|
||||
return app('json')->fail(400115);
|
||||
return app('json')->fail('请先发货或者送货');
|
||||
|
||||
if (!$this->services->update($id, $data)) {
|
||||
return app('json')->fail(400116);
|
||||
return app('json')->fail('收货失败,请稍候再试');
|
||||
} else {
|
||||
//增加收货订单状态
|
||||
/** @var StoreIntegralOrderStatusServices $statusService */
|
||||
@ -176,7 +176,7 @@ class StoreIntegralOrder extends AuthController
|
||||
'change_message' => '已收货',
|
||||
'change_time' => time()
|
||||
]);
|
||||
return app('json')->success(400117);
|
||||
return app('json')->success('收货成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,12 +188,12 @@ class StoreIntegralOrder extends AuthController
|
||||
public function order_info($id)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id))) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
/** @var UserServices $services */
|
||||
$services = app()->make(UserServices::class);
|
||||
$userInfo = $services->get($orderInfo['uid']);
|
||||
if (!$userInfo) return app('json')->fail(400119);
|
||||
if (!$userInfo) return app('json')->fail('用户信息不存在');
|
||||
$userInfo = $userInfo->hidden(['pwd', 'add_ip', 'last_ip', 'login_type']);
|
||||
$orderInfo = $this->services->tidyOrder($orderInfo->toArray());
|
||||
$userInfo = $userInfo->toArray();
|
||||
@ -208,9 +208,9 @@ class StoreIntegralOrder extends AuthController
|
||||
public function get_express($id, ExpressServices $services)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id)))
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($orderInfo['delivery_type'] != 'express' || !$orderInfo['delivery_id'])
|
||||
return app('json')->fail(400120);
|
||||
return app('json')->fail('快递单号不存在');
|
||||
|
||||
$cacheName = 'integral' . $orderInfo['order_id'] . $orderInfo['delivery_id'];
|
||||
|
||||
@ -229,7 +229,7 @@ class StoreIntegralOrder extends AuthController
|
||||
public function distribution($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
return app('json')->success($this->services->distributionForm((int)$id));
|
||||
}
|
||||
@ -242,9 +242,9 @@ class StoreIntegralOrder extends AuthController
|
||||
public function update_distribution($id)
|
||||
{
|
||||
$data = $this->request->postMore([['delivery_name', ''], ['delivery_code', ''], ['delivery_id', '']]);
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->updateDistribution($id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
|
||||
@ -257,9 +257,9 @@ class StoreIntegralOrder extends AuthController
|
||||
{
|
||||
$data = $this->request->postMore([['remark', '']]);
|
||||
if ($this->services->remark($id, $data['remark'])) {
|
||||
return app('json')->success(100024);
|
||||
return app('json')->success('备注成功');
|
||||
} else {
|
||||
return app('json')->fail(100025);
|
||||
return app('json')->fail('备注失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ class StoreIntegralOrder extends AuthController
|
||||
*/
|
||||
public function status(StoreIntegralOrderStatusServices $services, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($services->getStatusList(['oid' => $id])['list']);
|
||||
}
|
||||
|
||||
@ -281,16 +281,16 @@ class StoreIntegralOrder extends AuthController
|
||||
*/
|
||||
public function order_print($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$order = $this->services->get($id);
|
||||
if (!$order) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
$res = $this->services->orderPrint($order);
|
||||
if ($res) {
|
||||
return app('json')->success(400121);
|
||||
return app('json')->success('打印成功');
|
||||
} else {
|
||||
return app('json')->fail(400122);
|
||||
return app('json')->fail('打印失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ class StoreIntegralOrder extends AuthController
|
||||
public function expr_temp(ServeServices $services, $com)
|
||||
{
|
||||
if (!$com) {
|
||||
return app('json')->fail(400123);
|
||||
return app('json')->fail('快递公司编号缺失');
|
||||
}
|
||||
$list = $services->express()->temp($com);
|
||||
return app('json')->success($list);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -53,7 +53,7 @@ class StorePointRecord extends AuthController
|
||||
['mark', '']
|
||||
], true);
|
||||
$this->services->recordRemark($id, $mark);
|
||||
return app('json')->success(100024);
|
||||
return app('json')->success('备注成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -72,9 +72,9 @@ class LiveAnchor extends AuthController
|
||||
$this->validate($data, \app\adminapi\validate\marketing\LiveAnchorValidate::class, 'save');
|
||||
$res = $this->services->save((int)$data['id'], $data);
|
||||
if ($res === true) {
|
||||
return app('json')->success(100000, ['auth' => false]);
|
||||
return app('json')->success('保存成功', ['auth' => false]);
|
||||
}else{
|
||||
return app('json')->fail(100006);
|
||||
return app('json')->fail('保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,9 +88,9 @@ class LiveAnchor extends AuthController
|
||||
list($id) = $this->request->getMore([
|
||||
['id', 0],
|
||||
], true);
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->delAnchor((int)$id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,9 +101,9 @@ class LiveAnchor extends AuthController
|
||||
*/
|
||||
public function setShow($id = '', $is_show = '')
|
||||
{
|
||||
if ($is_show == '' || $id == '') return app('json')->fail(100100);
|
||||
if ($is_show == '' || $id == '') return app('json')->fail('参数错误');
|
||||
$this->services->setShow((int)$id, (int)$is_show);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,6 +113,6 @@ class LiveAnchor extends AuthController
|
||||
public function syncAnchor()
|
||||
{
|
||||
$this->services->syncAnchor();
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -81,7 +81,7 @@ class LiveGoods extends AuthController
|
||||
}
|
||||
if ($error) return app('json')->fail(40137);
|
||||
$this->services->add($goods_info);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,7 +91,7 @@ class LiveGoods extends AuthController
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$goods = $this->services->get($id, ['*'], ['product']);
|
||||
return app('json')->success($goods ? $goods->toArray() : []);
|
||||
}
|
||||
@ -103,7 +103,7 @@ class LiveGoods extends AuthController
|
||||
public function syncGoods()
|
||||
{
|
||||
$this->services->syncGoodStatus();
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,9 +116,9 @@ class LiveGoods extends AuthController
|
||||
*/
|
||||
public function audit($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->audit((int)$id);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,9 +131,9 @@ class LiveGoods extends AuthController
|
||||
*/
|
||||
public function resetAudit($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->resetAudit((int)$id);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ class LiveGoods extends AuthController
|
||||
*/
|
||||
public function setShow(int $id, $is_show)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->isShow($id, $is_show));
|
||||
}
|
||||
|
||||
@ -158,9 +158,9 @@ class LiveGoods extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$this->services->delete($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -52,7 +52,7 @@ class LiveRoom extends AuthController
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->get((int)$id)->toArray());
|
||||
}
|
||||
|
||||
@ -79,11 +79,11 @@ class LiveRoom extends AuthController
|
||||
['sort', 0]
|
||||
]);
|
||||
if (mb_strlen($data['name']) < 6 || mb_strlen($data['name']) > 17) {
|
||||
return app('json')->fail(500030);
|
||||
return app('json')->fail('名称长度需在6-17个字符之间');
|
||||
}
|
||||
$this->validate($data, \app\adminapi\validate\marketing\LiveRoomValidate::class, 'save');
|
||||
$this->services->add($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ class LiveRoom extends AuthController
|
||||
['goods_ids', []]
|
||||
], true);
|
||||
$this->services->exportGoods((int)$room_id, $goods_ids);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +115,7 @@ class LiveRoom extends AuthController
|
||||
['msg', '']
|
||||
], true);
|
||||
$this->services->apply((int)$id, $status, $msg);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ class LiveRoom extends AuthController
|
||||
public function setShow($id, $is_show)
|
||||
{
|
||||
$this->services->isShow((int)$id, $is_show);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,7 +138,7 @@ class LiveRoom extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
$this->services->delete($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,7 +148,7 @@ class LiveRoom extends AuthController
|
||||
public function syncRoom()
|
||||
{
|
||||
$this->services->syncRoomStatus();
|
||||
return app('json')->success(100038);
|
||||
return app('json')->success('同步成功');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -62,7 +62,7 @@ class LuckLottery extends AuthController
|
||||
public function detail($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($this->services->getLotteryInfo((int)$id));
|
||||
}
|
||||
@ -98,25 +98,25 @@ class LuckLottery extends AuthController
|
||||
['prize', []]
|
||||
]);
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400501);
|
||||
return app('json')->fail('请添加抽奖活动名称');
|
||||
}
|
||||
if ($data['is_content'] && !$data['content']) {
|
||||
return app('json')->fail(400502);
|
||||
return app('json')->fail('请添加抽奖描述等文案');
|
||||
}
|
||||
[$start, $end] = $data['period'];
|
||||
unset($data['period']);
|
||||
$data['start_time'] = $start ? strtotime($start) : 0;
|
||||
$data['end_time'] = $end ? strtotime($end) : 0;
|
||||
$data['end_time'] = $end ? strtotime($end) + 86399 : 0;
|
||||
if ($data['start_time'] && $data['end_time'] && $data['end_time'] <= $data['start_time']) {
|
||||
return app('json')->fail(400503);
|
||||
return app('json')->fail('活动结束时间必须大于开始时间');
|
||||
}
|
||||
if (!$data['prize']) {
|
||||
return app('json')->fail(400504);
|
||||
return app('json')->fail('请添加奖品');
|
||||
}
|
||||
if (in_array($data['factor'], [1, 2]) && !$data['factor_num']) {
|
||||
return app('json')->fail(400505);
|
||||
return app('json')->fail('请填写消耗数量');
|
||||
}
|
||||
return app('json')->success($this->services->add($data) ? 100000 : 100006);
|
||||
return app('json')->success($this->services->add($data) ? '保存成功' : '保存失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,28 +151,28 @@ class LuckLottery extends AuthController
|
||||
['prize', []]
|
||||
]);
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
if (!$data['name']) {
|
||||
return app('json')->fail(400501);
|
||||
return app('json')->fail('请添加抽奖活动名称');
|
||||
}
|
||||
[$start, $end] = $data['period'];
|
||||
unset($data['period']);
|
||||
$data['start_time'] = $start ? strtotime($start) : 0;
|
||||
$data['end_time'] = $end ? strtotime($end) : 0;
|
||||
$data['end_time'] = $end ? strtotime($end) + 86399 : 0;
|
||||
if ($data['start_time'] && $data['end_time'] && $data['end_time'] <= $data['start_time']) {
|
||||
return app('json')->fail(400503);
|
||||
return app('json')->fail('活动结束时间必须大于开始时间');
|
||||
}
|
||||
if ($data['is_content'] && !$data['content']) {
|
||||
return app('json')->fail(400502);
|
||||
return app('json')->fail('请添加抽奖描述等文案');
|
||||
}
|
||||
if (!$data['prize']) {
|
||||
return app('json')->fail(400504);
|
||||
return app('json')->fail('请添加奖品');
|
||||
}
|
||||
if (in_array($data['factor'], [1, 2]) && !$data['factor_num']) {
|
||||
return app('json')->fail(400505);
|
||||
return app('json')->fail('请填写消耗数量');
|
||||
}
|
||||
return app('json')->success($this->services->edit((int)$id, $data) ? 100001 : 100007);
|
||||
return app('json')->success($this->services->edit((int)$id, $data) ? '修改成功' : '修改失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,9 +187,9 @@ class LuckLottery extends AuthController
|
||||
list($id) = $this->request->getMore([
|
||||
['id', 0],
|
||||
], true);
|
||||
if (!$id) return app('json')->fail(100026);
|
||||
if (!$id) return app('json')->fail('数据不存在');
|
||||
$this->services->delLottery((int)$id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,9 +203,9 @@ class LuckLottery extends AuthController
|
||||
*/
|
||||
public function setStatus($id = '', $status = '')
|
||||
{
|
||||
if ($status == '' || $id == '') return app('json')->fail(100100);
|
||||
if ($status == '' || $id == '') return app('json')->fail('参数错误');
|
||||
$this->services->setStatus((int)$id, (int)$status);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
public function factorList()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -66,9 +66,9 @@ class LuckLotteryRecord extends AuthController
|
||||
['mark', ''],
|
||||
]);
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$this->services->setDeliver((int)$id, $data);
|
||||
return app('json')->success($this->services->setDeliver((int)$id, $data) ? 100014 : 100015);
|
||||
return app('json')->success($this->services->setDeliver((int)$id, $data) ? '设置成功' : '设置失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -83,7 +83,7 @@ class SystemStore extends AuthController
|
||||
public function select_address()
|
||||
{
|
||||
$key = sys_config('tengxun_map_key');
|
||||
if (!$key) return app('json')->fail(400124);
|
||||
if (!$key) return app('json')->fail('请配置腾讯地图KEY');
|
||||
return app('json')->success(compact('key'));
|
||||
}
|
||||
|
||||
@ -95,12 +95,12 @@ class SystemStore extends AuthController
|
||||
*/
|
||||
public function set_show($is_show = '', $id = '')
|
||||
{
|
||||
($is_show == '' || $id == '') && app('json')->fail(100100);
|
||||
($is_show == '' || $id == '') && app('json')->fail('参数错误');
|
||||
$res = $this->services->update((int)$id, ['is_show' => (int)$is_show]);
|
||||
if ($res) {
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail(100015);
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class SystemStore extends AuthController
|
||||
$data['address'] = implode(',', $data['address']);
|
||||
$data['latlng'] = explode(',', $data['latlng']);
|
||||
if (!isset($data['latlng'][0]) || !isset($data['latlng'][1])) {
|
||||
return app('json')->fail(400125);
|
||||
return app('json')->fail('请选择门店位置');
|
||||
}
|
||||
$data['latitude'] = $data['latlng'][0];
|
||||
$data['longitude'] = $data['latlng'][1];
|
||||
@ -138,7 +138,7 @@ class SystemStore extends AuthController
|
||||
$data['image'] = $site_url . $data['image'];
|
||||
}
|
||||
$this->services->saveStore((int)$id, $data);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,23 +148,23 @@ class SystemStore extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$storeInfo = $this->services->get($id);
|
||||
if (!$storeInfo) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
if ($storeInfo->is_del == 1) {
|
||||
$storeInfo->is_del = 0;
|
||||
if (!$storeInfo->save())
|
||||
return app('json')->fail(100041);
|
||||
return app('json')->fail('恢复失败');
|
||||
else
|
||||
return app('json')->success(100040);
|
||||
return app('json')->success('恢复成功');
|
||||
} else {
|
||||
$storeInfo->is_del = 1;
|
||||
if (!$storeInfo->save())
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -110,10 +110,10 @@ class SystemStoreStaff extends AuthController
|
||||
]);
|
||||
if (!$id) {
|
||||
if ($data['image'] == '') {
|
||||
return app('json')->fail(400250);
|
||||
return app('json')->fail('请选择用户');
|
||||
}
|
||||
if ($this->services->count(['uid' => $data['image']['uid']])) {
|
||||
return app('json')->fail(400126);
|
||||
return app('json')->fail('添加的核销员用户已存在');
|
||||
}
|
||||
$data['uid'] = $data['image']['uid'];
|
||||
$data['avatar'] = $data['image']['image'];
|
||||
@ -121,32 +121,32 @@ class SystemStoreStaff extends AuthController
|
||||
$data['avatar'] = $data['image'];
|
||||
}
|
||||
if ($data['uid'] == 0) {
|
||||
return app('json')->fail(400250);
|
||||
return app('json')->fail('请选择用户');
|
||||
}
|
||||
if ($data['store_id'] == '') {
|
||||
return app('json')->fail(400127);
|
||||
return app('json')->fail('请选择所属提货点');
|
||||
}
|
||||
if ($data['staff_name'] == ''){
|
||||
return app('json')->fail(400128);
|
||||
return app('json')->fail('请填写核销员名称');
|
||||
}
|
||||
if ($data['phone'] == ''){
|
||||
return app('json')->fail(400129);
|
||||
return app('json')->fail('请填写核销员电话');
|
||||
}
|
||||
unset($data['image']);
|
||||
if ($id) {
|
||||
$res = $this->services->update($id, $data);
|
||||
if ($res) {
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
} else {
|
||||
return app('json')->fail(100007);
|
||||
return app('json')->fail('修改失败');
|
||||
}
|
||||
} else {
|
||||
$data['add_time'] = time();
|
||||
$res = $this->services->save($data);
|
||||
if ($res) {
|
||||
return app('json')->success(400130);
|
||||
return app('json')->success('核销员添加成功');
|
||||
} else {
|
||||
return app('json')->fail(400131);
|
||||
return app('json')->fail('核销员添加失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -160,13 +160,13 @@ class SystemStoreStaff extends AuthController
|
||||
public function set_show($is_show = '', $id = '')
|
||||
{
|
||||
if ($is_show == '' || $id == '') {
|
||||
app('json')->fail(100100);
|
||||
app('json')->fail('参数错误');
|
||||
}
|
||||
$res = $this->services->update($id, ['status' => (int)$is_show]);
|
||||
if ($res) {
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
} else {
|
||||
return app('json')->fail(100015);
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,10 +177,10 @@ class SystemStoreStaff extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -40,11 +40,11 @@ class SmsAdmin extends AuthController
|
||||
public function captcha()
|
||||
{
|
||||
if (!request()->isPost()) {
|
||||
return app('json')->fail(100031);
|
||||
return app('json')->fail('发送失败');
|
||||
}
|
||||
$phone = request()->param('phone');
|
||||
if (!trim($phone)) {
|
||||
return app('json')->fail(400132);
|
||||
return app('json')->fail('请填写手机号');
|
||||
}
|
||||
return app('json')->success($this->services->captcha($phone));
|
||||
}
|
||||
@ -64,12 +64,12 @@ class SmsAdmin extends AuthController
|
||||
['sign', ''],
|
||||
], true);
|
||||
$signLen = mb_strlen(trim($sign));
|
||||
if (!strlen(trim($account))) return app('json')->fail(400133);
|
||||
if (!strlen(trim($password))) return app('json')->fail(400134);
|
||||
if (!$signLen) return app('json')->fail(400135);
|
||||
if ($signLen > 8) return app('json')->fail(400136);
|
||||
if (!strlen(trim($code))) return app('json')->fail(400137);
|
||||
if (!strlen(trim($url))) return app('json')->fail(400138);
|
||||
if (!strlen(trim($account))) return app('json')->fail('请填写账号');
|
||||
if (!strlen(trim($password))) return app('json')->fail('请填写密码');
|
||||
if (!$signLen) return app('json')->fail('请填写短信签名');
|
||||
if ($signLen > 8) return app('json')->fail('短信签名最长为8位');
|
||||
if (!strlen(trim($code))) return app('json')->fail('请填写验证码');
|
||||
if (!strlen(trim($url))) return app('json')->fail('请填写域名');
|
||||
$status = $this->services->register($account, $password, $url, $phone, $code, $sign);
|
||||
return app('json')->success($status['msg']);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -51,9 +51,9 @@ class SmsConfig extends AuthController
|
||||
$this->validate(['sms_account' => $account, 'sms_token' => $token], \app\adminapi\validate\notification\SmsConfigValidate::class);
|
||||
|
||||
if ($this->services->login($account, $token)) {
|
||||
return app('json')->success(400139);
|
||||
return app('json')->success('登录成功');
|
||||
} else {
|
||||
return app('json')->fail(400140);
|
||||
return app('json')->fail('账号或密码错误');
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ class SmsConfig extends AuthController
|
||||
CacheService::delete('sms_account');
|
||||
$this->services->updateSmsConfig('', '');
|
||||
CacheService::clear();
|
||||
return app('json')->success(100042);
|
||||
return app('json')->success('退出成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -37,7 +37,7 @@ class SmsPay extends AuthController
|
||||
'site_url' => sys_config('site_url')
|
||||
]);
|
||||
if (!$this->smsHandle->isLogin()) {
|
||||
return app('json')->fail(400141);
|
||||
return app('json')->fail('请先填写短信配置');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -37,7 +37,7 @@ class SmsPublicTemp extends AuthController
|
||||
'site_url' => sys_config('site_url')
|
||||
]);
|
||||
if (!$this->smsHandle->isLogin()) {
|
||||
return app('json')->fail(400141);
|
||||
return app('json')->fail('请先填写短信配置');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -86,12 +86,12 @@ class SmsTemplateApply extends AuthController
|
||||
['type', 0]
|
||||
]);
|
||||
if (!strlen(trim($data['title']))) {
|
||||
return app('json')->fail(400142);
|
||||
return app('json')->fail('请输入模板名称');
|
||||
}
|
||||
if (!strlen(trim($data['content']))) {
|
||||
return app('json')->fail(400143);
|
||||
return app('json')->fail('请输入模板内容');
|
||||
}
|
||||
$this->services->sms()->apply($data['title'], $data['content'], $data['type']);
|
||||
return app('json')->success(100027);
|
||||
return app('json')->success('申请成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -71,7 +71,7 @@ class DeliveryService extends AuthController
|
||||
]);
|
||||
|
||||
$this->services->saveDeliveryService($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ class DeliveryService extends AuthController
|
||||
]);
|
||||
|
||||
$this->services->updateDeliveryService((int)$id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,9 +111,9 @@ class DeliveryService extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,9 +124,9 @@ class DeliveryService extends AuthController
|
||||
*/
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) return app('json')->fail(100100);
|
||||
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -81,7 +81,7 @@ class RefundOrder extends AuthController
|
||||
public function agreeExpress($id)
|
||||
{
|
||||
$this->services->agreeExpress($id);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ class RefundOrder extends AuthController
|
||||
[$remark] = $this->request->postMore([['remark', '']], true);
|
||||
|
||||
$this->services->updateRemark((int)$id, $remark);
|
||||
return app('json')->success(100024);
|
||||
return app('json')->success('备注成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ class RefundOrder extends AuthController
|
||||
*/
|
||||
public function refund($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->refundOrderForm((int)$id));
|
||||
}
|
||||
|
||||
@ -129,21 +129,21 @@ class RefundOrder extends AuthController
|
||||
['type', 1]
|
||||
]);
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$orderRefund = $this->services->get($id);
|
||||
if (!$orderRefund) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
if ($orderRefund['is_cancel'] == 1) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
$order = $services->get((int)$orderRefund['store_order_id']);
|
||||
if (!$order) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
if (!in_array($orderRefund['refund_type'], [1, 5])) {
|
||||
return app('json')->fail(400144);
|
||||
return app('json')->fail('售后订单状态不支持该操作');
|
||||
}
|
||||
|
||||
if ($data['type'] == 1 || $data['type'] == 5) {
|
||||
@ -156,17 +156,17 @@ class RefundOrder extends AuthController
|
||||
//拒绝退款
|
||||
if ($type == 2) {
|
||||
$this->services->refuseRefund((int)$id, $data, $orderRefund);
|
||||
return app('json')->success(400145);
|
||||
return app('json')->success('修改退款状态成功');
|
||||
} else {
|
||||
//0元退款
|
||||
if ($orderRefund['refund_price'] == 0 && in_array($orderRefund['refund_type'], [1, 5])) {
|
||||
$refund_price = 0;
|
||||
} else {
|
||||
if (!$data['refund_price']) {
|
||||
return app('json')->fail(400146);
|
||||
return app('json')->fail('请输入退款金额');
|
||||
}
|
||||
if ($orderRefund['refund_price'] == $orderRefund['refunded_price']) {
|
||||
return app('json')->fail(400147);
|
||||
return app('json')->fail('已退完支付金额,不能再退款了');
|
||||
}
|
||||
$refund_price = $data['refund_price'];
|
||||
}
|
||||
@ -174,7 +174,7 @@ class RefundOrder extends AuthController
|
||||
$data['refunded_price'] = bcadd($data['refund_price'], $orderRefund['refunded_price'], 2);
|
||||
$bj = bccomp((string)$orderRefund['refund_price'], (string)$data['refunded_price'], 2);
|
||||
if ($bj < 0) {
|
||||
return app('json')->fail(400148);
|
||||
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
|
||||
}
|
||||
|
||||
unset($data['type']);
|
||||
@ -195,10 +195,10 @@ class RefundOrder extends AuthController
|
||||
unset($data['refund_price']);
|
||||
if ($this->services->agreeRefund($id, $refund_data)) {
|
||||
$this->services->update($id, $data);
|
||||
return app('json')->success(400149);
|
||||
return app('json')->success('退款成功');
|
||||
} else {
|
||||
$this->services->storeProductOrderRefundYFasle((int)$id, $refund_price);
|
||||
return app('json')->fail(400150);
|
||||
return app('json')->fail('退款失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ class RefundOrder extends AuthController
|
||||
*/
|
||||
public function noRefund($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->noRefundForm((int)$id));
|
||||
}
|
||||
|
||||
@ -227,6 +227,6 @@ class RefundOrder extends AuthController
|
||||
{
|
||||
[$refund_reason] = $this->request->postMore([['refund_reason', '']], true);
|
||||
$this->services->refuse($id, $refund_reason);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -12,6 +12,7 @@ namespace app\adminapi\controller\v1\order;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
use app\adminapi\validate\order\StoreOrderValidate;
|
||||
use app\jobs\MiniOrderJob;
|
||||
use app\jobs\OrderExpressJob;
|
||||
use app\services\serve\ServeServices;
|
||||
use app\services\wechat\WechatUserServices;
|
||||
@ -107,12 +108,12 @@ class StoreOrder extends AuthController
|
||||
['code', ''],
|
||||
['confirm', 0]
|
||||
], true);
|
||||
if (!$code) return app('json')->fail(100100);
|
||||
if (!$code) return app('json')->fail('参数错误');
|
||||
$orderInfo = $services->writeOffOrder($code, (int)$confirm);
|
||||
if ($confirm == 0) {
|
||||
return app('json')->success(400151, $orderInfo);
|
||||
return app('json')->success('验证成功', $orderInfo);
|
||||
}
|
||||
return app('json')->success(400152);
|
||||
return app('json')->success('核销成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,16 +129,16 @@ class StoreOrder extends AuthController
|
||||
{
|
||||
$orderInfo = $this->services->getOne(['order_id' => $order_id, 'is_del' => 0]);
|
||||
if ($orderInfo->shipping_type != 2 && $orderInfo->delivery_type != 'send') {
|
||||
return app('json')->fail(400153);
|
||||
return app('json')->fail('核销订单未查到');
|
||||
} else {
|
||||
if (!$orderInfo->verify_code) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$orderInfo = $services->writeOffOrder($orderInfo->verify_code, 1);
|
||||
if ($orderInfo) {
|
||||
return app('json')->success(400151);
|
||||
return app('json')->success('验证成功');
|
||||
} else {
|
||||
return app('json')->fail(400154);
|
||||
return app('json')->fail('核销失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,7 +151,7 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->updateForm($id));
|
||||
}
|
||||
|
||||
@ -162,7 +163,7 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function update($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$data = $this->request->postMore([
|
||||
['order_id', ''],
|
||||
['total_price', 0],
|
||||
@ -174,11 +175,11 @@ class StoreOrder extends AuthController
|
||||
|
||||
$this->validate($data, StoreOrderValidate::class);
|
||||
|
||||
if ($data['total_price'] < 0) return app('json')->fail(400155);
|
||||
if ($data['pay_price'] < 0) return app('json')->fail(400155);
|
||||
if ($data['total_price'] < 0) return app('json')->fail('订单金额必须填写');
|
||||
if ($data['pay_price'] < 0) return app('json')->fail('订单金额必须填写');
|
||||
|
||||
$this->services->updateOrder((int)$id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,13 +206,13 @@ class StoreOrder extends AuthController
|
||||
[$ids] = $this->request->postMore([
|
||||
['ids', []],
|
||||
], true);
|
||||
if (!count($ids)) return app('json')->fail(400156);
|
||||
if (!count($ids)) return app('json')->fail('请选择需要删除的订单');
|
||||
if ($this->services->getOrderIdsCount($ids))
|
||||
return app('json')->fail(400157);
|
||||
return app('json')->fail('您选择的的订单存在用户未删除的订单');
|
||||
if ($this->services->batchUpdate($ids, ['is_system_del' => 1]))
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
else
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,17 +223,17 @@ class StoreOrder extends AuthController
|
||||
public function del($id)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id)))
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
if (!$orderInfo->is_del)
|
||||
return app('json')->fail(400157);
|
||||
return app('json')->fail('您选择的的订单存在用户未删除的订单');
|
||||
$orderInfo->is_system_del = 1;
|
||||
if ($orderInfo->save()) {
|
||||
/** @var StoreOrderRefundServices $refundServices */
|
||||
$refundServices = app()->make(StoreOrderRefundServices::class);
|
||||
$refundServices->update(['store_order_id' => $id], ['is_system_del' => 1]);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
} else
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,7 +265,7 @@ class StoreOrder extends AuthController
|
||||
['day_type', 0], //顺丰传 0今天,1明天,2后台
|
||||
['pickup_time', []],//开始时间 9:00,结束时间 10:00 开始时间和结束时间之间不能小于一个小时
|
||||
]);
|
||||
return app('json')->success(100010, $services->delivery((int)$id, $data));
|
||||
return app('json')->success('操作成功', $services->delivery((int)$id, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -303,18 +304,17 @@ class StoreOrder extends AuthController
|
||||
['service_type', ''],//快递业务类型
|
||||
]);
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
if (!$data['cart_ids']) {
|
||||
return app('json')->fail(400158);
|
||||
return app('json')->fail('请选择发货商品');
|
||||
}
|
||||
foreach ($data['cart_ids'] as $cart) {
|
||||
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num']) {
|
||||
return app('json')->fail(400159);
|
||||
return app('json')->fail('请重新选择发货商品或发货件数');
|
||||
}
|
||||
}
|
||||
$services->splitDelivery((int)$id, $data);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功', $services->splitDelivery((int)$id, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,7 +347,7 @@ class StoreOrder extends AuthController
|
||||
], 'cart_info', 'cart_id');
|
||||
foreach ($data['cart_ids'] as $cart) {
|
||||
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num']) {
|
||||
return app('json')->fail(400159);
|
||||
return app('json')->fail('请重新选择发货商品或发货件数');
|
||||
}
|
||||
if (isset($cartList[$cart['cart_id']])) {
|
||||
$value = is_string($cartList[$cart['cart_id']]) ? json_decode($cartList[$cart['cart_id']], true) : $cartList[$cart['cart_id']];
|
||||
@ -378,7 +378,7 @@ class StoreOrder extends AuthController
|
||||
public function split_cart_info($id, StoreOrderCartInfoServices $services)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($services->getSplitCartList((int)$id));
|
||||
}
|
||||
@ -394,7 +394,7 @@ class StoreOrder extends AuthController
|
||||
public function split_order($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($this->services->getSplitOrderList(['pid' => $id, 'is_system_del' => 0], ['*'], ['split', 'pink', 'invoice']));
|
||||
}
|
||||
@ -408,24 +408,24 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function take_delivery(StoreOrderTakeServices $services, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$order = $this->services->get($id);
|
||||
if (!$order)
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($order['status'] == 2)
|
||||
return app('json')->fail(400114);
|
||||
return app('json')->fail('不能重复收货');
|
||||
if ($order['paid'] == 1 && $order['status'] == 1)
|
||||
$data['status'] = 2;
|
||||
else if ($order['pay_type'] == 'offline')
|
||||
$data['status'] = 2;
|
||||
else
|
||||
return app('json')->fail(400115);
|
||||
return app('json')->fail('请先发货或者送货');
|
||||
|
||||
if (!$this->services->update($id, $data)) {
|
||||
return app('json')->fail(400116);
|
||||
return app('json')->fail('收货失败,请稍候再试');
|
||||
} else {
|
||||
$services->storeProductOrderUserTakeDelivery($order);
|
||||
return app('json')->success(400117);
|
||||
return app('json')->success('收货成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ class StoreOrder extends AuthController
|
||||
public function refund(StoreOrderRefundServices $services, $id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($services->refundOrderForm((int)$id, 'order'));
|
||||
}
|
||||
@ -475,11 +475,11 @@ class StoreOrder extends AuthController
|
||||
['cart_ids', []]
|
||||
]);
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$order = $this->services->get($id);
|
||||
if (!$order) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
|
||||
$refundData = [
|
||||
@ -506,10 +506,10 @@ class StoreOrder extends AuthController
|
||||
$refund_price = 0;
|
||||
} else {
|
||||
if (!$data['refund_price']) {
|
||||
return app('json')->fail(400146);
|
||||
return app('json')->fail('请输入退款金额');
|
||||
}
|
||||
if ($orderRefund['refund_price'] == $orderRefund['refunded_price']) {
|
||||
return app('json')->fail(400147);
|
||||
return app('json')->fail('已退完支付金额,不能再退款了');
|
||||
}
|
||||
$refund_price = $data['refund_price'];
|
||||
}
|
||||
@ -517,7 +517,7 @@ class StoreOrder extends AuthController
|
||||
$data['refunded_price'] = bcadd($data['refund_price'], $orderRefund['refunded_price'], 2);
|
||||
$bj = bccomp((string)$orderRefund['refund_price'], (string)$data['refunded_price'], 2);
|
||||
if ($bj < 0) {
|
||||
return app('json')->fail(400148);
|
||||
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
|
||||
}
|
||||
|
||||
$refund_data['pay_price'] = $order['pay_price'];
|
||||
@ -536,10 +536,10 @@ class StoreOrder extends AuthController
|
||||
unset($data['refund_price']);
|
||||
if ($services->agreeRefund($orderRefund['id'], $refund_data)) {
|
||||
$services->update($orderRefund['id'], $data);
|
||||
return app('json')->success(400149);
|
||||
return app('json')->success('退款成功');
|
||||
} else {
|
||||
$services->storeProductOrderRefundYFasle((int)$orderRefund['id'], $refund_price);
|
||||
return app('json')->fail(400150);
|
||||
return app('json')->fail('退款失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,12 +552,12 @@ class StoreOrder extends AuthController
|
||||
public function order_info($id)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund', 'invoice']))) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
/** @var UserServices $services */
|
||||
$services = app()->make(UserServices::class);
|
||||
$userInfo = $services->get($orderInfo['uid']);
|
||||
if (!$userInfo) return app('json')->fail(400119);
|
||||
if (!$userInfo) return app('json')->fail('用户信息不存在');
|
||||
$userInfo = $userInfo->hidden(['pwd', 'add_ip', 'last_ip', 'login_type']);
|
||||
$userInfo['spread_name'] = '无';
|
||||
if ($userInfo['spread_uid']) {
|
||||
@ -609,9 +609,9 @@ class StoreOrder extends AuthController
|
||||
public function get_express($id, ExpressServices $services)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id)))
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($orderInfo['delivery_type'] != 'express' || !$orderInfo['delivery_id'])
|
||||
return app('json')->fail(400120);
|
||||
return app('json')->fail('快递单号不存在');
|
||||
|
||||
$cacheName = $orderInfo['order_id'] . $orderInfo['delivery_id'];
|
||||
|
||||
@ -631,7 +631,7 @@ class StoreOrder extends AuthController
|
||||
public function distribution(StoreOrderDeliveryServices $services, $id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
return app('json')->success($services->distributionForm((int)$id));
|
||||
}
|
||||
@ -644,9 +644,9 @@ class StoreOrder extends AuthController
|
||||
public function update_distribution(StoreOrderDeliveryServices $services, $id)
|
||||
{
|
||||
$data = $this->request->postMore([['delivery_name', ''], ['delivery_code', ''], ['delivery_id', '']]);
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$services->updateDistribution($id, $data);
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -658,7 +658,7 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function no_refund(StoreOrderRefundServices $services, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($services->noRefundForm((int)$id));
|
||||
}
|
||||
|
||||
@ -671,10 +671,10 @@ class StoreOrder extends AuthController
|
||||
public function update_un_refund(StoreOrderRefundServices $services, $id)
|
||||
{
|
||||
if (!$id || !($orderInfo = $this->services->get($id)))
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
[$refund_reason] = $this->request->postMore([['refund_reason', '']], true);
|
||||
if (!$refund_reason) {
|
||||
return app('json')->fail(400113);
|
||||
return app('json')->fail('拒绝理由不能为空');
|
||||
}
|
||||
$orderInfo->refund_reason = $refund_reason;
|
||||
$orderInfo->refund_status = 0;
|
||||
@ -699,7 +699,7 @@ class StoreOrder extends AuthController
|
||||
$orderInfo['phone'] = $orderInfo['user_phone'];
|
||||
event('CustomNoticeListener', [$orderInfo['uid'], $orderInfo, 'order_refund_fail']);
|
||||
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -709,12 +709,12 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function pay_offline(OrderOfflineServices $services, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$res = $services->orderOffline((int)$id);
|
||||
if ($res) {
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
} else {
|
||||
return app('json')->fail(100005);
|
||||
return app('json')->fail('操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,7 +727,7 @@ class StoreOrder extends AuthController
|
||||
public function refund_integral(StoreOrderRefundServices $services, $id)
|
||||
{
|
||||
if (!$id)
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
return app('json')->success($services->refundIntegralForm((int)$id));
|
||||
}
|
||||
|
||||
@ -740,29 +740,29 @@ class StoreOrder extends AuthController
|
||||
{
|
||||
[$back_integral] = $this->request->postMore([['back_integral', 0]], true);
|
||||
if (!$id || !($orderInfo = $this->services->get($id))) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
if ($orderInfo->is_del) {
|
||||
return app('json')->fail(400160);
|
||||
return app('json')->fail('订单已删除无法退积分');
|
||||
}
|
||||
if ($back_integral <= 0) {
|
||||
return app('json')->fail(400161);
|
||||
return app('json')->fail('请输入积分');
|
||||
}
|
||||
if ($orderInfo['use_integral'] == $orderInfo['back_integral']) {
|
||||
return app('json')->fail(400162);
|
||||
return app('json')->fail('已退完积分');
|
||||
}
|
||||
|
||||
$data['back_integral'] = bcadd((string)$back_integral, (string)$orderInfo['back_integral'], 2);
|
||||
$bj = bccomp((string)$orderInfo['use_integral'], (string)$data['back_integral'], 2);
|
||||
if ($bj < 0) {
|
||||
return app('json')->fail(400163);
|
||||
return app('json')->fail('退积分大于支付积分,请修改退积分');
|
||||
}
|
||||
//积分退款处理
|
||||
$orderInfo->back_integral = $data['back_integral'];
|
||||
if ($services->refundIntegral($orderInfo, $back_integral)) {
|
||||
return app('json')->success(400164);
|
||||
return app('json')->success('退积分成功');
|
||||
} else {
|
||||
return app('json')->fail(400165);
|
||||
return app('json')->fail('退积分失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -775,18 +775,18 @@ class StoreOrder extends AuthController
|
||||
{
|
||||
$data = $this->request->postMore([['remark', '']]);
|
||||
if (!$data['remark'])
|
||||
return app('json')->fail(400106);
|
||||
return app('json')->fail('备注不能为空');
|
||||
if (!$id)
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
|
||||
if (!$order = $this->services->get($id)) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
$order->remark = $data['remark'];
|
||||
if ($order->save()) {
|
||||
return app('json')->success(100024);
|
||||
return app('json')->success('备注成功');
|
||||
} else
|
||||
return app('json')->fail(100025);
|
||||
return app('json')->fail('备注失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -796,7 +796,7 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function status(StoreOrderStatusServices $services, $id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
return app('json')->success($services->getStatusList(['oid' => $id])['list']);
|
||||
}
|
||||
|
||||
@ -810,12 +810,12 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function order_print($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$res = $this->services->orderPrintTicket($id, true);
|
||||
if ($res) {
|
||||
return app('json')->success(100010);
|
||||
return app('json')->success('操作成功');
|
||||
} else {
|
||||
return app('json')->fail(100005);
|
||||
return app('json')->fail('操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -827,7 +827,7 @@ class StoreOrder extends AuthController
|
||||
public function expr_temp(ServeServices $services, $com)
|
||||
{
|
||||
if (!$com) {
|
||||
return app('json')->fail(400123);
|
||||
return app('json')->fail('快递公司编号缺失');
|
||||
}
|
||||
$list = $services->express()->temp($com);
|
||||
return app('json')->success($list);
|
||||
@ -840,7 +840,7 @@ class StoreOrder extends AuthController
|
||||
{
|
||||
$data = $this->request->getMore([['com', '']]);
|
||||
if (!$data['com']) {
|
||||
return app('json')->fail(400123);
|
||||
return app('json')->fail('快递公司编号缺失');
|
||||
}
|
||||
$tpd = $services->express()->temp($data['com']);
|
||||
return app('json')->success($tpd['data']);
|
||||
@ -855,7 +855,7 @@ class StoreOrder extends AuthController
|
||||
public function order_dump($order_id, StoreOrderDeliveryServices $storeOrderDeliveryServices)
|
||||
{
|
||||
$storeOrderDeliveryServices->orderDump($order_id);
|
||||
return app('json')->success(400121);
|
||||
return app('json')->success('打印成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -868,6 +868,7 @@ class StoreOrder extends AuthController
|
||||
*/
|
||||
public function getKuaidiComs(ServeServices $services)
|
||||
{
|
||||
MiniOrderJob::dispatch('syncOrderShipping');
|
||||
return app('json')->success($services->express()->getKuaidiComs());
|
||||
}
|
||||
|
||||
@ -906,7 +907,7 @@ class StoreOrder extends AuthController
|
||||
[$file] = $this->request->getMore([
|
||||
['file', '']
|
||||
], true);
|
||||
if (!$file) return app('json')->fail(400168);
|
||||
if (!$file) return app('json')->fail('请上传文件');
|
||||
$file = public_path() . substr($file, 1);
|
||||
// 获取文件后缀
|
||||
$suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
@ -939,4 +940,30 @@ class StoreOrder extends AuthController
|
||||
$data = $this->services->printShippingData($order_id);
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收货地址
|
||||
* @param $id
|
||||
* @return \think\Response
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2025/9/8
|
||||
*/
|
||||
public function editAddress($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
$data = $this->request->postMore([
|
||||
['real_name', ''],
|
||||
['user_phone', ''],
|
||||
['user_address', '']
|
||||
]);
|
||||
if (!$data['real_name']) return app('json')->fail('请填写收货人姓名');
|
||||
if (!$data['user_phone']) return app('json')->fail('请填写收货人电话');
|
||||
if (!$data['user_address']) return app('json')->fail('请填写收货人地址');
|
||||
$this->services->editAddress($id, $data);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -80,20 +80,17 @@ class StoreOrderInvoice extends AuthController
|
||||
*/
|
||||
public function set_invoice($id = '')
|
||||
{
|
||||
if ($id == '') return app('json')->fail(100100);
|
||||
if ($id == '') return app('json')->fail('参数错误');
|
||||
$data = $this->request->postMore([
|
||||
['is_invoice', 0],
|
||||
['invoice_number', 0],
|
||||
['remark', '']
|
||||
]);
|
||||
if ($data['is_invoice'] == 1 && !$data['invoice_number']) {
|
||||
return app('json')->fail(400166);
|
||||
}
|
||||
if ($data['invoice_number'] && !preg_match('/^\d{8,10}$/', $data['invoice_number'])) {
|
||||
return app('json')->fail(400167);
|
||||
return app('json')->fail('请填写开票号');
|
||||
}
|
||||
$this->services->setInvoice((int)$id, $data);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,13 +101,13 @@ class StoreOrderInvoice extends AuthController
|
||||
public function orderInfo(StoreProductServices $productServices, StoreOrderServices $orderServices, $id)
|
||||
{
|
||||
if (!$id || !($orderInfo = $orderServices->get($id))) {
|
||||
return app('json')->fail(400118);
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
/** @var UserServices $services */
|
||||
$services = app()->make(UserServices::class);
|
||||
$userInfo = $services->get($orderInfo['uid']);
|
||||
if (!$userInfo) {
|
||||
return app('json')->fail(400119);
|
||||
return app('json')->fail('用户信息不存在');
|
||||
}
|
||||
$userInfo = $userInfo->hidden(['pwd', 'add_ip', 'last_ip', 'login_type']);
|
||||
$userInfo['spread_name'] = '';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -109,6 +109,6 @@ class CopyTaobao extends AuthController
|
||||
['attrs', []]
|
||||
]);
|
||||
$this->services->save($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -89,9 +89,9 @@ class StoreCategory extends AuthController
|
||||
*/
|
||||
public function set_show($is_show = '', $id = '')
|
||||
{
|
||||
if ($is_show == '' || $id == '') return app('json')->fail(100100);
|
||||
if ($is_show == '' || $id == '') return app('json')->fail('参数错误');
|
||||
$this->service->setShow($id, $is_show);
|
||||
return app('json')->success($is_show == 1 ? 100003 : 100004);
|
||||
return app('json')->success($is_show == 1 ? '显示成功' : '隐藏成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,7 +122,7 @@ class StoreCategory extends AuthController
|
||||
['is_show', 0]
|
||||
]);
|
||||
$this->service->createData($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ class StoreCategory extends AuthController
|
||||
]);
|
||||
|
||||
$this->service->editData($id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,6 +167,6 @@ class StoreCategory extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
$this->service->del((int)$id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -110,7 +110,7 @@ class StoreProduct extends AuthController
|
||||
['type', 0]
|
||||
]);
|
||||
$services->setDbCache($this->adminId . '_product_data', $data, 68400);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,7 +121,7 @@ class StoreProduct extends AuthController
|
||||
public function deleteCacheData(CacheServices $services)
|
||||
{
|
||||
$services->delectDbCache($this->adminId . '_product_data');
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,7 +161,7 @@ class StoreProduct extends AuthController
|
||||
$del = $this->service->value(['id' => $id], 'is_del');
|
||||
if ($del == 1) return app('json')->fail('商品已删除,请先恢复商品');
|
||||
$this->service->setShow([$id], $is_show);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,7 +174,7 @@ class StoreProduct extends AuthController
|
||||
['ids', []]
|
||||
], true);
|
||||
$this->service->setShow($ids, 1);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,7 +187,7 @@ class StoreProduct extends AuthController
|
||||
['ids', []]
|
||||
], true);
|
||||
$this->service->setShow($ids, 0);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,6 +244,7 @@ class StoreProduct extends AuthController
|
||||
['presale_time', 0],//预售时间
|
||||
['presale_day', 0],//预售发货日
|
||||
['vip_product', 0],//是否付费会员商品
|
||||
['vip_product_type', 0],//0仅付费会员可见,1仅付费会员可购买
|
||||
['is_sub', []],//佣金是单独还是默认
|
||||
['recommend', []],//商品推荐
|
||||
['activity', []],//活动优先级
|
||||
@ -270,7 +271,7 @@ class StoreProduct extends AuthController
|
||||
['gift_price', 0],//礼品附加费
|
||||
]);
|
||||
$this->service->save((int)$id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,7 +410,7 @@ class StoreProduct extends AuthController
|
||||
} else {
|
||||
$re = $upload->getTempKeys();
|
||||
}
|
||||
return $re ? app('json')->success($re) : app('json')->fail(100016);
|
||||
return $re ? app('json')->success($re) : app('json')->fail('获取失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -422,7 +423,7 @@ class StoreProduct extends AuthController
|
||||
public function check_activity($id)
|
||||
{
|
||||
$this->service->checkActivity($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -435,7 +436,7 @@ class StoreProduct extends AuthController
|
||||
$data = $this->request->getMore([
|
||||
['file', ""]
|
||||
]);
|
||||
if (!$data['file']) return app('json')->fail(400168);
|
||||
if (!$data['file']) return app('json')->fail('请上传文件');
|
||||
$file = public_path() . substr($data['file'], 1);
|
||||
// 获取文件后缀
|
||||
$suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
@ -471,7 +472,7 @@ class StoreProduct extends AuthController
|
||||
['gift_price', 0],
|
||||
]);
|
||||
$this->service->batchSetting($data);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -522,7 +523,7 @@ class StoreProduct extends AuthController
|
||||
[$file] = $this->request->getMore([
|
||||
['file', ""]
|
||||
], true);
|
||||
if (!$file) return app('json')->fail(400168);
|
||||
if (!$file) return app('json')->fail('请上传文件');
|
||||
$res = $this->service->productImport($file);
|
||||
return app('json')->success('导入成功', $res);
|
||||
}
|
||||
@ -553,6 +554,7 @@ class StoreProduct extends AuthController
|
||||
['is_sub', 0],
|
||||
['is_vip', 0],
|
||||
['vip_product', 0],
|
||||
['vip_product_type', 0],
|
||||
['attr_value', []],
|
||||
]);
|
||||
$this->service->otherSave($id, $type, $data);
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\product;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\product;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\product;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -21,6 +21,17 @@ use think\facade\App;
|
||||
*/
|
||||
class StoreProductReply extends AuthController
|
||||
{
|
||||
/**
|
||||
* @var StoreProductReplyServices
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @param App $app
|
||||
* @param StoreProductReplyServices $service
|
||||
* @var StoreProductReplyServices $services
|
||||
*/
|
||||
public function __construct(App $app, StoreProductReplyServices $service)
|
||||
{
|
||||
parent::__construct($app);
|
||||
@ -56,7 +67,7 @@ class StoreProductReply extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
$this->services->del($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +81,7 @@ class StoreProductReply extends AuthController
|
||||
['content', '']
|
||||
], true);
|
||||
$this->services->setReply($id, $content);
|
||||
return app('json')->success(400169);
|
||||
return app('json')->success('回复成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +120,7 @@ class StoreProductReply extends AuthController
|
||||
}
|
||||
$this->validate(['product_id' => $data['product_id'], 'nickname' => $data['nickname'], 'avatar' => $data['avatar'], 'comment' => $data['comment'], 'product_score' => $data['product_score'], 'service_score' => $data['service_score']], \app\adminapi\validate\product\StoreProductReplyValidate::class, 'save');
|
||||
$this->services->saveReply($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -56,7 +56,7 @@ class StoreProductRule extends AuthController
|
||||
['spec', []]
|
||||
]);
|
||||
$this->services->save($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,6 +82,6 @@ class StoreProductRule extends AuthController
|
||||
['ids', '']
|
||||
], true);
|
||||
$this->services->del((string)$ids);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -82,9 +82,9 @@ class Login extends AuthController
|
||||
$res = $this->services->user()->register($data);
|
||||
if ($res) {
|
||||
$services->updateSmsConfig($data['account'], md5($data['account'] . md5($data['password'])));
|
||||
return app('json')->success(400170);
|
||||
return app('json')->success('注册成功');
|
||||
} else {
|
||||
return app('json')->fail(400171);
|
||||
return app('json')->fail('注册失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,9 +109,9 @@ class Login extends AuthController
|
||||
CacheService::clear();
|
||||
CacheService::set('sms_account', $account);
|
||||
$services->updateSmsConfig($account, $password);
|
||||
return app('json')->success(400139, $res);
|
||||
return app('json')->success('登录成功', $res);
|
||||
} else {
|
||||
return app('json')->fail(400172);
|
||||
return app('json')->fail('登录失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -63,7 +63,7 @@ class Serve extends AuthController
|
||||
if ($res) {
|
||||
return app('json')->success($res);
|
||||
} else {
|
||||
return app('json')->fail(400173);
|
||||
return app('json')->fail('获取套餐列表失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,19 +81,19 @@ class Serve extends AuthController
|
||||
['pay_type', ''],
|
||||
]);
|
||||
$openInfo = $this->services->user()->getUser();
|
||||
if (!$openInfo) app('json')->fail(400174);
|
||||
if (!$openInfo) app('json')->fail('获取支付码失败');
|
||||
switch ($data['type']) {
|
||||
case "sms" :
|
||||
if (!$openInfo['sms']['open']) return app('json')->fail(400175);
|
||||
if (!$openInfo['sms']['open']) return app('json')->fail('请先开通短信服务');
|
||||
break;
|
||||
case "query" :
|
||||
if (!$openInfo['query']['open']) return app('json')->fail(400176);
|
||||
if (!$openInfo['query']['open']) return app('json')->fail('请先开通物流查询服务');
|
||||
break;
|
||||
case "dump" :
|
||||
if (!$openInfo['dump']['open']) return app('json')->fail(400177);
|
||||
if (!$openInfo['dump']['open']) return app('json')->fail('请先开通电子面单打印服务');
|
||||
break;
|
||||
case "copy" :
|
||||
if (!$openInfo['copy']['open']) return app('json')->fail(400178);
|
||||
if (!$openInfo['copy']['open']) return app('json')->fail('请先开通商品采集服务');
|
||||
break;
|
||||
}
|
||||
$this->validate($data, MealValidata::class);
|
||||
@ -102,7 +102,7 @@ class Serve extends AuthController
|
||||
if ($res) {
|
||||
return app('json')->success($res);
|
||||
} else {
|
||||
return app('json')->fail(400174);
|
||||
return app('json')->fail('获取支付码失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class Serve extends AuthController
|
||||
$systemConfigService = app()->make(SystemConfigServices::class);
|
||||
$systemConfigService->saveExpressInfo($data);
|
||||
$this->services->express()->open();
|
||||
return app('json')->success(100044);
|
||||
return app('json')->success('开通成功');
|
||||
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ class Serve extends AuthController
|
||||
$this->services->express()->open();
|
||||
}
|
||||
|
||||
return app('json')->success(100044);
|
||||
return app('json')->success('开通成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +189,7 @@ class Serve extends AuthController
|
||||
$data['password'] = md5($data['password']);
|
||||
$this->services->user()->modify($data);
|
||||
CacheService::delete('sms_account');
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,6 +208,6 @@ class Serve extends AuthController
|
||||
|
||||
$this->services->user()->modifyPhone($data);
|
||||
CacheService::delete('sms_account');
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -43,10 +43,10 @@ class Sms extends AuthController
|
||||
public function openServe(string $sign)
|
||||
{
|
||||
if (!$sign) {
|
||||
return app('json')->fail(400179);
|
||||
return app('json')->fail('请设置短信签名');
|
||||
}
|
||||
$this->services->sms()->setSign($sign)->open();
|
||||
return app('json')->success(100044);
|
||||
return app('json')->success('开通成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,10 +65,10 @@ class Sms extends AuthController
|
||||
$this->validate(['phone' => $phone], ServeValidata::class, 'phone');
|
||||
|
||||
if (!$sign) {
|
||||
return app('json')->fail(400179);
|
||||
return app('json')->fail('请设置短信签名');
|
||||
}
|
||||
$this->services->sms()->modify($sign, $phone, $code);
|
||||
return app('json')->success(400180);
|
||||
return app('json')->success('修改短信签名成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ class Sms extends AuthController
|
||||
], true);
|
||||
|
||||
if (!$title || !$content || !$type) {
|
||||
return app('json')->success(400143);
|
||||
return app('json')->success('请输入模板内容');
|
||||
}
|
||||
return app('json')->success($this->services->sms()->apply($title, $content, (int)$type));
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -75,7 +75,7 @@ class LangCode extends AuthController
|
||||
['list', []]
|
||||
]);
|
||||
$this->services->langCodeSave($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ class LangCode extends AuthController
|
||||
public function langCodeDel($id)
|
||||
{
|
||||
$this->services->langCodeDel($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ class LangCode extends AuthController
|
||||
[$text] = $this->request->postMore([
|
||||
['text', '']
|
||||
], true);
|
||||
if ($text == '') return app('json')->fail(100100);
|
||||
if ($text == '') return app('json')->fail('参数错误');
|
||||
return app('json')->success($this->services->langCodeTranslate($text));
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -68,12 +68,12 @@ class LangCountry extends AuthController
|
||||
['type_id', 0],
|
||||
]);
|
||||
$this->services->langCountrySave($id, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
public function langCountryDel($id)
|
||||
{
|
||||
$this->services->langCountryDel($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -66,7 +66,7 @@ class LangType extends AuthController
|
||||
]);
|
||||
$this->services->langTypeSave($data);
|
||||
CacheService::delete('lang_type_data');
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ class LangType extends AuthController
|
||||
public function langTypeStatus($id, $status)
|
||||
{
|
||||
$this->services->langTypeStatus($id, $status);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,6 +90,6 @@ class LangType extends AuthController
|
||||
{
|
||||
$this->services->langTypeDel($id);
|
||||
CacheService::delete('lang_type_data');
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -80,7 +80,7 @@ class ShippingTemplates extends AuthController
|
||||
$temp['sort'] = $data['sort'];
|
||||
$temp['add_time'] = time();
|
||||
$this->services->save((int)$id, $temp, $data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,10 +92,10 @@ class ShippingTemplates extends AuthController
|
||||
[['id', 'd'], 0],
|
||||
], true);
|
||||
if ($id == 1) {
|
||||
return app('json')->fail(400181);
|
||||
return app('json')->fail('默认模板不能删除');
|
||||
} else {
|
||||
$this->services->detete($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -78,7 +78,7 @@ class SystemAdmin extends AuthController
|
||||
|
||||
$data['level'] = $this->adminInfo['level'] + 1;
|
||||
$this->services->create($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ class SystemAdmin extends AuthController
|
||||
public function edit($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(400182);
|
||||
return app('json')->fail('管理员信息读取失败');
|
||||
}
|
||||
|
||||
return app('json')->success($this->services->updateForm($this->adminInfo['level'] + 1, (int)$id));
|
||||
@ -115,9 +115,9 @@ class SystemAdmin extends AuthController
|
||||
$this->validate($data, \app\adminapi\validate\setting\SystemAdminValidata::class, 'update');
|
||||
|
||||
if ($this->services->save((int)$id, $data)) {
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
} else {
|
||||
return app('json')->fail(100007);
|
||||
return app('json')->fail('修改失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ class SystemAdmin extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$id) return app('json')->fail(100100);
|
||||
if (!$id) return app('json')->fail('参数错误');
|
||||
if ($this->services->update((int)$id, ['is_del' => 1, 'status' => 0]))
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
else
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ class SystemAdmin extends AuthController
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
$this->services->update((int)$id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,14 +172,14 @@ class SystemAdmin extends AuthController
|
||||
|
||||
if ($data['pwd']) {
|
||||
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
|
||||
return app('json')->fail(400183);
|
||||
return app('json')->fail('密码太过简单,请输入较为复杂的密码');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->services->updateAdmin($this->adminId, $data))
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
else
|
||||
return app('json')->fail(100007);
|
||||
return app('json')->fail('修改失败');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -193,12 +193,12 @@ class SystemAdmin extends AuthController
|
||||
['conf_file_pwd', ''],
|
||||
]);
|
||||
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['file_pwd'])) {
|
||||
return app('json')->fail(400183);
|
||||
return app('json')->fail('密码太过简单,请输入较为复杂的密码');
|
||||
}
|
||||
if ($this->services->setFilePassword($this->adminId, $data))
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
else
|
||||
return app('json')->fail(100007);
|
||||
return app('json')->fail('修改失败');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\controller\v1\setting;
|
||||
|
||||
use app\adminapi\controller\AuthController;
|
||||
@ -30,7 +38,7 @@ class SystemAgreement extends AuthController
|
||||
*/
|
||||
public function getAgreement($type)
|
||||
{
|
||||
if (!$type) return app('json')->fail(400184);
|
||||
if (!$type) return app('json')->fail('协议类型不存在');
|
||||
$info = $this->services->getAgreementBytype($type);
|
||||
return app('json')->success($info);
|
||||
}
|
||||
@ -49,6 +57,6 @@ class SystemAgreement extends AuthController
|
||||
]);
|
||||
$data['status'] = 1;
|
||||
$this->services->saveAgreement($data, $data['id']);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -90,12 +90,12 @@ class SystemCity extends AuthController
|
||||
$data['level'] = $data['level'] + 1;
|
||||
$data['city_id'] = intval($this->services->getCityIdMax() + 1);
|
||||
$this->services->save($data);
|
||||
return app('json')->success(100000);
|
||||
return app('json')->success('保存成功');
|
||||
} else {
|
||||
unset($data['level']);
|
||||
unset($data['parent_id']);
|
||||
$this->services->update($data['id'], $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class SystemCity extends AuthController
|
||||
[['city_id', 'd'], 0]
|
||||
], true);
|
||||
$this->services->deleteCity($id);
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +135,7 @@ class SystemCity extends AuthController
|
||||
{
|
||||
CacheService::delete('CITY_LIST');
|
||||
CacheService::delete('CITY_FULL_LIST');
|
||||
return app('json')->success(400185);
|
||||
return app('json')->success('清除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -53,7 +53,7 @@ class SystemConfig extends AuthController
|
||||
['status', -1]
|
||||
]);
|
||||
if (!$where['tab_id'] && $where['config_name'] == '') {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
if ($where['status'] == -1) {
|
||||
unset($where['status']);
|
||||
@ -103,24 +103,24 @@ class SystemConfig extends AuthController
|
||||
['status', 0]
|
||||
]);
|
||||
if (is_array($data['config_tab_id'])) $data['config_tab_id'] = end($data['config_tab_id']);
|
||||
if (!$data['info']) return app('json')->fail(400274);
|
||||
if (!$data['menu_name']) return app('json')->fail(400275);
|
||||
if (!$data['desc']) return app('json')->fail(400276);
|
||||
if (!$data['info']) return app('json')->fail('请输入配置名称');
|
||||
if (!$data['menu_name']) return app('json')->fail('请输入字段名称');
|
||||
if (!$data['desc']) return app('json')->fail('请输入配置简介');
|
||||
if ($data['sort'] < 0) {
|
||||
$data['sort'] = 0;
|
||||
}
|
||||
if ($data['type'] == 'text') {
|
||||
if (!$data['width']) return app('json')->fail(400277);
|
||||
if ($data['width'] <= 0) return app('json')->fail(400278);
|
||||
if (!$data['width']) return app('json')->fail('请输入文本框的宽度');
|
||||
if ($data['width'] <= 0) return app('json')->fail('请输入正确的文本框的宽度');
|
||||
}
|
||||
if ($data['type'] == 'textarea') {
|
||||
if (!$data['width']) return app('json')->fail(400279);
|
||||
if (!$data['high']) return app('json')->fail(400280);
|
||||
if ($data['width'] < 0) return app('json')->fail(400281);
|
||||
if ($data['high'] < 0) return app('json')->fail(400282);
|
||||
if (!$data['width']) return app('json')->fail('请输入多行文本框的宽度');
|
||||
if (!$data['high']) return app('json')->fail('请输入多行文本框的高度');
|
||||
if ($data['width'] < 0) return app('json')->fail('请输入正确的多行文本框的宽度');
|
||||
if ($data['high'] < 0) return app('json')->fail('请输入正确的多行文本框的宽度');
|
||||
}
|
||||
if ($data['type'] == 'radio' || $data['type'] == 'checkbox') {
|
||||
if (!$data['parameter']) return app('json')->fail(400283);
|
||||
if (!$data['parameter']) return app('json')->fail('请输入配置参数');
|
||||
$this->services->valiDateRadioAndCheckbox($data);
|
||||
}
|
||||
if ($data['level'] == 1) {
|
||||
@ -136,7 +136,7 @@ class SystemConfig extends AuthController
|
||||
$this->services->save($data);
|
||||
}
|
||||
CacheService::clear();
|
||||
return app('json')->success(400284);
|
||||
return app('json')->success('添加配置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,7 +148,7 @@ class SystemConfig extends AuthController
|
||||
public function read($id)
|
||||
{
|
||||
if (!$id) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$info = $this->services->getReadList((int)$id);
|
||||
return app('json')->success(compact('info'));
|
||||
@ -200,7 +200,7 @@ class SystemConfig extends AuthController
|
||||
]);
|
||||
if (is_array($data['config_tab_id'])) $data['config_tab_id'] = end($data['config_tab_id']);
|
||||
if (!$this->services->get($id)) {
|
||||
return app('json')->fail(100026);
|
||||
return app('json')->fail('数据不存在');
|
||||
}
|
||||
if ($data['level'] == 1) {
|
||||
if (!$data['link_data']) return app('json')->fail('请选择关联顶级选项');
|
||||
@ -210,7 +210,7 @@ class SystemConfig extends AuthController
|
||||
$data['value'] = json_encode($data['value']);
|
||||
$this->services->update($id, $data);
|
||||
CacheService::clear();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,10 +221,10 @@ class SystemConfig extends AuthController
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else {
|
||||
CacheService::clear();
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,11 +237,11 @@ class SystemConfig extends AuthController
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
CacheService::clear();
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,7 +251,7 @@ class SystemConfig extends AuthController
|
||||
{
|
||||
$tabId = $this->request->param('tab_id', 1);
|
||||
if (!$tabId) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$url = $request->baseUrl();
|
||||
return app('json')->success($this->services->getConfigForm($url, $tabId));
|
||||
@ -280,7 +280,7 @@ class SystemConfig extends AuthController
|
||||
$this->services->checkThumbParam($post);
|
||||
}
|
||||
if (isset($post['extract_type']) && !count($post['extract_type'])) {
|
||||
return app('json')->fail(400753);
|
||||
return app('json')->fail('提现方式最少选一种');
|
||||
}
|
||||
if (isset($post['store_brokerage_binding_status'])) {
|
||||
$this->services->checkBrokerageBinding($post);
|
||||
@ -288,18 +288,18 @@ class SystemConfig extends AuthController
|
||||
if (isset($post['store_brokerage_ratio']) && isset($post['store_brokerage_two'])) {
|
||||
$num = $post['store_brokerage_ratio'] + $post['store_brokerage_two'];
|
||||
if ($num > 100) {
|
||||
return app('json')->fail(400285);
|
||||
return app('json')->fail('一二级返佣比例不能大于100%');
|
||||
}
|
||||
}
|
||||
if (isset($post['spread_banner'])) {
|
||||
$num = count($post['spread_banner']);
|
||||
if ($num > 5) {
|
||||
return app('json')->fail(400286);
|
||||
return app('json')->fail('分销海报不能多于5张');
|
||||
}
|
||||
}
|
||||
if (isset($post['user_extract_min_price'])) {
|
||||
if (!preg_match('/[0-9]$/', $post['user_extract_min_price'])) {
|
||||
return app('json')->fail(400287);
|
||||
return app('json')->fail('提现最低金额只能为数字');
|
||||
}
|
||||
}
|
||||
if (isset($post['wss_open'])) {
|
||||
@ -307,30 +307,30 @@ class SystemConfig extends AuthController
|
||||
}
|
||||
if (isset($post['store_brokerage_price']) && $post['store_brokerage_statu'] == 3) {
|
||||
if ($post['store_brokerage_price'] === '') {
|
||||
return app('json')->fail(400288);
|
||||
return app('json')->fail('满额分销最低金额不能为空');
|
||||
}
|
||||
if ($post['store_brokerage_price'] < 0) {
|
||||
return app('json')->fail(400289);
|
||||
return app('json')->fail('满额分销最低金额不能小于0');
|
||||
}
|
||||
}
|
||||
if (isset($post['store_brokerage_binding_time']) && $post['store_brokerage_binding_status'] == 2) {
|
||||
if (!preg_match("/^[0-9][0-9]*$/", $post['store_brokerage_binding_time'])) {
|
||||
return app('json')->fail(400290);
|
||||
return app('json')->fail('绑定有效期请填写正整数');
|
||||
}
|
||||
}
|
||||
if (isset($post['uni_brokerage_price']) && $post['uni_brokerage_price'] < 0) {
|
||||
return app('json')->fail(400756);
|
||||
return app('json')->fail('推广佣金单价不能小于0');
|
||||
}
|
||||
if (isset($post['day_brokerage_price_upper']) && $post['day_brokerage_price_upper'] < -1) {
|
||||
return app('json')->fail(400757);
|
||||
return app('json')->fail('每日推广佣金上限不能小于-1');
|
||||
}
|
||||
if (isset($post['pay_new_weixin_open']) && (bool)$post['pay_new_weixin_open']) {
|
||||
if (empty($post['pay_new_weixin_mchid'])) {
|
||||
return app('json')->fail(400763);
|
||||
return app('json')->fail('商户号不能为空');
|
||||
}
|
||||
}
|
||||
if (isset($post['uni_brokerage_price']) && preg_match('/\.[0-9]{2,}[1-9][0-9]*$/', (string)$post['uni_brokerage_price']) > 0) {
|
||||
return app('json')->fail(500029);
|
||||
return app('json')->fail('金额最多两位小数');
|
||||
}
|
||||
|
||||
if (isset($post['weixin_ckeck_file'])) {
|
||||
@ -396,7 +396,7 @@ class SystemConfig extends AuthController
|
||||
}
|
||||
}
|
||||
if (isset($post['sms_save_type']) && sys_config('sms_account', '') != '') {
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
if (isset($post['param_filter_data'])) {
|
||||
$post['param_filter_data'] = base64_encode($post['param_filter_data']);
|
||||
@ -462,7 +462,7 @@ class SystemConfig extends AuthController
|
||||
}
|
||||
}
|
||||
CacheService::clear();
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -543,7 +543,8 @@ class SystemConfig extends AuthController
|
||||
$version = get_crmeb_version();
|
||||
return app('json')->success([
|
||||
'version' => $version,
|
||||
'label' => 19
|
||||
'label' => 19,
|
||||
'spread_uid' => (int)(parse_ini_file(app()->getRootPath() . '.version')['spread_uid'] ?? 0)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
@ -77,9 +77,9 @@ class SystemConfigTab extends AuthController
|
||||
['menus_id', 0],
|
||||
]);
|
||||
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
|
||||
if (!$data['title']) return app('json')->fail(400291);
|
||||
if (!$data['title']) return app('json')->fail('请输入标题');
|
||||
$this->services->save($data);
|
||||
return app('json')->success(400292);
|
||||
return app('json')->success('添加配置分类成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,10 +123,10 @@ class SystemConfigTab extends AuthController
|
||||
['menus_id', 0],
|
||||
]);
|
||||
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
|
||||
if (!$data['title']) return app('json')->fail(400291);
|
||||
if (!$data['eng_title']) return app('json')->fail(400275);
|
||||
if (!$data['title']) return app('json')->fail('请输入标题');
|
||||
if (!$data['eng_title']) return app('json')->fail('请输入字段名称');
|
||||
$this->services->update($id, $data);
|
||||
return app('json')->success(100001);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,12 +138,12 @@ class SystemConfigTab extends AuthController
|
||||
public function delete(SystemConfigServices $services, $id)
|
||||
{
|
||||
if ($services->count(['tab_id' => $id])) {
|
||||
return app('json')->fail(400293);
|
||||
return app('json')->fail('存在下级配置,无法删除');
|
||||
}
|
||||
if (!$this->services->delete($id))
|
||||
return app('json')->fail(100008);
|
||||
return app('json')->fail('删除失败');
|
||||
else
|
||||
return app('json')->success(100002);
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,9 +155,9 @@ class SystemConfigTab extends AuthController
|
||||
public function set_status($id, $status)
|
||||
{
|
||||
if ($status == '' || $id == 0) {
|
||||
return app('json')->fail(100100);
|
||||
return app('json')->fail('参数错误');
|
||||
}
|
||||
$this->services->update($id, ['status' => $status]);
|
||||
return app('json')->success(100014);
|
||||
return app('json')->success('设置成功');
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user