Commit 4b44dd66 by 冷斌

fix bug

parent 73a3a571
......@@ -110,11 +110,11 @@ class Model_Guard extends PhalApi_Model_NotORM {
$action='buyguard';
$giftid= $guardinfo['id'];
$total= $guardinfo['coin'];
$consumption = $total * 10;
/* 更新用户余额 消费 */
$isok=DI()->notorm->users
->where('id = ? and coin>=?', $uid,$total)
->update(array('coin' => new NotORM_Literal("coin - {$total}"),'consumption' => new NotORM_Literal("consumption + {$total}") ) );
->update(array('coin' => new NotORM_Literal("coin - {$total}"),'consumption' => new NotORM_Literal("consumption + {$consumption}") ) );
if(!$isok){
$rs['code'] = 1002;
$rs['msg'] = '余额不足';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment