update v5.2.0

This commit is contained in:
evoxwht 2023-09-19 17:39:39 +08:00
parent 40f850e294
commit 4f66fdff4f
3613 changed files with 119039 additions and 93874 deletions

204
README.md
View File

@ -1,10 +1,10 @@
![输入图片说明](readme/pic/gitee.jpg)
<div align="center" >
<img src="https://images.gitee.com/uploads/images/2021/1109/164354_0aafe3d2_892944.gif" />
</div>
<div align="center">
<div align="center">
支持免费商用的PHP **多语言** 商城系统
CRMEB开源商城系统PHP版
</div>
@ -13,10 +13,10 @@
<img src="https://img.shields.io/badge/Licence-GPL3.0-green.svg?style=flat" />
</a>
<a href="http://www.crmeb.com">
<img src="https://img.shields.io/badge/Edition-4.5-blue.svg" />
<img src="https://img.shields.io/badge/Edition-5.1-blue.svg" />
</a>
<a href="https://gitee.com/ZhongBangKeJi/CRMEB/repository/archive/master.zip">
<img src="https://img.shields.io/badge/Download-150m-red.svg" />
<img src="https://img.shields.io/badge/Download-240m-red.svg" />
</a>
<a href='https://gitee.com/ZhongBangKeJi/CRMEB/stargazers'>
<img src='https://gitee.com/ZhongBangKeJi/CRMEB/badge/star.svg?theme=gvp' alt='star'></img>
@ -36,137 +36,172 @@
</div>
<div align="center" >
<a href="https://gitee.com/ZhongBangKeJi/CRMEB/blob/master/README.md"> </a>
<a href="https://gitee.com/ZhongBangKeJi/CRMEB/blob/master/README.md">宽屏预览</a>
</div>
### 介绍
CRMEB打通版是历经6年时间匠心之作系统全开源可商用包含小程序商城、H5商城、公众号商城、PC商城、App多种分销模式、拼团、砍价、秒杀、优惠券、抽奖、积分、会员等级、小程序直播、页面DIY前后端分离全部100%开源。方便二开,更有详细使用文档、接口文档、数据字典、二开文档/视频教程。为开发者赋能,助力企业发展、国家富强,致力于打造最受欢迎的商城项目
---
### 📋 更新说明
```
v5.2.0 更新说明【更新时间2023年09月13日】
1、后台ui 从iview更新成element-ui
2、数据统计查询计算优化统计放在对应的模块中
3、优化站点配置分类对应的配置项
4、客服关键字自动回复添加自动回复用户在出发关键字时系统自动回复聊天
5、批量发货功能导出发货单填写对应的物流数据点击批量发货然后导入即可批量写入发货状态
6、商品起购数量后台可设置起购件数移动端默认显示最低的购买件数
7、提现手续费设置填写提现手续费百分比范围0-1000为无提现手续费设置10%提现提现100元到账90元10元手续费
8、签到功能增加提醒增加连续签到奖励累计签到奖励
9、支持微信服务商支付
10、优化小程序和公众号登录流程
11、代码生成二期
v5.1.0 更新说明【更新时间2023年07月10日】
1、增加一号通商家寄件功能
2、增加京东云华为云天翼云云存储
3、增加虚拟评价可选规格
4、增加自定义跳转小程序
5、增加移动端订单管理查看物流信息
6、增加一定端退款订单详情显示退款理由以及图片
7、增加后台订单详情展示用户的发票申请记录信息及开票信息/状态
8、增加使用的优惠券是否退回开关商品成功退款后退回/不退回使用的优惠券
```
### 用心做开源我们也很需要你的鼓励右上角Star🌟等你点亮
---
### 📝 介绍
CRMEB开源商城系统是一款全开源可商用的系统前后端分离开发全部100%开源在小程序、公众号、H5、APP、PC端都能用使用方便二开方便安装使用也很简单使用文档、接口文档、数据字典、二开文档、视频教程各种资料应有尽有就算你是技术小白也能轻松上手
欢迎大家来体验、来提建议来一起让CRMEB开源商城系统更强大让更多开发者受益虽然是开源但我们该有的功能全都有拼团、秒杀、优惠券、抽奖、积分、直播、分销、页面DIY... 常用商城系统功能,都是全开源,直接用!
CRMEB开源商城Java版https://gitee.com/ZhongBangKeJi/crmeb_java
---
### 系统亮点
### 🫧 系统亮点
~~~
多 语 言:后台随时配置语言包,移动端支持多语言切换;
高 性 能redis缓存、队列、长连接、多种云储存、支持集群部署
个 性 UI多种风格切换、支持DIY各种首页/专题页面
前后端分离后端TP6管理端iviewui移动端uniapp
代码规范遵循PSR-2命名规范、Restful标准接口、代码严格分层、注释齐全、统一错误码
权限管理:内置强大灵活的权限管理,可以控制到每一个菜单;
开发配置:低代码增加配置、系统组合数据模块;
二开效率PHP快速生成表单、内置所有事件、后台在线编辑器、代码注释齐全、完整接口文档
快速上手:详细帮助文档、接口文档、数据库字典、代码注释、一键安装;
系统安全:系统操作日志、系统生产日志、文件校验、数据备份;
系统功能:请看帮助文档 https://doc.crmeb.com/single/crmeb_v4/1758
用户体验:等您来评!
1.前后端分离后端TP6管理端iView UI移动端Uni-app
2.代码规范遵循PSR-2命名规范、Restful标准接口、代码严格分层、注释齐全、统一错误码
3.权限管理:内置强大灵活的权限管理,可以控制到每一个菜单;
4.开发配置:低代码增加配置、系统组合数据模块;
5.二开效率应用form-builder PHP快速生成表单、内置所有事件、后台接口管理调试、后台代码在线编辑器、代码生成快速对接第三方接口
6.快速上手:详细帮助文档、后台接口管理、后台数据库字典、系统文件管理备注、代码注释、一键安装;
7.系统安全:系统操作日志、系统生产日志、文件校验、数据备份;
8.高 性 能支持Redis缓存、队列、长连接、多种云储存、支持集群部署。
~~~
---
### 运行环境
### 🖥 运行环境
```
Nignx/Apache/IIS
PHP 7.1 ~ 7.4
MySQL 5.7
MySQL 5.7 8.0
Redis
```
> 温馨提示虚拟空间不支持推荐使用bt宝塔面板服务器推荐阿里云ecs或腾讯云cvm 云服务器:<a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z" target="_blank"> 查看 </a>
### 官方论坛
> 温馨提示虚拟空间不支持推荐使用bt宝塔面板服务器推荐京东云服务器<a href="https://partner.jdcloud.com/partner/notice/b06c3232b6394fdfa496923b8e00b286" target="_blank">注册即享6.5折专属优惠,点我领取!</a>
[![输入图片说明](readme/pic/gflt.jpg)](https://www.crmeb.com/ask/thread/list/147)
### 📱 系统演示
产品BUG、优化建议欢迎社区反馈https://www.crmeb.com/ask/thread/list?id=147
![输入图片说明](readme/pic/公众号.jpg)
管理后台: http://v5.crmeb.net/admin
---
账号demo 密码crmeb.com
#### 体验云部署
不懂服务器?不懂技术?无法解决高并发?想数据私有化?还想后期定制开发?
H5端http://v5.crmeb.net/(移动端打开)
推荐云部署版一键超低价格低至 :collision: 9.9元/年,解决以上所有问题<a href='https://saas.crmeb.com/saas-home-software-detail-50043-s-y.html' target='_blank'>点击了解 </a>
---
### 系统演示
![输入图片说明](readme/pic/20公众号.jpg)
管理后台: http://v4.crmeb.net/admin 账号demo 密码crmeb.com
H5端http://v4.crmeb.net/(移动端打开)
PC端http://v4.crmeb.net/(电脑端打开)
PC端http://v5.crmeb.net/(电脑端打开)
APP下载http://app.crmeb.cn/bzv 苹果手机直接在APP Store里搜索CRMEB下载
### 页面展示
(页面仅展示部分UI)
![输入图片说明](readme/pic/gitee开源版详情_01.jpg)
![输入图片说明](readme/pic/gitee开源版详情_02.jpg)
![输入图片说明](readme/pic/gitee开源版详情_03.jpg)
![输入图片说明](readme/pic/gitee开源版详情_04.jpg)
![输入图片说明](readme/pic/gitee开源版详情_05.jpg)
> 听说大神你想看看CRMEB开源项目的完整框架<a href="https://doc.crmeb.com/single/v5/7712" target="_blank">戳这儿,轻松获取!</a>
<div align="center">
<a href='http://s.crmeb.com/goods_detail/739' target='_blank'>点击查看高清版全套UI设计图</a>
</div>
---
### 🔐 安装教程
想要快速安装,教程来助攻!<a href="https://doc.crmeb.com/single/v5/7714" target="_blank">查看安装教程!</a>
---
### 📲 核心功能
![输入图片说明](readme/pic/功能列表.jpg)
### 推荐项目(欢迎合作QQ763569752 )
---
| 项目名称 | 关注量 | 项目介绍 |
| ------------ | ------------ | ------------ |
| [![](https://img.shields.io/badge/CRMEB-CRMChat-blue.svg)](https://gitee.com/ZhongBangKeJi/CRMChat) | [![](https://gitee.com/ZhongBangKeJi/CRMChat/badge/star.svg)](https://gitee.com/ZhongBangKeJi/CRMChat/stargazers) | CRMChat客服系统支持接入各种渠道. |
| [![](https://img.shields.io/badge/CRMEB-crmeb_java-blue.svg)](https://gitee.com/ZhongBangKeJi/crmeb_java) | [![](https://gitee.com/ZhongBangKeJi/crmeb_java/badge/star.svg)](https://gitee.com/ZhongBangKeJi/crmeb_java/stargazers) | JAVA版开源商城. |
| [![](https://img.shields.io/badge/xaboy-formbuilder-blue.svg)](https://gitee.com/xaboy/form-builder) | [![](https://gitee.com/xaboy/form-builder/badge/star.svg)](https://gitee.com/xaboy/form-builder/stargazers) | PHP表单生成器快速生成现代化的form表单。 |
| [![](https://img.shields.io/badge/就眠儀式-LayuiVue-blue.svg)](https://gitee.com/layui/layui-vue) | [![](https://gitee.com/layui/layui-vue/badge/star.svg)](https://gitee.com/layui/layui-vue/stargazers) | layui-vue(谐音:类UI)是一套Vue3.0 的桌面端组件库. |
| [![](https://img.shields.io/badge/逆天的蝈蝈-TpFlow-blue.svg)](https://gitee.com/ntdgg/tpflow) | [![](https://gitee.com/ntdgg/tpflow/badge/star.svg?theme=gvp)](https://gitee.com/ntdgg/tpflow/stargazers) | TpFlow工作流引擎是一套规范化的流程管理系统基于业务而驱动系统生命力的一套引擎. |
### 📖 UI界面展示
### 商业版购买
开源不易,以下如果有需要,请支持一下,感谢您的支持,让我们更多动力!
![输入图片说明](readme/pic/PHP_01.jpg)
![输入图片说明](readme/pic/PHP_02.jpg)
![输入图片说明](readme/pic/PHP_03.jpg)
![输入图片说明](readme/pic/PHP_04.jpg)
[![](readme/pic/gitee2.png)](https://www.crmeb.com/index/criteria)
---
### 🔥🔥庆祝CRMEB开源商城系统Gitee star突破10000+ 专属活动福利 [点击了解](https://www.crmeb.com/ask/thread/20738)
### 感谢参与开发者
感谢大神们提交代码(排名不分先后)
### 📕 CRMEB公益
做开源帮助更多人CRMEB开源项目不仅让开发者从中受益也在公益活动中帮助了很多人对此我们很荣幸也乐此不疲
So~~想要用CRMEB开源商城系统做公益项目的朋友可以来免费申请商业版系统哦有需要的朋友快去找官方客服咨询吧
---
### 💎 捐赠
赠人玫瑰手留余香CRMEB诚挚地邀请大家积极参与捐赠我们会将捐赠获得的费用悉数用于支持公益项目让善意无限传递下去
在此深表感谢~
---
### 📞 CRMEB互动
#### 技术娱乐!代码写累了?那就歇会吧!扫码让你开心一刻!
![输入图片说明](readme/pic/小剧场.jpg)
#### 技术社区找方法、提bug、看官方消息、拿活跃大奖都在 <a href="https://www.crmeb.com/ask" target="_blank">CRMEB 技术社区</a> 应有尽有
#### 技术交流!<a href="https://pd.qq.com/s/1v2yb4e0p" target="_blank">CRMEB开源商城系统开发QQ频道已开启点击加入一起交流学习</a>
![输入图片说明](readme/pic/联系我们.jpg)
---
### 📻 感谢参与开发者
#### 感谢大神们提交代码(排名不分先后)
@yizhisamoye@bys1123@xaboy@youngxj0@jacklincheung@392256866@sxsea
欢迎反馈问题 [反馈问题](https://gitee.com/ZhongBangKeJi/CRMEB/issues)。
欢迎<a href="https://gitee.com/ZhongBangKeJi/CRMEB/issues" target="_blank">反馈问题</a>
欢迎提交代码 [提交代码](https://gitee.com/ZhongBangKeJi/CRMEB/pulls)。
### 特别鸣谢
欢迎<a href="https://gitee.com/ZhongBangKeJi/CRMEB/pulls" target="_blank">提交代码</a>
---
### 📸 特别鸣谢
排名不分先后感谢这些软件的开发者thinkphp、iview、vue、mysql、redis、uniapp、echarts、tree-table-vue、swiper、form-create等如有遗漏请联系我
### 核心开发团队
---
### 🎬 核心开发团队
产品:木子刀客
技术聆听、等风来、xaboy、吴汐、最后一片叶、旺仔、小小、娜娜、归来仍是少年
UIxy-yyds、LXT
测试夏天、绵绵羊、。ws
测试夏天、绵绵羊、。ws、半山
### 使用须知
1.允许用于个人学习、毕业设计、教学案例、公益事业、商业使用;
---
### 📺 使用须知
1、允许用于个人学习、毕业设计、教学案例、公益事业、商业使用
2.如果商用必须保留版权信息,请自觉遵守;
2、如果商用必须保留版权信息,请自觉遵守;
3.禁止将本项目的代码和资源进行任何形式的出售,产生的一切任何后果责任由侵权者自负。
3禁止将本项目的代码和资源进行任何形式的出售,产生的一切任何后果责任由侵权者自负。
### 版权信息
---
### 💾 版权信息
本项目包含的第三方源码和二进制文件之版权信息另行标注。
@ -176,6 +211,9 @@ All rights reserved。
CRMEB® 商标和著作权所有者为西安众邦网络科技有限公司。
---
[返回顶部 :fa-arrow-circle-up: ](https://gitee.com/ZhongBangKeJi/CRMEB#%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D)

View File

@ -1,5 +1,5 @@
version=CRMEB-KY v5.0.0
version_code=500
platform=github
version=CRMEB-KY v5.2.0
version_code=520
platform=gitee
app_id=ze7x9rxsv09l6pvsyo
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI

View File

@ -33,7 +33,8 @@ class Request extends \think\Request
* 不过滤变量名
* @var array
*/
protected $except = ['menu_path', 'api_url', 'unique_auth', 'description', 'custom_form', 'content'];
protected $except = ['menu_path', 'api_url', 'unique_auth',
'description', 'custom_form', 'content', 'tableField'];
/**
* 获取请求的数据
@ -59,7 +60,12 @@ class Request extends \think\Request
$name = is_array($param[1]) ? $param[0] . '/a' : $param[0];
$keyName = $param[0];
}
$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->filterWord(is_string($this->param($name, $param[1], $param[2])) ? trim($this->param($name, $param[1], $param[2])) : $this->param($name, $param[1], $param[2]), $filter && !in_array($keyName, $this->except));
$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->filterWord(
is_string($this->param($name, $param[1], $param[2])) ?
trim($this->param($name, $param[1], $param[2])) :
$this->param($name, $param[1], $param[2]),
$filter && !in_array($keyName, $this->except));
}
}
return $p;
@ -85,12 +91,34 @@ class Request extends \think\Request
foreach ($str as &$v) {
if (is_array($v)) {
foreach ($v as &$vv) {
if (!is_array($vv)) $vv = preg_replace($farr, '', $vv);
if (!is_array($vv)) {
$vv = $this->replaceWord($farr, $vv);
}
}
} else {
$v = preg_replace($farr, '', $v);
$v = $this->replaceWord($farr, $v);
}
}
} else {
$str = $this->replaceWord($farr, $str);
}
return $str;
}
/**
* 替换
* @param $farr
* @param $str
* @return array|string|string[]|null
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/9/19
*/
public function replaceWord($farr, $str)
{
if (parse_url($str, PHP_URL_HOST)) {
$url = parse_url($str);
$str = $url['scheme'] . '://' . $url['host'] . preg_replace($farr, '', $url['path']);
} else {
$str = preg_replace($farr, '', $str);
}

View File

@ -17,6 +17,7 @@ use crmeb\exceptions\ApiException;
use crmeb\exceptions\AuthException;
use think\db\exception\DbException;
use think\exception\Handle;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\facade\Env;
use think\facade\Log;
@ -81,6 +82,9 @@ class AdminApiExceptionHandle extends Handle
*/
public function render($request, Throwable $e): Response
{
if ($e instanceof HttpResponseException) {
return parent::render($request, $e);
}
$massageData = Env::get('app_debug', false) ? [
'message' => $e->getMessage(),
'file' => $e->getFile(),

View File

@ -20,8 +20,8 @@ use app\services\user\UserExtractServices;
use app\services\product\sku\StoreProductAttrValueServices;
use app\services\system\SystemMenusServices;
use app\services\user\UserServices;
use crmeb\services\CacheService;
use crmeb\services\HttpService;
use think\facade\Cache;
/**
* 公共接口基类 主要存放公共接口
@ -402,7 +402,7 @@ class Common extends AuthController
'info' => ''
]);
}
$services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100000);
}

View File

@ -12,6 +12,9 @@
namespace app\adminapi\controller;
use app\Request;
use app\services\system\attachment\SystemAttachmentServices;
use app\services\system\SystemRouteServices;
use crmeb\services\CacheService;
use think\Response;
@ -44,4 +47,39 @@ class PublicController
{
return app('json')->success(getWorkerManUrl());
}
/**
* 扫码上传
* @param Request $request
* @param int $upload_type
* @param int $type
* @return Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUpload(Request $request, $upload_type = 0, $type = 0)
{
[$file, $uploadToken, $pid] = $request->postMore([
['file', 'file'],
['uploadToken', ''],
['pid', 0]
], true);
$service = app()->make(SystemAttachmentServices::class);
if (CacheService::get('scan_upload') != $uploadToken) {
return app('json')->fail(410086);
}
$service->upload((int)$pid, $file, $upload_type, $type, '', $uploadToken);
return app('json')->success(100032);
}
public function import(Request $request)
{
$filePath = $request->param('file_path', '');
if (empty($filePath)) {
return app('json')->fail(12894);
}
app()->make(SystemRouteServices::class)->import($filePath);
return app('json')->success(100010);
}
}

File diff suppressed because one or more lines are too long

View File

@ -11,8 +11,8 @@
namespace app\adminapi\controller\v1\application\routine;
use app\jobs\notice\SyncMessageJob;
use app\services\message\SystemNotificationServices;
use app\services\other\QrcodeServices;
use app\services\message\TemplateMessageServices;
use app\services\system\attachment\SystemAttachmentServices;
use crmeb\exceptions\AdminException;
use think\exception\ValidateException;
@ -34,9 +34,9 @@ class RoutineTemplate extends AuthController
* 构造方法
* WechatTemplate constructor.
* @param App $app
* @param TemplateMessageServices $services
* @param SystemNotificationServices $services
*/
public function __construct(App $app, TemplateMessageServices $services)
public function __construct(App $app, SystemNotificationServices $services)
{
parent::__construct($app);
$this->services = $services;
@ -54,16 +54,17 @@ class RoutineTemplate extends AuthController
if (!sys_config('routine_appId') || !sys_config('routine_appsecret')) {
throw new AdminException(400236);
}
$all = $this->services->getTemplateList(['status' => 1, 'type' => 0]);
$list = MiniProgramService::getSubscribeTemplateList();
foreach ($list->data as $v) {
MiniProgramService::delSubscribeTemplate($v['priTmplId']);
}
if ($all['list']) {
foreach ($all['list'] as $template) {
SyncMessageJob::dispatch('SyncSubscribe', [$template]);
}
$tempKeys = $this->services->getTempKey('routine');
foreach ($tempKeys as $key => $content) {
SyncMessageJob::dispatch('SyncSubscribe', [$key, $content]);
}
return app('json')->success(100038);
}

View File

@ -63,6 +63,7 @@ class Reply extends AuthController
['key', ''],
['type', ''],
]);
$where['key_type'] = 0;
$list = $this->services->getKeyAll($where);
return app('json')->success($list);
}

View File

@ -12,8 +12,8 @@ namespace app\adminapi\controller\v1\application\wechat;
use app\adminapi\controller\AuthController;
use app\jobs\notice\SyncMessageJob;
use app\services\message\SystemNotificationServices;
use crmeb\exceptions\AdminException;
use app\services\message\TemplateMessageServices;
use crmeb\services\app\WechatService;
use think\facade\App;
@ -28,9 +28,9 @@ class WechatTemplate extends AuthController
* 构造方法
* WechatTemplate constructor.
* @param App $app
* @param TemplateMessageServices $services
* @param SystemNotificationServices $services
*/
public function __construct(App $app, TemplateMessageServices $services)
public function __construct(App $app, SystemNotificationServices $services)
{
parent::__construct($app);
$this->services = $services;
@ -48,13 +48,16 @@ class WechatTemplate extends AuthController
if (!sys_config('wechat_appid') || !sys_config('wechat_appsecret')) {
throw new AdminException(400248);
}
$all = $this->services->getTemplateList(['status' => 1, 'type' => 1]);
$list = WechatService::getPrivateTemplates();
foreach ($list->template_list as $v) {
WechatService::deleleTemplate($v['template_id']);
$tempIds = $this->services->getTempId('wechat');
foreach ($tempIds as $v) {
WechatService::deleleTemplate($v);
}
foreach ($all['list'] as $template) {
SyncMessageJob::dispatch('SyncWechat', [$template]);
$tempKeys = $this->services->getTempKey('wechat');
foreach ($tempKeys as $key => $content) {
SyncMessageJob::dispatch('SyncWechat', [$key, $content['wechat_content']]);
}
return app('json')->success(100038);
}

View File

@ -170,9 +170,6 @@ class ArticleCategory extends AuthController
public function getTreeList()
{
$list = $this->service->getTreeList();
foreach ($list as &$item) {
$item['disabled'] = !$item['status'] || $item['is_del'];
}
return app('json')->success($list);
}
}

View File

@ -103,6 +103,18 @@ class ExportExcel extends AuthController
return app('json')->success($this->service->exportOrderList($where));
}
/**
* 发货订单列表导出
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function orderDeliveryList()
{
return app('json')->success($this->service->exportOrderDeliveryList());
}
/**
* 商品列表导出
* @return mixed

View File

@ -12,6 +12,7 @@ namespace app\adminapi\controller\v1\file;
use app\adminapi\controller\AuthController;
use app\services\system\attachment\SystemAttachmentServices;
use crmeb\services\CacheService;
use think\facade\App;
/**
@ -43,7 +44,8 @@ class SystemAttachment extends AuthController
public function index()
{
$where = $this->request->getMore([
['pid', 0]
['pid', 0],
['real_name', '']
]);
return app('json')->success($this->service->getImageList($where));
}
@ -135,4 +137,66 @@ class SystemAttachment extends AuthController
$res = $this->service->videoUpload($data, $_FILES['file']);
return app('json')->success($res);
}
/**
* 获取扫码上传页面链接以及参数
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadQrcode()
{
[$pid] = $this->request->getMore([
['pid', 0]
], true);
$uploadToken = md5(time());
CacheService::set('scan_upload', $uploadToken, 600);
$url = sys_config('site_url') . '/app/upload?pid=' . $pid . '&token=' . $uploadToken;
return app('json')->success(['url' => $url]);
}
/**
* 删除二维码
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/26
*/
public function removeUploadQrcode()
{
CacheService::delete('scan_upload');
return app('json')->success();
}
/**
* 获取扫码上传的图片数据
* @param $scan_token
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadImage($scan_token)
{
return app('json')->success($this->service->scanUploadImage($scan_token));
}
/**
* 网络图片上传
* @return \think\Response
* @throws \Exception
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function onlineUpload()
{
$data = $this->request->postMore([
['pid', 0],
['images', []]
]);
$this->service->onlineUpload($data);
return app('json')->success(100032);
}
}

View File

@ -38,15 +38,20 @@ class SystemAttachmentCategory extends AuthController
/**
* 显示资源列表
* @return mixed
* @return \think\Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$where = $this->request->getMore([
['name', ''],
['pid', 0]
['pid', 0],
['all', 0]
]);
if ($where['name'] != '') $where['pid'] = '';
if ($where['name'] != '' || $where['all'] == 1) $where['pid'] = '';
return app('json')->success($this->service->getAll($where));
}
@ -99,6 +104,7 @@ class SystemAttachmentCategory extends AuthController
['pid', 0],
['name', '']
]);
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
if (!$data['name']) {
return app('json')->fail(400100);
}

View File

@ -43,7 +43,8 @@ class Express extends AuthController
public function index()
{
$where = $this->request->getMore([
['keyword', '']
['keyword', ''],
['is_show', '']
]);
return app('json')->success($this->services->getExpressList($where));
}

View File

@ -0,0 +1,82 @@
<?php
/**
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/3
*/
namespace app\adminapi\controller\v1\kefu;
use app\adminapi\controller\AuthController;
use app\services\wechat\WechatReplyServices;
class StoreServiceAutoReply extends AuthController
{
/**
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/3
*/
public function autoReplyList()
{
$where = $this->request->getMore([
['key', ''],
['type', ''],
]);
$where['key_type'] = 1;
$list = app()->make(WechatReplyServices::class)->getKeyAll($where);
return app('json')->success($list);
}
/**
* 获取自动回复表单
* @param int $id
* @return \think\Response
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/3
*/
public function autoReplyForm($id = 0)
{
return app('json')->success(app()->make(WechatReplyServices::class)->autoReplyForm($id));
}
/**
* 保存自动回复
* @param int $id
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/3
*/
public function autoReplySave($id = 0)
{
$data = $this->request->postMore([
['keys', ''],
['type', ''],
['data', ''],
['status', 1],
]);
app()->make(WechatReplyServices::class)->autoReplySave($id, $data);
return app('json')->success(100000);
}
/**
* 删除自动回复
* @param $id
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/3
*/
public function autoReplyDel($id)
{
app()->make(WechatReplyServices::class)->autoReplyDel($id);
return app('json')->success(100002);
}
}

View File

@ -0,0 +1,117 @@
<?php
/**
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\system\SystemSignRewardServices;
use think\facade\App;
class SignRewards extends AuthController
{
/**
* @param App $app
* @param SystemSignRewardServices $services
*/
public function __construct(App $app, SystemSignRewardServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 签到奖励列表
* @return \think\Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
public function index()
{
[$type] = $this->request->getMore([
['type', 0]
], true);
$data = $this->services->getList($type);
return app('json')->success($data);
}
/**
* 新增签到奖励
* @return \think\Response
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
public function addRewards()
{
[$type] = $this->request->getMore([
['type', 0]
], true);
$data = $this->services->rewardsForm(0, $type);
return app('json')->success($data);
}
/**
* 修改签到奖励
* @param $id
* @return \think\Response
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
public function editRewards($id)
{
$data = $this->services->rewardsForm($id);
return app('json')->success($data);
}
/**
* 保存签到奖励
* @param $id
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
public function saveRewards($id)
{
$data = $this->request->postMore([
['type', 0],
['days', 0],
['point', 0],
['exp', 0]
]);
$this->services->saveRewards($id, $data);
return app('json')->success(100000);
}
/**
* 删除签到奖励
* @param $id
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/31
*/
public function delRewards($id)
{
$this->services->delete($id);
return app('json')->success(100002);
}
}

View File

@ -14,6 +14,7 @@ use app\services\system\config\SystemConfigServices;
use app\services\yihaotong\SmsAdminServices;
use app\services\serve\ServeServices;
use app\adminapi\controller\AuthController;
use crmeb\services\CacheService;
use think\facade\App;
/**
@ -65,7 +66,7 @@ class SmsConfig extends AuthController
public function is_login(ServeServices $services)
{
$configServices = app()->make(SystemConfigServices::class);
$sms_info = $configServices->cacheDriver()->get('sms_account');
$sms_info = CacheService::get('sms_account');
$data = ['status' => false, 'info' => ''];
if ($sms_info) {
try {
@ -81,14 +82,14 @@ class SmsConfig extends AuthController
}
return app('json')->success($data);
} else {
$configServices->cacheDriver()->clear();
CacheService::clear();
$account = sys_config('sms_account');
$password = sys_config('sms_token');
//没有退出登录 清空这两个数据 自动登录
if ($account && $password) {
$res = $services->user()->login($account, $password);
if ($res) {
$configServices->cacheDriver()->set('sms_account', $account);
CacheService::set('sms_account', $account);
$data['status'] = true;
$data['info'] = $account;
}
@ -104,10 +105,9 @@ class SmsConfig extends AuthController
*/
public function logout()
{
$configServices = app()->make(SystemConfigServices::class);
$configServices->cacheDriver()->delete('sms_account');
CacheService::delete('sms_account');
$this->services->updateSmsConfig('', '');
$configServices->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100042);
}

View File

@ -12,7 +12,9 @@ namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\adminapi\validate\order\StoreOrderValidate;
use app\jobs\OrderExpressJob;
use app\services\serve\ServeServices;
use crmeb\services\FileService;
use app\services\order\{StoreOrderCartInfoServices,
StoreOrderDeliveryServices,
StoreOrderRefundServices,
@ -242,7 +244,7 @@ class StoreOrder extends AuthController
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_record_type', 2],//发货记录类型:2=电子面单3=商家寄件
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
@ -252,7 +254,10 @@ class StoreOrder extends AuthController
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
['fictitious_content', ''],//虚拟发货内容
['day_type', 0], //顺丰传 0今天1明天2后台
['pickup_time', []],//开始时间 9:00结束时间 10:00 开始时间和结束时间之间不能小于一个小时
]);
return app('json')->success(100010, $services->delivery((int)$id, $data));
}
@ -286,7 +291,11 @@ class StoreOrder extends AuthController
['fictitious_content', ''],//虚拟发货内容
['cart_ids', []]
['cart_ids', []],
['day_type', 0], //顺丰传 0今天1明天2后台
['pickup_time', []],//开始时间 9:00结束时间 10:00 开始时间和结束时间之间不能小于一个小时
['service_type', ''],//快递业务类型
]);
if (!$id) {
return app('json')->fail(100100);
@ -303,6 +312,58 @@ class StoreOrder extends AuthController
return app('json')->success(100010);
}
/**
* 获取寄件预扣金额
* @param ServeServices $services
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/16
*/
public function getPrice(ServeServices $services)
{
$data = $this->request->postMore([
['kuaidicom', ''],
['send_address', ''],
['orderId', ''],
['service_type', ''],
['cart_ids', []],
]);
$orderInfo = $this->services->get($data['orderId'], ['user_address', 'cart_id']);
if (!$orderInfo) {
return app('json')->fail('订单没有查询到');
}
$weight = '0';
if ($data['cart_ids']) {
$cartIds = array_column($data['cart_ids'], 'cart_id');
$cartList = app()->make(StoreOrderCartInfoServices::class)->getColumn([
['cart_id', 'in', $cartIds]
], '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);
}
if (isset($cartList[$cart['cart_id']])) {
$value = is_string($cartList[$cart['cart_id']]) ? json_decode($cartList[$cart['cart_id']], true) : $cartList[$cart['cart_id']];
$weightnew = bcmul($value['attrInfo']['weight'], (string)$cart['cart_num'], 2);
$weight = bcadd($weightnew, $weight, 2);
}
}
} else {
$orderCartInfoList = app()->make(StoreOrderCartInfoServices::class)->getCartInfoPrintProduct($data['orderId']);
foreach ($orderCartInfoList as $item) {
$weightnew = bcmul($item['attrInfo']['weight'], (string)$item['cart_num'], 2);
$weight = bcadd($weightnew, $weight, 2);
}
}
$data['address'] = $orderInfo['user_address'];
if ($weight > 0) {
$data['weight'] = $weight;
}
return app('json')->success($services->express()->getPrice($data));
}
/**
* 获取订单可拆分发货商品列表
* @param $id
@ -465,7 +526,7 @@ class StoreOrder extends AuthController
*/
public function order_info($id)
{
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund']))) {
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund', 'invoice']))) {
return app('json')->fail(400118);
}
/** @var UserServices $services */
@ -803,4 +864,23 @@ class StoreOrder extends AuthController
return app('json')->fail('取消失败');
}
}
/**
* 导入批量发货
* @return \think\Response|void
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
*/
public function importExpress()
{
[$file] = $this->request->getMore([
['file', '']
], true);
if (!$file) return app('json')->fail(400168);
$file = public_path() . substr($file, 1);
$expressData = app()->make(FileService::class)->readExcel($file, 'express', 2);
foreach ($expressData as $item) {
OrderExpressJob::dispatch([$item]);
}
return app('json')->success('批量发货成功');
}
}

View File

@ -19,6 +19,7 @@ use app\services\product\product\StoreProductServices;
use crmeb\services\FileService;
use app\services\other\UploadService;
use think\facade\App;
use think\Request;
/**
* Class StoreProduct
@ -40,7 +41,11 @@ class StoreProduct extends AuthController
*/
public function type_header()
{
$list = $this->service->getHeader();
$where = $this->request->getMore([
['store_name', ''],
['cate_id', ''],
]);
$list = $this->service->getHeader($where);
return app('json')->success(compact('list'));
}
@ -237,7 +242,8 @@ class StoreProduct extends AuthController
['is_copy', 0],//是否是复制商品
['is_limit', 0],//是否限购
['limit_type', 0],//限购类型
['limit_num', 0]//限购数量
['limit_num', 0],//限购数量
['min_qty', 1],//起购数量
]);
$this->service->save((int)$id, $data);
return app('json')->success(100000);
@ -339,10 +345,21 @@ class StoreProduct extends AuthController
* @return mixed
* @throws \Exception
*/
public function getTempKeys()
public function getTempKeys(Request $request)
{
$upload = UploadService::init();
$re = $upload->getTempKeys();
$type = (int)sys_config('upload_type', 1);
$key = $request->get('key', '');
$path = $request->get('path', '');
$contentType = $request->get('contentType', '');
if ($type === 5) {
if (!$key || !$contentType) {
return app('json')->fail('缺少参数');
}
$re = $upload->getTempKeys($key, $path, $contentType);
} else {
$re = $upload->getTempKeys();
}
return $re ? app('json')->success($re) : app('json')->fail(100016);
}
@ -373,7 +390,7 @@ class StoreProduct extends AuthController
$file = public_path() . substr($data['file'], 1);
/** @var FileService $readExcelService */
$readExcelService = app()->make(FileService::class);
$cardData = $readExcelService->readExcel($file);
$cardData = $readExcelService->readExcel($file, 'card');
return app('json')->success($cardData);
}

View File

@ -100,7 +100,8 @@ class StoreProductReply extends AuthController
['product_score', 0],
['service_score', 0],
['product_id', 0],
['add_time', 0]
['add_time', 0],
['suk', ''],
]);
if (!$data['product_id']) {
$data['product_id'] = $data['image']['product_id'] ?? '';

View File

@ -92,4 +92,4 @@ class LangType extends AuthController
CacheService::delete('lang_type_data');
return app('json')->success(100002);
}
}
}

