AutoAssignCustomer.php
1.25 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
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AutoAssignCustomer extends Model
{
public $timestamps = false;
protected $table = 'auto_assign_customer';
const IS_NOW_YES = 1;
const IS_NOW_NO = 0;
public static function insertData($data)
{
return self::insertGetId($data);
}
//获取列表
public static function getList()
{
$res = self::orderBy('sort', 'asc')->get();
return ($res) ? $res->toArray() : [];
}
public static function getNowAssignInfo()
{
$res = self::where('is_now', self::IS_NOW_YES)->first();
return ($res) ? $res->toArray() : [];
}
public static function getInfoByOrderSort($sort = 0)
{
$res = self::where('sort', ">", $sort)->orderBy("sort", "ASC")->first();
return ($res) ? $res->toArray() : [];
}
public static function updateById($id, $update)
{
return self::where("id", $id)->update($update);
}
public static function updateAll($update)
{
return self::where([])->update($update);
}
public static function getInfoByDepartmentId($id)
{
$res = self::where('department_id', $id)->first();
return ($res) ? $res->toArray() : [];
}
}