|
|
@@ -32,16 +32,16 @@ class Test extends Base
|
|
|
$order = (new SaasOrder)->where("order_sn",$param["order"])->with(['product','poi','user'])->findOrEmpty();
|
|
|
echo "订单状态==={$order['status']}\n";
|
|
|
if ($order->isEmpty()) return errorTrans("empty.data");
|
|
|
- if ($order['status'] <> 7) return error("该订单状态不支持核销");
|
|
|
+// if ($order['status'] <> 7) return error("该订单状态不支持核销");
|
|
|
// if ($request->user['store_id'] <> $order['poi_id'] && $request->user['is_super'] == 0) return errorTrans("empty.data");
|
|
|
- $orderExpress = (new SaasOrderExpress)->where("order_sn",$order['out_order_no'])->findOrEmpty();
|
|
|
- if ($orderExpress->isEmpty()) return error("订单尚未发货");
|
|
|
- if (!empty($order['error_at'])) {
|
|
|
- if (strtotime("+24 hour",strtotime($order['error_at'])) < time()) return error("新订单需24小时后方可核销");
|
|
|
- }
|
|
|
- [$state,$expressData] = (new LifeWeb)->getExpressData($orderExpress['express_sn'],$orderExpress['mobile']);
|
|
|
- if (!$state) return error("查询物流失败,请联系管理员");
|
|
|
- if (!in_array($expressData['logisticsStatusDesc'],['派件中',"已签收"])) return error("当前物流状态不允许核销");
|
|
|
+// $orderExpress = (new SaasOrderExpress)->where("order_sn",$order['out_order_no'])->findOrEmpty();
|
|
|
+// if ($orderExpress->isEmpty()) return error("订单尚未发货");
|
|
|
+// if (!empty($order['error_at'])) {
|
|
|
+// if (strtotime("+24 hour",strtotime($order['error_at'])) < time()) return error("新订单需24小时后方可核销");
|
|
|
+// }
|
|
|
+// [$state,$expressData] = (new LifeWeb)->getExpressData($orderExpress['express_sn'],$orderExpress['mobile']);
|
|
|
+// if (!$state) return error("查询物流失败,请联系管理员");
|
|
|
+// if (!in_array($expressData['logisticsStatusDesc'],['派件中',"已签收"])) return error("当前物流状态不允许核销");
|
|
|
$startTime = $order['poi']['order_start']??'09:00';
|
|
|
$endTime = $order['poi']['order_end']??'22:30';
|
|
|
$startTimeStamp = strtotime(date("Y-m-d {$startTime}:00"));
|
|
|
@@ -68,95 +68,6 @@ class Test extends Base
|
|
|
} else {
|
|
|
return error("当前时间段不支持核销");
|
|
|
}
|
|
|
-// if ($order['status'] <> 2)
|
|
|
-// {
|
|
|
-// echo getDateFull()."===订单状态不符合核销\n";
|
|
|
-// return error("订单状态不符合核销",$order->toArray());
|
|
|
-// }
|
|
|
-// // 获取到订单encrypted_code
|
|
|
-// $orderCode = (new OrderData)->config([
|
|
|
-// "appid" => sConf("wechat.appid"),
|
|
|
-// "secret" => sConf("wechat.secret"),
|
|
|
-// "account" => sConf("wechat.shop_id"),
|
|
|
-// ])->token()->getCertificate($order['order_sn'],$order['poi']['store_id']);
|
|
|
-// if (empty($orderCode['certificates']))
|
|
|
-// {
|
|
|
-// echo getDateFull()."===获取订单数据失败\n";
|
|
|
-// return error("获取订单数据失败",$orderCode);
|
|
|
-// }
|
|
|
-// echo getDateFull()."===核销数据\n";
|
|
|
-// print_r($orderCode['certificates']);
|
|
|
-// $encrypted_code = [];
|
|
|
-// foreach ($orderCode['certificates'] as $key=>$v)
|
|
|
-// {
|
|
|
-// if (empty($v['encrypted_code']))
|
|
|
-// {
|
|
|
-// echo getDateFull()."===获取订单数据失败\n";
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// if ($v['status'] <> 1) {
|
|
|
-// echo getDateFull()."===该订单状态不支持核销\n";
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// $encrypted_code[$key] = $v['encrypted_code'];
|
|
|
-// }
|
|
|
-// echo getDateFull()."===券码数据\n";
|
|
|
-// print_r($encrypted_code);
|
|
|
-// if (empty($encrypted_code))
|
|
|
-// {
|
|
|
-// echo getDateFull()."===没有可核销券码\n";
|
|
|
-// $order->express_status = 3;
|
|
|
-// $order->done_at = getDateFull();
|
|
|
-// $order->save();
|
|
|
-// return error("没有可核销券码",$encrypted_code);
|
|
|
-// }
|
|
|
-// // 核销订单
|
|
|
-// $orderDone = (new OrderData)->config([
|
|
|
-// "appid" => sConf("wechat.appid"),
|
|
|
-// "secret" => sConf("wechat.secret"),
|
|
|
-// "account" => sConf("wechat.shop_id"),
|
|
|
-// ])->token()->verifyCertificate([
|
|
|
-// "account_id" => $order['poi']['store_id'],
|
|
|
-// "pay_sn" => $order['pay_sn'],
|
|
|
-//// "encrypted_code" => $orderCode['certificates'][0]['encrypted_code'],
|
|
|
-// "encrypted_code" => array_values($encrypted_code),
|
|
|
-// "order_id" => $order['order_sn'],
|
|
|
-// "poi_id" => $order['poi_id']
|
|
|
-// ]);
|
|
|
-// echo getDateFull()."===核销返回\n";
|
|
|
-// print_r($orderDone);
|
|
|
-// if (empty($orderDone['verify_results']))
|
|
|
-// {
|
|
|
-// echo getDateFull()."===核销失败\n";
|
|
|
-// return error("核销失败",$orderDone);
|
|
|
-// }
|
|
|
-// $doneData = [];
|
|
|
-// foreach ($orderDone['verify_results'] as $key=>$v)
|
|
|
-// {
|
|
|
-// if(empty($v['verify_id'])) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// if(empty($v['certificate_id'])) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// $doneData[$key] = [
|
|
|
-// "poi_id" => $order['poi_id'],
|
|
|
-// "order_sn" => $order['order_sn'],
|
|
|
-// "money" => $order['price'],
|
|
|
-// "certificate_id" => $v['certificate_id'],
|
|
|
-// "verify_id" => $v['verify_id'],
|
|
|
-// ];
|
|
|
-// }
|
|
|
-// if (empty($doneData))
|
|
|
-// {
|
|
|
-// echo getDateFull()."===核销完成无数据返回\n";
|
|
|
-// return error("核销完成无数据返回",$doneData);
|
|
|
-// }
|
|
|
-// $order->express_status = 3;
|
|
|
-// $order->done_at = getDateFull();
|
|
|
-// $order->save();
|
|
|
-// (new SaasOrderItem)->where(['order_sn'=>$order['order_sn'],'status'=>1])->update(['status'=>3]);
|
|
|
-// (new SaasOrderVerify)->insertAll(array_values($doneData));
|
|
|
} catch (\Throwable $throwable) {
|
|
|
echo $throwable->getMessage()."\n";
|
|
|
echo $throwable->getFile()."\n";
|
|
|
@@ -212,7 +123,7 @@ class Test extends Base
|
|
|
}
|
|
|
(new SaasOrder)->where($where)->save(['is_done' => 1]);
|
|
|
$expressUpData['status'] = 1;
|
|
|
- $msg = ("订单可以核销=={$resp['order_sn']}=={$resp['express_sn']}==".getDateFull())
|
|
|
+ $msg = ("订单可以核销=={$resp['order_sn']}=={$resp['express_sn']}==".getDateFull());
|
|
|
} else {
|
|
|
$msg = ("查询物流成功=={$resp['express_sn']}=={$resp['order_sn']}=={$expressData['logisticsStatusDesc']}==".getDateFull());
|
|
|
}
|
|
|
@@ -224,6 +135,27 @@ class Test extends Base
|
|
|
}
|
|
|
|
|
|
|
|
|
+ #[GetMapping('mini/at')]
|
|
|
+ public function checkOrderAt(Request $request): Response
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $param = $this->_valid([
|
|
|
+ "order.require" => trans("empty.require")
|
|
|
+ ],$request->method());
|
|
|
+ if (!is_array($param)) return error($param);
|
|
|
+ $order = (new SaasOrder)->where("order_sn",$param['order'])->findOrEmpty();
|
|
|
+ echo getDateFull()."===发货时间:{$order['error_at']}\n";
|
|
|
+ if (!empty($order['error_at'])) {
|
|
|
+ echo time()."===".strtotime("+1 day",strtotime($order['error_at']))."\n";
|
|
|
+ if (strtotime("+1 day",strtotime($order['error_at'])) < time()) return error("新订单需24小时后方可核销");
|
|
|
+ }
|
|
|
+ return success("ok");
|
|
|
+ } catch (\Throwable $throwable) {
|
|
|
+ return error($throwable->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
protected function getExpressData(string $expressNo = "",string $mobile = ""): array
|
|
|
{
|
|
|
$url = "https://kzexpress.market.alicloudapi.com/api-mall/api/express/query";
|