diff --git a/addons/cos/controller/Index.php b/addons/cos/controller/Index.php index 77d8c44..39e791d 100644 --- a/addons/cos/controller/Index.php +++ b/addons/cos/controller/Index.php @@ -447,7 +447,7 @@ class Index extends Controller $this->error("签名不正确"); } $json = json_decode(base64_decode($data), true); - if ($json['deadline'] < time()) { + if (($json['deadline'] ?? null)< time()) { $this->error("请求已经超时"); } } diff --git a/addons/epay/controller/Api.php b/addons/epay/controller/Api.php index f589f63..a3a051f 100644 --- a/addons/epay/controller/Api.php +++ b/addons/epay/controller/Api.php @@ -88,7 +88,7 @@ class Api extends Controller $orderid = $this->request->post("orderid"); try { $result = $pay->find($orderid, 'scan'); - if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { + if (($result['return_code'] ?? null)== 'SUCCESS' && ($result['result_code'] ?? null)== 'SUCCESS') { $this->success("", "", ['status' => $result['trade_state']]); } else { $this->error("查询失败"); @@ -150,7 +150,7 @@ class Api extends Controller $pay = Pay::alipay($config); try { $result = $pay->find($orderid, 'scan'); - if ($result['code'] == '10000' && $result['trade_status'] == 'TRADE_SUCCESS') { + if (($result['code'] ?? null)== '10000' && ($result['trade_status'] ?? null)== 'TRADE_SUCCESS') { $this->success("", "", ['status' => $result['trade_status']]); } else { $this->error("查询失败"); diff --git a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/AppGateway.php b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/AppGateway.php index 860b44b..2ae6cfa 100644 --- a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/AppGateway.php +++ b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/AppGateway.php @@ -26,7 +26,7 @@ class AppGateway extends Gateway $biz_array = json_decode($payload['biz_content'], true); if ((Alipay::MODE_SERVICE === $this->mode) && (!empty(Support::getInstance()->pid))) { - $biz_array['extend_params'] = is_array($biz_array['extend_params']) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], $biz_array['extend_params']) : ['sys_service_provider_id' => Support::getInstance()->pid]; + $biz_array['extend_params'] = is_array(($biz_array['extend_params'] ?? null)) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], ($biz_array['extend_params'] ?? [])) : ['sys_service_provider_id' => Support::getInstance()->pid]; } $payload['biz_content'] = json_encode(array_merge($biz_array, ['product_code' => 'QUICK_MSECURITY_PAY'])); $payload['sign'] = Support::generateSign($payload); diff --git a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/MiniGateway.php b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/MiniGateway.php index 0198194..55158c9 100644 --- a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/MiniGateway.php +++ b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/MiniGateway.php @@ -29,7 +29,7 @@ class MiniGateway extends Gateway public function pay($endpoint, array $payload): Collection { $biz_array = json_decode($payload['biz_content'], true); - if (empty($biz_array['buyer_id'])) { + if (empty(($biz_array['buyer_id'] ?? null))) { throw new InvalidArgumentException('buyer_id required'); } if ((Alipay::MODE_SERVICE === $this->mode) && (!empty(Support::getInstance()->pid))) { diff --git a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/PosGateway.php b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/PosGateway.php index de04761..df1426d 100644 --- a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/PosGateway.php +++ b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/PosGateway.php @@ -29,7 +29,7 @@ class PosGateway extends Gateway $payload['method'] = 'alipay.trade.pay'; $biz_array = json_decode($payload['biz_content'], true); if ((Alipay::MODE_SERVICE === $this->mode) && (!empty(Support::getInstance()->pid))) { - $biz_array['extend_params'] = is_array($biz_array['extend_params']) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], $biz_array['extend_params']) : ['sys_service_provider_id' => Support::getInstance()->pid]; + $biz_array['extend_params'] = is_array(($biz_array['extend_params'] ?? null)) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], ($biz_array['extend_params'] ?? [])) : ['sys_service_provider_id' => Support::getInstance()->pid]; } $payload['biz_content'] = json_encode(array_merge( $biz_array, diff --git a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/ScanGateway.php b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/ScanGateway.php index 9d6cbc3..f043370 100644 --- a/addons/epay/library/Yansongda/Pay/Gateways/Alipay/ScanGateway.php +++ b/addons/epay/library/Yansongda/Pay/Gateways/Alipay/ScanGateway.php @@ -29,7 +29,7 @@ class ScanGateway extends Gateway $payload['method'] = 'alipay.trade.precreate'; $biz_array = json_decode($payload['biz_content'], true); if ((Alipay::MODE_SERVICE === $this->mode) && (!empty(Support::getInstance()->pid))) { - $biz_array['extend_params'] = is_array($biz_array['extend_params']) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], $biz_array['extend_params']) : ['sys_service_provider_id' => Support::getInstance()->pid]; + $biz_array['extend_params'] = is_array(($biz_array['extend_params'] ?? null)) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], ($biz_array['extend_params'] ?? [])) : ['sys_service_provider_id' => Support::getInstance()->pid]; } $payload['biz_content'] = json_encode(array_merge($biz_array, ['product_code' => ''])); $payload['sign'] = Support::generateSign($payload); diff --git a/addons/epay/library/Yansongda/Supports/Logger.php b/addons/epay/library/Yansongda/Supports/Logger.php index 7232c59..7a3a24b 100644 --- a/addons/epay/library/Yansongda/Supports/Logger.php +++ b/addons/epay/library/Yansongda/Supports/Logger.php @@ -205,7 +205,11 @@ class Logger */ public function createHandler(): AbstractHandler { - $file = $this->config['file'] ?? sys_get_temp_dir().'/logs/'.$this->config['identify'].'.log'; + $file = $this->config['file'] ?? (defined('RUNTIME_PATH') ? RUNTIME_PATH . 'epay' . DIRECTORY_SEPARATOR . $this->config['identify'] . '.log' : sys_get_temp_dir().'/logs/'.$this->config['identify'].'.log'); + $dir = dirname($file); + if (!is_dir($dir)) { + @mkdir($dir, 0755, true); + } if ('single' === $this->config['type']) { return new StreamHandler($file, $this->config['level']); diff --git a/addons/qrcode/library/BaconQrCode/Renderer/Module/EdgeIterator/EdgeIterator.php b/addons/qrcode/library/BaconQrCode/Renderer/Module/EdgeIterator/EdgeIterator.php index af52d52..8ccc425 100644 --- a/addons/qrcode/library/BaconQrCode/Renderer/Module/EdgeIterator/EdgeIterator.php +++ b/addons/qrcode/library/BaconQrCode/Renderer/Module/EdgeIterator/EdgeIterator.php @@ -49,12 +49,12 @@ final class EdgeIterator implements IteratorAggregate $point = $this->findNext(0, 0); while (null !== $point) { - $edge = $this->findEdge($point[0], $point[1]); + $edge = $this->findEdge(($point[0] ?? null), ($point[1] ?? null)); $this->xorEdge($edge); yield $edge; - $point = $this->findNext($point[0], $point[1]); + $point = $this->findNext(($point[0] ?? null), ($point[1] ?? null)); } $this->bytes = $originalBytes; diff --git a/addons/shopro/controller/Express.php b/addons/shopro/controller/Express.php index 426c88d..bb31ec0 100644 --- a/addons/shopro/controller/Express.php +++ b/addons/shopro/controller/Express.php @@ -28,7 +28,7 @@ class Express extends Base // \think\Log::write('expresscallback:'. json_encode($requestData)); $data = json_decode(html_entity_decode($requestData['RequestData']), true); - $expressData = $data['Data']; + $expressData = ($data['Data'] ?? null); foreach ($expressData as $key => $express) { // 查找包裹 diff --git a/addons/shopro/controller/Index.php b/addons/shopro/controller/Index.php index 7ebaa50..1860891 100644 --- a/addons/shopro/controller/Index.php +++ b/addons/shopro/controller/Index.php @@ -36,7 +36,7 @@ class Index extends Base // 商城基本设置 $shoproConfig = json_decode($config['shopro'], true); - $shoproConfig['logo'] = cdnurl($shoproConfig['logo'], true); + $shoproConfig['logo'] = cdnurl(($shoproConfig['logo'] ?? null), true); $data['shop'] = $shoproConfig; // 支付设置 @@ -44,7 +44,7 @@ class Index extends Base $paymentConfig = []; foreach ($payment as $key => $v) { $val = json_decode($v->value, true); - if ($val && in_array($platform, $val['platform'])) { + if ($val && in_array($platform, ($val['platform'] ?? []))) { $paymentConfig[] = $v->name; } } @@ -74,7 +74,7 @@ class Index extends Base // 分享设置 $shareConfig = json_decode($config['share'], true); $data['share'] = [ - 'title' => $shareConfig['title'], + 'title' => ($shareConfig['title'] ?? null), 'image' => isset($shareConfig['image']) ? cdnurl($shareConfig['image'], true) : '', 'goods_poster_bg' => isset($shareConfig['goods_poster_bg']) ? cdnurl($shareConfig['goods_poster_bg'], true) : '', 'user_poster_bg' => isset($shareConfig['user_poster_bg']) ? cdnurl($shareConfig['user_poster_bg'], true) : '', diff --git a/addons/shopro/controller/User.php b/addons/shopro/controller/User.php index dcd1ab6..fd0a7fb 100644 --- a/addons/shopro/controller/User.php +++ b/addons/shopro/controller/User.php @@ -414,7 +414,7 @@ class User extends Base $payload = json_decode(htmlspecialchars_decode($params['payload']), true); // 解析前端主机 - if ($payload['event'] !== 'login' && $payload['token'] !== '') { + if (($payload['event'] ?? null)!== 'login' && ($payload['token'] ?? null)!== '') { $this->auth->init($payload['token']); } diff --git a/addons/shopro/controller/Wechat.php b/addons/shopro/controller/Wechat.php index 79d9854..88e0881 100644 --- a/addons/shopro/controller/Wechat.php +++ b/addons/shopro/controller/Wechat.php @@ -166,7 +166,7 @@ class Wechat extends Base break; } - switch ($message['type']) { + switch (($message['type'] ?? null)) { case 'text': //回复文本 $content = new \EasyWeChat\Kernel\Messages\Text($message['content']); break; diff --git a/addons/shopro/job/ActivityGrouponAutoOper.php b/addons/shopro/job/ActivityGrouponAutoOper.php index 1a817fd..8800c9d 100644 --- a/addons/shopro/job/ActivityGrouponAutoOper.php +++ b/addons/shopro/job/ActivityGrouponAutoOper.php @@ -26,7 +26,7 @@ class ActivityGrouponAutoOper extends BaseJob $activityGroupon = ActivityGroupon::where('id', $activity_groupon_id)->find(); // 活动正在进行中, 走这里的说明人数 都没满 - if ($activityGroupon && $activityGroupon['status'] == 'ing') { + if ($activityGroupon && ($activityGroupon['status'] ?? null)== 'ing') { \think\Db::transaction(function () use ($activity, $activityGroupon) { $rules = $activity['rules']; // 是否虚拟成团 diff --git a/addons/shopro/job/OrderAutoOper.php b/addons/shopro/job/OrderAutoOper.php index ac7d668..5e66e24 100644 --- a/addons/shopro/job/OrderAutoOper.php +++ b/addons/shopro/job/OrderAutoOper.php @@ -107,7 +107,7 @@ class OrderAutoOper extends BaseJob // 获取自动好评内容 $config = Config::where('name', 'order')->cache(300)->find(); // 读取配置自动缓存 5 分钟 - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; $comment_content = (isset($config['order_comment_content']) && $config['order_comment_content']) ? $config['order_comment_content'] : '用户默认好评'; // 单位天 diff --git a/addons/shopro/job/OrderPayed.php b/addons/shopro/job/OrderPayed.php index 8a5e604..3f38e1a 100644 --- a/addons/shopro/job/OrderPayed.php +++ b/addons/shopro/job/OrderPayed.php @@ -28,7 +28,7 @@ class OrderPayed extends BaseJob $order = $data['order']; $user = $data['user']; - $order = Order::with('item')->where('id', $order['id'])->find(); + $order = Order::with('item')->where('id', ($order['id'] ?? null))->find(); // 数据库删订单的问题常见,这里被删的订单直接把队列移除 if ($order) { @@ -51,7 +51,7 @@ class OrderPayed extends BaseJob } // 处理消费返积分 TODO: 待测试 $scoreConfig = Config::where('name', 'score')->find(); - $scoreConfig = json_decode($scoreConfig['value'], true); + $scoreConfig = json_decode(($scoreConfig['value'] ?? null), true); if(!empty($scoreConfig['consume_get_score']) && !empty($scoreConfig['consume_get_score_ratio'])) { $scoreRatio = intval($scoreConfig['consume_get_score_ratio']); $score = intval($scoreRatio * 0.01 * $order->total_fee); diff --git a/addons/shopro/library/Express.php b/addons/shopro/library/Express.php index 112713f..8de49b3 100644 --- a/addons/shopro/library/Express.php +++ b/addons/shopro/library/Express.php @@ -51,7 +51,7 @@ class Express if ($result['ret'] == 1) { $exResult = json_decode($result['msg'], true); - if (!$exResult['Success']) { + if (!($exResult['Success'] ?? null)) { throw new \Exception($exResult['Reason']); } @@ -79,7 +79,7 @@ class Express if ($result['ret'] == 1) { $exResult = json_decode($result['msg'], true); - if (!$exResult['Success']) { + if (!($exResult['Success'] ?? null)) { throw new \Exception($exResult['Reason']); } @@ -198,7 +198,7 @@ class Express if ($result['ret'] == 1) { $exResult = json_decode($result['msg'], true); - if (!$exResult['Success']) { + if (!($exResult['Success'] ?? null)) { throw new \Exception($exResult['Reason']); } diff --git a/addons/shopro/library/PayService.php b/addons/shopro/library/PayService.php index 6bf40a8..3fab061 100644 --- a/addons/shopro/library/PayService.php +++ b/addons/shopro/library/PayService.php @@ -30,7 +30,7 @@ class PayService $paymentConfig = json_decode(\addons\shopro\model\Config::get(['name' => $this->payment])->value, true); // 如果是支付,并且不是 复制地址的支付宝支付 - if ($this->type == 'pay' && $this->platform != 'url' && !in_array($this->platform, $paymentConfig['platform'])) { + if ($this->type == 'pay' && $this->platform != 'url' && !in_array($this->platform, ($paymentConfig['platform'] ?? []))) { new Exception('暂不支持该方式付款'); } @@ -57,7 +57,7 @@ class PayService case 'wxOfficialAccount': $platformConfig = json_decode(\addons\shopro\model\Config::get(['name' => $this->platform])->value, true); if (isset($this->config['mode']) && $this->config['mode'] === 'service') { - $this->config['sub_app_id'] = $platformConfig['app_id']; + $this->config['sub_app_id'] = ($platformConfig['app_id'] ?? null); $this->config['app_id'] = $this->config['app_id']; // 主商户号,关联的 app_id } else { $this->config['app_id'] = $platformConfig['app_id']; @@ -66,7 +66,7 @@ class PayService case 'wxMiniProgram': $platformConfig = json_decode(\addons\shopro\model\Config::get(['name' => $this->platform])->value, true); if (isset($this->config['mode']) && $this->config['mode'] === 'service') { - $this->config['sub_miniapp_id'] = $platformConfig['app_id']; + $this->config['sub_miniapp_id'] = ($platformConfig['app_id'] ?? null); // $this->config['sub_app_id'] = $platformConfig['app_id']; $this->config['miniapp_id'] = $this->config['app_id']; // 主商户号,关联的 app_id } else { @@ -77,7 +77,7 @@ class PayService case 'H5': $platformConfig = json_decode(\addons\shopro\model\Config::get(['name' => $this->platform])->value, true); if (isset($this->config['mode']) && $this->config['mode'] === 'service') { - $this->config['sub_app_id'] = $platformConfig['app_id']; + $this->config['sub_app_id'] = ($platformConfig['app_id'] ?? null); $this->config['appid'] = $this->config['app_id']; // 主商户号,关联的 app_id } else { $this->config['app_id'] = $platformConfig['app_id']; @@ -86,7 +86,7 @@ class PayService case 'App': $platformConfig = json_decode(\addons\shopro\model\Config::get(['name' => 'App'])->value, true); if (isset($this->config['mode']) && $this->config['mode'] === 'service') { - $this->config['sub_appid'] = $platformConfig['app_id']; + $this->config['sub_appid'] = ($platformConfig['app_id'] ?? null); $this->config['sub_app_id'] = $platformConfig['app_id']; $this->config['appid'] = $this->config['app_id']; // 主商户号,关联的 app_id } else { diff --git a/addons/shopro/library/Wechat.php b/addons/shopro/library/Wechat.php index 3581fd7..8efee39 100644 --- a/addons/shopro/library/Wechat.php +++ b/addons/shopro/library/Wechat.php @@ -152,7 +152,7 @@ class Wechat extends Model if (isset($result['ret']) && $result['ret']) { // 请求成功 - $result = json_decode($result['msg'], true); + $result = json_decode(($result['msg'] ?? null), true); return $result; } diff --git a/addons/shopro/library/chat/Online.php b/addons/shopro/library/chat/Online.php index 0e75d8b..a47ffd9 100644 --- a/addons/shopro/library/chat/Online.php +++ b/addons/shopro/library/chat/Online.php @@ -130,7 +130,7 @@ class Online $config = \addons\shopro\model\Config::where('name', 'user')->find(); if ($config) { $userConfig = json_decode($config['value'], true); - $defaultAvatar = $userConfig['avatar']; + $defaultAvatar = ($userConfig['avatar'] ?? null); } if (!$chatUser) { diff --git a/addons/shopro/library/traits/Groupon.php b/addons/shopro/library/traits/Groupon.php index 51403af..c2e8208 100644 --- a/addons/shopro/library/traits/Groupon.php +++ b/addons/shopro/library/traits/Groupon.php @@ -226,7 +226,7 @@ trait Groupon // 获取活动 $activity = Activity::where('id', $goodsItem['activity_id'])->find(); - $rules = $activity['rules']; + $rules = ($activity['rules'] ?? null); // 小于 0 不限结束时间单位小时 $expiretime = 0; @@ -398,7 +398,7 @@ trait Groupon } // 重新获取团信息 - $activityGroupon = ActivityGroupon::where('id', $activityGroupon['id'])->find(); + $activityGroupon = ActivityGroupon::where('id', ($activityGroupon['id'] ?? null))->find(); if ($activityGroupon['current_num'] >= $activityGroupon['num'] && !in_array($activityGroupon['status'], ['finish', 'finish-fictitious'])) { // 查询是否有虚拟团成员 $fictitiousCount = ActivityGrouponLog::where('groupon_id', $activityGroupon['id'])->where('is_fictitious', 1)->count(); diff --git a/addons/shopro/library/traits/model/order/OrderOper.php b/addons/shopro/library/traits/model/order/OrderOper.php index 9c34a84..67e7bbb 100644 --- a/addons/shopro/library/traits/model/order/OrderOper.php +++ b/addons/shopro/library/traits/model/order/OrderOper.php @@ -394,7 +394,7 @@ trait OrderOper \think\Hook::listen('order_create_after', $data); // 重新获取订单 - $order = self::where('id', $order['id'])->find(); + $order = self::where('id', ($order['id'] ?? null))->find(); return $order; }); @@ -689,7 +689,7 @@ trait OrderOper 'level' => $level, 'content' => $content, 'images' => $images ? implode(',', $images) : $images, - 'status' => !empty($config['user_reply']) ? 'show' : 'hidden' + 'status' => !empty(($config['user_reply'] ?? null)) ? 'show' : 'hidden' ]); $item->comment_status = OrderItem::COMMENT_STATUS_OK; // 评价成功 diff --git a/addons/shopro/library/traits/model/order/OrderOperCreate.php b/addons/shopro/library/traits/model/order/OrderOperCreate.php index a50a5df..922b5a0 100644 --- a/addons/shopro/library/traits/model/order/OrderOperCreate.php +++ b/addons/shopro/library/traits/model/order/OrderOperCreate.php @@ -643,7 +643,7 @@ trait OrderOperCreate public static function preCalcInvoiceAmount($total_fee, $goods_amount) { $config = \addons\shopro\model\Config::where('name', 'order')->find(); - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; if (isset($config['invoice']) && $config['invoice']['enable']) { $price_type = $config['invoice']['price_type']; diff --git a/addons/shopro/listener/activity/Update.php b/addons/shopro/listener/activity/Update.php index f59d288..e52ae4f 100644 --- a/addons/shopro/listener/activity/Update.php +++ b/addons/shopro/listener/activity/Update.php @@ -21,7 +21,7 @@ class Update $activity = $params['activity']; // 重新查询活动 - $activity = Activity::where('id', $activity['id'])->find(); + $activity = Activity::where('id', ($activity['id'] ?? null))->find(); if ($this->hasRedis()) { // 如果存在 redis 将活动存入缓存 diff --git a/addons/shopro/listener/commission/CommissionHook.php b/addons/shopro/listener/commission/CommissionHook.php index f44970c..29937aa 100644 --- a/addons/shopro/listener/commission/CommissionHook.php +++ b/addons/shopro/listener/commission/CommissionHook.php @@ -25,7 +25,7 @@ class CommissionHook // 订单支付成功 $order = $params['order']; // 重新查询订单 - $order = Order::with('item')->where('id', $order['id'])->find(); + $order = Order::with('item')->where('id', ($order['id'] ?? null))->find(); if (!$order) return false; $agent = new AgentLibrary($order['user_id']); if (!$agent->user) return false; @@ -82,7 +82,7 @@ class CommissionHook // 扣除用户消费总计金额 $orderItem = OrderItem::where(['id' => $item['id'], "refund_status" => ['in', [OrderItem::REFUND_STATUS_FINISH, OrderItem::REFUND_STATUS_OK]]])->find(); if($orderItem && $orderItem->refund_fee > 0) { - $user = \addons\shopro\model\User::get($orderItem['user_id']); + $user = \addons\shopro\model\User::get(($orderItem['user_id'] ?? null)); $user->setDec('total_consume', $orderItem->refund_fee); } // 订单退款成功 diff --git a/addons/shopro/listener/order/Comment.php b/addons/shopro/listener/order/Comment.php index 0d1b911..4d6fbc9 100644 --- a/addons/shopro/listener/order/Comment.php +++ b/addons/shopro/listener/order/Comment.php @@ -19,7 +19,7 @@ class Comment $order = $params['order']; // 获取订单,判断订单是否全部评价 - $order = Order::with('item')->where('id', $order['id'])->find(); + $order = Order::with('item')->where('id', ($order['id'] ?? null))->find(); $user = User::where('id', $order['user_id'])->find(); // 更新评价时间 diff --git a/addons/shopro/listener/order/Confirm.php b/addons/shopro/listener/order/Confirm.php index bdd7b9a..ae8f174 100644 --- a/addons/shopro/listener/order/Confirm.php +++ b/addons/shopro/listener/order/Confirm.php @@ -16,7 +16,7 @@ class Confirm public function orderConfirmAfter(&$params) { $order = $params['order']; - $order = Order::where('id', $order['id'])->find(); + $order = Order::where('id', ($order['id'] ?? null))->find(); // 更新收货时间 $order->ext = json_encode($order->setExt($order, ['confirm_time' => time()])); // 收货时间 @@ -24,7 +24,7 @@ class Confirm // 添加自动好评队列 $config = Config::where('name', 'order')->cache(300)->find(); // 读取配置自动缓存 5 分钟 - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; $close_days = (isset($config['order_auto_comment']) && $config['order_auto_comment'] > 0) ? $config['order_auto_comment'] : 7; // 单位天 diff --git a/addons/shopro/listener/order/Create.php b/addons/shopro/listener/order/Create.php index db78d9f..2747ff7 100644 --- a/addons/shopro/listener/order/Create.php +++ b/addons/shopro/listener/order/Create.php @@ -76,7 +76,7 @@ class Create // (开新团不判断)参与旧团 增加预拼团人数,上面加入团的时候已经判断过一次了,所以这里 99.99% 会加入成功的 if (isset($activityGroupon) && $activityGroupon) { // 将团信息缓存,用在后续下单流程 - $key = 'grouponinfo-' . $user['id']; + $key = 'grouponinfo-' . ($user['id'] ?? null); cache($key, json_encode($activityGroupon), 60); // 增加拼团预成员人数, 拼团只能单独购买 @@ -141,7 +141,7 @@ class Create } else { // 添加自动关闭队列 $config = Config::where('name', 'order')->cache(300)->find(); // 读取配置自动缓存 5 分钟 - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; $close_minue = (isset($config['order_auto_close']) && $config['order_auto_close'] > 0) ? $config['order_auto_close'] : 15; diff --git a/addons/shopro/listener/order/Payed.php b/addons/shopro/listener/order/Payed.php index 84bc15f..f2c37f3 100644 --- a/addons/shopro/listener/order/Payed.php +++ b/addons/shopro/listener/order/Payed.php @@ -21,7 +21,7 @@ class Payed $order = $params['order']; // 重新查询订单 - $order = Order::with('item')->where('id', $order['id'])->find(); + $order = Order::with('item')->where('id', ($order['id'] ?? null))->find(); $items = $order ? $order['item'] : []; // 有门店相关的订单 diff --git a/addons/shopro/listener/order/Send.php b/addons/shopro/listener/order/Send.php index 7789f93..0f15723 100644 --- a/addons/shopro/listener/order/Send.php +++ b/addons/shopro/listener/order/Send.php @@ -39,7 +39,7 @@ class Send if ($item['dispatch_type'] != 'selfetch') { // 添加自动确认收货队列 $config = Config::where('name', 'order')->cache(300)->find(); // 读取配置自动缓存 5 分钟 - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; $close_days = (isset($config['order_auto_confirm']) && $config['order_auto_confirm'] > 0) ? $config['order_auto_confirm'] : 10; // 单位天 diff --git a/addons/shopro/model/Decorate.php b/addons/shopro/model/Decorate.php index 867e997..7d760b4 100644 --- a/addons/shopro/model/Decorate.php +++ b/addons/shopro/model/Decorate.php @@ -105,7 +105,7 @@ class Decorate extends Model case 'grid-list': case 'popup': case 'nav-list': - foreach ($content['list'] as &$l) { + foreach (($content['list'] ?? []) as &$l) { $l['image'] && $l['image'] = cdnurl($l['image'], true); } break; diff --git a/addons/shopro/model/OrderAftersale.php b/addons/shopro/model/OrderAftersale.php index 70ae2dd..9b37bda 100644 --- a/addons/shopro/model/OrderAftersale.php +++ b/addons/shopro/model/OrderAftersale.php @@ -190,7 +190,7 @@ class OrderAftersale extends Model } $orderItem = OrderItem::where('id', $aftersale['order_item_id'])->find(); - if (!$orderItem || in_array($orderItem['refund_status'], [OrderItem::REFUND_STATUS_OK, OrderItem::REFUND_STATUS_FINISH])) { + if (!$orderItem || in_array(($orderItem['refund_status'] ?? null), [OrderItem::REFUND_STATUS_OK, OrderItem::REFUND_STATUS_FINISH])) { // 不存在, 或者已经退款 new Exception('退款商品不存在或已退款'); } diff --git a/addons/shopro/model/TradeOrder.php b/addons/shopro/model/TradeOrder.php index aee5020..2774279 100644 --- a/addons/shopro/model/TradeOrder.php +++ b/addons/shopro/model/TradeOrder.php @@ -147,7 +147,7 @@ class TradeOrder extends Model { // 添加自动关闭队列 $config = Config::where('name', 'order')->cache(300)->find(); // 读取配置自动缓存 5 分钟 - $config = isset($config) ? json_decode($config['value'], true) : []; + $config = isset($config) ? json_decode(($config['value'] ?? null), true) : []; $close_minue = (isset($config['order_auto_close']) && $config['order_auto_close'] > 0) ? $config['order_auto_close'] : 15; diff --git a/addons/shopro/model/User.php b/addons/shopro/model/User.php index 4b529ea..de665a2 100644 --- a/addons/shopro/model/User.php +++ b/addons/shopro/model/User.php @@ -47,7 +47,7 @@ class User extends Model //如果不需要启用首字母头像,请使用 //$value = '/assets/img/avatar.png'; $config = json_decode(\addons\shopro\model\Config::get(['name' => 'user'])->value, true); - $value = $config['avatar']; + $value = ($config['avatar'] ?? null); } return cdnurl($value, true); diff --git a/addons/shopro/model/UserSign.php b/addons/shopro/model/UserSign.php index 266392c..c80803b 100644 --- a/addons/shopro/model/UserSign.php +++ b/addons/shopro/model/UserSign.php @@ -112,7 +112,7 @@ class UserSign extends Model // 获取积分规则 $config = Config::where('name', 'score')->find(); - $config = json_decode($config['value'], true); + $config = json_decode(($config['value'] ?? null), true); $everyday = $config['everyday']; $inc_value = $config['inc_value']; $until_day = $config['until_day']; @@ -180,7 +180,7 @@ class UserSign extends Model // 获取积分规则 $config = Config::where('name', 'score')->find(); - $config = json_decode($config['value'], true); + $config = json_decode(($config['value'] ?? null), true); $everyday = $config['everyday']; $inc_value = $config['inc_value']; $until_day = $config['until_day']; diff --git a/addons/shopro/model/UserWalletApply.php b/addons/shopro/model/UserWalletApply.php index 3d31625..894f249 100644 --- a/addons/shopro/model/UserWalletApply.php +++ b/addons/shopro/model/UserWalletApply.php @@ -353,7 +353,7 @@ class UserWalletApply extends Model public static function getWithdrawConfig() { $config = \addons\shopro\model\Config::where('name', 'withdraw')->find(); - return json_decode($config['value'], true); + return json_decode(($config['value'] ?? null), true); } /** diff --git a/addons/shopro/notifications/Notification.php b/addons/shopro/notifications/Notification.php index 847882e..9a41852 100644 --- a/addons/shopro/notifications/Notification.php +++ b/addons/shopro/notifications/Notification.php @@ -228,7 +228,7 @@ class Notification $domain = null; // 查询商城配置获取 h5 网址,并缓存 5 分钟 $config = Config::where('name', 'shopro')->cache(300)->find(); - if ($config && $cv = json_decode($config['value'], true)) { + if ($config && $cv = json_decode(($config['value'] ?? null), true)) { $domain = isset($cv['domain']) ? $cv['domain'] : null; } diff --git a/addons/shopro/notifications/Wallet.php b/addons/shopro/notifications/Wallet.php index ce954fb..45630f4 100644 --- a/addons/shopro/notifications/Wallet.php +++ b/addons/shopro/notifications/Wallet.php @@ -231,7 +231,7 @@ class Wallet extends Notification implements ShouldQueue private function walletScoreChangeData($notifiable) { $currentData = $this->data; $walletLog = $currentData['walletLog'] ?? []; - $notifiable = User::where('id', $notifiable['id'])->find(); + $notifiable = User::where('id', ($notifiable['id'] ?? null))->find(); $data['template'] = self::$returnField[$this->event]['name']; // 模板名称 $data['nickname'] = $notifiable['nickname']; $data['wallet'] = $walletLog['wallet']; diff --git a/application/admin/controller/shopro/Category.php b/application/admin/controller/shopro/Category.php index 43c8c64..d20ac80 100644 --- a/application/admin/controller/shopro/Category.php +++ b/application/admin/controller/shopro/Category.php @@ -62,7 +62,7 @@ class Category extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -102,7 +102,7 @@ class Category extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/Coupons.php b/application/admin/controller/shopro/Coupons.php index ff3abc5..a5d2bb8 100644 --- a/application/admin/controller/shopro/Coupons.php +++ b/application/admin/controller/shopro/Coupons.php @@ -90,7 +90,7 @@ class Coupons extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -139,7 +139,7 @@ class Coupons extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/Express.php b/application/admin/controller/shopro/Express.php index a1e649e..4efa52c 100644 --- a/application/admin/controller/shopro/Express.php +++ b/application/admin/controller/shopro/Express.php @@ -82,7 +82,7 @@ class Express extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -124,7 +124,7 @@ class Express extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/Feedback.php b/application/admin/controller/shopro/Feedback.php index a35bf76..325ba1d 100644 --- a/application/admin/controller/shopro/Feedback.php +++ b/application/admin/controller/shopro/Feedback.php @@ -86,7 +86,7 @@ class Feedback extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/Link.php b/application/admin/controller/shopro/Link.php index 2292117..b0d1076 100644 --- a/application/admin/controller/shopro/Link.php +++ b/application/admin/controller/shopro/Link.php @@ -58,7 +58,7 @@ class Link extends Base if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -99,7 +99,7 @@ class Link extends Base if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/dispatch/Autosend.php b/application/admin/controller/shopro/dispatch/Autosend.php index 0789d60..63935de 100644 --- a/application/admin/controller/shopro/dispatch/Autosend.php +++ b/application/admin/controller/shopro/dispatch/Autosend.php @@ -79,7 +79,7 @@ class Autosend extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -137,7 +137,7 @@ class Autosend extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -211,7 +211,7 @@ class Autosend extends Backend { if($data['type'] == 'autosend' ) { $autosend = \app\admin\model\shopro\dispatch\Autosend::where('id', $data['type_ids'])->find(); - if($autosend && $autosend['type'] === 'params') { + if($autosend && ($autosend['type'] ?? null)=== 'params') { $autosend['content'] = json_decode($autosend['content'], true); } return $autosend; diff --git a/application/admin/controller/shopro/dispatch/Express.php b/application/admin/controller/shopro/dispatch/Express.php index 9bfed25..f967e57 100644 --- a/application/admin/controller/shopro/dispatch/Express.php +++ b/application/admin/controller/shopro/dispatch/Express.php @@ -80,7 +80,7 @@ class Express extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -132,7 +132,7 @@ class Express extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/dispatch/Selfetch.php b/application/admin/controller/shopro/dispatch/Selfetch.php index dbc98ab..e16db84 100644 --- a/application/admin/controller/shopro/dispatch/Selfetch.php +++ b/application/admin/controller/shopro/dispatch/Selfetch.php @@ -81,7 +81,7 @@ class Selfetch extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -134,7 +134,7 @@ class Selfetch extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/dispatch/Store.php b/application/admin/controller/shopro/dispatch/Store.php index 8f6c7fe..74bcaf0 100644 --- a/application/admin/controller/shopro/dispatch/Store.php +++ b/application/admin/controller/shopro/dispatch/Store.php @@ -81,7 +81,7 @@ class Store extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -134,7 +134,7 @@ class Store extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/store/Store.php b/application/admin/controller/shopro/store/Store.php index b271bfd..ae5f20e 100644 --- a/application/admin/controller/shopro/store/Store.php +++ b/application/admin/controller/shopro/store/Store.php @@ -105,7 +105,7 @@ class Store extends Backend $params[$this->dataLimitField] = $this->auth->id; } $result = false; - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); Db::startTrans(); try { $result = $this->model->allowField(true)->save($params); @@ -156,7 +156,7 @@ class Store extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/user/Group.php b/application/admin/controller/shopro/user/Group.php index 4949b5e..5ac0192 100644 --- a/application/admin/controller/shopro/user/Group.php +++ b/application/admin/controller/shopro/user/Group.php @@ -68,7 +68,7 @@ class Group extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -111,7 +111,7 @@ class Group extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/user/User.php b/application/admin/controller/shopro/user/User.php index 0c07f0f..147da74 100644 --- a/application/admin/controller/shopro/user/User.php +++ b/application/admin/controller/shopro/user/User.php @@ -103,7 +103,7 @@ class User extends Backend { $params = $this->request->post('data'); $params = json_decode($params, true); - $user = $this->model->get($params['id']); + $user = $this->model->get(($params['id'] ?? null)); if (!$user) { $this->error('未找到用户'); } diff --git a/application/admin/controller/shopro/wechat/AutoReply.php b/application/admin/controller/shopro/wechat/AutoReply.php index fa94f1d..b9a0f25 100644 --- a/application/admin/controller/shopro/wechat/AutoReply.php +++ b/application/admin/controller/shopro/wechat/AutoReply.php @@ -78,7 +78,7 @@ class AutoReply extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -143,7 +143,7 @@ class AutoReply extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/wechat/Material.php b/application/admin/controller/shopro/wechat/Material.php index 02a74e8..bb61e22 100644 --- a/application/admin/controller/shopro/wechat/Material.php +++ b/application/admin/controller/shopro/wechat/Material.php @@ -79,7 +79,7 @@ class Material extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { @@ -120,7 +120,7 @@ class Material extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); try { diff --git a/application/admin/controller/shopro/wechat/Menu.php b/application/admin/controller/shopro/wechat/Menu.php index f57c768..0012559 100644 --- a/application/admin/controller/shopro/wechat/Menu.php +++ b/application/admin/controller/shopro/wechat/Menu.php @@ -81,7 +81,7 @@ class Menu extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); if ($this->request->get('act') === 'publish') { @@ -128,7 +128,7 @@ class Menu extends Backend if ($this->request->isPost()) { $params = $this->request->post(); if ($params) { - $params = json_decode($params['data'], true); + $params = json_decode(($params['data'] ?? null), true); $result = false; Db::startTrans(); if ($this->request->get('act') === 'publish') { @@ -202,7 +202,7 @@ class Menu extends Backend $this->error(__('No Results were found')); } $publish = $this->publishMenu(json_decode($row->content, true)); - if (!$publish['result']) { + if (!($publish['result'] ?? null)) { return $this->error($publish['msg']); } return $this->success('发布成功'); diff --git a/application/admin/library/traits/Backend.php b/application/admin/library/traits/Backend.php index a5f2eff..0f51d02 100644 --- a/application/admin/library/traits/Backend.php +++ b/application/admin/library/traits/Backend.php @@ -365,7 +365,11 @@ trait Backend } if ($ext === 'csv') { $file = fopen($filePath, 'r'); - $filePath = tempnam(sys_get_temp_dir(), 'import_csv'); + $tmpDir = RUNTIME_PATH . 'temp' . DIRECTORY_SEPARATOR; + if (!is_dir($tmpDir)) { + @mkdir($tmpDir, 0755, true); + } + $filePath = tempnam($tmpDir, 'import_csv'); $fp = fopen($filePath, 'w'); $n = 0; while ($line = fgets($file)) { diff --git a/application/api/controller/Datas.php b/application/api/controller/Datas.php index d386afd..ef2b78a 100644 --- a/application/api/controller/Datas.php +++ b/application/api/controller/Datas.php @@ -85,7 +85,7 @@ class Datas extends Api foreach ($postcodes as $k => $rr){ if($rr["POSTCODE"]==$r["postcode"]){ $has = true; - $postcodes[$k]["weight_0_300"] += $weights["w1"]; + $postcodes[$k]["weight_0_300"] += ($weights["w1"] ?? null); $postcodes[$k]["weight_300_500"]+= $weights["w2"]; $postcodes[$k]["weight_500_1000"]+= $weights["w3"]; $postcodes[$k]["weight_1000_1500"]+= $weights["w4"]; @@ -206,11 +206,11 @@ class Datas extends Api foreach ($postcodes as $k => $rr){ if($rr["create_date"]==$r["create_date"]){ $has = true; - $postcodes[$k]["ITEMS_1"] += $weights["w1"]; + $postcodes[$k]["ITEMS_1"] += ($weights["w1"] ?? null); $postcodes[$k]["ITEMS_2_3"]+= $weights["w2"]; $postcodes[$k]["ITEMS_3_5"]+= $weights["w3"]; $postcodes[$k]["ITEMS_qt_5"]+= $weights["w4"]; - $postcodes[$k]["GOODSCOUNT_1"] += $weights2["w1"]; + $postcodes[$k]["GOODSCOUNT_1"] += ($weights2["w1"] ?? null); $postcodes[$k]["GOODSCOUNT_2_3"]+= $weights2["w2"]; $postcodes[$k]["GOODSCOUNT_3_5"]+= $weights2["w3"]; $postcodes[$k]["GOODSCOUNT_qt_5"]+= $weights2["w4"]; @@ -395,7 +395,7 @@ class Datas extends Api $tmp_infos = explode(',',$rr); array_push($ITEMSS,$tmp_infos[3].'('.$tmp_infos[1].')'); } - $ITEMSS = implode($ITEMSS,"\r\n"); + $ITEMSS = implode("\r\n",$ITEMSS); array_push($lists,[$ITEMSS,$COUNT,$STORENAME]); } $worksheet->fromArray( @@ -1216,7 +1216,7 @@ class Datas extends Api } } $data = $stockModel ->where(["STOCKID"=>intval($datas['formData']['STOCKID'])])->find(); - $YXQ = isset($datas['formData']['YXQ'])?$datas['formData']['YXQ']:$data['YXQ']; + $YXQ = isset($datas['formData']['YXQ'])?$datas['formData']['YXQ']:($data['YXQ'] ?? null); $saveData = [intval($datas['formData']['STOCKID']),intval($datas['formData']['WEIGHT']),0,0,0,$YXQ]; $data->save(["YXQ"=>$YXQ,"WEIGHT"=>$datas['formData']['WEIGHT']]); //$result = Wsdl::webservice($saveData,'upateStock'); @@ -1511,7 +1511,7 @@ class Datas extends Api print_r($rr["ruluid"]); /*if($rrr["iscost"]==0){ $rule = $RuleModel->where(["id"=>$rr["ruluid"]])->find(); - print_r($rr["weight"]."|".$rule["id"]."|"); + print_r($rr["weight"]."|".($rule["id"] ?? null)."|"); $ruleprice = $this->getOrderPrice($rr["weight"],$rule); print_r($ruleprice2."|||"); } @@ -1653,7 +1653,7 @@ class Datas extends Api if($this->auth->check("isstaff")){ if($storeid>0){ $storeids = $StoreModel->where(["STOREID"=>$storeid])->find(); - array_push($USERIDS,$storeids["USERID"]); + array_push($USERIDS,($storeids["USERID"] ?? null)); array_push($STORES,$storeids["STOREID"]); }else{ $STORESS = $WarestoreModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->select(); @@ -1696,8 +1696,8 @@ class Datas extends Api $outAccount = 0; $Accountdetailout=$AccountdetailModel->field("sum(BALANCE) as BALANCE")->where("ACCOUNTID","in",$ACCOUNTID)->where("CREATIONDATE","BETWEEN",["00".$startOfMonth."000","00".$endOfMonth."999"])->where("TYPE>0")->find(); $Accountdetailin=$AccountdetailModel->field("sum(BALANCE) as BALANCE")->where("ACCOUNTID","in",$ACCOUNTID)->where("CREATIONDATE","BETWEEN",["00".$startOfMonth."000","00".$endOfMonth."999"])->where(["TYPE"=>0])->find(); - $inAccount = $Accountdetailin["BALANCE"]?$Accountdetailin["BALANCE"]:0; - $outAccount = $Accountdetailout["BALANCE"]?$Accountdetailout["BALANCE"]:0; + $inAccount = ($Accountdetailin["BALANCE"] ?? null)?($Accountdetailin["BALANCE"] ?? null):0; + $outAccount = ($Accountdetailout["BALANCE"] ?? null)?($Accountdetailout["BALANCE"] ?? null):0; $this->success("获取成功",["allprice"=>$allprice,"STORES"=>$STORES,"orders"=>$orders,"inAccount"=>$inAccount,"outAccount"=>$outAccount,"Accountdetail"=>$Accountdetail]); } } \ No newline at end of file diff --git a/application/api/controller/Gonghao.php b/application/api/controller/Gonghao.php index 60b8a65..70ced17 100644 --- a/application/api/controller/Gonghao.php +++ b/application/api/controller/Gonghao.php @@ -40,7 +40,7 @@ class Gonghao extends Api } $userModel = new \app\common\model\User; $userinfo = $userModel->where(["wms_userid"=>$wmsuser['userID']])->find(); - if($userinfo && $userinfo['id']!=$this->auth->id){ + if($userinfo && ($userinfo['id'] ?? null)!=$this->auth->id){ $this->error('工号已被其他用户绑定'); } $user = $this->auth->getUser(); @@ -75,7 +75,7 @@ class Gonghao extends Api //print_r($settime); $WarehouseModel = new \app\common\model\Warehouse; $WAREHOUSE = $WarehouseModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->find(); - $workDate = $WAREHOUSE['workDate']; + $workDate = ($WAREHOUSE['workDate'] ?? null); $settime= strtotime(date('Y-m-d ',$workDate).$params['settime'].':00'); $Token = new \app\common\model\workers\clock\in\Token; $Token2 = new \app\common\model\workers\clock\in\Token; @@ -101,7 +101,7 @@ class Gonghao extends Api $clockinModel->where('endtime is null'); } $WAREHOUSE = $WarehouseModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->find(); - $workDate = $WAREHOUSE['workDate']; + $workDate = ($WAREHOUSE['workDate'] ?? null); $list = $clockinModel->where(["WAREHOUSEID"=>$WAREHOUSEID,"workDate"=>$workDate])->with(['name'])->order('endtime,createtime','desc')->select(); $this->success('获取成功',$list); } @@ -116,7 +116,7 @@ class Gonghao extends Api $WarehouseModel = new \app\common\model\Warehouse; $Token = new \app\common\model\workers\clock\in\Token; $WAREHOUSE = $WarehouseModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->find(); - $workDate = $WAREHOUSE['workDate']; + $workDate = ($WAREHOUSE['workDate'] ?? null); $time = time(); $tokens = $Token->where("expiretime>".($time))->where(["token"=>$token])->where(["WAREHOUSEID"=>$WAREHOUSEID])->find(); if($tokens){ diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index dd44684..2412dfe 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -76,7 +76,7 @@ class Index extends Api // 商城基本设置 $shoproConfig = json_decode($config['shopro'], true); - $shoproConfig['logo'] = cdnurl($shoproConfig['logo'], true); + $shoproConfig['logo'] = cdnurl(($shoproConfig['logo'] ?? null), true); $data['shop'] = $shoproConfig; // 支付设置 @@ -84,7 +84,7 @@ class Index extends Api $paymentConfig = []; foreach ($payment as $key => $v) { $val = json_decode($v->value, true); - if ($val && in_array($platform, $val['platform'])) { + if ($val && in_array($platform, ($val['platform'] ?? []))) { $paymentConfig[] = $v->name; } } @@ -107,7 +107,7 @@ class Index extends Api // 分享设置 $shareConfig = json_decode($config['share'], true); $data['share'] = [ - 'title' => $shareConfig['title'], + 'title' => ($shareConfig['title'] ?? null), 'image' => isset($shareConfig['image']) ? cdnurl($shareConfig['image'], true) : '', 'goods_poster_bg' => isset($shareConfig['goods_poster_bg']) ? cdnurl($shareConfig['goods_poster_bg'], true) : '', 'user_poster_bg' => isset($shareConfig['user_poster_bg']) ? cdnurl($shareConfig['user_poster_bg'], true) : '', diff --git a/application/api/controller/Prints.php b/application/api/controller/Prints.php index 36bcc55..000f8db 100644 --- a/application/api/controller/Prints.php +++ b/application/api/controller/Prints.php @@ -72,7 +72,7 @@ class Prints extends Api // 验证仓库是否在允许列表中 $inWarehouseList = false; - foreach($code_data["stores"] as $r){ + foreach(($code_data["stores"] ?? []) as $r){ if($r["store_id"] == $warehouse_id){ $inWarehouseList = true; break; @@ -117,7 +117,7 @@ class Prints extends Api if($req["ret"]){ $msg = $req["msg"]; $msg = json_decode($msg, true); - if($msg["status"] == "fail"){ + if(($msg["status"] ?? null)== "fail"){ $this->PrintComputerModel->where(["id" => $insert_id])->delete(); Log::error("远程绑定接口返回失败"); $this->error($msg["message"]); diff --git a/application/api/controller/Produce.php b/application/api/controller/Produce.php index ef8e7cc..822f620 100644 --- a/application/api/controller/Produce.php +++ b/application/api/controller/Produce.php @@ -86,7 +86,7 @@ class Produce extends Api foreach($list as $r){ $StoreModel = new \app\common\model\wms\Store; $store = $StoreModel->where(['STOREID'=>$r['STOREID']])->find(); - $r['huozhu'] = $store['TITLE']; + $r['huozhu'] = ($store['TITLE'] ?? null); } Db::commit(); } catch (ValidateException|PDOException|Exception $e) { diff --git a/application/api/controller/Statements.php b/application/api/controller/Statements.php index 07831af..52928f2 100644 --- a/application/api/controller/Statements.php +++ b/application/api/controller/Statements.php @@ -210,9 +210,9 @@ class Statements extends Api } } $bank = $this->AccountModel->where(["id"=>$line["bank_id"]])->lock(true)->find(); - $account = $bank["account"]; + $account = ($bank["account"] ?? null); $type = $this->AccounttypeModel->where(["id"=>$line["type"]])->find(); - switch ($type["isin"]) { + switch (($type["isin"] ?? null)) { case 0: $account +=$line["account"]; break; @@ -355,9 +355,9 @@ class Statements extends Api } } $bank = $this->AccountModel->where(["id"=>$line["bank_id"]])->lock(true)->find(); - $account = $bank["account"]; + $account = ($bank["account"] ?? null); $type = $this->AccounttypeModel->where(["id"=>$line["type"]])->find(); - switch ($type["isin"]) { + switch (($type["isin"] ?? null)) { case 0: $account -=$line["account"]; break; diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 7edc933..ede9633 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -320,7 +320,7 @@ class User extends Api $code = $params['appid']; $payload = json_decode(htmlspecialchars_decode($params['payload']), true); // 解析前端主机 - if ($payload['event'] !== 'login' && $payload['token'] !== '') { + if (($payload['event'] ?? null)!== 'login' && ($payload['token'] ?? null)!== '') { $this->auth->init($payload['token']); } $wechat = new Wechat('wxOfficialAccount',$code); @@ -642,7 +642,7 @@ class User extends Api if($req["ret"]){ $msg = $req["msg"]; $msg = json_decode($msg,true); - if($msg["code"]==200){ + if(($msg["code"] ?? null)==200){ if($msg["data"]["status"]=="scanned"){ $uuid = Random::uuid(); $this->redis->set("bindCode:".$uuid,$code, 300); @@ -679,7 +679,7 @@ class User extends Api if($req["ret"]){ $msg = $req["msg"]; $msg = json_decode($msg,true); - if($msg["code"]==200){ + if(($msg["code"] ?? null)==200){ $this->success($msg["message"]); }else{ $this->error($msg["message"]); diff --git a/application/api/controller/Warehouse.php b/application/api/controller/Warehouse.php index ec6d554..25f8467 100644 --- a/application/api/controller/Warehouse.php +++ b/application/api/controller/Warehouse.php @@ -59,7 +59,7 @@ class Warehouse extends Api $WarehouseModel = new \app\common\model\Warehouse; $WAREHOUSEconfig = $WarehouseModel->where(['WAREHOUSEID'=>$WAREHOUSEID])->find(); $list = $StorageModel->with(['employees','goods']) - ->where(['storage.WAREHOUSEID'=>$WAREHOUSEID,'storage.APPLYSTORAGENUM'=>$sn,'storage.SPACEID'=>$WAREHOUSEconfig['SPACEID']]) + ->where(['storage.WAREHOUSEID'=>$WAREHOUSEID,'storage.APPLYSTORAGENUM'=>$sn,'storage.SPACEID'=>($WAREHOUSEconfig['SPACEID'] ?? null)]) ->select(); $this->success("入库单详情",$list); } @@ -70,7 +70,7 @@ class Warehouse extends Api $StorageModel = new \app\common\model\wms\Storage; $WarehouseModel = new \app\common\model\Warehouse; $WAREHOUSEconfig = $WarehouseModel->where(['WAREHOUSEID'=>$WAREHOUSEID])->find(); - $list = $StorageModel->where(['WAREHOUSEID'=>$WAREHOUSEID,'APPLYSTORAGENUM'=>$sn,'SPACEID'=>$WAREHOUSEconfig['SPACEID']]) + $list = $StorageModel->where(['WAREHOUSEID'=>$WAREHOUSEID,'APPLYSTORAGENUM'=>$sn,'SPACEID'=>($WAREHOUSEconfig['SPACEID'] ?? null)]) ->select(); foreach($list as $r){ $WarehouseModel = new \app\common\model\Storage; diff --git a/application/api/controller/Wms.php b/application/api/controller/Wms.php index 7e4dda1..9fae7c8 100644 --- a/application/api/controller/Wms.php +++ b/application/api/controller/Wms.php @@ -128,7 +128,7 @@ class Wms extends Api foreach($list as $r){ $StoreModel = new \app\common\model\wms\Store; $store = $StoreModel->where(['STOREID'=>$r['STOREID']])->find(); - $r['huozhu'] = $store['TITLE']; + $r['huozhu'] = ($store['TITLE'] ?? null); } if(!$list && $params['query']['his']){ $orderModel = new \app\common\model\wms\Order1; @@ -148,7 +148,7 @@ class Wms extends Api foreach($list as $r){ $StoreModel = new \app\common\model\wms\Store; $store = $StoreModel->where(['STOREID'=>$r['STOREID']])->find(); - $r['huozhu'] = $store['TITLE']; + $r['huozhu'] = ($store['TITLE'] ?? null); $r['OPERATERECORDS'] = $r['NOTES']; } } diff --git a/application/api/controller/Work.php b/application/api/controller/Work.php index 8685da6..df34bd7 100644 --- a/application/api/controller/Work.php +++ b/application/api/controller/Work.php @@ -29,7 +29,7 @@ class Work extends Api $this->WAREHOUSEID = $this->auth->warehouseid; $this->StockModel = new \app\common\model\wms\Stock; $ware = $WarehouseModel->where(["WAREHOUSEID"=>$this->WAREHOUSEID])->find(); - $this->room2id = $ware["room2"]; + $this->room2id = ($ware["room2"] ?? null); $this->operatorID = $ware["operatorID"]; $this->redis = new \Redis(); $this->redis->connect('127.0.0.1', 6379); @@ -121,7 +121,7 @@ class Work extends Api $OrderModel = new \app\common\model\wms\Order; $order = $OrderModel->where(["ID"=>$orderID])->find(); - if($order && $order["PLSENDFLAG"]==0){ + if($order && ($order["PLSENDFLAG"] ?? null)==0){ $modelUser = new \app\common\model\wms\User; $user = $modelUser->where(["userID"=>$this->operatorID])->find(); $username = $user?$user->username:""; diff --git a/application/index/controller/Express.php b/application/index/controller/Express.php index 06e3697..69fb8d6 100644 --- a/application/index/controller/Express.php +++ b/application/index/controller/Express.php @@ -57,7 +57,7 @@ class Express extends Frontend $yunshuList = ["ACCEPT","GOT","ARRIVAL","DEPARTURE","SENT","OUTBOUND","OVERSEA_IN","OVERSEA_OUT","TRANSFER","CLEARANCE_START","CLEARANCE_FINISH","CLEARANCE_FAIL","OVERSEA_ARRIVAL","OVERSEA_DEPARTURE"]; $yichang = ["ISSUE","RETURN","SIGNFAIL","REJECTION","OTHER"]; $content = json_decode(html_entity_decode($params['data']),true); - $postnum = $content['mailno']; + $postnum = ($content['mailno'] ?? null); $order = $ExpressModel->where(["POSTNUM"=>$postnum])->where('status>-1')->find(); if($order){ $trace = $order->trace?json_decode($order->trace,true):[]; diff --git a/application/index/controller/agent/Index.php b/application/index/controller/agent/Index.php index 54d922f..2003e64 100644 --- a/application/index/controller/agent/Index.php +++ b/application/index/controller/agent/Index.php @@ -46,7 +46,7 @@ class Index extends Frontend foreach ($list as $store){ // 1. 检查 business_license 是否已存在(未软删除) $oldStore = $this->nStoreModel->where(["business_license"=>$store["WARESTOREID"], "deleted_at"=>null])->lock(true)->find(); - if($oldStore && $oldStore['company_name'] != $store['TITLE']){ + if($oldStore && ($oldStore['company_name'] ?? null)!= $store['TITLE']){ // 归档旧记录 $this->nStoreModel->where(["id"=>$oldStore['id']])->update(["deleted_at"=>date('Y-m-d H:i:s')]); // 关联store_warehouse全部use_status=0 diff --git a/application/index/controller/qiwe/Index.php b/application/index/controller/qiwe/Index.php index e965841..e6cf0f1 100644 --- a/application/index/controller/qiwe/Index.php +++ b/application/index/controller/qiwe/Index.php @@ -463,7 +463,7 @@ class Index extends Frontend $result = json_decode($result, true); \think\Log::error('拉取图片返回的结果: ' . json_encode($result)); - if ($result && $result["code"] == 0 && !empty($result["data"]["cloudUrl"])) { + if ($result && ($result["code"] ?? null)== 0 && !empty(($result["data"]["cloudUrl"] ?? null))) { return $result["data"]["cloudUrl"]; } @@ -483,7 +483,7 @@ class Index extends Frontend $result = json_decode($result, true); \think\Log::error('拉取图片返回的结果: ' . json_encode($result)."\n\n\n\n"); - if ($result && $result["code"] == 0 && !empty($result["data"]["cloudUrl"])) { + if ($result && ($result["code"] ?? null)== 0 && !empty(($result["data"]["cloudUrl"] ?? null))) { return $result["data"]["cloudUrl"]; } @@ -942,7 +942,7 @@ class Index extends Frontend $result = $this->query->query("getRoomList", [$this->guid, $index]); $result = json_decode($result, true); - if ($result && $result["code"] == 0) { + if ($result && ($result["code"] ?? null)== 0) { $data = $result["data"]; $roomList = $data["roomList"]; $insertDatas = []; @@ -992,7 +992,7 @@ class Index extends Frontend $result = json_decode($result, true); $insertDatas = []; - if ($result && $result['code'] == 0) { + if ($result && ($result['code'] ?? null)== 0) { \think\Log::error('返回结果正常: '); $roomList = $result["data"]["roomList"]; @@ -1057,7 +1057,7 @@ class Index extends Frontend $result = json_decode($result, true); $insertDatas = []; - if ($result && $result['code'] == 0) { + if ($result && ($result['code'] ?? null)== 0) { \think\Log::error('返回结果正常: '); $contactList = $result["data"]["contactList"]; \think\Log::error('返回结果正常: '.json_encode($contactList)); @@ -1161,7 +1161,7 @@ class Index extends Frontend //先通过URL上传文件获取fileId $result = $this->query->query("cdnBigUploadByUrl", [$this->guid, "照片.png",$imgUrl,1]); $result = json_decode($result, true); - if($result && $result["code"] == 0){ + if($result && ($result["code"] ?? null)== 0){ $fileAesKey = $result["data"]["fileAesKey"]; $fileId = $result["data"]["fileId"]; $fileKey = $result["data"]["fileKey"]; @@ -1181,7 +1181,7 @@ class Index extends Frontend $filename = basename($fileUrl); $result = $this->query->query("cdnBigUploadByUrl", [$this->guid, $filename,$fileUrl,5]); $result = json_decode($result, true); - if($result && $result["code"] == 0){ + if($result && ($result["code"] ?? null)== 0){ $fileAesKey = $result["data"]["fileAesKey"]; $fileId = $result["data"]["fileId"]; $fileKey = $result["data"]["fileKey"]; diff --git a/application/index/controller/wms/Chat.php b/application/index/controller/wms/Chat.php index 269cc58..11d1ef9 100644 --- a/application/index/controller/wms/Chat.php +++ b/application/index/controller/wms/Chat.php @@ -1367,7 +1367,7 @@ _________________________________________________________ $Exceptionwmsorder_row->save(); } if($room && $Exceptionwmsorder_row && $this->excludeWords($msg["MSG"])){ - $msg = $this->toMsg($room["room_id"],$msg["STORENAME"]."运单号:".$msg["POSTNUM"]."运方反馈信息:".$msg["MSG"]); + $msg = $this->toMsg(($room["room_id"] ?? null),$msg["STORENAME"]."运单号:".$msg["POSTNUM"]."运方反馈信息:".$msg["MSG"]); array_push($msg_arr,$msg); $this->redis->select(2); $this->redis->lpush("Message",json_encode($msg)); @@ -2913,7 +2913,7 @@ _________________________________________________________ foreach($postnums as $postnum){ try{ $order = $this->getOrderInfoByPostnum($postnum,$from); - if($order && $order["ID"]){ + if($order && ($order["ID"] ?? null)){ $text = "{$postnum}\n"; $STOREID = $order["STOREID"]; $WAREHOUSEID = $order["WAREHOUSEID"]; diff --git a/application/index/controller/wms/Dianguanjia.php b/application/index/controller/wms/Dianguanjia.php index b99c6f8..862aeab 100644 --- a/application/index/controller/wms/Dianguanjia.php +++ b/application/index/controller/wms/Dianguanjia.php @@ -401,7 +401,7 @@ class Dianguanjia extends Frontend $has = true; $data = json_decode($data,true); array_push($list,$data); - array_push($skuids,$data["SkuId"]); + array_push($skuids,($data["SkuId"] ?? null)); }else{ $has = false; } @@ -625,7 +625,7 @@ class Dianguanjia extends Frontend 'TableName' => isset($this->TableName[$k])?$this->TableName[$k]:'LogicOrder', 'Name' => $k, 'Value' => $r, - 'Contract' => isset($this->Contract[$k])?$this->Contract[$k]:$op[$k], + 'Contract' => isset($this->Contract[$k])?$this->Contract[$k]:($op[$k] ?? null), 'CustomQuery'=>isset($this->CustomQuery[$k])?$this->CustomQuery[$k]:'' ]; if($k=="PrintRemark"){ @@ -928,7 +928,7 @@ class Dianguanjia extends Frontend } public function edit_stock($ids = null){ $row = $this->StockModel->where(["SkuId"=>$ids])->with(['myagent'])->find(); - $row["AgentName"] = $this->getStoreName($row["myagent"]["STOREID"]); + $row["AgentName"] = $this->getStoreName(($row["myagent"]["STOREID"] ?? null)); if (!$row) { $this->error(__('No Results were found')); } @@ -2734,7 +2734,7 @@ class Dianguanjia extends Frontend $this->redis->select(2); $this->redis->lpush("Message",json_encode($msg)); } - $req = json_decode($req["msg"],true); + $req = json_decode(($req["msg"] ?? null),true); /*if(isset($req["Success"])&&$req["Success"]==false){ $msg = $this->toMsg($this->room_id,"店管家接口错误:".$this->unicode_to_chinese(json_encode($req))."\n--------------".$url."--------------\n".json_encode($data)."\n--------------".$url."--------------\n".json_encode($headers)); @@ -3373,7 +3373,7 @@ class Dianguanjia extends Frontend print_r($data); $PrintDataJson = $data["Data"][0]["PrintHistoryData"]["PrintDataJson"]; $PrintData = json_decode($PrintDataJson,true); - $encryptedData = $PrintData["PrintDataList"]["task"]["documents"][0]["contents"][0]["encryptedData"]; + $encryptedData = ($PrintData["PrintDataList"]["task"]["documents"][0]["contents"][0]["encryptedData"] ?? null); $signature = $PrintData["PrintDataList"]["task"]["documents"][0]["contents"][0]["signature"]; $printData = [$encryptedData,$signature]; $order->ENCRYPTEDDATA = $encryptedData; diff --git a/application/index/controller/wms/Extbot.php b/application/index/controller/wms/Extbot.php index 3c60e83..47ba9de 100644 --- a/application/index/controller/wms/Extbot.php +++ b/application/index/controller/wms/Extbot.php @@ -31,7 +31,7 @@ class ExtBot extends Frontend "method"=>"list" ]; $res = $this->query($query_data); - if(count($res['data'])==0){ + if(count(($res['data'] ?? []))==0){ $msg = "无登录的微信"; } $pids = []; diff --git a/application/index/controller/wms/Order.php b/application/index/controller/wms/Order.php index b2c76a4..e3c122a 100644 --- a/application/index/controller/wms/Order.php +++ b/application/index/controller/wms/Order.php @@ -242,7 +242,7 @@ class Order extends Frontend } } - return json(["grabnum"=>!empty($last['grabnum'])?$last['grabnum']:null,"count"=>$count,"hour_sum"=>$hour_sum]); + return json(["grabnum"=>!empty(($last['grabnum'] ?? null))?($last['grabnum'] ?? null):null,"count"=>$count,"hour_sum"=>$hour_sum]); } public function closeall(){ $first = $Gongzuomodel->where(["endtime"=>0])->select(); diff --git a/application/index/controller/wms/Pda.php b/application/index/controller/wms/Pda.php index 92ab771..a116ea3 100644 --- a/application/index/controller/wms/Pda.php +++ b/application/index/controller/wms/Pda.php @@ -177,7 +177,7 @@ class Pda extends Frontend $task_count = isset($params['count'])?$params['count']:1; $insertData = []; $time = time(); - $stores = implode($params["stores"],","); + $stores = implode(",",$params["stores"] ?? []); $n = ""; for($i=0;$i<$task_count;$i++){ if($task_count>1){ diff --git a/application/index/controller/wms/Wms.php b/application/index/controller/wms/Wms.php index 197777b..8352842 100644 --- a/application/index/controller/wms/Wms.php +++ b/application/index/controller/wms/Wms.php @@ -6389,10 +6389,10 @@ class Wms extends Frontend $price = 0; switch($rule['type']){ case 1: - $price=$rule["continuedcount"]>0?$order["GOODSCOUNT"]<$rule["fristcount"]?$rule["fristprice"]:round(ceil(($order["GOODSCOUNT"]-$rule["fristcount"])/$rule["continuedcount"])*$rule["continuedprice"]+$rule["fristprice"],2):0; + $price=$rule["continuedcount"]>0?($order["GOODSCOUNT"]<$rule["fristcount"]?$rule["fristprice"]:round(ceil(($order["GOODSCOUNT"]-$rule["fristcount"])/$rule["continuedcount"])*$rule["continuedprice"]+$rule["fristprice"],2)):0; break; case 2: - $price=$rule["continuedcount"]>0?$order["STOCKSCOUNT"]<$rule["fristcount"]?$rule["fristprice"]:round((($order["STOCKSCOUNT"]-$rule["fristcount"])/$rule["continuedcount"])*$rule["continuedprice"]+$rule["fristprice"],2):0; + $price=$rule["continuedcount"]>0?($order["STOCKSCOUNT"]<$rule["fristcount"]?$rule["fristprice"]:round((($order["STOCKSCOUNT"]-$rule["fristcount"])/$rule["continuedcount"])*$rule["continuedprice"]+$rule["fristprice"],2)):0; break; } return round($price,2); diff --git a/application/index/library/chat/Orders.php b/application/index/library/chat/Orders.php index 4af5e33..a83c0fb 100644 --- a/application/index/library/chat/Orders.php +++ b/application/index/library/chat/Orders.php @@ -427,7 +427,7 @@ class Orders $data = Wsdl::webservice([$order["warehouseid"],106300,$wmsorder->ID],'createPostNum'); $wmsorder = $orderModel->where(["SOURCEID"=>$order['ordercode']])->find(); - if(empty($wmsorder["POSTNUM"])){ + if(empty(($wmsorder["POSTNUM"] ?? null))){ if($type==0){ Wsdl::webservice([106300,($wmsorder["ID"] ?? null)],"cancelOrderByIds"); } diff --git a/application/index/library/new_wms/notify/action/Base.php b/application/index/library/new_wms/notify/action/Base.php index a4ca6da..94f7948 100644 --- a/application/index/library/new_wms/notify/action/Base.php +++ b/application/index/library/new_wms/notify/action/Base.php @@ -116,7 +116,7 @@ abstract class Base if (!$room) { $room = (new \app\common\model\Rooms())->where(['room_id' => $groupId])->find(); } - if ($room && intval($room['WAREHOUSEID']) > 0) { + if ($room && intval(($room['WAREHOUSEID'] ?? null)) > 0) { return ['id' => intval($room['WAREHOUSEID']), 'from' => "group:{$groupId}"]; } } catch (\Exception $e) {