作者 lihan
1 个管道 的构建 通过 耗费 0 秒

充值卡测试

... ... @@ -34,11 +34,10 @@ class ChargeController extends HomeBaseController
$pay = new \Payment();
$return = $pay->handleNotify();
if (!empty($return)) {
Db::name('user')->where(['id' => 4])->setInc('balance', 50);
$info = Db::name('charge')->where(['id' => $return['attach']])->find();
$info = Db::name('charge')->where(['id'=>$return['attach']])->find();
$balance = $info['denomination'] + $info['bonus'];
Db::startTrans();
if (Db::name('user')->where(['openid' => $return['openid']])->setInc('balance', $balance)) {
if (Db::name('user')->where(['openid'=>$return['openid']])->setInc('balance', $balance)) {
$data = [
'user_id' => session('user.id'),
'type' => 1,
... ... @@ -46,7 +45,7 @@ class ChargeController extends HomeBaseController
'create_time' => time()
];
if (Db::name('my_wallet')->insert($data)) {
//Db::commit();
Db::commit();
echo "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
exit();
} else {
... ...