lyzflash
2025-11-17 91a56a9b83ec23a1580aa586a24b34aba6990ffa
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
<?php
 
namespace app\agent\model;
 
use app\common\model\agent\Contract as ContractModel;
 
class Contract extends ContractModel
{
    /**
     * 获取客户合同
     */
    public function getList($data)
    {
        $data = $this->where('client_id','=',$data[0])
                ->field(['name','url'])
                ->select();
 
        return $data;
    }
 
    /**
     * 新增记录
     */
    public function add($data)
    {
        return $this->saveAll($data);
    }
 
    /**
     * 修改记录
     */
    public function edit($data)
    {
        $this->startTrans();
        try {
            $save_data = [
                'client_name' => $data['client_name'],
                'company' => $data['company'],
                'mark_manager' => $data['mark_manager'],
                'handrate_wx'=>$data['handrate_wx'],
                'commissionrate_wx' => $data['commissionrate_wx']
            ];
            $this->save($save_data);
            
            $this->commit();
            return true;
        } catch (\Exception $e) {
            $this->error = $e->getMessage();
            $this->rollback();
            return false;
        }
    }
    /**
     * 移入移出回收站
     */
    public function recycle($is_recycle = true)
    {
        return $this->save(['is_recycle' => (int)$is_recycle]);
    }
 
    /**
     * 软删除
     */
    public function setDelete()
    {
        return $this->save(['is_delete' => 1]);
    }
 
}