From c3f462cadd1a31f2b9ed1b6afd0047953f28aec7 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 8 Aug 2023 16:33:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AE=8C=E6=88=90=E5=8F=91=E9=80=81=E7=89=A9=E6=B5=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/CommunityRepository.php | 3 ++- app/controller/api/Auth.php | 5 +++++ app/controller/api/community/Community.php | 2 -- app/listener/paySuccessOrder.php | 22 +++++++++++++++++++ route/api.php | 1 + 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/common/repositories/community/CommunityRepository.php b/app/common/repositories/community/CommunityRepository.php index 97cdc04f..9d5888e4 100644 --- a/app/common/repositories/community/CommunityRepository.php +++ b/app/common/repositories/community/CommunityRepository.php @@ -14,6 +14,7 @@ namespace app\common\repositories\community; use app\common\dao\community\CommunityDao; use app\common\dao\store\order\StoreCartDao; +use app\common\model\community\Community; use app\common\model\store\order\StoreCart; use app\common\model\store\product\ProductAttrValue; use app\common\model\store\product\PurchaseRecord; @@ -98,7 +99,6 @@ class CommunityRepository extends BaseRepository $config = systemConfig("community_app_switch"); if (!isset($where['is_type']) && $config) $where['is_type'] = is_array($config) ? implode(',', $config) : $config; $where['is_del'] = 0; - $query = $this->dao->search($where)->when(in_array(self::COMMUNITY_TYPE_RESALE, explode(',', $where['is_type'])), function ($query) { $query->where('is_sale', 0); })->order('start DESC,Community.create_time DESC,community_id DESC'); @@ -127,6 +127,7 @@ class CommunityRepository extends BaseRepository $list = $query->page($page, $limit)->setOption('field',[]) ->field('community_id,title,image,topic_id,Community.count_start,count_reply,start,Community.create_time,Community.uid,Community.status,is_show,content,video_link,is_type,refusal') ->select()->append(['time']); + if ($list) $list = $list->toArray(); foreach ($list as $k => $item) { if ($item['is_type'] == self::COMMUNITY_TYPE_RESALE) { diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index d3c4cc99..58820c41 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -53,6 +53,11 @@ use app\controller\api\Ceshi; */ class Auth extends BaseController { + public function dotest() + { + return app('json')->success([]); + } + public function test() { $type = $this->request->param('type'); diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 31f9afa5..323c4fc0 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -291,9 +291,7 @@ class Community extends BaseController $data['status_time'] = date('Y-m-d H:i:s', time()); } if (!$data['video_link']) throw new ValidateException('请上传视频'); - } - $data['content'] = filter_emoji($data['content']); MiniProgramService::create()->msgSecCheck($this->request->userInfo(), $data['content'],3,0); app()->make(CommunityValidate::class)->check($data); diff --git a/app/listener/paySuccessOrder.php b/app/listener/paySuccessOrder.php index 74975a4a..60ba749f 100644 --- a/app/listener/paySuccessOrder.php +++ b/app/listener/paySuccessOrder.php @@ -136,6 +136,28 @@ class paySuccessOrder Log::error('订单分润出错', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'trace' => $e->getTraceAsString()]); DingTalk::exception($e, '订单分润出错'); } + //发起物流信息 + $this->sendLogistics($this->event['order']['order_id'], $this->event['order']['order_sn']); + + } + + //发送物流 + public function sendLogistics($orderId, $orderSn) + { + $postUrl = 'http://logistics.lihaink.cn/api/lstSet'; + $curlPost = [ + 'order_id' => $orderId, + 'order_sn' => $orderSn, + ]; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL,$postUrl); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); + $data = curl_exec($ch); + curl_close($ch); + Log::record("发送物流信息 orderId: {$orderId}, orderSn: {$orderSn}"); } public function calculate($type, $field) diff --git a/route/api.php b/route/api.php index 021576e1..8310b76a 100644 --- a/route/api.php +++ b/route/api.php @@ -21,6 +21,7 @@ use think\facade\Route; Route::group('api/', function () { Route::any('test', 'api.Auth/test'); + Route::any('dotest', 'api.Auth/dotest'); Route::resource('upload', 'api.Upload'); Route::post('articleCatch', 'api.Upload/article'); //强制登录