mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 15:00:52 +00:00
Merge branch 'v5.1.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.1.0dev
# Conflicts: # template/admin/src/pages/order/orderList/handle/orderSend.vue
This commit is contained in:
commit
d94858a89b
@ -323,18 +323,42 @@ class StoreOrder extends AuthController
|
||||
$data = $this->request->postMore([
|
||||
['kuaidicom', ''],
|
||||
['send_address', ''],
|
||||
['address', ''],
|
||||
['weight', ''],
|
||||
['orderId', ''],
|
||||
['service_type', ''],
|
||||
['cart_ids', []],
|
||||
]);
|
||||
|
||||
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);
|
||||
$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));
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ use app\services\order\{OtherOrderServices,
|
||||
StoreOrderInvoiceServices,
|
||||
StoreOrderRefundServices,
|
||||
StoreOrderServices,
|
||||
StoreOrderStatusServices,
|
||||
StoreOrderSuccessServices,
|
||||
StoreOrderTakeServices
|
||||
};
|
||||
@ -814,11 +815,11 @@ class StoreOrderController
|
||||
]);
|
||||
|
||||
if (md5(json_encode($data['data']) . $data['t']) != $data['sign']) {
|
||||
return app('json')->fail();
|
||||
return app('json')->fail('验签失败');
|
||||
}
|
||||
|
||||
switch ($data['type']) {
|
||||
case 'order_success':
|
||||
case 'order_success'://下单成功
|
||||
$update = [
|
||||
'label' => $data['data']['label'] ?? '',
|
||||
];
|
||||
@ -829,6 +830,28 @@ class StoreOrderController
|
||||
$this->services->update(['task_id' => $data['task_id']], $update);
|
||||
}
|
||||
break;
|
||||
case 'order_take'://取件
|
||||
if (isset($data['task_id'])) {
|
||||
$orderInfo = $this->services->get(['task_id' => $data['task_id']]);
|
||||
if (!$orderInfo) {
|
||||
return app('json')->fail('订单不存在');
|
||||
}
|
||||
$this->services->transaction(function () use ($data, $orderInfo) {
|
||||
$this->services->update(['task_id' => $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;
|
||||
}
|
||||
|
||||
return app('json')->success();
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -393,11 +393,11 @@ class StoreCombinationServices extends BaseServices
|
||||
|
||||
/** @var StorePinkServices $pinkService */
|
||||
$pinkService = app()->make(StorePinkServices::class);
|
||||
list($pink, $pindAll) = $pinkService->getPinkList($id, true);//拼团列表
|
||||
list($pink, $pinkAll) = $pinkService->getPinkList($id, true);//拼团列表
|
||||
$data['pink_ok_list'] = $pinkService->getPinkOkList($uid);
|
||||
$data['pink_ok_sum'] = $pinkService->getPinkOkSumTotalNum();
|
||||
$data['pink'] = $pink;
|
||||
$data['pindAll'] = $pindAll;
|
||||
$data['pinkAll'] = $pinkAll;
|
||||
|
||||
/** @var StoreOrderServices $storeOrderServices */
|
||||
$storeOrderServices = app()->make(StoreOrderServices::class);
|
||||
|
||||
@ -157,6 +157,7 @@ class StorePinkServices extends BaseServices
|
||||
$where['cid'] = $id;
|
||||
$where['k_id'] = 0;
|
||||
$where['is_refund'] = 0;
|
||||
$where['status'] = 1;
|
||||
$pinkList = $this->dao->pinkList($where);
|
||||
$ids = array_column($pinkList, 'id');
|
||||
$orderIdKey = array_column($pinkList, 'order_id_key');
|
||||
|
||||
@ -593,24 +593,48 @@ class StoreOrderDeliveryServices extends BaseServices
|
||||
}
|
||||
$orderInfo->delivery_id = $data['delivery_id'];
|
||||
}
|
||||
$data['status'] = 1;
|
||||
$orderInfo->delivery_type = $data['delivery_type'];
|
||||
$orderInfo->delivery_name = $data['delivery_name'];
|
||||
$orderInfo->status = $data['status'];
|
||||
/** @var StoreOrderStatusServices $services */
|
||||
$services = app()->make(StoreOrderStatusServices::class);
|
||||
$this->transaction(function () use ($id, $data, $services) {
|
||||
$res = $this->dao->update($id, $data);
|
||||
$res = $res && $services->save([
|
||||
'oid' => $id,
|
||||
'change_time' => time(),
|
||||
'change_type' => 'delivery_goods',
|
||||
'change_message' => '已发货 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
|
||||
]);
|
||||
if (!$res) {
|
||||
throw new AdminException(400529);
|
||||
}
|
||||
});
|
||||
if ($data['express_record_type'] != 3) {
|
||||
$data['status'] = 1;
|
||||
$orderInfo->delivery_type = $data['delivery_type'];
|
||||
$orderInfo->delivery_name = $data['delivery_name'];
|
||||
$orderInfo->status = $data['status'];
|
||||
/** @var StoreOrderStatusServices $services */
|
||||
$services = app()->make(StoreOrderStatusServices::class);
|
||||
$this->transaction(function () use ($id, $data, $services) {
|
||||
$res = $this->dao->update($id, $data);
|
||||
$res = $res && $services->save([
|
||||
'oid' => $id,
|
||||
'change_time' => time(),
|
||||
'change_type' => 'delivery_goods',
|
||||
'change_message' => '已发货 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
|
||||
]);
|
||||
if (!$res) {
|
||||
throw new AdminException(400529);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
$update = [
|
||||
'is_stock_up' => 1,
|
||||
'delivery_type' => $data['delivery_type'],
|
||||
'delivery_name' => $data['delivery_name'],
|
||||
];
|
||||
|
||||
/** @var StoreOrderStatusServices $services */
|
||||
$services = app()->make(StoreOrderStatusServices::class);
|
||||
$this->transaction(function () use ($id, $data, $services, $update) {
|
||||
$res = $this->dao->update($id, $update);
|
||||
$res = $res && $services->save([
|
||||
'oid' => $id,
|
||||
'change_time' => time(),
|
||||
'change_type' => 'stock_up_goods',
|
||||
'change_message' => '备货中 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
|
||||
]);
|
||||
if (!$res) {
|
||||
throw new AdminException(400529);
|
||||
}
|
||||
});
|
||||
}
|
||||
return $dump;
|
||||
}
|
||||
|
||||
|
||||
@ -129,7 +129,11 @@ class ExportServices extends BaseServices
|
||||
}
|
||||
$custom_form = '';
|
||||
foreach ($item['custom_form'] as $custom_form_value) {
|
||||
$custom_form .= $custom_form_value['title'] . ':' . $custom_form_value['value'] . ';';
|
||||
if (is_string($custom_form_value['value'])) {
|
||||
$custom_form .= $custom_form_value['title'] . ':' . $custom_form_value['value'] . ';';
|
||||
} elseif (is_array($custom_form_value['value'])) {
|
||||
$custom_form .= $custom_form_value['title'] . ':' . implode(',', $custom_form_value['value']) . ';';
|
||||
}
|
||||
}
|
||||
|
||||
$goodsName = [];
|
||||
|
||||
@ -180,7 +180,7 @@ class Express extends BaseExpress
|
||||
throw new ApiException('收件地址必须填写');
|
||||
}
|
||||
$param = [
|
||||
'kuaidi_num' => $data['kuaidicom'],
|
||||
'kuaidicom' => $data['kuaidicom'],
|
||||
'send_address' => $data['send_address'],
|
||||
'address' => $data['address'] ?? '',
|
||||
'weight' => $data['weight'] ?? '',
|
||||
|
||||
@ -114,6 +114,7 @@ class Jdoss extends BaseUpload
|
||||
'region' => $this->storageRegion,
|
||||
'endpoint' => "http://s3.{$this->storageRegion}.jdcloud-oss.com",
|
||||
'signature_version' => 'v4',
|
||||
'use_path_style_endpoint' => true,
|
||||
'credentials' => [
|
||||
'key' => $this->accessKey,
|
||||
'secret' => $this->secretKey,
|
||||
@ -326,11 +327,11 @@ class Jdoss extends BaseUpload
|
||||
'CORSConfiguration' => [ // REQUIRED
|
||||
'CORSRules' => [ // REQUIRED
|
||||
[
|
||||
'AllowedHeaders' => ['Authorization'],
|
||||
'AllowedMethods' => ['POST', 'GET', 'PUT'], // REQUIRED
|
||||
'AllowedHeaders' => ['*'],
|
||||
'AllowedMethods' => ['POST', 'GET', 'PUT', 'DELETE', 'HEAD'], // REQUIRED
|
||||
'AllowedOrigins' => ['*'], // REQUIRED
|
||||
'ExposeHeaders' => [],
|
||||
'MaxAgeSeconds' => 3000
|
||||
'ExposeHeaders' => ['Etag'],
|
||||
'MaxAgeSeconds' => 0
|
||||
],
|
||||
],
|
||||
]
|
||||
@ -353,14 +354,15 @@ class Jdoss extends BaseUpload
|
||||
'PutObject', [
|
||||
'Bucket' => $this->storageName,
|
||||
'Key' => $key,
|
||||
'SourceFile' => $path,
|
||||
// 'SourceFile' => $path,
|
||||
'ContentType' => $contentType
|
||||
]
|
||||
);
|
||||
$request = $app->createPresignedRequest($cmd, $expires);
|
||||
$request = $app->createPresignedRequest($cmd, $expires, ['Scheme' => 'https']);
|
||||
return [
|
||||
'url' => (string)$request->getUri(),
|
||||
'type' => 'JDOSS'
|
||||
'upload_url' => (string)$request->getUri(),
|
||||
'type' => 'JDOSS',
|
||||
'url' => $this->uploadUrl . '/' . $key
|
||||
];
|
||||
} catch (\Throwable $e) {
|
||||
return $this->setError($e->getMessage());
|
||||
|
||||
@ -6,6 +6,7 @@ use crmeb\exceptions\AdminException;
|
||||
use crmeb\exceptions\UploadException;
|
||||
use crmeb\services\upload\extend\obs\Client as TyClient;
|
||||
use crmeb\services\upload\BaseUpload;
|
||||
use DateTimeInterface;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
|
||||
class Obs extends BaseUpload
|
||||
@ -236,8 +237,8 @@ class Obs extends BaseUpload
|
||||
'AllowedHeader' => ['*'],
|
||||
'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'],
|
||||
'AllowedOrigin' => ['*'],
|
||||
'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'],
|
||||
'MaxAgeSeconds' => 100
|
||||
'ExposeHeader' => ['ETag'],
|
||||
'MaxAgeSeconds' => 0
|
||||
]);
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
@ -249,15 +250,59 @@ class Obs extends BaseUpload
|
||||
* @return array
|
||||
* @date 2023/6/13
|
||||
*/
|
||||
public function getTempKeys()
|
||||
public function getTempKeys($callbackUrl = '', $dir = '')
|
||||
{
|
||||
// return [
|
||||
// 'access_key' => $this->accessKey,
|
||||
// 'secret_key' => $this->secretKey,
|
||||
// 'type' => 'OBS'
|
||||
// ];
|
||||
// TODO: Implement getTempKeys() method.
|
||||
$base64CallbackBody = base64_encode(json_encode([
|
||||
'callbackUrl' => $callbackUrl,
|
||||
'callbackBody' => 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}',
|
||||
'callbackBodyType' => "application/x-www-form-urlencoded"
|
||||
]));
|
||||
|
||||
$policy = json_encode([
|
||||
'expiration' => $this->gmtIso8601(time() + 300),
|
||||
'conditions' =>
|
||||
[
|
||||
[0 => 'content-length-range', 1 => 0, 2 => 1048576000],
|
||||
['bucket' => $this->storageName],
|
||||
[0 => 'starts-with', 1 => '$key', 2 => $dir],
|
||||
]
|
||||
]);
|
||||
$base64Policy = base64_encode($policy);
|
||||
$signature = base64_encode(hash_hmac('sha1', $base64Policy, $this->secretKey, true));
|
||||
return [
|
||||
'access_key' => $this->accessKey,
|
||||
'secret_key' => $this->secretKey,
|
||||
'accessid' => $this->accessKey,
|
||||
'host' => $this->uploadUrl,
|
||||
'policy' => $base64Policy,
|
||||
'signature' => $signature,
|
||||
'expire' => time() + 30,
|
||||
'callback' => $base64CallbackBody,
|
||||
'cdn' => $this->cdn,
|
||||
'type' => 'OBS'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ISO时间格式
|
||||
* @param $time
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function gmtIso8601($time): string
|
||||
{
|
||||
$dtStr = date("c", $time);
|
||||
$myDateTime = new \DateTime($dtStr);
|
||||
$expiration = $myDateTime->format(DateTimeInterface::ISO8601);
|
||||
$pos = strpos($expiration, '+');
|
||||
$expiration = substr($expiration, 0, $pos);
|
||||
return $expiration . "Z";
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图
|
||||
* @param string $filePath
|
||||
|
||||
@ -5,6 +5,7 @@ namespace crmeb\services\upload\storage;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\services\upload\extend\obs\Client as TyClient;
|
||||
use crmeb\services\upload\BaseUpload;
|
||||
use DateTimeInterface;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
|
||||
class Tyoss extends BaseUpload
|
||||
@ -364,8 +365,8 @@ class Tyoss extends BaseUpload
|
||||
'AllowedHeader' => ['*'],
|
||||
'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'],
|
||||
'AllowedOrigin' => ['*'],
|
||||
'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'],
|
||||
'MaxAgeSeconds' => 100
|
||||
'ExposeHeader' => ['ETag'],
|
||||
'MaxAgeSeconds' => 0
|
||||
]);
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
@ -374,18 +375,62 @@ class Tyoss extends BaseUpload
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $callbackUrl
|
||||
* @param string $dir
|
||||
* @return array
|
||||
* @date 2023/6/13
|
||||
* @throws \Exception
|
||||
* @author 吴汐
|
||||
* @email 442384644@qq.com
|
||||
* @date 2023/06/19
|
||||
*/
|
||||
public function getTempKeys()
|
||||
public function getTempKeys($callbackUrl = '', $dir = '')
|
||||
{
|
||||
// TODO: Implement getTempKeys() method.
|
||||
$base64CallbackBody = base64_encode(json_encode([
|
||||
'callbackUrl' => $callbackUrl,
|
||||
'callbackBody' => 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}',
|
||||
'callbackBodyType' => "application/x-www-form-urlencoded"
|
||||
]));
|
||||
|
||||
$policy = json_encode([
|
||||
'expiration' => $this->gmtIso8601(time() + 300),
|
||||
'conditions' =>
|
||||
[
|
||||
[0 => 'content-length-range', 1 => 0, 2 => 1048576000],
|
||||
['bucket' => $this->storageName],
|
||||
[0 => 'starts-with', 1 => '$key', 2 => $dir],
|
||||
]
|
||||
]);
|
||||
$base64Policy = base64_encode($policy);
|
||||
$signature = base64_encode(hash_hmac('sha1', $base64Policy, $this->secretKey, true));
|
||||
return [
|
||||
'access_key' => $this->accessKey,
|
||||
'secret_key' => $this->secretKey,
|
||||
'type' => 'TYOSS'
|
||||
'accessid' => $this->accessKey,
|
||||
'host' => $this->uploadUrl,
|
||||
'policy' => $base64Policy,
|
||||
'signature' => $signature,
|
||||
'expire' => time() + 30,
|
||||
'callback' => $base64CallbackBody,
|
||||
'cdn' => $this->cdn,
|
||||
'type' => 'OBS'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ISO时间格式
|
||||
* @param $time
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function gmtIso8601($time): string
|
||||
{
|
||||
$dtStr = date("c", $time);
|
||||
$myDateTime = new \DateTime($dtStr);
|
||||
$expiration = $myDateTime->format(DateTimeInterface::ISO8601);
|
||||
$pos = strpos($expiration, '+');
|
||||
$expiration = substr($expiration, 0, $pos);
|
||||
return $expiration . "Z";
|
||||
}
|
||||
|
||||
/**
|
||||
* 缩略图
|
||||
* @param string $filePath
|
||||
|
||||
@ -28438,6 +28438,7 @@ CREATE TABLE IF NOT EXISTS `eb_store_order` (
|
||||
`pay_type` varchar(32) NOT NULL DEFAULT '' COMMENT '支付方式',
|
||||
`add_time` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态(-1 : 申请退款 -2 : 退货成功 0:待发货;1:待收货;2:已收货;3:待评价;-1:已退款)',
|
||||
`is_stock_up` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '是否备货中',
|
||||
`refund_status` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 未退款 1 申请中 2 已退款',
|
||||
`refund_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '退款申请类型',
|
||||
`refund_express` varchar(255) NOT NULL DEFAULT '' COMMENT '退货快递单号',
|
||||
|
||||
@ -291,10 +291,6 @@ export default {
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
modals(newVal) {
|
||||
if (newVal) {
|
||||
}
|
||||
},
|
||||
virtual_type(val) {
|
||||
if (this.virtual_type == 3) this.formItem.type = '3';
|
||||
},
|
||||
@ -310,9 +306,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
watchPrice() {
|
||||
console.log(1111);
|
||||
let data = {
|
||||
kuaidicom: this.formItem.delivery_code,
|
||||
send_address: this.formItem.to_addr,
|
||||
orderId: this.orderId,
|
||||
service_type: this.formItem.service_type,
|
||||
cart_ids: [],
|
||||
};
|
||||
|
||||
@ -618,7 +618,7 @@
|
||||
'<img style="max-width:100%;height:auto;float:left;display:block" ');
|
||||
that.attribute.productSelect.num = res.data.storeInfo.num;
|
||||
that.pink = res.data.pink;
|
||||
that.pindAll = res.data.pindAll;
|
||||
that.pinkAll = res.data.pinkAll;
|
||||
that.reply = res.data.reply ? [res.data.reply] : [];
|
||||
that.replyCount = res.data.replyCount;
|
||||
that.itemNew = res.data.pink_ok_list;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user