diff --git a/base/aaa/user.go b/base/aaa/user.go index c7d0f27a..030301aa 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -112,11 +112,7 @@ func init() { _user_create(m, arg[0], kit.Select("", arg, 1)) }}, mdb.MODIFY: {Name: "modify username [key value]...", Help: "编辑", Hand: func(m *ice.Message, arg ...string) { - if len(arg) == 2 { - _user_modify(m, m.Option("username"), arg[0], arg[1]) - return - } - _user_modify(m, arg[0], arg[1:]...) + _user_modify(m, m.Option("username"), arg[0], arg[1]) }}, mdb.SEARCH: {Name: "search type name text arg...", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { _user_search(m, arg[0], arg[1], kit.Select("", arg, 2)) diff --git a/base/mdb/mdb.go b/base/mdb/mdb.go index 02189d8f..44ed2f13 100644 --- a/base/mdb/mdb.go +++ b/base/mdb/mdb.go @@ -170,11 +170,13 @@ func _list_import(m *ice.Message, prefix, key, file string) { m.Log_IMPORT(kit.MDB_KEY, kit.Keys(prefix, key), kit.MDB_COUNT, count) m.Echo(kit.Keys(file, CSV)) } -func _list_select(m *ice.Message, prefix, key, limit, offend, field, value string) { - m.Option("cache.limit", limit) - m.Option("cache.offend", offend) +func _list_select(m *ice.Message, prefix, key, field, value string) { fields := strings.Split(kit.Select("time,name", m.Option("fields")), ",") m.Grows(prefix, key, field, value, func(index int, value map[string]interface{}) { + if field == kit.MDB_ID { + m.Push("detail", value) + return + } m.Push("", value, fields) }) } @@ -321,7 +323,7 @@ var Index = &ice.Context{Name: "mdb", Help: "数据模块", SELECT: {Name: "select conf key type field value", Help: "数据查询", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { switch arg[2] { case LIST: - _list_select(m, arg[0], arg[1], kit.Select("10", arg, 3), kit.Select("0", arg, 4), kit.Select("", arg, 5), kit.Select("", arg, 6)) + _list_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4)) case HASH: _hash_select(m, arg[0], arg[1], arg[3], arg[4]) } diff --git a/core/chat/meet.go b/core/chat/meet.go index 4f6dce86..d90b3557 100644 --- a/core/chat/meet.go +++ b/core/chat/meet.go @@ -1,12 +1,12 @@ package chat import ( - "path" - ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/mdb" "github.com/shylinux/icebergs/base/web" kit "github.com/shylinux/toolkits" + + "path" ) const MEET = "meet" @@ -15,24 +15,30 @@ const ( DATE = "date" ) -var _miss_select = "time,name,性别,年龄,籍贯,学历,职业,照片" +var _miss_select = "time,name,性别,年龄,身高,籍贯,户口,学历,职业,公司,年薪,资产,家境,照片" var _miss_insert = kit.List( "_input", "text", "name", "name", "_input", "text", "name", "性别", "_input", "text", "name", "年龄", - "_input", "text", "name", "生日", - "_input", "text", "name", "照片", "_input", "text", "name", "身高", "_input", "text", "name", "体重", + + "_input", "text", "name", "星座", + "_input", "text", "name", "生日", "_input", "text", "name", "性格", "_input", "text", "name", "爱好", + "_input", "text", "name", "籍贯", "_input", "text", "name", "户口", "_input", "text", "name", "学历", "_input", "text", "name", "学校", "_input", "text", "name", "职业", + "_input", "text", "name", "公司", + "_input", "text", "name", "年薪", "_input", "text", "name", "资产", + "_input", "text", "name", "家境", + "_input", "text", "name", "照片", ) var _date_select = "time,id,name,地点,主题" @@ -56,7 +62,7 @@ func init() { m.Save(MISS, DATE) }}, - MISS: {Name: "miss name=auto auto 添加:button 导出:button 导入:button", Help: "miss", Meta: kit.Dict( + MISS: {Name: "miss name=auto auto 添加:button 导出:button 导入:button", Help: "信息", Meta: kit.Dict( "display", "", "insert", _miss_insert, ), Action: map[string]*ice.Action{ mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) { @@ -80,17 +86,31 @@ func init() { msg.Table(func(index int, value map[string]string, head []string) { for _, k := range head { if k == "照片" { + if m.Option(ice.MSG_USERUA) == "" { + continue + } m.Push("照片", m.Cmdx(mdb.RENDER, web.RENDER.IMG, path.Join("/share/local", value["照片"]))) } else { m.Push(k, value[k]) } } }) - m.PushAction("删除") + if m.Option(ice.MSG_USERUA) == "" { + return + } + m.PushAction("喜欢", "删除") + } else { + msg.Table(func(index int, value map[string]string, head []string) { + if value["key"] == "照片" { + value["value"] = m.Cmdx(mdb.RENDER, web.RENDER.IMG, path.Join("/share/local", value["value"]), "400") + } + m.Push("key", value["key"]) + m.Push("value", value["value"]) + }) } }}, - DATE: {Name: "date name=auto auto 添加:button 导出:button 导入:button", Help: "date", Meta: kit.Dict( + DATE: {Name: "date id=auto auto 添加:button 导出:button 导入:button", Help: "约会", Meta: kit.Dict( "display", "", "insert", _date_insert, ), Action: map[string]*ice.Action{ mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) { @@ -109,8 +129,12 @@ func init() { m.Cmdy(mdb.IMPORT, m.Prefix(DATE), "", mdb.LIST) }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.Option("fields", _date_select) - m.Cmdy(mdb.SELECT, m.Prefix(DATE), "", mdb.LIST) + if len(arg) == 0 { + m.Option("fields", _date_select) + m.Cmdy(mdb.SELECT, m.Prefix(DATE), "", mdb.LIST) + return + } + m.Cmdy(mdb.SELECT, m.Prefix(DATE), "", mdb.LIST, kit.MDB_ID, arg[0]) }}, }, }, nil) diff --git a/core/wiki/feel.go b/core/wiki/feel.go index aef98c26..0f54da59 100644 --- a/core/wiki/feel.go +++ b/core/wiki/feel.go @@ -21,8 +21,8 @@ func init() { Index.Merge(&ice.Context{Name: "feel", Help: "影音媒体", Configs: map[string]*ice.Config{ FEEL: {Name: "feel", Help: "影音媒体", Value: kit.Data( - kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|PNG|jpg|JPG|MOV|m4v|mp4)", - "height", "400", "page.limit", "3", + kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|PNG|jpg|jpeg|JPG|MOV|m4v|mp4)", + "height", "200", "page.limit", "3", )}, }, Commands: map[string]*ice.Command{ diff --git a/misc/wx/wx.shy b/misc/wx/wx.shy index ea434f58..c58fb625 100644 --- a/misc/wx/wx.shy +++ b/misc/wx/wx.shy @@ -10,9 +10,9 @@ image qrcode `https://weixin.qq.com` chapter "应用" -field "feel" web.wiki.feel args `[ usr/export/web.chat.meet.miss/feel/ ]` field "miss" web.chat.meet.miss args `[ ]` field "date" web.chat.meet.date args `[ ]` +field "feel" web.wiki.feel args `[ usr/export/web.chat.meet.miss/feel/ ]` field "user" user field "sess" sess