SubjoinInsuranceModel.php
1.9 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
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/12/27
* Time: 17:33
*/
namespace app\index\model;
use think\Model;
class SubjoinInsuranceModel extends Model
{
public function subjoinSum($where){
$where['c.delete_time'] = ['eq',0];
$where['s.delete_time'] = ['eq',0];
// $where['c.expire_time'] = ['>',time()];//判断保单是否还在缴费期限内
$data = $this
->alias('s')
->join('collocation c','s.collocation_id = c.id')
->where($where)
->sum('s.subjoin_pay_method_price');
return $data;
}
public function selectData($where,$whereor=null){
$where['s_i.delete_time'] = ['eq',0];
$where['c.delete_time'] = ['eq',0];
//$where['o.status'] = ['eq',3];
$data = $this
->alias('s_i')
->field('s_i.*,c.insurer,o.order_expire_time,o.status,o.order_about_time,o.order_expire_time2')
->join('cmf_collocation c','c.id = s_i.collocation_id')
->join('cmf_order_info o_i','c.id = o_i.collocation_id')
->join('cmf_order o','o_i.order_id = o.id')
->where($where)
->whereOr($whereor)
->order('c.create_time','desc')
// ->fetchSql()
->select()->toArray();
$new_data = [];
foreach($data as $k1=>$v1 ){
$new_data[$v1['subjoin_product_name']][] = $v1;
}
return $new_data;
}
public function selectData2($where){
$where['delete_time'] = ['eq',0];
$data = $this->where($where)->select()->toArray();
return $data;
}
public function findData($where){
$where['delete_time'] = ['eq',0];
$data = $this->where($where)->find();
return $data;
}
public function deleteData($where){
$result = $this->where($where)->delete();
return $result;
}
}