Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
4c5fc6d0
Commit
4c5fc6d0
authored
Oct 15, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'qrcode' into salon
parents
50404ff8
24773813
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
YHScanModel.swift
...y/galaxy/Classes/Modules/Mine(我的)/Model/YHScanModel.swift
+12
-18
No files found.
galaxy/galaxy/Classes/Modules/Mine(我的)/Model/YHScanModel.swift
View file @
4c5fc6d0
...
@@ -35,6 +35,14 @@ struct YHScanType: OptionSet {
...
@@ -35,6 +35,14 @@ struct YHScanType: OptionSet {
}
}
}
}
var
prefixString
:
String
{
if
self
==
.
checkIn
{
return
"SLQD_"
}
else
{
return
""
}
}
var
instructionText
:
String
?
{
var
instructionText
:
String
?
{
if
self
==
.
checkIn
{
if
self
==
.
checkIn
{
return
"将二维码放到框内"
return
"将二维码放到框内"
...
@@ -50,28 +58,14 @@ struct YHScanType: OptionSet {
...
@@ -50,28 +58,14 @@ struct YHScanType: OptionSet {
/// 从二维码内容识别类型
/// 从二维码内容识别类型
func
recognizeType
(
from
code
:
String
)
->
YHScanType
?
{
func
recognizeType
(
from
code
:
String
)
->
YHScanType
?
{
// 根据二维码内容规则识别类型
// 根据二维码内容规则识别类型
if
contains
(
.
checkIn
)
&&
code
.
hasPrefix
(
"CHECKIN_"
)
{
if
contains
(
.
checkIn
)
&&
code
.
hasPrefix
(
YHScanType
.
checkIn
.
prefixString
)
{
return
.
checkIn
return
.
checkIn
}
}
if
contains
(
.
smartCabinet
)
&&
code
.
hasPrefix
(
"CABINET_"
)
{
//
if contains(.smartCabinet) && code.hasPrefix("CABINET_") {
return
.
smartCabinet
//
return .smartCabinet
}
//
}
// 可以添加更多识别规则
// 示例: JSON 格式识别
if
let
data
=
code
.
data
(
using
:
.
utf8
),
let
json
=
try
?
JSONSerialization
.
jsonObject
(
with
:
data
)
as?
[
String
:
Any
],
let
type
=
json
[
"type"
]
as?
String
{
switch
type
{
case
"checkin"
:
return
contains
(
.
checkIn
)
?
.
checkIn
:
nil
case
"cabinet"
:
return
contains
(
.
smartCabinet
)
?
.
smartCabinet
:
nil
default
:
break
}
}
// 如果只有一个类型,直接返回
// 如果只有一个类型,直接返回
if
self
==
.
checkIn
{
if
self
==
.
checkIn
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment