下单接口添加字段

pull/1/head
ztt 11 months ago
parent 3e9d8aa588
commit aac5e719df
  1. 3
      app/api/service/order/Checkout.php
  2. 8
      app/common.php
  3. 21
      app/common/model/Order.php
  4. 3
      app/store/model/OrderRefund.php

@ -850,6 +850,9 @@ class Checkout extends BaseService
'order_status' => OrderStatusEnum::NORMAL,
'platform' => getPlatform(),
'store_id' => $this->storeId,
'expect_receive_time' => $this->param['expect_receive_time'],//期待收货时间
'is_street_take' => $this->param['is_street_take'],//是否街边1-在 0-不在
'to_store_time' => $this->param['to_store_time'],//预计到店时间
];
if ($order['delivery'] == DeliveryTypeEnum::EXPRESS) {
$data['express_price'] = $order['expressPrice'];

@ -458,3 +458,11 @@ function getUrl($value, $host = ''){
return $value ? $host."/".$value : "";
}
function calc_time($startTime, $endTime) {
$diffTime = ($endTime - $startTime);
if ($diffTime > 3600) {
return "";
}
return date('i分钟s秒', (3600 - $diffTime));
}

@ -57,6 +57,8 @@ class Order extends BaseModel
'state_text', // 售后单状态文字描述
'pay_method_text', //订单支付方式文字描述
'delivery_type_text', //配送方式文字描述
'time_text', //倒计时文字
'store_phone'//商家电话
];
/**
@ -406,4 +408,23 @@ class Order extends BaseModel
{
return !empty(DeliveryType::data()[$data['delivery_type']])? DeliveryType::data()[$data['delivery_type']]['name']: '';//配送方式
}
public function getTimeTextAttr($value, $data) : int
{
$diffTime = 60*60*24;//24小时倒计时
// 付款状态
if ($data['pay_status'] == PayStatusEnum::PENDING) {
return (($data['create_time'] + $diffTime) - time()) * 1000;
}
// 收货状态
if ($data['receipt_status'] == ReceiptStatusEnum::NOT_RECEIVED) {
return (($data['delivery_time'] + $diffTime) - time()) * 1000;
}
return 0;
}
public function getStorePhoneAttr($value,$data) {
return Store::get($data['store_id'])->phone ?: '';
}
}

@ -108,8 +108,6 @@ class OrderRefund extends OrderRefundModel
foreach ($list['data'] as $key => $row) {
$row['orderData']['pay_method_text'] = Method::data()[$row['orderData']['pay_method']]['name'];//支付方式
$row['orderData']['delivery_type_text'] = DeliveryType::data()[$row['orderData']['delivery_type']]['name'];//配送方式
// $row['orderData']['order_status'] = $row['orderData']['status'];
// unset($row['orderData']['status']);
$newRow = array_merge($row, $row['orderData']);
$list['data'][$key] = $newRow;
unset($list['data'][$key]['orderData']);
@ -160,6 +158,7 @@ class OrderRefund extends OrderRefundModel
}
// 起止时间
if (!empty($params['betweenTime'])) {
$params['betweenTime'] = explode(',', $params['betweenTime']);
$times = between_time($params['betweenTime']);
$filter[] = ['refund.create_time', '>=', $times['start_time']];
$filter[] = ['refund.create_time', '<', $times['end_time'] + 86400];

Loading…
Cancel
Save