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

赠送积分模块

... ... @@ -239,7 +239,7 @@ class PayController extends HomeBaseController
private function integral($oid)
{
//判断该订单是否属于赠送积分订单
$info = Db::name('zj_order')->field('step,cid,pay_type')->where(['id' => $oid])->find();
$info = Db::name('zj_order')->field('uid,step,cid,pay_type')->where(['id' => $oid])->find();
if ($info['cid'] == 2 && $info['step'] == 2) {
if ($info['pay_type'] == 1 || $info['pay_type'] == 2) {
//计算该笔订单应给积分总额
... ... @@ -259,10 +259,10 @@ class PayController extends HomeBaseController
//插入配送计划表,先将此积分的一半立刻给用户,剩余一半每日按固定百分比给用户,直到发完为止
$integral_half = $integral / 2;
Db::startTrans();
$integral_give_id = $model->insertIntegralGive(session('user.id'), $ratio, $integral_half, $integral, time());
$integral_give_id = $model->insertIntegralGive($info['uid'], $ratio, $integral_half, $integral, time());
if ($integral_give_id) {
if ($model->insertIntegralLog($integral_give_id, session('user.id'), time(), $integral_half, 1)) {
if(Db::name('user')->where(['id'=>session('user.id')])->setInc('balance', $integral_half)) {
if ($model->insertIntegralLog($integral_give_id, $info['uid'], time(), $integral_half, 1)) {
if(Db::name('user')->where(['id'=>$info['uid']])->setInc('balance', $integral_half)) {
Db::commit();
}else {
Db::rollback();
... ...