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

赠送积分模块

... ... @@ -191,11 +191,11 @@ class PayController extends HomeBaseController
private function wxPay($info)
{
//只有未支付的订单才能唤起微信支付
if(Db::name('zj_order')->where(['id'=>$info['attach']])->value('step') == 1) {
if (Db::name('zj_order')->where(['id' => $info['attach']])->value('step') == 1) {
require_once EXTEND_PATH . '/Payment.php';
$pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee'] * 100);
$this->success('ok', url('user/center/orderlist'), $pay->pay());
}else {
} else {
$this->success('该订单禁止支付', '', false);
}
}
... ... @@ -227,21 +227,22 @@ class PayController extends HomeBaseController
}
//赠送积分模块
public function integral() {
public function integral()
{
$oid = 156;
//判断该订单是否属于赠送积分订单
$info = Db::name('zj_order')->field('step,cid,pay_type')->where(['id'=>$oid])->find();
if($info['cid'] == 2 && $info['step'] == 2) {
if($info['pay_type'] == 1 || $info['pay_type'] == 2) {
$info = Db::name('zj_order')->field('step,cid,pay_type')->where(['id' => $oid])->find();
if ($info['cid'] == 2 && $info['step'] == 2) {
if ($info['pay_type'] == 1 || $info['pay_type'] == 2) {
//计算该笔订单应给积分总额
$data = Db::name('zj_order_goods')->alias('o')
->field('g.price,g.num')
->field('g.price,o.num')
->join('zj_goods g', 'g.id=o.gid')
->where(['oid'=>$oid])
->where(['oid' => $oid])
->select();
$integral = 0;
foreach ($data as $item) {
$integral+= $item['price'] * $item['num'];
$integral += $item['price'] * $item['num'];
}
echo $integral;
}
... ...