|
@@ -86,7 +86,7 @@ class buy_virtualLogic
|
|
* @param int $member_id
|
|
* @param int $member_id
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
- public function buyStep3($post, $member_id,$calc_vorder_amount = null,$merchant = false)
|
|
|
|
|
|
+ public function buyStep3($post, $member_id,$calc_vorder_amount = null,$merchant = false,$use_trans = true)
|
|
{
|
|
{
|
|
$fRefill = $merchant;
|
|
$fRefill = $merchant;
|
|
$result = $this->getBuyStepData($post['goods_id'], $post['quantity'], $member_id, $fRefill);
|
|
$result = $this->getBuyStepData($post['goods_id'], $post['quantity'], $member_id, $fRefill);
|
|
@@ -116,7 +116,10 @@ class buy_virtualLogic
|
|
{
|
|
{
|
|
$model_goods = Model('goods');
|
|
$model_goods = Model('goods');
|
|
//开始事务
|
|
//开始事务
|
|
- $trans = new trans_wapper($model_goods,__METHOD__);
|
|
|
|
|
|
+ if($use_trans) {
|
|
|
|
+ $trans = new trans_wapper($model_goods,__METHOD__);
|
|
|
|
+ }
|
|
|
|
+
|
|
$member_info = Model('member')->getMemberInfo(['member_id' => $member_id]);
|
|
$member_info = Model('member')->getMemberInfo(['member_id' => $member_id]);
|
|
$order_info = $this->_createOrder($input,$goods_info,$member_info,$fRefill);
|
|
$order_info = $this->_createOrder($input,$goods_info,$member_info,$fRefill);
|
|
if (!empty($post['password']))
|
|
if (!empty($post['password']))
|
|
@@ -144,12 +147,17 @@ class buy_virtualLogic
|
|
else {
|
|
else {
|
|
Log::record('',Log::DEBUG);
|
|
Log::record('',Log::DEBUG);
|
|
}
|
|
}
|
|
- //提交事务
|
|
|
|
- $trans->commit();
|
|
|
|
|
|
+ if($use_trans) {
|
|
|
|
+ //提交事务
|
|
|
|
+ $trans->commit();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
catch (Exception $e)
|
|
catch (Exception $e)
|
|
{
|
|
{
|
|
- $trans->rollback();
|
|
|
|
|
|
+ if($use_trans) {
|
|
|
|
+ $trans->rollback();
|
|
|
|
+ }
|
|
|
|
+
|
|
return callback(false, $e->getMessage());
|
|
return callback(false, $e->getMessage());
|
|
}
|
|
}
|
|
|
|
|