master
wangxinglong 2022-06-08 17:41:13 +08:00
parent a74ff7d4d0
commit 4e9d871ff4
3 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@ use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Config as CConfig;
use think\facade\Db;
use think\response\Json;
/**
@ -35,14 +36,17 @@ class Order extends Base
$params = $this->request->param();
$accountId = $this->request->user['user_id'] ?? 0;
Db::startTrans();
try {
$data = OrderRepository::getInstance()->createOrder($accountId, $params);
//OrderRepository::getInstance()->updateSpuStock([]);
Db::commit();
return $this->json(0, 'success', $data);
} catch (RepositoryException $e) {
Db::rollback();
return $this->json(4000, $e->getMessage());
} catch (Exception $e) {
Db::rollback();
OrderRepository::log('订单创建失败', $e, 'error', 'order');
return $this->json(5000, '订单创建失败'.$e->getMessage());
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB