Skip to content

Commit

Permalink
新增:接口 eventSource、请求支持 event stream
Browse files Browse the repository at this point in the history
  • Loading branch information
modstart committed Feb 28, 2024
1 parent 9dc4c70 commit 06b8a79
Show file tree
Hide file tree
Showing 61 changed files with 577 additions and 43 deletions.
6 changes: 6 additions & 0 deletions module/Vendor/Docs/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.4.0

- 新增:订单快捷操作工具类 OrderUtil

---

## 4.3.0 移动端链接识别,uniapp操作工具

- 新增:有移动端链接时,后台链接选择自动识别电脑端和移动端筛选
Expand Down
2 changes: 2 additions & 0 deletions module/Vendor/Type/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class OrderStatus implements BaseType

// 订单过期,支付成功的订单
const CANCEL_PAID = 97;
// 订单过期,未支付的订单
const CANCEL_EXPIRED = 98;
// 用户取消
const CANCEL = 99;

// const CANCEL_QUEUE = 100;
Expand Down
8 changes: 7 additions & 1 deletion module/Vendor/Util/ApiUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ public static function config()
];
$uploads = config('data.upload');
foreach ($uploads as $category => $categoryInfo) {
$data['dataUpload']['category'][$category] = [
$info = [
'maxSize' => $categoryInfo['maxSize'],
'extensions' => $categoryInfo['extensions'],
];
if ('image' == $category) {
$info['compress'] = $categoryInfo['compress'];
$info['compressMaxWidthOrHeight'] = $categoryInfo['compressMaxWidthOrHeight'];
$info['compressMaxSize'] = $categoryInfo['compressMaxSize'];
}
$data['dataUpload']['category'][$category] = $info;
}

return $data;
Expand Down
80 changes: 80 additions & 0 deletions module/Vendor/Util/OrderUtil.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php


namespace Module\Vendor\Util;


use ModStart\Core\Dao\ModelUtil;
use ModStart\Core\Exception\BizException;
use Module\Vendor\Type\OrderStatus;

class OrderUtil
{
public static function cancelManual($model, $where, $successCallback = null)
{
ModelUtil::transactionBegin();
try {
$order = ModelUtil::getWithLock($model, $where);
BizException::throwsIfEmpty('订单不存在', $order);
BizException::throwsIf('订单状态异常', $order['status'] != OrderStatus::WAIT_PAY);
$update = [
'status' => OrderStatus::CANCEL,
];
if (array_key_exists('cancelTime', $order)) {
$update['cancelTime'] = date('Y-m-d H:i:s');
}
ModelUtil::update($model, $order['id'], $update);
call_user_func_array($successCallback, [$order]);
ModelUtil::transactionCommit();
} catch (BizException $e) {
ModelUtil::transactionRollback();
throw $e;
}
}

public static function cancelExpire($model, $where, $successCallback)
{
ModelUtil::transactionBegin();
try {
$order = ModelUtil::getWithLock($model, $where);
BizException::throwsIfEmpty('订单不存在', $order);
BizException::throwsIf('订单状态异常', $order['status'] != OrderStatus::WAIT_PAY);
$update = [
'status' => OrderStatus::CANCEL_EXPIRED,
];
if (array_key_exists('cancelTime', $order)) {
$update['cancelTime'] = date('Y-m-d H:i:s');
}
ModelUtil::update($model, $order['id'], $update);
call_user_func_array($successCallback, [$order]);
ModelUtil::transactionCommit();
} catch (BizException $e) {
ModelUtil::transactionRollback();
}
}

public static function payed($model, $where, $successCallback, $updateStatus = null)
{
if (is_null($updateStatus)) {
$updateStatus = OrderStatus::COMPLETED;
}
ModelUtil::transactionBegin();
try {
$order = ModelUtil::getWithLock($model, $where);
BizException::throwsIfEmpty('订单不存在', $order);
BizException::throwsIf('订单状态异常', $order['status'] != OrderStatus::WAIT_PAY);
$update = [
'status' => $updateStatus,
];
if (array_key_exists('payTime', $order)) {
$update['payTime'] = date('Y-m-d H:i:s');
}
ModelUtil::update($model, $order['id'], $update);
call_user_func_array($successCallback, [$order]);
ModelUtil::transactionCommit();
} catch (BizException $e) {
ModelUtil::transactionRollback();
throw $e;
}
}
}
2 changes: 1 addition & 1 deletion module/Vendor/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Vendor",
"title": "通用功能包",
"version": "4.3.0",
"version": "4.4.0",
"author": "官方",
"description": "提供基础功能",
"modstartVersion": ">=3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion public/asset/common/base.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/asset/common/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/asset/common/uploadButton.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/asset/entry/basic.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/asset/entry/dataFileManager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/asset/vendor/iconfont/iconfont.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions public/asset/vendor/iconfont/iconfont.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "27298710",
"name": "douyin",
"font_class": "douyin",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "38459183",
"name": "description",
Expand Down
Binary file modified public/asset/vendor/iconfont/iconfont.ttf
Binary file not shown.
Binary file modified public/asset/vendor/iconfont/iconfont.woff
Binary file not shown.
Binary file modified public/asset/vendor/iconfont/iconfont.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion vendor/modstart/modstart/asset/common/base.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/modstart/modstart/asset/common/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/modstart/modstart/asset/common/uploadButton.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/modstart/modstart/asset/entry/basic.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/modstart/modstart/asset/entry/dataFileManager.js

Large diffs are not rendered by default.

Loading

0 comments on commit 06b8a79

Please sign in to comment.