新增订单支付完成发送物流信息

This commit is contained in:
yaooo 2023-08-08 16:33:08 +08:00
parent 3b6a96073e
commit c3f462cadd
5 changed files with 30 additions and 3 deletions

View File

@ -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) {

View File

@ -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');

View File

@ -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);

View File

@ -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)

View File

@ -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');
//强制登录