Skip to content

Commit 194162c

Browse files
committed
更新v4.4.2版本
1 parent 1be525f commit 194162c

File tree

1,323 files changed

+2522
-1778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,323 files changed

+2522
-1778
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
CRMEB技术团队(官网:www.crmeb.com)历经4年时间匠心之作!系统采用前后端分离技术,基于TP6+Uni-app框架开发;客户移动端采用uni-app开发,管理后台前端使用iviewUI开发。系统支持微信公众号端、微信小程序端、H5端、PC端多端账号同步,可快速打包生成APP;
1313

14-
赋能开发者,减少重复造轮子;系统支持自动检查安装环境一键安装部署,使用简单方便;围绕方便二次开发,系统内置强大灵活的权限管理,可以控制到每一个菜单;通过内置组合数据,管理碎片化数据,系统配置快速添加系统配置参数,内置钩子,方便二开;后台应用form-builder PHP快速生成现代化表单;并提供详细的使用文档、开发文档、接口文档、数据字典等相关文档;及十几个技术交流群、技术论坛答疑;帮助更多开发者快速上手,节省开发时间,提升开发效率;助力企业实现数字化经营!
14+
赋能开发者,减少重复造轮子;系统支持自动检查安装环境一键安装部署,使用简单方便;围绕方便二次开发,系统内置强大灵活的权限管理,可以控制到每一个菜单;通过内置组合数据,管理碎片化数据,系统配置快速添加系统配置参数,所有用户操作地方都内置钩子,代码严格分控制层(中间件、路由)、Services层、Dao层、Model层;后台应用form-builder PHP快速生成现代化表单;并提供详细的使用文档、开发文档、接口文档、数据字典等相关文档;及十几个技术交流群、技术论坛答疑;让您二开无忧,帮助更多开发者快速上手,节省开发时间,提升开发效率;助力企业实现数字化经营!
1515

1616
<p align="center" >
1717
<a href="https://gitee.com/ZhongBangKeJi/CRMEB/blob/master/README.md"> 宽屏预览 </a>
@@ -52,7 +52,7 @@
5252

5353
技术交流社区:<a href="https://q.crmeb.com" target="_blank">https://q.crmeb.com
5454

55-
55+
![](readme/images/gitee打通版-横.jpg)
5656
[![](readme/images/1思维脑图功能清单.jpg)](http://s.crmeb.com/goods_detail/730)
5757
[![](readme/images/2高清UI设计图.jpg)](http://s.crmeb.com/goods_detail/728)
5858
[![](readme/images/3前后端接口文档.jpg)](http://s.crmeb.com/goods_detail/729)
@@ -106,6 +106,7 @@ Redis
106106
15.支持队列降低流量高峰,解除耦合,高可用;
107107
16.一键安装自动检查系统环境一键安装;
108108
17.移动端使用uni-app进行开发,方便编译成各种格式的代码;
109+
18.严格代码规范,层次分明
109110
~~~
110111

111112
## 页面展示

crmeb/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
3、电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您一旦开始确认本协议并安装 CRMEB,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。
2323

2424
协议发布时间: 2017年8月01日
25-
版本最新更新: 2019年8月15日 By CRMEB
25+
版本最新更新: 2022年3月15日 By CRMEB
2626

2727
CRMEB官方网站:http://www.crmeb.com
2828
CRMEB演示站:http://demo.crmeb.com

crmeb/app/adminapi/controller/v1/setting/SystemStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ public function delete($id)
248248
*/
249249
public function uploadType(SystemConfigServices $services, $type)
250250
{
251+
$status = $this->services->count(['type' => $type, 'status' => 1]);
252+
if (!$status && $type != 1) {
253+
return app('json')->success('未有正在使用的存储空间');
254+
}
251255
$services->update('upload_type', ['value' => json_encode($type)], 'menu_name');
252256
\crmeb\services\CacheService::clear();
253257
if ($type != 1) {

crmeb/app/model/system/config/SystemStorage.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,24 @@ public function searchNameAttr($query, $value)
4545
{
4646
$query->where('name', $value);
4747
}
48+
49+
/**
50+
* 类型搜索器
51+
* @param $query
52+
* @param $value
53+
*/
54+
public function searchTypeAttr($query, $value)
55+
{
56+
if ($value) $query->where('type', $value);
57+
}
58+
59+
/**
60+
* 状态搜索器
61+
* @param $query
62+
* @param $value
63+
*/
64+
public function searchStatusAttr($query, $value)
65+
{
66+
if ($value !== '') $query->where('status', $value);
67+
}
4868
}

crmeb/app/services/message/wechat/MessageServices.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function wechatEventScan($message)
4747
if (strtolower($qrInfo['third_type']) == 'spread') {
4848
try {
4949
$spreadUid = $qrInfo['third_id'];
50+
$is_new = $wechatUser->saveUser($message->FromUserName);
5051
$uid = $wechatUser->getFieldValue($message->FromUserName, 'openid', 'uid', ['user_type', '<>', 'h5']);
5152
$userInfo = $userService->get($uid);
5253
if ($spreadUid == $uid) {
@@ -55,7 +56,7 @@ public function wechatEventScan($message)
5556
$response = '用户不存在';
5657
} else if ($userInfo['spread_uid']) {
5758
$response = '已有推荐人!';
58-
} else if (!$loginService->updateUserInfo(['code' => $spreadUid], $userInfo)) {
59+
} else if (!$loginService->updateUserInfo(['code' => $spreadUid], $userInfo, $is_new)) {
5960
$response = '绑定推荐人失败!';
6061
}
6162
} catch (\Exception $e) {
@@ -65,6 +66,7 @@ public function wechatEventScan($message)
6566
try {
6667
$spreadUid = $qrInfo['third_id'];
6768
$spreadInfo = $userService->get($spreadUid);
69+
$is_new = $wechatUser->saveUser($message->FromUserName);
6870
$uid = $wechatUser->getFieldValue($message->FromUserName, 'openid', 'uid', ['user_type', '<>', 'h5']);
6971
$userInfo = $userService->get($uid);
7072
if ($spreadUid == $uid) {
@@ -77,7 +79,7 @@ public function wechatEventScan($message)
7779
$response = '您是事业部,不能绑定成为别人的员工';
7880
} else if ($userInfo->is_agent) {
7981
$response = '您是代理商,不能绑定成为别人的员工';
80-
} else if ($loginService->updateUserInfo(['code' => $spreadUid, 'is_staff' => 1], $userInfo)) {
82+
} else if ($loginService->updateUserInfo(['code' => $spreadUid, 'is_staff' => 1], $userInfo, $is_new)) {
8183
$response = '绑定店员成功!';
8284
}
8385
} catch (\Exception $e) {
@@ -91,6 +93,7 @@ public function wechatEventScan($message)
9193
$qrcodeInfo = $wechatQrcodeService->qrcodeInfo($qrInfo['third_id']);
9294
$spreadUid = $qrcodeInfo['uid'];
9395
$spreadInfo = $userService->get($spreadUid);
96+
$is_new = $wechatUser->saveUser($message->FromUserName);
9497
$uid = $wechatUser->getFieldValue($message->FromUserName, 'openid', 'uid', ['user_type', '<>', 'h5']);
9598
$userInfo = $userService->get($uid);
9699
if ($qrcodeInfo['status'] == 0 || $qrcodeInfo['is_del'] == 1 || ($qrcodeInfo['end_time'] < time() && $qrcodeInfo['end_time'] > 0)) {
@@ -101,7 +104,7 @@ public function wechatEventScan($message)
101104
$response = '用户不存在';
102105
} else if (!$spreadInfo) {
103106
$response = '上级用户不存在';
104-
} else if ($loginService->updateUserInfo(['code' => $spreadUid], $userInfo)) {
107+
} else if ($loginService->updateUserInfo(['code' => $spreadUid], $userInfo, $is_new)) {
105108
//写入扫码记录,返回内容
106109
$response = $wechatQrcodeService->wechatQrcodeRecord($qrcodeInfo, $userInfo, $spreadInfo);
107110
}

crmeb/app/services/order/StoreOrderRefundServices.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -894,22 +894,26 @@ public function applyRefund(int $id, int $uid, $order = [], array $cart_ids = []
894894
}
895895
$refund_num = bcadd((string)$refund_num, (string)$cart['cart_num'], 0);
896896
}
897-
/** @var StoreOrderSplitServices $storeOrderSpliteServices */
898-
$storeOrderSpliteServices = app()->make(StoreOrderSplitServices::class);
899-
$cartInfos = $storeOrderSpliteServices->getSplitOrderCartInfo($id, $cart_ids, $order);
900-
$total_price = $pay_postage = 0;
901-
foreach ($cartInfos as $cart) {
902-
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
903-
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
904-
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
905-
}
906-
$refund_pay_price = bcadd((string)$total_price, (string)$pay_postage, 2);
907-
//订单实际支付金额
908-
$order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
909-
if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
910-
$refund_price = bcmul((string)bcdiv((string)$order['pay_price'], (string)$order_pay_price, 4), (string)$refund_pay_price, 2);
911-
} else {
912-
$refund_price = $refund_pay_price;
897+
//总共申请多少件
898+
$total_num = array_sum(array_column($cart_ids, 'cart_num'));
899+
if ($total_num < $order['total_num']) {
900+
/** @var StoreOrderSplitServices $storeOrderSpliteServices */
901+
$storeOrderSpliteServices = app()->make(StoreOrderSplitServices::class);
902+
$cartInfos = $storeOrderSpliteServices->getSplitOrderCartInfo($id, $cart_ids, $order);
903+
$total_price = $pay_postage = 0;
904+
foreach ($cartInfos as $cart) {
905+
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
906+
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
907+
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
908+
}
909+
$refund_pay_price = bcadd((string)$total_price, (string)$pay_postage, 2);
910+
//订单实际支付金额
911+
$order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
912+
if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
913+
$refund_price = bcmul((string)bcdiv((string)$order['pay_price'], (string)$order_pay_price, 4), (string)$refund_pay_price, 2);
914+
} else {
915+
$refund_price = $refund_pay_price;
916+
}
913917
}
914918
} else {
915919
foreach ($cartInfos as $cart) {

crmeb/app/services/order/StoreOrderServices.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@ public function getOrderConfirmData(array $user, $cartId, bool $new, int $addres
14871487
} else {
14881488
$addr = [];
14891489
}
1490+
if ($shipping_type == 2) $addr = [];
14901491
/** @var StoreCartServices $cartServices */
14911492
$cartServices = app()->make(StoreCartServices::class);
14921493
$cartGroup = $cartServices->getUserProductCartListV1($user['uid'], $cartId, $new, $addr, $shipping_type);

crmeb/app/services/product/product/StoreCategoryServices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function menus($pid = '')
187187
*/
188188
public function createData($data)
189189
{
190-
if ($this->dao->getOne(['cate_name' => $data['cate_name']])) {
190+
if ($this->dao->getOne(['cate_name' => $data['cate_name'], 'pid' => $data['pid']])) {
191191
throw new AdminException('该分类已经存在');
192192
}
193193
$data['add_time'] = time();
@@ -203,7 +203,7 @@ public function createData($data)
203203
*/
204204
public function editData($id, $data)
205205
{
206-
$cate = $this->dao->getOne(['cate_name' => $data['cate_name']]);
206+
$cate = $this->dao->getOne(['cate_name' => $data['cate_name'], 'pid' => $data['pid']]);
207207
if ($cate && $cate['id'] != $id) {
208208
throw new AdminException('该分类已存在');
209209
}

crmeb/app/services/product/product/StoreProductServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function getInfo(int $id)
252252
$productInfo['give_integral'] = floatval($productInfo['give_integral']);
253253
$productInfo['presale'] = boolval($productInfo['presale'] ?? 0);
254254
$productInfo['vip_product'] = boolval($productInfo['vip_product'] ?? 0);
255-
$productInfo['presale_time'] = $productInfo['presale_start_time'] == 0 ? [] : [date('Y-m-d M:i:s', $productInfo['presale_start_time']), date('Y-m-d M:i:s', $productInfo['presale_end_time'])];
255+
$productInfo['presale_time'] = $productInfo['presale_start_time'] == 0 ? [] : [date('Y-m-d H:i:s', $productInfo['presale_start_time']), date('Y-m-d H:i:s', $productInfo['presale_end_time'])];
256256
$productInfo['description'] = $storeDescriptionServices->getDescription(['product_id' => $id, 'type' => 0]);
257257
$productInfo['custom_form'] = json_decode($productInfo['custom_form'], true);
258258
/** @var StoreProductAttrServices $storeProductAttrServices */

crmeb/app/services/shipping/ExpressServices.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ class ExpressServices extends BaseServices
3333
{
3434
public $_cacheKey = "plat_express_list";
3535

36+
//物流查询物流公司code
37+
public $express_code = [
38+
'yunda' => 'yunda',
39+
'yundakuaiyun' => 'yunda56',
40+
'ems' => 'EMS',
41+
'youzhengguonei' => 'chinapost',
42+
'huitongkuaidi' => 'HTKY',
43+
'baishiwuliu' => 'BSKY',
44+
'shentong' => 'STO',
45+
'jd' => 'JD',
46+
'zhongtong' => 'ZTO',
47+
'zhongtongkuaiyun' => 'ZTO56',
48+
];
49+
3650
/**
3751
* 构造方法
3852
* ExpressServices constructor.
@@ -63,6 +77,7 @@ public function apiExpressList()
6377
{
6478
return $this->dao->getExpressList([], '*', 0, 0);
6579
}
80+
6681
/**
6782
* 物流表单
6883
* @param array $formData
@@ -164,7 +179,7 @@ public function expressSelectForm(array $where = [])
164179

165180
public function expressList($where = [])
166181
{
167-
if(empty($where)) $where = ['is_show' => 1];
182+
if (empty($where)) $where = ['is_show' => 1];
168183
return $this->dao->getExpressList($where, 'id,name,code,partner_id,partner_key,net,account,key,net_name', 0, 0);
169184
}
170185

@@ -180,6 +195,7 @@ public function query(string $cacheName, string $expressNum, string $com = null)
180195
$resultData = CacheService::get($cacheName, null);
181196
if ($resultData === null || !is_array($resultData)) {
182197
$data = [];
198+
$com = $this->express_code[$com] ?? '';
183199
$cacheTime = 0;
184200
switch ((int)sys_config('logistics_type')) {
185201
case 1:
@@ -196,7 +212,7 @@ public function query(string $cacheName, string $expressNum, string $com = null)
196212
}
197213
break;
198214
case 2:
199-
$result = ExpressService::query($expressNum);
215+
$result = ExpressService::query($expressNum, $com);
200216
if (is_array($result) &&
201217
isset($result['result']) &&
202218
isset($result['result']['deliverystatus']) &&

0 commit comments

Comments
 (0)