Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zptz-sass-kelaidian
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
李大见
zptz-sass-kelaidian
Commits
81f29ef0
提交
81f29ef0
authored
9月 17, 2024
作者:
窦斌
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
edit
上级
e67b717f
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
82 行增加
和
20 行删除
+82
-20
WebLogin.php
app/Http/Middleware/WebLogin.php
+1
-1
AftersaleOrderValidator.php
...ests/Validators/Api/MobileWeb/AftersaleOrderValidator.php
+2
-2
AftersaleOrderService.php
app/Services/Api/MobileWeb/AftersaleOrderService.php
+3
-3
LoginService.php
app/Services/Api/MobileWeb/LoginService.php
+76
-14
没有找到文件。
app/Http/Middleware/WebLogin.php
浏览文件 @
81f29ef0
...
...
@@ -55,7 +55,7 @@ class WebLogin
$now_time
=
$hours
+
10
*
60
*
60
;
if
(
$now_time
>
$login_web
[
'lowe_last_login'
])
{
// 每隔2个小时更新一次,降低更新次数,如果登录时间超过2个小时在操作就当前时间加12小时
DB
::
table
(
'login_web'
)
->
where
(
'api_token'
,
'='
,
$api_token
)
->
update
([
'lowe_last_login'
=>
$hours
+
12
*
60
*
60
]);
DB
::
table
(
'login_web'
)
->
where
(
'api_token'
,
'='
,
$api_token
)
->
update
([
'lowe_last_login'
=>
$hours
+
7
*
24
*
60
*
60
]);
}
$request
[
'api_token'
]
=
$api_token
;
//赋值解密后的token值
$session
[
'user_type'
]
=
$login_web
[
'user_type'
];
//用户账号类型
...
...
app/Http/Requests/Validators/Api/MobileWeb/AftersaleOrderValidator.php
浏览文件 @
81f29ef0
...
...
@@ -85,7 +85,7 @@ class AftersaleOrderValidator extends FormRequest
return
$validator
->
errors
();
}
}
//
日常反馈验证器
//
上传图片
public
function
uploadValidator
(
$data
)
{
// 自定义错误消息
...
...
@@ -107,7 +107,7 @@ class AftersaleOrderValidator extends FormRequest
}
}
//
添加图片验证器
//
删除图片
public
function
deletPicValidator
(
$data
)
{
// 自定义错误消息
...
...
app/Services/Api/MobileWeb/AftersaleOrderService.php
浏览文件 @
81f29ef0
...
...
@@ -349,8 +349,8 @@ class AftersaleOrderService extends Model
* @param [type] $data [description]
* @return [type] [description]
*/
public
static
function
quality
(
$data
)
{
$session
=
$data
(
'session'
)
;
public
static
function
quality
(
$data
)
{
$session
=
$data
[
'session'
]
;
$find_data
=
OrderAfter
::
where
(
'id'
,
$data
[
'id'
])
->
first
();
$serial_number
=
$find_data
[
'serial_number'
];
if
(
$find_data
[
'status'
]
==
1
||
$find_data
[
'status'
]
==
10
||
$find_data
[
'status'
]
==
15
){
...
...
@@ -358,7 +358,7 @@ class AftersaleOrderService extends Model
return
[
'ErrorCode'
=>
2
,
'ErrorMessage'
=>
'售后状态错误'
,
'Data'
=>
[]];
}
Db
::
beginTransaction
();
$rest
=
CommonService
::
accMe
(
$find_data
[
'sys_num'
],
"售后订单"
,
"【售后】申请完成,"
.
$data
[
'
quality_content
'
],
$serial_number
,
'2'
,
2
,
$session
[
'install_name'
],
$session
[
'install_id'
]);
$rest
=
CommonService
::
accMe
(
$find_data
[
'sys_num'
],
"售后订单"
,
"【售后】申请完成,"
.
$data
[
'
remark
'
],
$serial_number
,
'2'
,
2
,
$session
[
'install_name'
],
$session
[
'install_id'
]);
if
(
$rest
){
$get
[
'deal_time'
]
=
date
(
"Y-m-d H:i:s"
);
...
...
app/Services/Api/MobileWeb/LoginService.php
浏览文件 @
81f29ef0
...
...
@@ -16,13 +16,18 @@ class LoginService
// 登录
public
static
function
login
(
$request
)
{
if
(
isset
(
$request
[
'logins_type'
])
&&
$request
[
'logins_type'
]
==
2
){
$password
=
$request
[
'password'
];
}
else
{
$password
=
md5
(
$request
[
'password'
]);
}
if
(
$request
[
'user_type'
]
==
1
)
{
//技师登录
// 查询登录账号数据
$find_person
=
DB
::
table
(
'install_person as install'
)
->
leftJoin
(
'admin as adm'
,
'install.admin_id'
,
'='
,
'adm.id'
)
->
where
(
'delet_y'
,
1
)
->
where
(
'check_code'
,
$request
[
'account'
])
->
where
(
'install_password'
,
md5
(
$request
[
'password'
])
)
->
where
(
'install_password'
,
$password
)
->
select
(
'install.id'
,
'check_code'
,
'install_name'
,
'install_phone'
,
'install_is_type'
,
'admin_id'
,
'adm.company_id'
,
'admin_groupnew'
)
->
first
();
}
elseif
(
$request
[
'user_type'
]
==
2
)
{
//服务商登录
...
...
@@ -31,33 +36,34 @@ class LoginService
return
[
'ErrorCode'
=>
201
,
'ErrorMessage'
=>
'请填写公司名称!'
,
'data'
=>
''
];
}
//查询公司名称是否存在
$company_id
=
Company
::
where
(
"com_name"
,
$request
[
'company_name'
])
->
value
(
'com_id'
);
$company
=
Company
::
where
(
"com_name"
,
$request
[
'company_name'
])
->
select
(
'com_id'
,
'com_type'
)
->
first
();
$company_id
=
$company
[
'com_id'
];
// 查询登录账号数据
$find_person
=
DB
::
table
(
'admin as adm'
)
->
leftJoin
(
'admin_infor as adin'
,
'adin.admin_id'
,
'='
,
'adm.id'
)
->
where
(
'admin_acc'
,
$request
[
'account'
])
->
where
(
'company_id'
,
$company_id
)
->
whereIn
(
'admin_groupnew'
,
[
2
,
3
])
->
where
(
'admin_password'
,
md5
(
$request
[
'password'
])
)
->
where
(
'admin_password'
,
$password
)
->
select
(
'adm.id'
,
'admin_acc as check_code'
,
'admin_name as install_name'
,
'phone as install_phone'
,
'enable as install_is_type'
,
'adm.id as admin_id'
,
'admin_groupnew'
,
'company_id'
)
->
first
();
$find_person
=
CommonService
::
dataToArray
(
$find_person
);
}
if
(
empty
(
$find_person
))
{
return
[
'ErrorCode'
=>
202
,
'ErrorMessage'
=>
'账号密码错误!'
,
'data'
=>
''
];
return
[
'ErrorCode'
=>
202
,
'ErrorMessage'
=>
'账号密码错误!'
,
'data'
=>
''
];
}
if
(
$find_person
[
'install_is_type'
]
!=
1
)
{
return
[
'ErrorCode'
=>
203
,
'ErrorMessage'
=>
'当前账号已停用!'
,
'data'
=>
''
];
}
if
(
$request
[
'user_type'
]
==
2
&&
$
find_person
[
'admin_groupnew'
]
==
3
){
if
(
$request
[
'user_type'
]
==
2
&&
$
company
[
'com_type'
]
==
2
){
$request
[
'user_type'
]
=
3
;
}
if
(
$request
[
'openid'
]
)
{
if
(
isset
(
$request
[
'openid'
])
&&
$request
[
'openid'
]
!=
''
)
{
// 微信授权绑定用户信息
$bingding_res
=
self
::
accreditBinding
(
$request
,
$find_person
);
}
$expiration_time
=
12
*
60
*
60
;
//登录过期时间
$expiration_time
=
7
*
24
*
60
*
60
;
//登录过期时间
// 生成token
$unique_string
=
md5
(
uniqid
(
md5
(
microtime
(
true
))
.
rand
(
100000
,
999999
),
true
));
//生成唯一字符串
$api_token
=
sha1
(
$unique_string
);
//加密
...
...
@@ -155,6 +161,7 @@ class LoginService
'button'
=>
$button
,
'user_type'
=>
$request
[
'user_type'
],
'button_more'
=>
$button_more
,
'openid'
=>
$request
[
'openid'
],
];
return
[
'ErrorCode'
=>
1
,
'ErrorMessage'
=>
'登录成功'
,
'data'
=>
$return_data
];
}
else
{
...
...
@@ -165,12 +172,31 @@ class LoginService
// 微信授权绑定
public
static
function
accreditBinding
(
$request
,
$find_person
)
{
if
(
$request
[
'user_type'
]
==
1
){
$type
=
2
;
}
else
{
$type
=
1
;
}
$master
=
DB
::
table
(
'ser_master'
)
->
where
(
'wechat_number'
,
$request
[
'openid'
])
->
where
(
'ser_id'
,
$find_person
[
'id'
])
->
where
(
'type'
,
$type
)
->
value
(
'id'
);
if
(
!
$master
){
$poss
[
'wechat_number'
]
=
$request
[
'openid'
];
$poss
[
'ser_id'
]
=
$find_person
[
'id'
];
$poss
[
'creact_time'
]
=
date
(
"Y-m-d H:i:s"
);
$poss
[
'company_id'
]
=
$find_person
[
'company_id'
];
$poss
[
'type'
]
=
$type
;
DB
::
table
(
'ser_master'
)
->
insert
(
$poss
);
}
// 查询数据表openID是否存在绑定,存在绑定改为离线
DB
::
table
(
'installation_master'
)
->
where
(
'wechat_number'
,
$request
[
'openid'
])
->
update
([
'priority'
=>
2
,
'update_time'
=>
date
(
'Y-m-d H:i:s'
)]);
$find_data
=
DB
::
table
(
'installation_master'
)
->
where
(
'check_code'
,
$find_person
[
'
check_code
'
])
->
where
(
'check_code'
,
$find_person
[
'
id
'
])
->
where
(
'type'
,
$request
[
'user_type'
])
->
value
(
'id'
);
if
(
$find_data
){
...
...
@@ -181,11 +207,10 @@ class LoginService
// 新增绑定关系
$data
[
'wechat_number'
]
=
$request
[
'openid'
];
$data
[
'type'
]
=
$request
[
'user_type'
];
$data
[
'check_code'
]
=
$find_person
[
'
check_code
'
];
$data
[
'check_code'
]
=
$find_person
[
'
id
'
];
$data
[
'inst_name'
]
=
$find_person
[
'install_name'
];
$data
[
'inst_phone'
]
=
$find_person
[
'install_phone'
];
$data
[
'admin_id'
]
=
$find_person
[
'admin_id'
];
$data
[
'install_id'
]
=
$find_person
[
'id'
];
$data
[
'adminn_id'
]
=
$find_person
[
'admin_id'
];
$data
[
'priority'
]
=
1
;
return
DB
::
table
(
'installation_master'
)
->
insert
(
$data
);
}
...
...
@@ -276,10 +301,47 @@ class LoginService
$result
=
CommonService
::
requestGet
(
$url
);
$jsoninfo
=
json_decode
(
$result
,
true
);
if
(
isset
(
$jsoninfo
[
"openid"
])){
return
[
"ErrorCode"
=>
1
,
'ErrorMessage'
=>
'操作成功'
,
'data'
=>
$jsoninfo
[
"openid"
]];
$return_data
=
[
'api_token'
=>
''
,
//生成前台token
'account'
=>
''
,
'install_name'
=>
''
,
'install_phone'
=>
''
,
'install_id'
=>
''
,
'admin_id'
=>
''
,
'company_id'
=>
''
,
'openid'
=>
$jsoninfo
[
"openid"
],
];
$find_data
=
DB
::
table
(
'installation_master'
)
->
where
(
'wechat_number'
,
$jsoninfo
[
"openid"
])
->
where
(
"priority"
,
1
)
->
first
();
//openid
if
(
$find_data
){
if
(
$find_data
[
'type'
]
==
1
){
$admin
=
InstallPerson
::
where
(
'id'
,
$find_data
[
'check_code'
])
->
select
(
'check_code as admin_acc'
,
'install_password as admin_password'
)
->
first
();
$login
[
'user_type'
]
=
1
;
$company_name
=
''
;
}
else
{
$admin
=
Admin
::
where
(
'id'
,
$find_data
[
'check_code'
])
->
select
(
'admin_acc'
,
'admin_password'
,
'company_id'
)
->
first
();
if
(
$admin
){
$company_name
=
Company
::
where
(
"com_id"
,
$admin
[
'company_id'
])
->
value
(
'com_name'
);
}
$login
[
'user_type'
]
=
2
;
}
$login
[
'logins_type'
]
=
2
;
$login
[
'login_type'
]
=
1
;
$login
[
'account'
]
=
$admin
[
'admin_acc'
];
$login
[
'password'
]
=
$admin
[
'admin_password'
];
$login
[
'company_name'
]
=
$company_name
;
$login
[
'openid'
]
=
$jsoninfo
[
"openid"
];
$data
=
self
::
login
(
$login
);
if
(
$data
[
'ErrorCode'
]
==
1
){
return
[
'ErrorCode'
=>
1
,
'ErrorMessage'
=>
'操作成功'
,
'data'
=>
$data
[
'data'
]];
}
}
return
[
'ErrorCode'
=>
201
,
'ErrorMessage'
=>
'自动登录失败'
,
'data'
=>
$return_data
];
}
else
{
return
[
"ErrorCode"
=>
ErrorInc
::
SAPI_FAILED
,
'ErrorMessage'
=>
'
操作
失败'
,
'data'
=>
$jsoninfo
];
return
[
"ErrorCode"
=>
ErrorInc
::
SAPI_FAILED
,
'ErrorMessage'
=>
'
自动登录
失败'
,
'data'
=>
$jsoninfo
];
}
$openid
=
$jsoninfo
[
"openid"
];
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论