RebateController.php 741 字节
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/31
 * Time: 4:53
 */

namespace api\wxapp\controller;


use think\Controller;
use think\Db;

class RebateController extends Controller
{
    /*
     * 分享返利
     * @param user_id
     * @param card_id
     */
    public function rebate() {
        $data = $this->request->param();
        $arr = [
            'card_id' => $data['card_id'],
            'user_id' => $data['user_id'],
            'money' => 1,
        ];
        $log = Db::name('share_log')->insert($arr);

        $arr = [
            'money' => ['exp','money - '.$data['money']],
            'num' => ['exp','num - 1'],
        ];

        $log2 = Db::name('share_log')->update($arr);
    }
}