View File

@ -169,9 +169,13 @@ class SystemAdmin extends AuthController
['new_pwd', ''],
['conf_pwd', ''],
]);
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
return app('json')->fail(400183);
if ($data['pwd']) {
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
return app('json')->fail(400183);
}
}
if ($this->services->updateAdmin($this->adminId, $data))
return app('json')->success(100001);
else

View File

@ -14,6 +14,7 @@ use app\adminapi\controller\AuthController;
use app\Request;
use app\services\system\config\SystemConfigServices;
use app\services\system\config\SystemConfigTabServices;
use crmeb\services\CacheService;
use crmeb\services\easywechat\orderShipping\MiniOrderService;
use think\facade\App;
@ -97,6 +98,7 @@ class SystemConfig extends AuthController
['sort', 0],
['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);
@ -124,7 +126,7 @@ class SystemConfig extends AuthController
} else {
$this->services->save($data);
}
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(400284);
}
@ -185,12 +187,13 @@ class SystemConfig extends AuthController
['sort', 0],
['status', 0]
]);
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);
}
$data['value'] = json_encode($data['value']);
$this->services->update($id, $data);
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100001);
}
@ -204,7 +207,7 @@ class SystemConfig extends AuthController
if (!$this->services->delete($id))
return app('json')->fail(100008);
else {
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100002);
}
}
@ -221,7 +224,7 @@ class SystemConfig extends AuthController
return app('json')->fail(100100);
}
$this->services->update($id, ['status' => $status]);
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100014);
}
@ -329,12 +332,33 @@ class SystemConfig extends AuthController
@copy($from, $toPublic);
}
if (isset($post['reward_integral']) || isset($post['reward_money'])) {
if ($post['reward_integral'] < 0 || $post['reward_money'] < 0) return app('json')->fail(400558);
if ($post['reward_money'] < 0) return app('json')->fail('赠送余额不能小于0元');
if ($post['reward_integral'] < 0) return app('json')->fail('赠送积分不能小于0');
}
if (isset($post['sign_give_point'])) {
if (!is_int($post['sign_give_point']) || $post['sign_give_point'] < 0) return app('json')->fail('签到赠送积分请填写大于等于0的整数');
}
if (isset($post['sign_give_exp'])) {
if (!is_int($post['sign_give_exp']) || $post['sign_give_exp'] < 0) return app('json')->fail('签到赠送经验请填写大于等于0的整数');
}
if (isset($post['integral_frozen'])) {
if (!ctype_digit($post['integral_frozen']) || $post['integral_frozen'] < 0) return app('json')->fail('积分冻结天数请填写大于等于0的整数');
}
if (isset($post['store_free_postage'])) {
if (!is_int($post['store_free_postage']) || $post['store_free_postage'] < 0) return app('json')->fail('满额包邮请填写大于等于0的整数');
}
if (isset($post['withdrawal_fee'])) {
if ($post['withdrawal_fee'] < 0 || $post['withdrawal_fee'] > 100) return app('json')->fail('提现手续费范围在0-100之间');
}
if (isset($post['routine_auth_type']) && count($post['routine_auth_type']) == 0) return app('json')->fail('微信和手机号登录开关至少开启一个');
if (isset($post['integral_max_num'])) {
if (!ctype_digit($post['integral_max_num']) || $post['integral_max_num'] < 0) return app('json')->fail('积分抵扣上限请填写大于等于0的整数');
}
if (isset($post['customer_phone'])) {
if (!ctype_digit($post['customer_phone']) || strlen($post['customer_phone']) > 11) return app('json')->fail('客服手机号为11位数字');
}
// if (isset($post['order_shipping_open']) && $post['order_shipping_open'] == 1 && isset($post['order_shipping_url'])) {
// MiniOrderService::setMesJumpPathAndCheck($post['order_shipping_url']);
// }
foreach ($post as $k => $v) {
$config_one = $this->services->getOne(['menu_name' => $k]);
if ($config_one) {
@ -343,7 +367,7 @@ class SystemConfig extends AuthController
$this->services->update($k, ['value' => json_encode($v)], 'menu_name');
}
}
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100001);
}
@ -366,6 +390,7 @@ class SystemConfig extends AuthController
$config_tab = [];
} else {
$config_tab = $services->getConfigTab($pid);
if (empty($config_tab)) $config_tab[] = $services->get($pid, ['id', 'id as value', 'title as label', 'pid', 'icon', 'type']);
}
return app('json')->success(compact('config_tab'));
}

