Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_soapi
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7ef6e4df
authored
Jan 09, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
fbf2e8b4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
4 deletions
pkg/common/function.go → common/function.go
service/self.go → logic/self.go
pkg/setting/data.go → map/data.go
pkg/readme.md
readme.md
server/http/self.go
pkg/
common/function.go
→
common/function.go
View file @
7ef6e4df
File moved
service
/self.go
→
logic
/self.go
View file @
7ef6e4df
package
service
package
logic
import
(
"LC_soapi/pkg/es"
...
...
@@ -37,6 +37,7 @@ func Search(params SearchParams) interface{} {
//获取需要用到的ES参数
func
getESParams
(
params
SearchParams
)
(
esParams
ESParams
)
{
var
(
upperField
,
intField
[]
string
goodsTempStatus
,
TestFlagNum
int
...
...
pkg/setting
/data.go
→
map
/data.go
View file @
7ef6e4df
package
setting
package
_map
//品牌简写替换
var
SelfBrandReplace
=
map
[
string
]
string
{
...
...
pkg/readme.md
0 → 100644
View file @
7ef6e4df
-
操作
```python
#写
set(名称, 值,超时秒数) #string写入
hset(名称,键名,键值) #hash写入
hmset(名称,键值对) #hash批量写入
rpush(名称,值1,值2,...) #list右写入
lpush(名称,值1,值2,...) #list左写入
zadd(名称,值1,排序1,值2,排序2....) #zset写入
#删
delete(名称) #string删
hdel(名称,值1,值2,...) #hash批量删
zremrangebyrank(名称,起始索引,结束索引) #zset删除范围内的数据
lrem(名称,值) #list删除符合值的数据
lpop(名称) #list删除最左
#读
get(名称) #string获取
hget(名称,键名) #hash获取
hgetall(名称) #hash获取所有
hvals(名称) #获取键值
zcard(名称) #获取zset条数
hlen(名称) #获取hash条数
llen(名称) #获取list条数
zrange(名称,起始索引,结束索引,是否分数倒序,是否获取分数,分数类型转换)
zrevrange(名称,起始索引,结束索引) #zset固定分数倒叙
keys(名称) #搜索键名 * ?通配符
#其他
ttl(名称) #查看过期时间
expire(名称,时间) #写过期时间
#string
redis.set('key', 'value')
redis.set('key', 'value', 10)
redis.get('key')
redis.delete('key')
#hash
redis.hset('name', 'key', 'value')
redis.hmset('name', {'key1':'value1', 'key2':'value2'})
redis.hget('name', 'key')
redis.hgetall('name')
redis.hlen('name')
redis.hvals('name')
redis.hdel('name', 'key1', 'key2')
#list
redis.rpush('key', '1')
redis.rpush('key', '1', '2', '3')
redis.lpush('key', '1')
redis.lpush('key', '1', '2', '3')
redis.llen('key')
redis.lrange('key', 0, 5)
redis.lrem('key', '2')
redis.lpop('key')
#zset
redis.zadd('key', 'a1', 6, 'a2', 2, 'a3',5)
redis.zadd('key', b1=10, b2=5)
redis.zcard('key')
redis.zrange('key', 0, 1)
eg:['c', 'a']
redis.zrange('key', 0, 1, True) #等于redis.zrevrange('key', 0, 1)
eg:['a', 'c']
redis.zrange('key', 0, 1, False, True) #显示分数
eg:[('q', 4), ('b', 3)]
redis.zrange('key', 0, 1, False, True, float) #分数转float类型
eg:[('q', 4.0), ('b', 3.0)]
redis.zrevrange('key', 0, 2)
eg:['a', 'c']
redis.zremrangebyrank('key', 2, 6)
#其他
redis.keys('key*')
redis.ttl('key')
redis.expire('key', 1000)
```
readme.md
0 → 100644
View file @
7ef6e4df
#整个项目说明:结构说明,怎么调用
\ No newline at end of file
server/http/self.go
View file @
7ef6e4df
...
...
@@ -10,11 +10,11 @@ import (
func
Search
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
//先去处理请求参数
var
params
service
.
SearchParams
var
params
logic
.
SearchParams
if
err
:=
c
.
ShouldBindQuery
(
&
params
);
err
!=
nil
{
appG
.
ResponseErr
(
500
,
"参数有误"
)
}
result
:=
service
.
Search
(
params
)
result
:=
logic
.
Search
(
params
)
appG
.
ResponseData
(
result
)
}
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