diff --git a/api/controllers/plan/Bobing.php b/api/controllers/plan/Bobing.php index fb77d3c1..ee2fc987 100644 --- a/api/controllers/plan/Bobing.php +++ b/api/controllers/plan/Bobing.php @@ -100,9 +100,17 @@ class Bobing extends HD_Controller } $uid = 5; $credit = rand(50, 120); - $ret = $this->mdBobingUser->update(array("credit = credit+{$credit}" => null), array('uid' => $uid, - 'app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key'])); + $where = array('uid' => $uid, 'app_id' => $this->appConfig['app_id'], 'act_key' => $this->appConfig['act_key']); + $ret = $this->mdBobingUser->update(array("credit = credit+{$credit}" => null), $where); if ($ret) { + $re_u = $this->mdBobingUserCredit->get($where); + if ($re_u) { + $this->mdBobingUserCredit->update(array("credit = credit+{$credit}" => null), $where); + } else { + $where['credit'] = $credit; + $where['c_time'] = time(); + $this->mdBobingUserCredit->add($where); + } echo 'uid(' . $uid . ')本次加了' . $credit; } else { echo 'uid(' . $uid . ')本次加分失败了';