RebateController.php
741 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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);
}
}