setPayment($fromUserAccount); $trade->setReceive($user['mobile']); $trade->setMoney($money); $trade->setRem('现金鼓励'); $result = $finance->order($msg, $trade); if(!$result) { Db::rollback(); return true; } //第二步 $cash = Cash::create([ 'mode'=>Cash::MODE_CANG, 'modeID'=>$cang['cangID'], 'outerNumber'=>$result, 'userID'=>$user['userID'], 'fromUser'=>$fromUserAccount, 'money'=>$money ]); //第三步 $user->userAccount = $user->userAccount->MODE_cashsend_addMoney($cash, $user); Db::commit(); } catch (Exception $e) { Log::write($e->getMessage().'|'.$e->getLine().'|'.$e->getFile(), 'behavior'); Db::rollback(); } return true; } }