ProductUser.php
1.7 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace app\common\model\serviceapi;
use app\common\model\ServiceApi;
/**
* 功能描述 用户管理
* Class Product
* @package app\common\model\commapi
* Date: 2020/11/2
* Time: 16:33
* @author nyq
*/
class ProductUser extends ServiceApi
{
protected $table = "sos_product_user";
protected $pk = "id";
/**
* 函数功能描述 添加用户
* Date: 2020/11/2
* Time: 15:00
* @author nyq
*/
public function add($data)
{
$res = static::insertGetId($data);
return $res;
}
/**
* 函数功能描述 编辑奖品
* @param $where
* @param $data
* Date: 2020/7/21
* Time: 16:47
* @author nyq
*/
public function productUp($where, $data) {
$res = static::where($where)->update($data);
return $res;
}
/**
* 函数功能描述 获取商品列表
* Date: 2020/11/2
* Time: 16:40
* @author nyq
*/
public function getUserlist($code,$offset,$rows){
$user = static::alias("user")->where($code)->limit($offset,$rows);
$res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
->select();
return $res;
}
public function getUserlistToEx(){
$user = static::alias("user");
$res= $user->join("sos_product_order or", "or.user_id=user.id")->join("sos_product_goods go", "or.goods_id=go.id","LEFT")
->field("user.*,or.order_code,or.num,or.price,go.name as goods_name")
->select();
return $res;
}
}