OrderModel.php
946 字节
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
<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/16
* Time: 15:21
*/
namespace app\admin\model;
use think\Model;
class OrderModel extends Model
{
protected $autoWriteTimestamp = true;
/**
* 添加订单
*/
public function addOrder($data) {
$this->allowField(true)->data($data,true)->isUpdate(false)->save();
return $this;
}
/**
* 编辑订单
*/
public function editOrder($data) {
$this->allowField(true)->data($data,true)->isUpdate(true)->save();
return $this;
}
/**
* 查询订单
*/
public function getOrder($where) {
$where['o.delete_time'] = 0;
return $this->alias('o')
->field(['o.*,ms.user_login,os.name'])
->join('__MEMBER_SALES__ ms','o.user_id = ms.id')
->join('__ORDER_SORT__ os','os.id = o.sort_id')
->where($where)
->select();
}
}