|
|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
+use bizGhs\book\classes\BookClass;
|
|
|
use common\components\book;
|
|
|
use common\components\bookJd;
|
|
|
+use common\components\orderSn;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -69,7 +71,26 @@ class BookController extends BaseController
|
|
|
//开启预订活动 ssh 20240609
|
|
|
public function actionOpenBook()
|
|
|
{
|
|
|
- util::complete();
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $orderSn = orderSn::getBookSn();
|
|
|
+ $data = [
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ 'shopId' => $this->shopId,
|
|
|
+ 'mainId' => $this->mainId,
|
|
|
+ ];
|
|
|
+ $repond = BookClass::add($data, true);
|
|
|
+ $shop = $this->shop;
|
|
|
+ $shop->bookSn = $orderSn;
|
|
|
+ $shop->save();
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('开启成功');
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Yii::info("开启失败原因:" . $e->getMessage());
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail('开启失败');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|