UserLogic.php
1.5 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
<?php
namespace App\Http\Logic\Bside;
use App\Enums\Common\Code;
use App\Models\User as UserModel;
class UserLogic extends BaseLogic
{
//获取用户列表
public function lists($map, $p, $row,$order, $fields = ['*']){
$userModel = new UserModel();
$lists = $userModel->lists($map, $p, $row,$order,$fields);
if(empty($lists)){
return [];
}
return $lists;
}
//新增用户
public function add($param){
$userModel = new UserModel();
//验证当前用户是否存在
$info = $userModel->read(['mobile'=>$param['mobile']]);
if(!empty($info)){
return false;
}
//密码加密
$param['password'] = base64_encode(md5($param['password']));
$rs = $userModel->add($param);
if($rs === false){
return false;
}
return true;
}
/**
* @param $param
* @name :编辑管理员
* @return bool
* @author :liyuhang
* @method
*/
public function edits($param){
$userModel = new UserModel();
//验证当前用户是否存在
$info = $userModel->read(['mobile'=>$param['mobile']]);
if(!empty($info)){
return false;
}
//密码加密
$param['password'] = base64_encode(md5($param['password']));
$rs = $userModel->edit($param,['id'=>$param['id']]);
if($rs === false){
return false;
}
return true;
}
}