View File

@ -75,6 +75,7 @@ class SystemConfigTab extends AuthController
['sort', 0],
['pid', 0],
]);
if (is_array($data['pid'])) $data['pid'] = end($data['pid']);
if (!$data['title']) return app('json')->fail(400291);
$this->services->save($data);
return app('json')->success(400292);
@ -119,6 +120,7 @@ class SystemConfigTab extends AuthController
['sort', 0],
['pid', 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);
$this->services->update($id, $data);

View File

@ -17,12 +17,14 @@ namespace app\adminapi\controller\v1\setting;
use app\adminapi\controller\AuthController;
use app\Request;
use app\services\system\log\SystemFileServices;
use app\services\system\SystemCrudDataService;
use app\services\system\SystemCrudServices;
use app\services\system\SystemMenusServices;
use crmeb\services\CacheService;
use crmeb\services\crud\enum\FormTypeEnum;
use crmeb\services\crud\Make;
use crmeb\services\crud\Service;
use crmeb\services\FileService;
use crmeb\utils\Terminal;
use think\facade\App;
use think\helper\Str;
use think\Response;
@ -49,7 +51,7 @@ class SystemCrud extends AuthController
}
/**
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
@ -60,12 +62,12 @@ class SystemCrud extends AuthController
}
/**
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
*/
public function save($id = 0)
public function save(SystemCrudDataService $service, $id = 0)
{
$data = $this->request->postMore([
['pid', 0],//上级菜单id
@ -80,30 +82,44 @@ class SystemCrud extends AuthController
['deleteField', []],//删除的表字段
]);
$fromField = $columnField = [];
$fromField = $searchField = $hasOneField = $columnField = $tableIndex = [];
$dictionaryids = array_column($data['tableField'], 'dictionary_id');
if ($dictionaryids) {
$dictionaryList = $service->getColumn([['id', 'in', $dictionaryids]], 'value', 'id');
foreach ($dictionaryList as &$value) {
$value = is_string($value) ? json_decode($value, true) : $value;
}
} else {
$dictionaryList = [];
}
foreach ($data['tableField'] as $item) {
//判断字段长度
if (in_array($item['field_type'], ['datetime', 'timestamp', 'time', 'date', 'year']) && $item['limit'] > 6) {
if (in_array($item['field_type'], [FormTypeEnum::DATE_TIME, 'timestamp', 'time', 'date', 'year']) && $item['limit'] > 6) {
return app('json')->fail('字段' . $item['field'] . '长度不能大于6');
}
if ($item['field_type'] == 'enum' && !is_array($item['limit'])) {
return app('json')->fail('数据类型为枚举时,长度为数组类型');
}
//收集列表展示数据
if ($item['is_table'] && !in_array($item['field_type'], ['primaryKey', 'addSoftDelete', 'addSoftDelete'])) {
if ($item['is_table'] && !in_array($item['field_type'], ['primaryKey', 'addSoftDelete'])) {
if (isset($item['primaryKey']) && !$item['primaryKey']) {
$columnField[] = [
'field' => $item['field'],
'name' => $item['table_name'],
'name' => $item['table_name'] ?: $item['comment'],
'type' => $item['from_type'],
];
}
}
$name = $item['table_name'] ?: $item['comment'];
$option = $item['options'] ?? (isset($item['dictionary_id']) ? ($dictionaryList[$item['dictionary_id']] ?? []) : []);
//收集表单展示数据
if ($item['from_type']) {
$name = $item['table_name'] ?: $item['comment'];
$option = $item['options'] ?? [];
if (!$name) {
return app('json')->fail(500048, [], ['field' => $item['field']]);
}
if (!$option && in_array($item['from_type'], ['radio', 'select'])) {
if (!$option && in_array($item['from_type'], [FormTypeEnum::RADIO, FormTypeEnum::SELECT])) {
return app('json')->fail('表单类型为radio或select时,options字段不能为空');
}
$fromField[] = [
@ -111,9 +127,34 @@ class SystemCrud extends AuthController
'type' => $item['from_type'],
'name' => $name,
'required' => $item['required'],
'option' => $option,
'option' => $option
];
}
//搜索
if (!empty($item['search'])) {
$searchField[] = [
'field' => $item['field'],
'type' => $item['from_type'],
'name' => $name,
'search' => $item['search'],
'options' => $option
];
}
//关联
if (!empty($item['hasOne'])) {
$hasOneField[] = [
'field' => $item['field'],
'hasOne' => $item['hasOne'] ?? '',
'name' => $name,
];
}
//索引
if (!empty($item['index'])) {
$tableIndex[] = $item['field'];
}
}
if (!$fromField) {
return app('json')->fail(500046);
@ -122,7 +163,10 @@ class SystemCrud extends AuthController
return app('json')->fail(500047);
}
$data['fromField'] = $fromField;
$data['tableIndex'] = $tableIndex;
$data['columnField'] = $columnField;
$data['searchField'] = $searchField;
$data['hasOneField'] = $hasOneField;
if (!$data['tableName']) {
return app('json')->fail(500042);
}
@ -134,7 +178,7 @@ class SystemCrud extends AuthController
/**
* 获取创建文件的目录存放位置
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
@ -194,7 +238,7 @@ class SystemCrud extends AuthController
/**
* @param $id
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/12
@ -233,10 +277,13 @@ class SystemCrud extends AuthController
$make = $this->services->makeFile($info->table_name, $routeName, false, [
'menuName' => $info->name,
'modelName' => $info->model_name,
'tableField' => $info->field['tableField'] ?? [],
'key' => $key,
'softDelete' => $softDelete,
'fromField' => $info->field['fromField'] ?? [],
'columnField' => $info->field['columnField'] ?? [],
'searchField' => $info->field['searchField'] ?? [],
'hasOneField' => $info->field['hasOneField'] ?? [],
]);
$data = [];
@ -284,9 +331,15 @@ class SystemCrud extends AuthController
$item['default_field_type'] = $item['field_type'];
$item['default_comment'] = $item['comment'];
$item['default_default'] = $item['default'];
$item['default_default_type'] = $item['default_type'] ?? '1';
$item['default_type'] = $item['default_type'] ?? '1';
$item['is_table'] = !!$item['is_table'];
$item['required'] = !!$item['required'];
$item['index'] = isset($item['index']) && !!$item['index'];
$item['primaryKey'] = isset($item['primaryKey']) ? (int)$item['primaryKey'] : 0;
if (!isset($item['dictionary_id'])) {
$item['dictionary_id'] = 0;
}
$info['field']['tableField'][$key] = $item;
}
//对比数据库,是否有新增字段
@ -412,7 +465,7 @@ class SystemCrud extends AuthController
/**
* 获取tree菜单
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
@ -423,9 +476,50 @@ class SystemCrud extends AuthController
->getList(['auth_type' => 1, 'is_show' => 1], ['auth_type', 'pid', 'id', 'menu_name as label', 'id as value']));
}
/**
* 获取可以进行关联的表名
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/8/2
*/
public function getAssociationTable()
{
return app('json')->success($this->services->getTableAll());
}
/**
* 获取表的详细信息
* @param string $tableName
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/8/2
*/
public function getAssociationTableInfo(string $tableName)
{
if (!$tableName) {
return app('json')->fail('缺少表名');
}
// if (in_array($tableName, SystemCrudServices::NOT_CRUD_TABANAME)) {
// return app('json')->fail('不允许查看当前表明细');
// }
$tableInfo = $this->services->getColumnNamesList($tableName);
$data = [];
foreach ($tableInfo as $key => $item) {
$data[] = [
'label' => $item['comment'] ?: $key,
'value' => $key,
'leaf' => true
];
}
return app('json')->success($data);
}
/**
* 获取创建表数据类型
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
@ -438,7 +532,7 @@ class SystemCrud extends AuthController
/**
* @param SystemMenusServices $services
* @param $id
* @return \think\Response
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/11
@ -511,11 +605,12 @@ class SystemCrud extends AuthController
unlink($zipName);
}
$makePath = $info->make_path ?? [];
foreach ($makePath as $key => $item) {
if (in_array($key, ['pages', 'router', 'api'])) {
$item = $zipPath . str_replace(dirname(app()->getRootPath()), '', Make::adminTemplatePath()) . $item;
} else {
$item = $zipPath . DS . $item;
$item = $zipPath . DS . 'crmeb' . DS . $item;
}
$makePath[$key] = $item;
}
@ -542,10 +637,13 @@ class SystemCrud extends AuthController
$this->services->makeFile($info->table_name, $routeName, true, [
'menuName' => $info->name,
'tableFields' => $info->field['tableField'] ?? [],
'key' => $key,
'softDelete' => $softDelete,
'fromField' => $info->field['fromField'] ?? [],
'columnField' => $info->field['columnField'] ?? [],
'searchField' => $info->field['searchField'] ?? [],
'hasOneField' => $info->field['hasOneField'] ?? [],
], $makePath, $zipPath);
if (!extension_loaded('zip')) {
@ -590,11 +688,19 @@ class SystemCrud extends AuthController
$newRoute['create'] = $item['api_url'];
} else if (strstr($item['api_url'], 'edit')) {
$newRoute['edit'] = $item['api_url'];
} else if (strstr($item['api_url'], 'status')) {
$newRoute['status'] = $item['api_url'];
} else {
$newRoute['index'] = $item['api_url'];
if (strstr($item['api_url'], '<id>')) {
$newRoute['read'] = $item['api_url'];
} else {
$newRoute['index'] = $item['api_url'];
}
}
} else if ($item['methods'] == 'DELETE') {
$newRoute['delete'] = $item['api_url'];
} else if ($item['methods'] == 'PUT' && strstr($item['api_url'], 'status')) {
$newRoute['status'] = $item['api_url'];
}
}
@ -614,62 +720,171 @@ class SystemCrud extends AuthController
'from_type' => '',
]
];
$readFields = [
'name' => $info->field['modelName'] ?: $info->field['menuName'],
'all' => [],
];
foreach ((array)$info->field['tableField'] as $item) {
if (isset($item['primaryKey']) && $item['primaryKey']) {
continue;
}
$prefix = app()->make(Service::class)->getAttrPrefix();
$readFields['all'][] = [
'field' => in_array($item['from_type'], [FormTypeEnum::FRAME_IMAGES,
FormTypeEnum::DATE_TIME_RANGE,
FormTypeEnum::RADIO,
FormTypeEnum::SELECT,
FormTypeEnum::CHECKBOX]) ? $item['field'] . $prefix : $item['field'],
'comment' => $item['comment'],
'from_type' => $item['from_type'],
];
if (isset($item['is_table']) && $item['is_table']) {
if (in_array($item['from_type'], ['frameImageOne', 'frameImages'])) {
$label = '';
if (in_array($item['from_type'], [FormTypeEnum::SWITCH, FormTypeEnum::DATE_TIME_RANGE, FormTypeEnum::FRAME_IMAGE_ONE, FormTypeEnum::FRAME_IMAGES])) {
$keyName = 'slot';
if ($item['from_type'] == FormTypeEnum::FRAME_IMAGES) {
$label = $prefix;
} else if ($item['from_type'] == FormTypeEnum::DATE_TIME_RANGE) {
$label = $prefix;
}
} elseif (in_array($item['from_type'], [FormTypeEnum::RADIO, FormTypeEnum::SELECT, FormTypeEnum::CHECKBOX])) {
$label = $prefix;
$keyName = 'key';
} else {
$keyName = 'key';
}
$columns[] = [
'title' => $item['table_name'] ?: $item['comment'],
$keyName => $item['field'],
$keyName => $item['field'] . $label,
'from_type' => $item['from_type'],
];
}
}
$searchField = $info->field['searchField'] ?? [];
$search = [];
foreach ((array)$searchField as $item) {
if (!$item['type']) {
$item['type'] = FormTypeEnum::INPUT;
}
if ($item['search'] == 'BETWEEN') {
$item['type'] = 'date-picker';
} else {
if (in_array($item['type'], [FormTypeEnum::CHECKBOX, FormTypeEnum::RADIO, FormTypeEnum::SELECT])) {
$item['type'] = FormTypeEnum::SELECT;
} else {
$item['type'] = FormTypeEnum::INPUT;
}
}
$search[] = [
'field' => $item['field'],
'type' => $item['type'],
'name' => $item['name'],
'option' => $item['options'] ?? [],
];
}
$route = $newRoute;
return app('json')->success(compact('key', 'route', 'columns'));
return app('json')->success(compact('key', 'route', 'columns', 'readFields', 'search'));
}
/**
* @return string
* 修改或者保存字典数据
* @param SystemCrudDataService $service
* @param int $id
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/4/14
* @date 2023/8/1
*/
public function npm()
public function saveDataDictionary(SystemCrudDataService $service, $id = 0)
{
$terminal = new Terminal();
$data = $this->request->postMore([
['name', ''],
['value', []],
]);
$adminPath = $terminal->adminTemplatePath();
$adminPath = dirname($adminPath);
try {
$dir = $adminPath . DS . 'node_modules';
if (!is_dir($dir)) {
// $terminal->run('npm-install');
}
// $res = $terminal->run('npm-build');
} catch (\Throwable $e) {
$terminal->echoOutputFlag($e->getMessage());
if (!$data['name']) {
return app('json')->fail('数据字段名不能为空');
}
if (!$data['value']) {
return app('json')->fail('数据字段内容不能为空');
}
$data['value'] = json_encode($data['value']);
if ($id) {
$service->update($id, $data);
} else {
$service->save($data);
}
if (!is_dir($adminPath . DS . 'dist')) {
echo Response::create([
'message' => '打包失败',
], 'json')->getContent();
return app('json')->success($id ? '修改成功' : '添加成功');
}
/**
* 查看数据字典
* @param SystemCrudDataService $service
* @param $id
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/8/7
*/
public function getDataDictionaryOne(SystemCrudDataService $service, $id)
{
if (!$id) {
return app('json')->fail('缺少参数');
}
$info = $service->get($id);
if (!$info) {
return app('json')->fail('没有查询到数据');
}
return app('json')->success($info->toArray());
}
/**
* 获取数据字典列表
* @param SystemCrudDataService $service
* @return Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 等风来
* @email 136327134@qq.com
* @date 2023/8/1
*/
public function getDataDictionary(SystemCrudDataService $service)
{
$name = $this->request->get('name', '');
$data = $service->getlistAll($name);
return app('json')->success($data);
}
/**
* 删除数据字典
* @param SystemCrudDataService $service
* @param $id
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/8/4
*/
public function deleteDataDictionary(SystemCrudDataService $service, $id)
{
if (!$id) {
return app('json')->fail('缺少参数');
}
if ($service->delete($id)) {
return app('json')->success('删除成功');
} else {
return app('json')->fail('删除失败');
}
$build = public_path() . config('app.admin_prefix');
// $this->app->make(FileService::class)->copyDir($adminPath . DS . 'dist', $build);
// echo $res;
}
}

View File

@ -109,6 +109,10 @@ class SystemGroupData extends AuthController
}
}
}
if ($group && $group['config_name'] == 'user_recharge_quota') {
if ($params['price'] <= 0) return app('json')->fail('售价必须大于0');
if ($params['give_money'] < 0) return app('json')->fail('赠送不能小于0');
}
$this->services->checkSeckillTime($services, $gid, $params);
$this->checkSign($services, $gid, $params);
$fields = json_decode($group['fields'], true) ?? [];
@ -175,6 +179,11 @@ class SystemGroupData extends AuthController
$groupData = $this->services->get($id);
$fields = $services->getValueFields((int)$groupData["gid"]);
$params = request()->post();
$group = $services->getOne(['id' => $params['gid']], 'id,config_name,fields');
if ($group && $group['config_name'] == 'user_recharge_quota') {
if ($params['price'] <= 0) return app('json')->fail('售价必须大于0');
if ($params['give_money'] < 0) return app('json')->fail('赠送不能小于0');
}
$this->services->checkSeckillTime($services, $groupData["gid"], $params, $id);
$this->checkSign($services, $groupData["gid"], $params);
$value = [];
@ -231,7 +240,6 @@ class SystemGroupData extends AuthController
}
/**
* 检查签到配置
* @param SystemGroupServices $services

View File

@ -111,7 +111,7 @@ class SystemMenus extends AuthController
['is_show', 0],
['is_show_path', 0],
]);
$data['is_show_path'] = $data['is_show'];
if (!$data['menu_name'])
return app('json')->fail(400198);
$data['path'] = implode('/', $data['path']);

View File

@ -81,12 +81,12 @@ class SystemRole extends AuthController
$data['rules'] = implode(',', $data['rules']);
if ($id) {
if (!$this->services->update($id, $data)) return app('json')->fail(100007);
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100001);
} else {
$data['level'] = $this->adminInfo['level'] + 1;
if (!$this->services->save($data)) return app('json')->fail(400223);
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(400222);
}
}
@ -124,7 +124,7 @@ class SystemRole extends AuthController
if (!$this->services->delete($id))
return app('json')->fail(100008);
else {
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100002);
}
}
@ -146,7 +146,7 @@ class SystemRole extends AuthController
}
$role->status = $status;
if ($role->save()) {
$this->services->cacheDriver()->clear();
CacheService::clear();
return app('json')->success(100001);
} else {
return app('json')->fail(100007);

View File

@ -16,6 +16,7 @@ namespace app\adminapi\controller\v1\setting;
use app\adminapi\controller\AuthController;
use app\services\system\SystemRouteServices;
use crmeb\services\CacheService;
use think\facade\App;
/**
@ -104,6 +105,8 @@ class SystemRoute extends AuthController
['method', ''],
['type', 0],
['app_name', ''],
['query', []],
['header', []],
['request', []],
['response', []],
['request_example', []],
@ -111,24 +114,25 @@ class SystemRoute extends AuthController
['describe', ''],
]);
if (!$data['name']) {
return app('json')->fail(500031);
}
if (!$data['path']) {
return app('json')->fail(500032);
}
if (!$data['method']) {
return app('json')->fail(500033);
}
if (!$data['app_name']) {
return app('json')->fail(500034);
}
// if (!$data['name']) {
// return app('json')->fail(500031);
// }
// if (!$data['path']) {
// return app('json')->fail(500032);
// }
// if (!$data['method']) {
// return app('json')->fail(500033);
// }
// if (!$data['app_name']) {
// return app('json')->fail(500034);
// }
if ($id) {
$this->services->update($id, $data);
} else {
$data['add_time'] = date('Y-m-d H:i:s');
$this->services->save($data);
}
CacheService::clear();
return app('json')->success($id ? 100001 : 100021);
}
@ -162,6 +166,4 @@ class SystemRoute extends AuthController
return app('json')->success(100002);
}
}

View File

@ -79,24 +79,17 @@ class SystemStorage extends AuthController
}
/**
* @param SystemConfigServices $services
* @return mixed
*/
public function saveConfig(SystemConfigServices $services)
public function saveConfig( )
{
$type = (int)$this->request->post('type', 0);
// $services->update('upload_type', ['value' => json_encode($type)], 'menu_name');
// if (1 === $type) {
// $this->services->transaction(function () {
// $this->services->update(['status' => 1, 'is_delete' => 0], ['status' => 0]);
// });
// }
// \crmeb\services\CacheService::clear();
$data = $this->request->postMore([
['accessKey', ''],
['secretKey', ''],
['appid', ''],
['storageRegion', ''],
]);
$this->services->saveConfig((int)$type, $data);
@ -166,7 +159,10 @@ class SystemStorage extends AuthController
//设置跨域规则
try {
$upload = UploadService::init($info->type);
$upload->setBucketCors($info->name, $info->region);
$res = $upload->setBucketCors($info->name, $info->region);
if (false === $res) {
return app('json')->fail($upload->getError());
}
} catch (\Throwable $e) {
}
@ -199,6 +195,7 @@ class SystemStorage extends AuthController
public function updateDomain($id)
{
$domain = $this->request->post('domain', '');
$cdn = $this->request->post('cdn', '');
$data = $this->request->postMore([
['pri', ''],
['ca', '']
@ -214,7 +211,7 @@ class SystemStorage extends AuthController
// return app('json')->fail('域名为HTTPS访问时必须填写证书');
// }
$this->services->updateDomain($id, $domain);
$this->services->updateDomain($id, $domain, ['cdn' => $cdn]);
return app('json')->success(100001);
}

View File

@ -115,7 +115,7 @@ class SystemFile extends AuthController
$comment = $this->request->param('comment');
$filepath = $this->request->param('filepath');
if (empty($filepath)) {
return app('json')->fail(410087);
return app('json')->fail('文件路径不存在');
}
$res = $this->services->savefile($filepath, $comment);
if ($res) {

View File

@ -43,7 +43,7 @@ class UserLabel extends AuthController
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index($label_cate = 0)
public function index($label_cate = '')
{
return app('json')->success($this->services->getList(['label_cate' => $label_cate]));
}

View File

@ -129,6 +129,18 @@ Route::group('app', function () {
Route::get('wechat/kefu/record/:id', 'v1.kefu.StoreService/chat_user')->option(['real_name' => '聊天记录']);
//查看对话
Route::get('wechat/kefu/chat_list', 'v1.kefu.StoreService/chat_list')->option(['real_name' => '查看对话']);
//客服自动回复列表
Route::get('kefu/auto_reply/list', 'v1.kefu.StoreServiceAutoReply/autoReplyList')->option(['real_name' => '客服自动回复列表']);
//客服自动回复添加修改表单
Route::get('kefu/auto_reply/form/:id', 'v1.kefu.StoreServiceAutoReply/autoReplyForm')->option(['real_name' => '客服自动回复添加修改表单']);
//客服自动回复添加修改保存
Route::post('kefu/auto_reply/save/:id', 'v1.kefu.StoreServiceAutoReply/autoReplySave')->option(['real_name' => '客服自动回复添加修改保存']);
//客服自动回复修改状态
Route::put('kefu/auto_reply/status/:id/:status', 'v1.kefu.StoreServiceAutoReply/autoReplyStatus')->option(['real_name' => '客服自动回复修改状态']);
//客服自动回复删除
Route::delete('kefu/auto_reply/del/:id', 'v1.kefu.StoreServiceAutoReply/autoReplyDel')->option(['real_name' => '客服自动回复删除']);
})->option(['parent' => 'app', 'cate_name' => '客服相关']);
})->middleware([

View File

@ -32,4 +32,4 @@ Route::group(function () {
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,
\app\adminapi\middleware\AdminCheckRoleMiddleware::class,
\app\adminapi\middleware\AdminLogMiddleware::class
])->option(['mark' => 'crud', 'mark_name' => '代码生成']);
])->option(['mark' => 'crud', 'mark_name' => '生成代码路由']);

View File

@ -18,6 +18,8 @@ Route::group('export', function () {
Route::get('user_list', 'v1.export.ExportExcel/userList')->option(['real_name' => '用户列表导出']);
//订单列表
Route::get('order_list', 'v1.export.ExportExcel/orderList')->option(['real_name' => '订单列表导出']);
//发货订单列表
Route::get('order_delivery_list', 'v1.export.ExportExcel/orderDeliveryList')->option(['real_name' => '发货订单列表导出']);
//商品列表
Route::get('product_list', 'v1.export.ExportExcel/productList')->option(['real_name' => '商品列表导出']);
//砍价列表

View File

@ -36,12 +36,21 @@ Route::group('file', function () {
'update' => '修改附件分类管理',
'delete' => '删除附件分类管理'
],
]);
//获取上传类型
Route::get('upload_type', 'v1.file.SystemAttachment/uploadType')->option(['real_name' => '上传类型']);
//分片上传本地视频
Route::post('video_upload', 'v1.file.SystemAttachment/videoUpload')->option(['real_name' => '分片上传本地视频']);
//获取扫码上传页面链接以及参数
Route::get('scan_upload/qrcode', 'v1.file.SystemAttachment/scanUploadQrcode')->option(['real_name' => '扫码上传页面链接']);
//删除扫码上传token
Route::delete('scan_upload/qrcode', 'v1.file.SystemAttachment/removeUploadQrcode')->option(['real_name' => '删除扫码上传页面链接']);
//获取扫码上传的图片数据
Route::get('scan_upload/image/:scan_token', 'v1.file.SystemAttachment/scanUploadImage')->option(['real_name' => '获取扫码上传的图片数据']);
//网络图片上传
Route::post('online_upload', 'v1.file.SystemAttachment/onlineUpload')->option(['real_name' => '网络图片上传']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -198,6 +198,20 @@ Route::group('marketing', function () {
Route::post('lottery/record/deliver', 'v1.marketing.lottery.LuckLotteryRecord/deliver')->option(['real_name' => '抽奖中奖发货、备注处理']);
})->option(['parent' => 'marketing', 'cate_name' => '抽奖活动']);
/** 每日签到 */
Route::group(function () {
//签到奖励列表
Route::get('sign/rewards', 'v1.marketing.SignRewards/index')->option(['real_name' => '签到奖励列表']);
//添加签到奖励
Route::get('sign/add_rewards', 'v1.marketing.SignRewards/addRewards')->option(['real_name' => '添加签到奖励']);
//编辑签到奖励
Route::get('sign/edit_rewards/:id', 'v1.marketing.SignRewards/editRewards')->option(['real_name' => '保存签到奖励']);
//保存签到奖励
Route::post('sign/save_rewards/:id', 'v1.marketing.SignRewards/saveRewards')->option(['real_name' => '保存签到奖励']);
//删除签到奖励
Route::delete('sign/del_rewards/:id', 'v1.marketing.SignRewards/delRewards')->option(['real_name' => '删除签到奖励']);
})->option(['parent' => 'marketing', 'cate_name' => '每日签到']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -34,8 +34,12 @@ Route::group('order', function () {
Route::put('update/:id', 'v1.order.StoreOrder/update')->name('StoreOrderUpdate')->option(['real_name' => '修改订单']);
//确认收货
Route::put('take/:id', 'v1.order.StoreOrder/take_delivery')->name('StoreOrderTakeDelivery')->option(['real_name' => '确认收货']);
//批量发货
Route::get('delivery/import_express', 'v1.order.StoreOrder/importExpress')->name('importExpress')->option(['real_name' => '批量发货']);
//发送货
Route::put('delivery/:id', 'v1.order.StoreOrder/update_delivery')->name('StoreOrderUpdateDelivery')->option(['real_name' => '订单发送货']);
//获取商家寄件金额
Route::post('price', 'v1.order.StoreOrder/getPrice')->name('getPrice')->option(['real_name' => '获取商家寄件金额']);
//获取订单可拆分商品列表
Route::get('split_cart_info/:id', 'v1.order.StoreOrder/split_cart_info')->name('StoreOrderSplitCartInfo')->option(['real_name' => '获取订单可拆分商品列表']);
//拆单发送货

View File

@ -52,7 +52,7 @@ Route::group('product', function () {
//修改商品状态
Route::put('product/set_show/:id/:is_show', 'v1.product.StoreProduct/set_show')->option(['real_name' => '修改商品状态']);
//商品快速编辑
Route::put('product/set_product/:id', 'v1.product.StoreProduct/set_product')->option(['real_name' => '商品快速编辑']);
// Route::put('product/set_product/:id', 'v1.product.StoreProduct/set_product')->option(['real_name' => '商品快速编辑']);
//设置批量商品上架
Route::put('product/product_show', 'v1.product.StoreProduct/product_show')->option(['real_name' => '设置批量商品上架']);
//设置批量商品下架

View File

@ -36,6 +36,12 @@ Route::group(function () {
Route::get('get_workerman_url', 'PublicController/getWorkerManUrl')->option(['real_name' => '获取客服数据']);
//测试
Route::get('index', 'Test/index')->option(['real_name' => '测试地址']);
//扫码上传图片
Route::post('image/scan_upload', 'PublicController/scanUpload')->option(['real_name' => '扫码上传图片']);
//路由导入
Route::get('route/import_api', 'PublicController/import')->option(['real_name' => '路由导入']);
})->middleware(AllowOriginMiddleware::class)->option(['mark' => 'login', 'mark_name' => '登录相关']);
/**

View File

@ -174,6 +174,18 @@ Route::group('system', function () {
Route::get('crud/menus', 'v1.setting.SystemCrud/getMenus')->option(['real_name' => '获取菜单TREE形数据']);
//获取CRUD文件存放
Route::post('crud/file_path', 'v1.setting.SystemCrud/getFilePath')->option(['real_name' => '获取CRUD文件存放']);
//获取数据字典列表
Route::get('crud/data_dictionary', 'v1.setting.SystemCrud/getDataDictionary')->option(['real_name' => '获取数据字典列表']);
//查看数据字典
Route::get('crud/data_dictionary/:id', 'v1.setting.SystemCrud/getDataDictionaryOne')->option(['real_name' => '查看数据字典']);
//修改或者保存字典数据
Route::post('crud/data_dictionary/[:id]', 'v1.setting.SystemCrud/saveDataDictionary')->option(['real_name' => '修改或者保存字典数据']);
//删除数据字典
Route::delete('crud/data_dictionary/:id', 'v1.setting.SystemCrud/deleteDataDictionary')->option(['real_name' => '删除数据字典']);
//获取可以进行关联的表名
Route::get('crud/association_table', 'v1.setting.SystemCrud/getAssociationTable')->option(['real_name' => '获取可以进行关联的表名']);
//获取表的详细信息
Route::get('crud/association_table/:tableName', 'v1.setting.SystemCrud/getAssociationTableInfo')->option(['real_name' => '获取表的详细信息']);
//删除CRUD
Route::delete('crud/:id', 'v1.setting.SystemCrud/delete')->option(['real_name' => '删除CRUD']);
//查看CRUD

View File

@ -38,7 +38,6 @@ class SystemConfigValidata extends Validate
'store_stock' => 'number',
'store_brokerage_price' => 'float',
'integral_ratio' => 'float|egt:0|elt:1000|regex:float_two',
'integral_max_num' => 'number|egt:0',
'order_give_integral' => 'float|egt:0|elt:1000',
'order_cancel_time' => 'float',
'order_activity_time' => 'float',
@ -52,7 +51,6 @@ class SystemConfigValidata extends Validate
'sign_rule_number' => 'number|gt:0',
'offline_rule_number' => 'number|gt:0',
'order_give_exp' => 'number|egt:0',
'sign_give_exp' => 'number|egt:0',
'invite_user_exp' => 'number|egt:0',
'config_export_to_name' => 'chs|length:2,10',
'config_export_to_tel' => 'mobile|number',
@ -100,8 +98,6 @@ class SystemConfigValidata extends Validate
'integral_ratio.regex' => '400055',
'integral_ratio.egt' => '400056',
'integral_ratio.elt' => '400056',
'integral_max_num.number' => '400057',
'integral_max_num.egt' => '400058',
'order_give_integral.float' => '400059',
'order_give_integral.egt' => '400060',
'order_give_integral.elt' => '400060',
@ -117,8 +113,6 @@ class SystemConfigValidata extends Validate
'offline_rule_number.number' => '400070',
'order_give_exp.number' => '400071',
'order_give_exp.egt' => '400072',
'sign_give_exp.number' => '400073',
'sign_give_exp.egt' => '400074',
'invite_user_exp.number' => '400075',
'invite_user_exp.egt' => '400076',
'config_export_to_name.chs' => '400077',

View File

@ -51,6 +51,8 @@ class PublicController
$data['site_keywords'] = sys_config('site_keywords');
$data['site_description'] = sys_config('site_description');
$data['network_security'] = sys_config('network_security');
$data['network_security_url'] = sys_config('network_security_url');
$data['icp_url'] = sys_config('icp_url');
$logoUrl = sys_config('pc_logo');
if (strstr($logoUrl, 'http') === false && $logoUrl) {
$logoUrl = sys_config('site_url') . $logoUrl;

View File

@ -14,8 +14,6 @@ namespace app\api\controller\v1;
use app\Request;
use app\services\message\notice\SmsService;
use app\services\wechat\WechatServices;
use think\facade\Cache;
use app\jobs\TaskJob;
use think\facade\Config;
use crmeb\services\CacheService;
use app\services\user\LoginServices;
@ -81,7 +79,7 @@ class LoginController
public function verifyCode()
{
$unique = password_hash(uniqid(true), PASSWORD_BCRYPT);
Cache::set('sms.key.' . $unique, 0, 300);
CacheService::set('sms.key.' . $unique, 0, 300);
$time = sys_config('verify_expire_time', 1);
return app('json')->success(['key' => $unique, 'expire_time' => $time]);
}
@ -98,7 +96,7 @@ class LoginController
$key = app('session')->get('captcha.key');
$uni = $request->get('key');
if ($uni) {
Cache::set('sms.key.cap.' . $uni, $key, 300);
CacheService::set('sms.key.cap.' . $uni, $key, 300);
}
return $rep;
}
@ -113,14 +111,14 @@ class LoginController
protected function checkCaptcha($uni, string $code): bool
{
$cacheName = 'sms.key.cap.' . $uni;
if (!Cache::has($cacheName)) {
if (!CacheService::has($cacheName)) {
return false;
}
$key = Cache::get($cacheName);
$key = CacheService::get($cacheName);
$code = mb_strtolower($code, 'UTF-8');
$res = password_verify($code, $key);
if ($res) {
Cache::delete($cacheName);
CacheService::delete($cacheName);
}
return $res;
}
@ -144,13 +142,13 @@ class LoginController
$keyName = 'sms.key.' . $key;
$nowKey = 'sms.' . date('YmdHi');
if (!Cache::has($keyName)) {
if (!CacheService::has($keyName)) {
return app('json')->fail(410003);
}
$total = 1;
if (Cache::has($nowKey)) {
$total = Cache::get($nowKey);
if (CacheService::has($nowKey)) {
$total = CacheService::get($nowKey);
if ($total > Config::get('sms.maxMinuteCount', 20))
return app('json')->success(410006);
}
@ -171,7 +169,7 @@ class LoginController
$smsCode = $this->services->verify($services, $phone, $type, $time, app()->request->ip());
if ($smsCode) {
CacheService::set('code_' . $phone, $smsCode, $time * 60);
Cache::set($nowKey, $total, 61);
CacheService::set($nowKey, $total, 61);
return app('json')->success(410007);
} else {
return app('json')->fail(410008);

View File

@ -37,7 +37,6 @@ use app\Request;
use crmeb\services\CacheService;
use app\services\other\UploadService;
use crmeb\services\workerman\ChannelService;
use think\facade\Cache;
/**
* 公共类
@ -117,6 +116,9 @@ class PublicController
public function getSiteConfig()
{
$data['record_No'] = sys_config('record_No');
$data['icp_url'] = sys_config('icp_url');
$data['network_security'] = sys_config('network_security');
$data['network_security_url'] = sys_config('network_security_url');
return app('json')->success($data);
}
@ -217,8 +219,8 @@ class PublicController
/**
* 图片上传
* @param Request $request
* @param SystemAttachmentServices $services
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function upload_image(Request $request, SystemAttachmentServices $services)
{
@ -226,7 +228,7 @@ class PublicController
['filename', 'file'],
]);
if (!$data['filename']) return app('json')->fail(100100);
if (Cache::has('start_uploads_' . $request->uid()) && Cache::get('start_uploads_' . $request->uid()) >= 100) return app('json')->fail(100101);
if (CacheService::has('start_uploads_' . $request->uid()) && CacheService::get('start_uploads_' . $request->uid()) >= 100) return app('json')->fail(100101);
$upload = UploadService::init();
$info = $upload->to('store/comment')->validate()->move($data['filename']);
if ($info === false) {
@ -234,12 +236,12 @@ class PublicController
}
$res = $upload->getUploadInfo();
$services->attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, (int)sys_config('upload_type', 1), $res['time'], 3);
if (Cache::has('start_uploads_' . $request->uid()))
$start_uploads = (int)Cache::get('start_uploads_' . $request->uid());
if (CacheService::has('start_uploads_' . $request->uid()))
$start_uploads = (int)CacheService::get('start_uploads_' . $request->uid());
else
$start_uploads = 0;
$start_uploads++;
Cache::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
CacheService::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
$res['dir'] = path_to_url($res['dir']);
if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
return app('json')->success(100009, ['name' => $res['name'], 'url' => $res['dir']]);
@ -643,7 +645,8 @@ class PublicController
*/
public function getVersion()
{
return app('json')->success(['version' => get_crmeb_version()]);
$version = parse_ini_file(app()->getRootPath() . '.version');
return app('json')->success(['version' => $version['version'], 'version_code' => $version['version_code']]);
}
/**
@ -685,6 +688,9 @@ class PublicController
$data['yue_pay_status'] = sys_config('yue_pay_status') == 1 && sys_config('balance_func_status') != 0;//余额是否启用
$data['offline_pay_status'] = sys_config('offline_pay_status') == 1;//线下是否启用
$data['friend_pay_status'] = sys_config('friend_pay_status') == 1;//好友是否启用
$data['wechat_auth_switch'] = (int)in_array(1, sys_config('routine_auth_type'));//微信登录开关
$data['phone_auth_switch'] = (int)in_array(2, sys_config('routine_auth_type'));//手机号登录开关
$data['wechat_status'] = sys_config('wechat_appid') != '' && sys_config('wechat_appsecret') != '';//公众号是否配置
return app('json')->success($data);
}
}

View File

@ -46,6 +46,84 @@ class StoreOrderController
$this->service = $services;
}
/**
* 订单 查看物流
* @param StoreOrderCartInfoServices $services
* @param ExpressServices $expressServices
* @param $uni
* @param string $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function express(StoreOrderServices $orderServices, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '')
{
if ($type == 'refund') {
/** @var StoreOrderRefundServices $refundService */
$refundService = app()->make(StoreOrderRefundServices::class);
$order = $refundService->refundDetail($uni);
$express = $order['refund_express'];
$cacheName = $uni . $express;
$orderInfo = [];
$info = [];
$cartNew = [];
foreach ($order['cart_info'] as $k => $cart) {
$cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
array_push($info, $cartNew);
unset($cart);
}
$orderInfo['cartInfo'] = $info;
$orderInfo['delivery_id'] = $express;
$orderInfo['delivery_name'] = $order['refund_express_name'];
$orderInfo['delivery_code'] = '';
} else {
if (!$uni || !($order = $orderServices->getUserOrderDetail($uni, 0, []))) {
return app('json')->fail(410173);
}
if ($type != 'refund' && ($order['delivery_type'] != 'express' || !$order['delivery_id'])) {
return app('json')->fail(410206);
}
$express = $type == 'refund' ? $order['refund_express'] : $order['delivery_id'];
$cacheName = $uni . $express;
$orderInfo = [];
$cartInfo = $services->getCartColunm(['oid' => $order['id']], 'cart_info', 'unique');
$info = [];
$cartNew = [];
foreach ($cartInfo as $k => $cart) {
$cart = json_decode($cart, true);
$cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
array_push($info, $cartNew);
unset($cart);
}
$orderInfo['delivery_id'] = $express;
$orderInfo['delivery_name'] = $type == 'refund' ? '用户退回' : $order['delivery_name'];;
$orderInfo['delivery_code'] = $type == 'refund' ? '' : $order['delivery_code'];
$orderInfo['delivery_type'] = $order['delivery_type'];
$orderInfo['user_address'] = $order['user_address'];
$orderInfo['user_mark'] = $order['mark'];
$orderInfo['cartInfo'] = $info;
}
return app('json')->success([
'order' => $orderInfo,
'express' => [
'result' => ['list' => $expressServices->query($cacheName, $orderInfo['delivery_id'], $orderInfo['delivery_code'], $order['user_phone'])
]
]
]);
}
/**
* 订单数据统计
* @param StoreOrderServices $services
@ -163,7 +241,8 @@ class StoreOrderController
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
['fictitious_content', ''],//虚拟发货内容
['pickup_time', []]
]);
if ($data['delivery_type']) {
$data['delivery_name'] = $data['delivery_type'];

View File

@ -18,8 +18,6 @@ use app\services\pay\PayServices;
use app\services\pay\YuePayServices;
use app\services\user\member\MemberCardServices;
use app\services\user\UserServices;
use crmeb\services\CacheService;
use crmeb\services\pay\extend\allinpay\AllinPay;
use app\Request;
/**

View File

@ -9,7 +9,6 @@ use app\services\activity\integral\StoreIntegralOrderServices;
use app\services\activity\integral\StoreIntegralServices;
use app\services\product\sku\StoreProductAttrValueServices;
use app\services\shipping\ExpressServices;
use crmeb\services\CacheService;
class StoreIntegralOrderController
{

View File

@ -14,26 +14,19 @@ use app\Request;
use app\services\pay\PayServices;
use app\services\shipping\ExpressServices;
use app\services\system\admin\SystemAdminServices;
use app\services\user\UserInvoiceServices;
use crmeb\exceptions\ApiException;
use crmeb\exceptions\ApiStatusException;
use crmeb\services\pay\extend\allinpay\AllinPay;
use app\services\activity\{lottery\LuckLotteryServices,
bargain\StoreBargainServices,
combination\StoreCombinationServices,
combination\StorePinkServices,
seckill\StoreSeckillServices
combination\StorePinkServices
};
use app\services\activity\coupon\StoreCouponIssueServices;
use app\services\order\{OtherOrderServices,
use app\services\order\{
StoreCartServices,
StoreOrderCartInfoServices,
StoreOrderComputedServices,
StoreOrderCreateServices,
StoreOrderEconomizeServices,
StoreOrderInvoiceServices,
StoreOrderRefundServices,
StoreOrderServices,
StoreOrderStatusServices,
StoreOrderSuccessServices,
StoreOrderTakeServices
};
@ -42,7 +35,12 @@ use app\services\pay\YuePayServices;
use app\services\product\product\StoreProductReplyServices;
use app\services\shipping\ShippingTemplatesServices;
use crmeb\services\CacheService;
use think\facade\Cache;
use Psr\SimpleCache\InvalidArgumentException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Log;
use think\Response;
/**
* 订单控制器
@ -61,9 +59,9 @@ class StoreOrderController
* @var int[]
*/
protected $getChennel = [
'weixin' => 0,
'wechat' => 0,
'routine' => 1,
'weixinh5' => 2,
'h5' => 2,
'pc' => 3,
'app' => 4
];
@ -81,7 +79,7 @@ class StoreOrderController
* 获取确认订单页面是否展示快递配送和到店自提
* @param Request $request
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function checkShipping(Request $request)
{
@ -94,10 +92,10 @@ class StoreOrderController
* @param Request $request
* @param ShippingTemplatesServices $services
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function confirm(Request $request, ShippingTemplatesServices $services)
{
@ -152,21 +150,14 @@ class StoreOrderController
/**
* 订单创建
* @param Request $request
* @param StoreBargainServices $bargainServices
* @param StorePinkServices $pinkServices
* @param StoreOrderCreateServices $createServices
* @param StoreSeckillServices $seckillServices
* @param UserInvoiceServices $userInvoiceServices
* @param StoreOrderInvoiceServices $storeOrderInvoiceServices
* @param StoreCombinationServices $combinationServices
* @param $key
* @return \think\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function create(Request $request, StoreBargainServices $bargainServices, StorePinkServices $pinkServices, StoreOrderCreateServices $createServices, StoreSeckillServices $seckillServices, UserInvoiceServices $userInvoiceServices, StoreOrderInvoiceServices $storeOrderInvoiceServices, StoreCombinationServices $combinationServices, $key)
public function create(Request $request, StoreOrderCreateServices $createServices, $key)
{
if (!$key) return app('json')->fail(100100);
$userInfo = $request->user()->toArray();
@ -218,10 +209,10 @@ class StoreOrderController
* @param Request $request
* @param $orderId
* @param string $type
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author 等风来
* @email 136327134@qq.com
* @date 2023/2/13
@ -241,7 +232,6 @@ class StoreOrderController
* @param OrderPayServices $payServices
* @param YuePayServices $yuePayServices
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function pay(Request $request, StorePinkServices $services, OrderPayServices $payServices, YuePayServices $yuePayServices)
{
@ -255,10 +245,11 @@ class StoreOrderController
$orderInfo = $this->services->get(['order_id' => $uni]);
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
$orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
$orderInfo->order_id = $uid != $orderInfo->pay_uid ? app()->make(StoreOrderCreateServices::class)->getNewOrderId('cp') : $uni;
$orderInfo->pay_uid = $uid;
$orderInfo->save();
$orderInfo = $orderInfo->toArray();
$order = $this->services->get(['order_id' => $uni]);
$order = $this->services->get(['order_id' => $orderInfo['order_id']]);
if (!$order)
return app('json')->fail(410173);
if ($order['paid'])
@ -307,9 +298,9 @@ class StoreOrderController
* 订单列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function lst(Request $request)
{
@ -336,9 +327,9 @@ class StoreOrderController
* @param StoreOrderEconomizeServices $services
* @param $uni
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function detail(Request $request, StoreOrderEconomizeServices $services, $uni)
{
@ -351,9 +342,9 @@ class StoreOrderController
* 代付订单详情
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function friendDetail(Request $request)
{
@ -416,7 +407,7 @@ class StoreOrderController
* 订单删除
* @param Request $request
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function del(Request $request)
{
@ -461,9 +452,9 @@ class StoreOrderController
* @param $uni
* @param string $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function express(Request $request, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '')
{
@ -499,7 +490,7 @@ class StoreOrderController
$cartInfo = $services->getCartColunm(['oid' => $order['id']], 'cart_info', 'unique');
$info = [];
$cartNew = [];
foreach ($cartInfo as $k => $cart) {
foreach ($cartInfo as $cart) {
$cart = json_decode($cart, true);
$cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice'];
@ -532,8 +523,8 @@ class StoreOrderController
* @param Request $request
* @param StoreOrderCartInfoServices $cartInfoServices
* @param StoreProductReplyServices $replyServices
* @return \think\Response|void
* @throws \Psr\SimpleCache\InvalidArgumentException
* @return Response|void
* @throws InvalidArgumentException
*/
public function comment(Request $request, StoreOrderCartInfoServices $cartInfoServices, StoreProductReplyServices $replyServices)
{
@ -660,9 +651,9 @@ class StoreOrderController
* 获取退货商品列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function refundCartInfoList(Request $request)
{
@ -683,10 +674,10 @@ class StoreOrderController
* @param StoreOrderServices $storeOrderServices
* @param $id
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function applyRefund(Request $request, StoreOrderRefundServices $services, StoreOrderServices $storeOrderServices, $id)
{
@ -715,6 +706,7 @@ class StoreOrderController
if (!$order || $uid != $order['uid']) {
return app('json')->fail(410173);
}
if ($order['pid'] == -1) return app('json')->fail('主订单已拆单,请刷新页面');
$refundData = [
'refund_reason' => $data['text'],
'refund_explain' => $data['refund_reason_wap_explain'],
@ -751,9 +743,9 @@ class StoreOrderController
* 订单取消 未支付的订单回退积分,回退优惠券,回退库存
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function cancel(Request $request)
{
@ -793,4 +785,111 @@ class StoreOrderController
$cartProduct['order_id'] = $this->services->value(['id' => $cartInfo['oid']], 'order_id');
return app('json')->success($cartProduct);
}
/**
* 商家寄件回调
* @param Request $request
* @return Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/12
*/
public function callBack(Request $request)
{
$data = $request->postMore([
['type', ''],
['data', ''],
]);
$data['data'] = $this->decrypt($data['data'], sys_config('sms_token'));
switch ($data['type']) {
case 'order_success'://下单成功
$update = [
'label' => $data['data']['label'] ?? '',
];
//韵达会异步推送单号
if (isset($data['kuaidinum'])) {
$update['delivery_id'] = $data['kuaidinum'];
}
if (isset($data['task_id'])) {
$this->services->update(['task_id' => $data['task_id']], $update);
}
break;
case 'order_take'://取件
if (isset($data['data']['task_id'])) {
$orderInfo = $this->services->get(['kuaidi_task_id' => $data['data']['task_id']]);
if (!$orderInfo) {
return app('json')->fail('订单不存在');
}
$this->services->transaction(function () use ($data, $orderInfo) {
$this->services->update(['kuaidi_task_id' => $data['data']['task_id']], [
'status' => 1,
'is_stock_up' => 0
]);
/** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class);
$services->save([
'oid' => $orderInfo->id,
'change_time' => time(),
'change_type' => 'delivery_goods',
'change_message' => '已发货 快递公司:' . $orderInfo->delivery_name . ' 快递单号:' . $orderInfo->delivery_id
]);
});
}
break;
case 'order_cancel'://取消寄件
if (isset($data['data']['task_id'])) {
$orderInfo = $this->services->get(['kuaidi_task_id' => $data['data']['task_id']]);
if (!$orderInfo) {
return app('json')->fail('订单不存在');
}
if ($orderInfo->is_stock_up && $orderInfo->status == 0) {
app()->make(StoreOrderStatusServices::class)->save([
'oid' => $orderInfo->id,
'change_time' => time(),
'change_type' => 'delivery_goods_cancel',
'change_message' => '已取消发货,取消原因:用户手动取消'
]);
$orderInfo->status = 0;
$orderInfo->is_stock_up = 0;
$orderInfo->kuaidi_task_id = '';
$orderInfo->kuaidi_order_id = '';
$orderInfo->express_dump = '';
$orderInfo->kuaidi_label = '';
$orderInfo->delivery_id = '';
$orderInfo->delivery_code = '';
$orderInfo->delivery_name = '';
$orderInfo->delivery_type = '';
$orderInfo->save();
} else {
Log::error('商家寄件自动回调,订单状态不正确:', [
'kuaidi_task_id' => $data['data']['task_id']
]);
}
}
break;
}
return app('json')->success();
}
/**
* 解密商家寄件回调
* @param string $encryptedData
* @param string $key
* @return false|string
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
function decrypt(string $encryptedData, string $key)
{
$key = substr($key, 0, 32);
$decodedData = base64_decode($encryptedData);
$iv = substr($decodedData, 0, 16);
$encrypted = substr($decodedData, 16);
$decrypted = openssl_decrypt($encrypted, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
return $decrypted;
}
}

View File

@ -5,6 +5,9 @@ namespace app\api\controller\v1\order;
use app\Request;
use app\services\order\StoreOrderRefundServices;
use app\services\order\StoreOrderServices;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
class StoreOrderRefundController
{
@ -56,9 +59,9 @@ class StoreOrderRefundController
* @param Request $request
* @param $uni
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function cancelApply(Request $request, $uni)
{

View File

@ -10,7 +10,6 @@
// +----------------------------------------------------------------------
namespace app\api\controller\v1\publics;
use app\Request;
use app\services\article\ArticleServices;
/**

View File

@ -15,6 +15,9 @@ use app\services\product\product\StoreCategoryServices;
use app\services\product\product\StoreProductReplyServices;
use app\services\product\product\StoreProductServices;
use app\services\user\UserServices;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* 商品类
@ -39,9 +42,9 @@ class StoreProductController
* @param Request $request
* @param StoreCategoryServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function lst(Request $request, StoreCategoryServices $services)
{
@ -99,9 +102,9 @@ class StoreProductController
* @param $id
* @param int $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function detail(Request $request, $id, $type = 0)
{
@ -113,9 +116,9 @@ class StoreProductController
* 为你推荐
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function product_hot(Request $request)
{
@ -129,9 +132,9 @@ class StoreProductController
* @param Request $request
* @param $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function groom_list(Request $request, $type)
{
@ -173,9 +176,9 @@ class StoreProductController
* @param Request $request
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function reply_list(Request $request, $id)
{

View File

@ -9,6 +9,9 @@ use app\services\agent\DivisionAgentApplyServices;
use app\services\other\AgreementServices;
use app\services\user\UserServices;
use crmeb\services\CacheService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
class DivisionController
{
@ -51,9 +54,9 @@ class DivisionController
* 申请详情
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function applyInfo(Request $request)
{
@ -66,9 +69,9 @@ class DivisionController
* 移动端获取规则
* @param AgreementServices $agreementServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getAgentAgreement(AgreementServices $agreementServices)
{
@ -80,9 +83,9 @@ class DivisionController
* 员工列表
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getStaffList(Request $request)
{

View File

@ -16,6 +16,9 @@ use app\services\activity\coupon\StoreCouponUserServices;
use app\services\order\OtherOrderServices;
use app\services\other\AgreementServices;
use app\services\user\member\MemberCardServices;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/** 会员卡
* Class MemberCardController
@ -40,9 +43,9 @@ class MemberCardController
* 会员卡主页数据接口
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index(Request $request)
{
@ -91,9 +94,9 @@ class MemberCardController
* 会员券接口
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function memberCouponList(Request $request)
{

View File

@ -11,8 +11,6 @@
namespace app\api\controller\v1\user;
use app\Request;
use app\services\user\member\MemberCardServices;
use app\services\user\UserServices;
use app\services\user\UserSignServices;
/**
@ -35,31 +33,15 @@ class UserSignController
/**
* 签到 配置
* @param Request $request
* @param UserServices $userServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function sign_config(Request $request, UserServices $userServices)
public function sign_config(Request $request)
{
$signConfig = sys_data('sign_day_num') ?? [];
// $uid = (int)$request->uid();
// $user = $userServices->getUserInfo($uid);
// //是否是付费会员
// if ($user['is_money_level'] > 0) {
// //看是否开启签到积分翻倍奖励
// /** @var MemberCardServices $memberCardService */
// $memberCardService = app()->make(MemberCardServices::class);
// $sign_rule_number = $memberCardService->isOpenMemberCard('sign');
// if ($sign_rule_number) {
// foreach ($signConfig as &$value) {
// $value['sign_num'] = (int)$sign_rule_number * $value['sign_num'];
// }
// }
// }
return app('json')->success($signConfig);
$uid = (int)$request->uid();
return app('json')->success($this->services->signConfig($uid));
}
/**
@ -125,4 +107,20 @@ class UserSignController
return app('json')->success($this->services->getSignMonthList($uid));
}
/**
* 用户设置签到提醒
* @param Request $request
* @param $status
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/9
*/
public function sign_remind(Request $request, $status)
{
$uid = (int)$request->uid();
$this->services->setSignRemind($uid, $status);
return app('json')->success(100014);
}
}

View File

@ -42,6 +42,7 @@ class WechatController
{
return $this->services->serve();
}
/**
* 微信小程序公众号服务
* @return \think\Response
@ -74,28 +75,6 @@ class WechatController
return app('json')->success($this->services->config($request->get('url')));
}
/**
* 公众号授权登陆
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function auth(Request $request)
{
[$spreadId, $login_type] = $request->getMore([
[['spread', 'd'], 0],
['login_type', ''],
], true);
$token = $this->services->auth($spreadId, $login_type);
if ($token && isset($token['key'])) {
return app('json')->success(410022, $token);
} else if ($token) {
return app('json')->success(410001, ['userInfo' => $token['userInfo']]);
} else
return app('json')->fail(410019);
}
/**
* App微信登陆
* @param Request $request

View File

@ -66,7 +66,7 @@ class StoreCartController
{
list($product_id, $num, $unique, $type) = $request->postMore([
['product_id', 0],
['num', 0],
['num', 1],
['unique', ''],
['type', -1]
], true);

View File

@ -35,24 +35,37 @@ class AuthController
}
/**
* 静默授权
* 返回用户信息的缓存key返回是否强制绑定手机号
* @param $code
* @param string $spread_code
* @param string $spread_spid
* @return mixed
* @return \think\Response
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/12
*/
public function authType($code, $spread_code = '', $spread_spid = '')
{
$data = $this->services->authType($code, $spread_code, $spread_spid);
return app('json')->success($data);
}
/**
* 根据缓存获取token
* @param $key
* @return \think\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/12
*/
public function silenceAuth($code, $spread_code = '', $spread_spid = '')
public function authLogin($key)
{
$token = $this->services->silenceAuth($code, $spread_code, $spread_spid);
if ($token && isset($token['key'])) {
return app('json')->success(410022, $token);
} else if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'expires_time' => $token['params']['exp'], 'new_user' => $token['new_user']]);
} else
return app('json')->fail(410019);
$data = $this->services->authLogin($key);
return app('json')->success($data);
}
/**
@ -72,13 +85,46 @@ class AuthController
{
if (!$code || !$iv || !$encryptedData)
return app('json')->fail(100100);
$token = $this->services->authBindingPhone($code, $iv, $encryptedData, $spread_code, $spread_spid, $key);
if ($token) {
return app('json')->success(410001, $token);
$data = $this->services->authBindingPhone($code, $iv, $encryptedData, $spread_code, $spread_spid, $key);
if ($data) {
return app('json')->success(410001, $data);
} else
return app('json')->fail(410019);
}
/**
* 小程序手机号登录
* @param string $key
* @param string $phone
* @param string $captcha
* @param string $spread_code
* @param string $spread_spid
* @param string $code
* @return \think\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/12
*/
public function phoneLogin($key = '', $phone = '', $captcha = '', $spread_code = '', $spread_spid = '', $code = '')
{
//验证验证码
$verifyCode = CacheService::get('code_' . $phone);
if (!$verifyCode)
return app('json')->fail(410009);
$verifyCode = substr($verifyCode, 0, 6);
if ($verifyCode != $captcha) {
CacheService::delete('code_' . $phone);
return app('json')->fail(410010);
}
CacheService::delete('code_' . $phone);
$data = $this->services->phoneLogin($key, $phone, $spread_code, $spread_spid, $code);
return app('json')->success($data);
}
/**
* 小程序绑定手机号
* @param string $code
@ -95,103 +141,4 @@ class AuthController
$this->services->bindingPhone($code, $iv, $encryptedData);
return app('json')->success(410016);
}
/** 以下方法该版本暂未使用 */
/**
* 小程序授权登录
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function auth(Request $request)
{
[$code, $spid, $spread, $iv, $encryptedData] = $request->postMore([
['code', ''],
['spread_spid', 0],
['spread_code', ''],
['iv', ''],
['encryptedData', ''],
], true);
$token = $this->services->newAuth($code, $spid, $spread, $iv, $encryptedData);
if ($token) {
if (isset($token['key']) && $token['key']) {
return app('json')->success(410022, $token);
} else {
return app('json')->success(410001, ['token' => $token['token'], 'userInfo' => $token['userInfo'], 'expires_time' => $token['params']['exp']]);
}
} else
return app('json')->fail(410019);
}
/**
* 静默授权 不登录
* @param $code
* @param string $spread_code
* @param string $spread_spid
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function silenceAuthNoLogin($code, $spread_code = '', $spread_spid = '')
{
$token = $this->services->silenceAuthNoLogin($code, $spread_code, $spread_spid);
if ($token && isset($token['auth_login'])) {
return app('json')->success(410023);
} else if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'userInfo' => $token['userInfo'], 'expires_time' => $token['params']['exp']]);
} else
return app('json')->fail(410019);
}
/**
* 静默授权
* @param string $code
* @param string $spread_code
* @param string $spread_spid
* @param string $phone
* @param string $captcha
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function silenceAuthBindingPhone($code = '', $spread_code = '', $spread_spid = '', $phone = '', $captcha = '')
{
//验证验证码
$verifyCode = CacheService::get('code_' . $phone);
if (!$verifyCode)
return app('json')->fail(410009);
$verifyCode = substr($verifyCode, 0, 6);
if ($verifyCode != $captcha) {
CacheService::delete('code_' . $phone);
return app('json')->fail(410010);
}
CacheService::delete('code_' . $phone);
$token = $this->services->silenceAuthBindingPhone($code, $spread_code, $spread_spid, $phone);
if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'expires_time' => $token['params']['exp'], 'new_user' => $token['new_user']]);
} else
return app('json')->fail(410019);
}
/**
* 更新用户信息
* @param Request $request
* @param $userInfo
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function updateInfo(Request $request, $userInfo)
{
if (!$userInfo) {
return app('json')->fail(100100);
}
$uid = (int)$request->uid();
$re = $this->services->updateUserInfo($uid, $userInfo);
if ($re) {
return app('json')->success(100012);
} else
return app('json')->fail(100013);
}
}

View File

@ -32,75 +32,38 @@ class WechatController
}
/**
* 公众号授权登陆
* @param Request $request
* @return mixed
* 公众号授权登录返回token
* @param $spread
* @return \think\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/12
*/
public function auth(Request $request)
public function authLogin($spread = '')
{
[$spreadId, $login_type] = $request->getMore([
[['spread', 'd'], 0],
['login_type', 'wechat'],
], true);
$token = $this->services->newAuth($spreadId, $login_type);
if ($token && isset($token['key'])) {
return app('json')->success(410022, $token);
} else if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'userInfo' => $token['userInfo'], 'expires_time' => $token['params']['exp']]);
} else
return app('json')->fail(410019);
$data = $this->services->authLogin($spread);
return app('json')->success($data);
}
/**
* 微信公众号静默授权
* @param string $spread
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function silenceAuth($spread = '')
{
$token = $this->services->silenceAuth($spread);
if ($token && isset($token['key'])) {
return app('json')->success(410022, $token);
} else if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'expires_time' => $token['params']['exp']]);
} else
return app('json')->fail(410019);
}
/**
* 微信公众号静默授权
* @param string $spread
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function silenceAuthNoLogin($spread = '')
{
$token = $this->services->silenceAuthNoLogin($spread);
if ($token && isset($token['auth_login'])) {
return app('json')->success(410023, $token);
} else if ($token) {
return app('json')->success(410001, ['token' => $token['token'], 'userInfo' => $token['userInfo'], 'expires_time' => $token['params']['exp']]);
} else
return app('json')->fail(410019);
}
/**
* 静默授权 手机号直接注册登录
* 公众号授权绑定手机号
* @param string $key
* @param string $phone
* @param string $captcha
* @return mixed
* @return \think\Response
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/12
*/
public function silenceAuthBindingPhone($key = '', $phone = '', $captcha = '')
public function authBindingPhone($key = '', $phone = '', $captcha = '')
{
//验证验证码
$verifyCode = CacheService::get('code_' . $phone);
@ -112,10 +75,7 @@ class WechatController
return app('json')->fail(410010);
}
CacheService::delete('code_' . $phone);
$token = $this->services->silenceAuthBindingPhone($key, $phone);
if ($token) {
return app('json')->success(410001, $token);
} else
return app('json')->fail(410019);
$data = $this->services->authBindingPhone($key, $phone);
return app('json')->success($data);
}
}

View File

@ -18,9 +18,10 @@ Route::group(function () {
Route::any('wechat/serve', 'v1.wechat.WechatController/serve')->option(['real_name' => '公众号服务']);//公众号服务
Route::any('wechat/miniServe', 'v1.wechat.WechatController/miniServe')->option(['real_name' => '小程序服务']);//公众号服务
Route::any('pay/notify/:type', 'v1.PayController/notify')->option(['real_name' => '支付回调']);//支付回调
Route::any('order_call_back', 'v1.order.StoreOrderController/callBack')->option(['real_name' => '商家寄件回调']);//商家寄件回调
Route::get('get_script', 'v1.PublicController/getScript')->option(['real_name' => '获取统计代码']);//获取统计代码
Route::get('version', 'v1.PublicController/getVersion')->option(['real_name' => '获取代码版本号']);
})->option(['mark' => 'serve', 'mark_name' => '服务接口']);
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->option(['mark' => 'serve', 'mark_name' => '服务接口']);
Route::group(function () {
//apple快捷登陆
@ -80,6 +81,7 @@ Route::group(function () {
Route::get('admin/order/delivery_info', 'v1.admin.StoreOrderController/getDeliveryInfo')->name('getDeliveryInfo')->option(['real_name' => '获取电子面单默认信息']);//获取电子面单默认信息
Route::get('admin/order/export_temp', 'v1.admin.StoreOrderController/getExportTemp')->name('getExportTemp')->option(['real_name' => '获取电子面单模板获取']);//获取电子面单模板获取
Route::get('admin/order/export_all', 'v1.admin.StoreOrderController/getExportAll')->name('getExportAll')->option(['real_name' => '获取物流公司']);//获取物流公司
Route::get('admin/order/express/:uni/[:type]', 'v1.admin.StoreOrderController/express')->name('orderExpress')->option(['real_name' => '订单查看物流']); //订单查看物流
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)
->middleware(\app\api\middleware\StationOpenMiddleware::class)
->middleware(\app\api\middleware\AuthTokenMiddleware::class, true)
@ -155,6 +157,7 @@ Route::group(function () {
Route::get('sign/config', 'v1.user.UserSignController/sign_config')->name('signConfig')->option(['real_name' => '签到配置']);//签到配置
Route::get('sign/list', 'v1.user.UserSignController/sign_list')->name('signList')->option(['real_name' => '签到列表']);//签到列表
Route::get('sign/month', 'v1.user.UserSignController/sign_month')->name('signIntegral')->option(['real_name' => '签到列表(年月)']);//签到列表(年月)
Route::get('sign/remind/:status', 'v1.user.UserSignController/sign_remind')->name('signRemind')->option(['real_name' => '签到提醒开关']);//签到列表(年月)
Route::post('sign/user', 'v1.user.UserSignController/sign_user')->name('signUser')->option(['real_name' => '签到用户信息']);//签到用户信息
Route::post('sign/integral', 'v1.user.UserSignController/sign_integral')->name('signIntegral')->option(['real_name' => '公众号授权登录'])->middleware(BlockerMiddleware::class);//签到
})->option(['mark' => 'sign', 'mark_name' => '签到']);

View File

@ -18,30 +18,22 @@ Route::group('v2', function () {
//无需授权接口
Route::group(function () {
Route::group(function () {
//公众号授权登录
Route::get('wechat/auth', 'v2.wechat.WechatController/auth')->option(['real_name' => '公众号授权登录']);
//小程序授权
Route::get('wechat/routine_auth', 'v2.wechat.AuthController/auth')->option(['real_name' => '小程序授权']);
//小程序静默授权
Route::get('wechat/silence_auth', 'v2.wechat.AuthController/silenceAuthNoLogin')->option(['real_name' => '小程序静默授权']);
//小程序静默授权登陆
Route::get('wechat/silence_auth_login', 'v2.wechat.AuthController/silenceAuth')->option(['real_name' => '小程序静默授权登陆']);
//公众号静默授权
Route::get('wechat/wx_silence_auth', 'v2.wechat.WechatController/silenceAuthNoLogin')->option(['real_name' => '公众号静默授权']);
//公众号静默授权登陆
Route::get('wechat/wx_silence_auth_login', 'v2.wechat.WechatController/silenceAuth')->option(['real_name' => '公众号静默授权登陆']);
//是否强制绑定手机号
Route::get('bind_status', 'v2.PublicController/bindPhoneStatus')->option(['real_name' => '是否强制绑定手机号']);
//小程序登录页面自动加载返回用户信息的缓存key返回是否强制绑定手机号
Route::get('routine/auth_type', 'v2.wechat.AuthController/authType')->option(['real_name' => '小程序页面登录类型']);
//小程序授权登录返回token
Route::get('routine/auth_login', 'v2.wechat.AuthController/authLogin')->option(['real_name' => '小程序授权登录']);
//小程序授权绑定手机号
Route::post('auth_bindind_phone', 'v2.wechat.AuthController/authBindingPhone')->option(['real_name' => '小程序授权绑定手机号']);
Route::post('routine/auth_binding_phone', 'v2.wechat.AuthController/authBindingPhone')->option(['real_name' => '小程序授权绑定手机号']);
//小程序手机号直接登录
Route::post('routine/phone_login', 'v2.wechat.AuthController/phoneLogin')->option(['real_name' => '手机号直接登录']);
//小程序授权后绑定手机号
Route::post('routine/binding_phone', 'v2.wechat.AuthController/BindingPhone')->option(['real_name' => '小程序授权后绑定手机号']);
//小程序手机号登录直接绑定
Route::post('phone_silence_auth', 'v2.wechat.AuthController/silenceAuthBindingPhone')->option(['real_name' => '小程序手机号登录直接绑定']);
//微信手机号登录直接绑定
Route::post('phone_wx_silence_auth', 'v2.wechat.WechatController/silenceAuthBindingPhone')->option(['real_name' => '微信手机号登录直接绑定']);
//公众号授权登录返回token
Route::get('wechat/auth_login', 'v2.wechat.WechatController/authLogin')->option(['real_name' => '公众号授权登录']);
//公众号授权绑定手机号
Route::post('wechat/auth_binding_phone', 'v2.wechat.WechatController/authBindingPhone')->option(['real_name' => '小程序授权绑定手机号']);
})->option(['mark' => 'wechat_auto', 'mark_name' => '微信授权']);
Route::group(function () {
@ -59,8 +51,6 @@ Route::group('v2', function () {
Route::post('reset_cart', 'v2.store.StoreCartController/resetCart')->name('resetCart')->option(['real_name' => '清除购物车', 'mark' => 'cart', 'mark_name' => '购物车']);
Route::get('new_coupon', 'v2.store.StoreCouponsController/getNewCoupon')->name('getNewCoupon')->option(['real_name' => '获取新人券', 'mark' => 'coupons', 'mark_name' => '优惠券']);//获取新人券
// Route::get('get_today_coupon', 'v2.store.StoreCouponsController/getTodayCoupon');//新优惠券弹窗接口
Route::post('user/user_update', 'v2.wechat.AuthController/updateInfo')->option(['real_name' => '修改用户信息', 'mark' => 'user', 'mark_name' => '用户']);
Route::post('order/product_coupon/:orderId', 'v2.store.StoreCouponsController/getOrderProductCoupon')->option(['real_name' => '获取订单下管理的优惠券', 'mark' => 'coupons', 'mark_name' => '优惠券']);
Route::get('user/service/record', 'v2.user.StoreService/record')->name('userServiceRecord')->option(['real_name' => '客服聊天记录', 'parent' => 'user', 'cate_name' => '客服']);//客服聊天记录
Route::get('cart_list', 'v2.store.StoreCartController/getCartList')->option(['real_name' => '获取购物车列表', 'mark' => 'cart', 'mark_name' => '购物车']);

View File

@ -23,6 +23,7 @@ use app\services\system\lang\LangCodeServices;
use app\services\system\lang\LangCountryServices;
use think\facade\Config;
use think\facade\Log;
use think\facade\Db;
if (!function_exists('crmebLog')) {
/**
@ -506,6 +507,9 @@ if (!function_exists('image_to_base64')) {
$avatar = str_replace('https', 'http', $avatar);
try {
$url = parse_url($avatar);
if ($url['scheme'] . '://' . $url['host'] == sys_config('site_url')) {
return "data:image/jpeg;base64," . base64_encode(file_get_contents(public_path() . substr($url['path'], 1)));
}
$url = $url['host'];
$header = [
'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0',
@ -682,10 +686,10 @@ if (!function_exists('get_file_link')) {
if (!$link) {
return '';
}
if (strstr('http', $link) === false) {
return app()->request->domain() . $link;
} else {
if (substr($link, 0, 4) === "http" || substr($link, 0, 2) === "//") {
return $link;
} else {
return app()->request->domain() . $link;
}
}
}
@ -952,7 +956,7 @@ if (!function_exists('getLang')) {
//获取接口传入的语言类型
if (!$range = $request->header('cb-lang')) {
//没有传入则使用系统默认语言显示
$range = $langTypeServices->cacheDriver()->remember('range_name', function () use ($langTypeServices) {
$range = CacheService::remember('range_name', function () use ($langTypeServices) {
return $langTypeServices->value(['is_default' => 1], 'file_name');
});
if (!$range) {
@ -966,7 +970,7 @@ if (!function_exists('getLang')) {
}
// 获取type_id
$typeId = $langCountryServices->cacheDriver()->remember('type_id_' . $range, function () use ($langCountryServices, $range) {
$typeId = CacheService::remember('type_id_' . $range, function () use ($langCountryServices, $range) {
return $langCountryServices->value(['code' => $range], 'type_id') ?: 1;
}, 3600);
@ -1090,3 +1094,19 @@ if (!function_exists('out_push')) {
return true;
}
}
if (!function_exists('dump_sql')) {
/**
* 默认数据推送
* @param string $pushUrl
* @param array $data
* @param string $tip
* @return bool
*/
function dump_sql()
{
Db::listen(function ($sql) {
var_dump($sql);
});
}
}

View File

@ -71,7 +71,7 @@ class StoreCombinationDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -132,7 +132,7 @@ class StorePinkDao extends BaseDao
public function successList(int $uid)
{
return $this->search(['status' => 2, 'is_refund' => 0])
->where('uid', '<>', $uid)
// ->where('uid', '<>', $uid)
->select()->toArray();
}

View File

@ -72,6 +72,17 @@ class StoreCouponIssueDao extends BaseDao
->page($page, $limit)->order('id desc')->select()->toArray();
}
/**
* 优惠券数量
* @param $where
* @return int
* @throws \ReflectionException
*/
public function couponCount($where): int
{
return $this->search($where)->count();
}
/**
* 获取优惠券列表
* @param int $uid 用户ID

View File

@ -39,7 +39,7 @@ class StoreIntegralDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -93,9 +93,9 @@ class StoreIntegralOrderDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
return $this->search($where)->count();
}
/**

View File

@ -41,7 +41,7 @@ class StoreSeckillDao extends BaseDao
*/
public function search(array $where = [], bool $search = false)
{
return parent::search($where, $search)->when(isset($where['seckllTime']), function ($query) use ($where) {
return parent::search($where)->when(isset($where['seckllTime']), function ($query) use ($where) {
[$startTime, $stopTime] = is_array($where['seckllTime']) ? $where['seckllTime'] : [time(), time() - 86400];
$query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime);
})->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) {
@ -67,6 +67,7 @@ class StoreSeckillDao extends BaseDao
* 条件获取数量
* @param array $where
* @return int
* @throws \ReflectionException
*/
public function getCount(array $where)
{

View File

@ -59,7 +59,7 @@ class ArticleCategoryDao extends BaseDao
public function getArticleCategory()
{
return $this->search(['hidden' => 0, 'is_del' => 0, 'status' => 1, 'pid' => 0])->with(['children'])
->order('sort DESC')
->order('sort DESC,id DESC')
->field('id,pid,title')
->select()->toArray();
}
@ -77,7 +77,7 @@ class ArticleCategoryDao extends BaseDao
->where('hidden', 0)
->where('is_del', 0)
->where('status', 1)
->order('sort DESC')
->order('sort DESC,id DESC')
->field('id,pid,title')
->select()->toArray();
}
@ -92,4 +92,22 @@ class ArticleCategoryDao extends BaseDao
{
return $this->search($where)->order('sort desc,id desc')->column('title,pid,id,is_del,status');
}
/**
* 树形列表
* @param array $where
* @param array $field
* @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/9/7
*/
public function getTreeList(array $where, array $field)
{
return $this->search($where)->field($field)->order('sort desc,id desc')->select()->toArray();
}
}

View File

@ -47,7 +47,7 @@ class PageCategoryDao extends BaseDao
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page();
})->order('sort desc')->select()->toArray();
})->order('sort desc,id DESC')->select()->toArray();
}
}

View File

@ -190,7 +190,7 @@ class OtherOrderDao extends BaseDao
* @email 442384644@qq.com
* @date 2023/04/11
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -269,7 +269,7 @@ class StoreOrderDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}
@ -702,7 +702,7 @@ class StoreOrderDao extends BaseDao
$query->field("sum($sumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
/**时间分组订单数统计
@ -730,7 +730,7 @@ class StoreOrderDao extends BaseDao
$query->field("count($sumField) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
/**时间段支付订单人数
@ -773,7 +773,7 @@ class StoreOrderDao extends BaseDao
$query->field("count(distinct uid) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
@ -940,6 +940,21 @@ class StoreOrderDao extends BaseDao
})->field(['order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
}
/**
* 秒杀订单统计总数
* @param $id
* @param $where
* @return int
* @throws \ReflectionException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function seckillCount($id, $where)
{
return $this->search($where)->where('seckill_id', $id)->count();
}
/**
* 砍价订单统计
* @param $id
@ -959,6 +974,21 @@ class StoreOrderDao extends BaseDao
})->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
}
/**
* 砍价订单统计数量
* @param $id
* @param $where
* @return int
* @throws \ReflectionException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function bargainStatisticsOrderCount($id, $where)
{
return $this->search($where)->where('bargain_id', $id)->count();
}
/**
* 拼团订单统计
* @param $id
@ -978,16 +1008,62 @@ class StoreOrderDao extends BaseDao
})->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
}
/**
* 拼团订单统计数量
* @param $id
* @param $where
* @param int $page
* @param int $limit
* @return int
* @throws \ReflectionException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function combinationStatisticsCount($id, $where)
{
return $this->search($where)->where('combination_id', $id)->count();
}
/**
* 查找待收货的子订单
* @param int $pid
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function getSubOrderNotSendList(int $pid)
{
return $this->getModel()->where('pid', $pid)->where('status', 1)->select()->toArray();
}
/**
* 判断订单是否全部发货
* @param int $pid
* @param int $order_id
* @return int
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function getSubOrderNotSend(int $pid, int $order_id)
{
return $this->getModel()->where('pid', $pid)->where('status', 0)->where('id', '<>', $order_id)->count();
}
/**
* 判断是否存在子未收货子订单
* @param int $pid
* @param int $order_id
* @return int
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/31
*/
public function getSubOrderNotTake(int $pid, int $order_id)
{
return $this->getModel()->where('pid', $pid)->where('status', 1)->where('id', '<>', $order_id)->count();

View File

@ -95,9 +95,27 @@ class StoreOrderRefundDao extends BaseDao
})->order('id DESC')->select()->toArray();
}
/**
* 退款订单数量
* @param array $where
* @param bool $search
* @return int
* @throws \ReflectionException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/19
*/
public function count(array $where = [], bool $search = false)
{
return $this->search($where, $search)->count();
}
/**
* 根据时间获取
* @param array $where
* @param string $sum_field
* @param string $selectType
* @param string $group
* @return float|int
*/
public function getOrderRefundMoneyByWhere(array $where, string $sum_field, string $selectType, string $group = "")

View File

@ -122,7 +122,7 @@ class StoreProductDao extends BaseDao
})->when(isset($where['cid']) && $where['cid'], function ($query) use ($where) {
$query->whereIn('id', function ($query) use ($where) {
$query->name('store_product_cate')->whereIn('cate_id', function ($query) use ($where) {
$query->name('store_category')->where('pid', $where['cid'])->field('id')->select();
$query->name('store_category')->where('pid', $where['cid'])->whereOr('id', $where['cid'])->field('id')->select();
})->field('product_id')->select();
});
})->when(isset($where['coupon_category_id']) && $where['coupon_category_id'] != '', function ($query) use ($where) {

View File

@ -96,7 +96,7 @@ class StoreServiceDao extends BaseDao
* @email 442384644@qq.com
* @date 2023/05/10
*/
public function count(array $where = [], $search = true)
public function count(array $where = [], bool $search = true)
{
return $this->search($where, false)->when(isset($where['noId']), function ($query) use ($where) {
$query->whereNotIn('uid', $where['noId']);

View File

@ -42,7 +42,7 @@ class ExpressDao extends BaseDao
*/
public function getExpressList(array $where, string $field, int $page, int $limit)
{
return $this->search($where)->field($field)->order('sort DESC,id DESC')
return $this->search($where)->field($field)->order('sort DESC,is_show DESC,id ASC')
->when($page > 0 && $limit > 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();

View File

@ -53,7 +53,7 @@ class ShippingTemplatesDao extends BaseDao
*/
public function getShippingList(array $where, int $page, int $limit)
{
return $this->search($where)->order('sort DESC')->page($page, $limit)->select()->toArray();
return $this->search($where)->order('sort DESC,id DESC')->page($page, $limit)->select()->toArray();
}
/**

View File

@ -51,9 +51,9 @@ class ShippingTemplatesNoDeliveryDao extends BaseDao
* @param string $key
* @return array
*/
public function getShippingArray(array $where, string $field, string $key)
public function getShippingArray(array $where)
{
return $this->search($where)->column($field, $key);
return $this->search($where)->select()->toArray();
}
/**

View File

@ -0,0 +1,40 @@
<?php
/**
* +----------------------------------------------------------------------
* | CRMEB [ CRMEB赋能开发者助力企业发展 ]
* +----------------------------------------------------------------------
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
* +----------------------------------------------------------------------
* | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
* +----------------------------------------------------------------------
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemCrudData;
/**
* Class SystemCrudDataDao
* @author 等风来
* @email 136327134@qq.com
* @date 2023/7/28
* @package app\dao\system
*/
class SystemCrudDataDao extends BaseDao
{
/**
* @return string
* @author 等风来
* @email 136327134@qq.com
* @date 2023/7/28
*/
protected function setModel(): string
{
return SystemCrudData::class;
}
}

View File

@ -128,7 +128,7 @@ class SystemMenusDao extends BaseDao
public function menusSelect(array $where, $type = 1)
{
if ($type == 1) {
return $this->search($where)->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC')->select();
return $this->search($where)->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC,id DESC')->select();
} else {
return $this->search($where)->group('pid')->column('pid');
}
@ -143,7 +143,7 @@ class SystemMenusDao extends BaseDao
public function getSearchList()
{
return $this->search(['is_show' => 1, 'auth_type' => 1, 'is_del' => 0, 'is_show_path' => 0])
->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC')->select();
->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC,id DESC')->select();
}
/**

View File

@ -36,10 +36,15 @@ class SystemNotificationDao extends BaseDao
* 获取列表
* @param array $where
* @param string $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/16
*/
public function getList(array $where, string $field = '*', int $page = 0, $limit = 0)
{
@ -48,5 +53,38 @@ class SystemNotificationDao extends BaseDao
})->order('id asc')->select()->toArray();
}
/**
* 获取tempid
* @param $type
* @return array
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/16
*/
public function getTempId($type)
{
$whereField = 'is_' . $type;
$field = $type . '_tempid';
return array_unique($this->getModel()->where($whereField, 1)->where($field, '<>', '')->column($field));
}
/**
* 获取tempkey
* @param $type
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/16
*/
public function getTempKey($type)
{
$whereField = 'is_' . $type;
$field = $type . '_tempkey';
$content = $type . '_content,name';
return $this->getModel()->where($whereField, 1)->column($content, $field);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemSignReward;
/**
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/28
*/
class SystemSignRewardDao extends BaseDao
{
/**
* 设置模型
* @return string
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/7/28
*/
protected function setModel(): string
{
return SystemSignReward::class;
}
}

View File

@ -92,4 +92,20 @@ class SystemAttachmentDao extends BaseDao
{
$this->getModel()->whereTime('time', 'yesterday')->where('module_type', 2)->delete();
}
/**
* 获取扫码上传的图片数据
* @param $scan_token
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadImage($scan_token)
{
return $this->getModel()->where('scan_token', $scan_token)->field('att_dir,att_id')->select()->toArray();
}
}

View File

@ -68,7 +68,7 @@ class SystemConfigDao extends BaseDao
*/
public function getConfigList(array $where, int $page, int $limit)
{
return $this->search($where)->page($page, $limit)->order('sort desc,id desc')->select()->toArray();
return $this->search($where)->page($page, $limit)->order('sort desc,id asc')->select()->toArray();
}
/**
@ -84,7 +84,7 @@ class SystemConfigDao extends BaseDao
{
$where['tab_id'] = $tabId;
if ($status == 1) $where['status'] = $status;
return $this->search($where)->order('sort desc')->select()->toArray();
return $this->search($where)->order('sort desc,id ASC')->select()->toArray();
}
/**

View File

@ -50,7 +50,7 @@ class MemberShipDao extends BaseDao
*/
public function getApiList(array $where)
{
return $this->search()->where($where)->order('sort desc')->select()->toArray();
return $this->search()->where($where)->order('sort desc,id DESC')->select()->toArray();
}

View File

@ -44,6 +44,6 @@ class UserAddressDao extends BaseDao
*/
public function getList(array $where, string $field = '*', int $page, int $limit): array
{
return $this->search($where)->field($field)->page($page, $limit)->order('is_default DESC')->select()->toArray();
return $this->search($where)->field($field)->page($page, $limit)->order('is_default DESC,id DESC')->select()->toArray();
}
}

View File

@ -45,7 +45,7 @@ class UserLabelCateDao extends BaseDao
{
return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('sort DESC')->select()->toArray();
})->order('sort DESC,id DESC')->select()->toArray();
}
/**
@ -59,6 +59,6 @@ class UserLabelCateDao extends BaseDao
{
return $this->getModel()->when(count($with), function ($query) use ($with) {
$query->with($with);
})->order('sort DESC')->select()->toArray();
})->order('sort DESC,id DESC')->select()->toArray();
}
}

View File

@ -63,4 +63,47 @@ class UserSignDao extends BaseDao
{
return $this->search($where)->field($field)->order('id desc')->group($group)->page($page, $limit)->select()->toArray();
}
/**
* 获取周或者月的累积签到次数
* @param $type
* @param $uid
* @return int
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/1
*/
public function getCumulativeDays($type, $uid)
{
return $this->getModel()->where('uid', $uid)->where(function ($query) use ($type) {
if ($type == 1) {
$query->whereWeek('add_time');
} elseif($type == 0) {
$query->whereMonth('add_time');
}
})->count();
}
/**
* 获取本周或者本月的签到列表
* @param $type
* @param $uid
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/8
*/
public function getUserSignList($type, $uid): array
{
return $this->getModel()->where('uid', $uid)->where(function ($query) use ($type) {
if ($type == 1) {
$query->whereWeek('add_time');
} else {
$query->whereMonth('add_time');
}
})->order('id asc')->select()->toArray();
}
}

View File

@ -42,11 +42,11 @@ class WechatReplyDao extends BaseDao
public function getKey($key)
{
$res = $this->getModel()->whereIn('id', function ($query) use ($key) {
$query->name('wechat_key')->where('keys', $key)->field(['reply_id'])->select();
$query->name('wechat_key')->where('keys', $key)->where('key_type', 0)->field(['reply_id'])->select();
})->where('status', '1')->find();
if (empty($res)) {
$res = $this->getModel()->whereIn('id', function ($query) use ($key) {
$query->name('wechat_key')->where('keys', 'default')->field(['reply_id'])->select();
$query->name('wechat_key')->where('keys', 'default')->where('key_type', 0)->field(['reply_id'])->select();
})->where('status', '1')->find();
}
return $res;

View File

@ -80,6 +80,8 @@ class WechatReplyKeyDao extends BaseDao
$query->where($this->joinAlis . '.keys', 'LIKE', "%$where[key]%");
})->when(isset($where['type']) && $where['type'], function ($query) use ($where) {
$query->where($this->alias . '.type', $where['type']);
})->when(isset($where['key_type']) && $where['key_type'] !== '', function ($query) use ($where) {
$query->where($this->joinAlis . '.key_type', $where['key_type']);
})->where($this->joinAlis . '.keys', '<>', 'subscribe')
->where($this->joinAlis . '.keys', '<>', 'default');
}
@ -106,7 +108,7 @@ class WechatReplyKeyDao extends BaseDao
* @param bool $search
* @return int
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->group($this->alias . '.id')->count();
}

View File

@ -9,7 +9,13 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
// 事件定义文件
/** 事件定义文件
* 调用事件示例:
* @param mixed $event 事件名(或者类名)
* @param mixed $args 参数
* event($event,$args);
* event('OrderCreateAfterListener',$order);
*/
return [
'bind' => [

View File

@ -38,7 +38,7 @@ class AutoCommentJob extends BaseJobs
'uid' => $item['uid'],
'oid' => $item['oid'],
'unique' => $item['unique'],
'product_id' => $item['product_id'],
'product_id' => json_decode($item['cart_info'],true)['product_id'],
'reply_type' => 'product',
'nickname' => $userInfos[$item['uid']]['nickname'],
'avatar' => $userInfos[$item['uid']]['avatar'],

View File

@ -0,0 +1,43 @@
<?php
namespace app\jobs;
use app\services\order\StoreOrderDeliveryServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use think\facade\Log;
class OrderExpressJob extends BaseJobs
{
use QueueTrait;
public function doJob($expressInfo)
{
$id = $expressInfo['id'];
$data = [
'type' => 1,
'delivery_name' => $expressInfo['delivery_name'],
'delivery_code' => $expressInfo['delivery_code'],
'delivery_id' => $expressInfo['delivery_id'],
'express_record_type' => 1,
'express_temp_id' => '',
'to_name' => '',
'to_tel' => '',
'to_addr' => '',
'sh_delivery_name' => '',
'sh_delivery_id' => '',
'sh_delivery_uid' => '',
'fictitious_content' => '',
'cart_ids' => [],
'day_type' => 0,
'pickup_time' => [],
'service_type' => '',
];
try {
app()->make(StoreOrderDeliveryServices::class)->splitDelivery($id, $data, false);
} catch (\Throwable $e) {
Log::error('订单ID' . $id . '发货失败,失败原因:' . $e->getMessage());
}
return true;
}
}

View File

@ -81,8 +81,6 @@ class ProductCopyJob extends BaseJobs
$copyTaobao = app()->make(CopyTaobaoServices::class);
/** @var StoreProductServices $StoreProductServices */
$StoreProductServices = app()->make(StoreProductServices::class);
/** @var StoreProductAttrValueServices $StoreProductAttrValueServices */
$StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
//下载图片
$res = $copyTaobao->downloadCopyImage($image);
//获取缓存中的轮播图
@ -97,7 +95,6 @@ class ProductCopyJob extends BaseJobs
$image = $slider_images[0];
$slider_images = $slider_images ? json_encode($slider_images) : '';
$StoreProductServices->update($id, ['slider_image' => $slider_images, 'image' => $image]);
$StoreProductAttrValueServices->update(['product_id' => $id], ['image' => $image]);
} else {
CacheService::set('slider_images_' . $id, $slider_images);
}
@ -106,4 +103,26 @@ class ProductCopyJob extends BaseJobs
}
return true;
}
/**
* 下载商品规格图片
* @param $value_id
* @param $value_image
* @return bool
*/
public function copyAttrImage($value_id, $value_image)
{
try {
/** @var CopyTaobaoServices $copyTaobao */
$copyTaobao = app()->make(CopyTaobaoServices::class);
/** @var StoreProductAttrValueServices $StoreProductAttrValueServices */
$StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
//下载图片
$res = $copyTaobao->downloadCopyImage($value_image);
$StoreProductAttrValueServices->update($value_id, ['image' => $res]);
} catch (\Throwable $e) {
Log::error('下载商品规格图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
}
return true;
}
}

View File

@ -37,7 +37,7 @@ class TemplateJob extends BaseJobs
* @param $color
* @return bool|mixed
*/
public function doJob($type, $openid, $tempCode, $data, $link, $color)
public function doJob($type, $openid, $tempId, $data, $link, $color)
{
try {
if (!$openid) return true;
@ -56,15 +56,7 @@ class TemplateJob extends BaseJobs
}
$template->url($link);
}
//判断小程序还是公众号获取数据id
$is_type = $type == 'wechat' ? 'is_wechat' : 'is_routine';
$key = $is_type == 'is_wechat' ? 'wechat_' . $tempCode : 'routine_' . $tempCode;
$tempid = CacheService::remember($key, function () use ($type, $tempCode, $is_type) {
/** @var SystemNotificationServices $notifyServices */
$notifyServices = app()->make(SystemNotificationServices::class);
return $notifyServices->getNotInfo(['type' => $is_type, 'mark' => $tempCode])['tempid'];
});
return $template->send($tempid, $data);
return $template->send($tempId, $data);
} catch (\Exception $e) {
Log::error($e->getMessage());
return true;

View File

@ -2,9 +2,8 @@
namespace app\jobs\notice;
use app\services\message\TemplateMessageServices;
use app\services\message\SystemNotificationServices;
use crmeb\basic\BaseJobs;
use crmeb\exceptions\AdminException;
use crmeb\services\app\MiniProgramService;
use crmeb\services\app\WechatService;
use crmeb\traits\QueueTrait;
@ -19,95 +18,57 @@ class SyncMessageJob extends BaseJobs
* @param $template
* @return bool
*/
public function syncSubscribe($template)
public function syncSubscribe($key, $data)
{
$errCode = [-1, 40001, 40002, 40013, 40125, 41002, 41004, 43104, 45009, 200011, 200012, 200014];
/** @var TemplateMessageServices $templateMessageServices */
$templateMessageServices = app()->make(TemplateMessageServices::class);
if ($template['tempkey']) {
if ($template['tempid']) {
try {
MiniProgramService::delSubscribeTemplate($template['tempid']);
} catch (\Throwable $e) {
$wechatErr = $e->getMessage();
if (is_string($wechatErr)) {
Log::error('删除旧订阅消息模版失败:' . $wechatErr);
return true;
}
if (in_array($wechatErr->getCode(), $errCode)) {
Log::error('删除旧订阅消息模版失败:' . $wechatErr->getCode());
return true;
}
Log::error('删除旧订阅消息模版失败:' . $wechatErr->getMessage());
return true;
$works = MiniProgramService::getSubscribeTemplateKeyWords($key);
$kid = [];
if ($works) {
$works = array_combine(array_column($works, 'name'), $works);
$content = is_array($data['routine_content']) ? $data['routine_content'] : explode("\n", $data['routine_content']);
foreach ($content as $c) {
$name = explode('{{', $c)[0] ?? '';
if ($name && isset($works[$name])) {
$kid[] = $works[$name]['kid'];
}
}
}
if ($kid) {
try {
$works = MiniProgramService::getSubscribeTemplateKeyWords($template['tempkey']);
$tempid = MiniProgramService::addSubscribeTemplate($key, $kid, $data['name']);
} catch (\Throwable $e) {
$wechatErr = $e->getMessage();
if (is_string($wechatErr)) {
Log::error('获取关键词列表失败:' . $wechatErr);
return true;
}
if (in_array($wechatErr->getCode(), $errCode)) {
Log::error('获取关键词列表失败:' . $wechatErr->getCode());
return true;
}
Log::error('获取关键词列表失败:' . $wechatErr->getMessage());
return true;
}
$kid = [];
if ($works) {
$works = array_combine(array_column($works, 'name'), $works);
$content = is_array($template['content']) ? $template['content'] : explode("\n", $template['content']);
foreach ($content as $c) {
$name = explode('{{', $c)[0] ?? '';
if ($name && isset($works[$name])) {
$kid[] = $works[$name]['kid'];
}
}
}
if ($kid) {
try {
$tempid = MiniProgramService::addSubscribeTemplate($template['tempkey'], $kid, $template['name']);
} catch (\Throwable $e) {
$wechatErr = $e->getMessage();
if (is_string($wechatErr)) {
Log::error('添加订阅消息模版失败:' . $wechatErr);
return true;
}
if (in_array($wechatErr->getCode(), $errCode)) {
Log::error('添加订阅消息模版失败:' . $wechatErr->getCode());
return true;
}
Log::error('添加订阅消息模版失败:' . $wechatErr->getMessage());
return true;
}
$templateMessageServices->update($template['id'], ['tempid' => $tempid, 'kid' => json_encode($kid), 'add_time' => time()], 'id');
Log::error('同步订阅消息失败:' . $e->getMessage());
return true;
}
app()->make(SystemNotificationServices::class)->update(['routine_tempkey' => $key], ['routine_tempid' => $tempid, 'routine_kid' => json_encode($kid)]);
return true;
}
return true;
}
/**
* 同步公众号模版消息
* @param $template
* @param $key
* @param $content
* @return bool
* @author: 吴汐
* @email: 442384644@qq.com
* @date: 2023/8/16
*/
public function syncWechat($template)
public function syncWechat($key, $content)
{
/** @var TemplateMessageServices $templateMessageServices */
$templateMessageServices = app()->make(TemplateMessageServices::class);
$content = is_array($content) ? $content : explode("\n", $content);
$name = [];
foreach ($content as $c) {
$name[] = explode('{{', $c)[0] ?? '';
}
try {
$res = WechatService::addTemplateId($template['tempkey']);
$res = WechatService::addTemplateId($key, $name);
} catch (\Throwable $e) {
Log::error('同步模版消息失败:' . $e->getMessage());
return true;
}
if(!$res->errcode && $res->template_id){
$templateMessageServices->update($template['id'],['tempid'=>$res->template_id]);
if (!$res->errcode && $res->template_id) {
app()->make(SystemNotificationServices::class)->update(['wechat_tempkey' => $key], ['wechat_tempid' => $res->template_id]);
}
return true;
}

View File

@ -27,9 +27,9 @@ use app\api\validate\user\StoreServiceFeedbackValidate;
use app\services\kefu\service\StoreServiceFeedbackServices;
use crmeb\exceptions\AuthException;
use app\services\other\UploadService;
use crmeb\services\CacheService;
use crmeb\utils\Arr;
use crmeb\utils\JwtAuth;
use think\facade\Cache;
class Common extends BaseController
{
@ -225,7 +225,7 @@ class Common extends BaseController
}
$uid = $authInfo['user']['uid'];
if (!$data['filename']) return app('json')->fail(100100);
if (Cache::has('start_uploads_' . $uid) && Cache::get('start_uploads_' . $uid) >= 100) return app('json')->fail('非法操作');
if (CacheService::has('start_uploads_' . $uid) && CacheService::get('start_uploads_' . $uid) >= 100) return app('json')->fail('非法操作');
$upload = UploadService::init();
$info = $upload->to('store/comment')->validate()->move($data['filename']);
if ($info === false) {
@ -233,12 +233,12 @@ class Common extends BaseController
}
$res = $upload->getUploadInfo();
$services->attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, (int)sys_config('upload_type', 1), $res['time'], 2);
if (Cache::has('start_uploads_' . $uid))
$start_uploads = (int)Cache::get('start_uploads_' . $uid);
if (CacheService::has('start_uploads_' . $uid))
$start_uploads = (int)CacheService::get('start_uploads_' . $uid);
else
$start_uploads = 0;
$start_uploads++;
Cache::set('start_uploads_' . $uid, $start_uploads, 86400);
CacheService::set('start_uploads_' . $uid, $start_uploads, 86400);
$res['dir'] = path_to_url($res['dir']);
if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
return app('json')->success(410091, ['name' => $res['name'], 'url' => $res['dir']]);

View File

@ -23,7 +23,6 @@ use app\services\user\UserLabelCateServices;
use app\services\user\UserLabelRelationServices;
use app\services\kefu\service\StoreServiceRecordServices;
use think\facade\Config;
use think\facade\Cache;
/**
* Class User
@ -163,7 +162,7 @@ class User extends AuthController
['filename', 'file'],
]);
if (!$data['filename']) return app('json')->fail(100100);
if (Cache::has('start_uploads_' . $request->kefuId()) && Cache::get('start_uploads_' . $request->kefuId()) >= 100) return app('json')->fail('非法操作');
if (CacheService::has('start_uploads_' . $request->kefuId()) && CacheService::get('start_uploads_' . $request->kefuId()) >= 100) return app('json')->fail('非法操作');
$upload = UploadService::init();
$info = $upload->to('store/comment')->validate()->move($data['filename']);
if ($info === false) {
@ -171,12 +170,12 @@ class User extends AuthController
}
$res = $upload->getUploadInfo();
$services->attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, (int)sys_config('upload_type', 1), $res['time'], 2);
if (Cache::has('start_uploads_' . $request->kefuId()))
$start_uploads = (int)Cache::get('start_uploads_' . $request->kefuId());
if (CacheService::has('start_uploads_' . $request->kefuId()))
$start_uploads = (int)CacheService::get('start_uploads_' . $request->kefuId());
else
$start_uploads = 0;
$start_uploads++;
Cache::set('start_uploads_' . $request->kefuId(), $start_uploads, 86400);
CacheService::set('start_uploads_' . $request->kefuId(), $start_uploads, 86400);
$res['dir'] = path_to_url($res['dir']);
if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
return app('json')->success(410091, ['name' => $res['name'], 'url' => $res['dir']]);

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More