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

充值卡测试

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