Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1eafe36
update nginx/dev.wemall.com.conf file, due to /etc/nginx rather than …
keonjeo Apr 20, 2020
0601d6d
add gvm config and nvm config for wemall project (go 1.13.5 and nodej…
keonjeo Apr 20, 2020
81e4762
add go.mod and go.sum file for wemall/utils
keonjeo Apr 20, 2020
c19ea02
add go.mod and go.sum, update config.go
keonjeo Apr 20, 2020
52a5111
add go.mod and go.sum file for model directory
keonjeo Apr 20, 2020
825e593
add go.mod and go.sum for controller/admin
keonjeo Apr 20, 2020
5dda122
add go.mod and go.sum file for controller/common
keonjeo Apr 20, 2020
2799842
add go.mod and go.sum file for controller/cart
keonjeo Apr 20, 2020
87a0c06
add go.mod and go.sum file for controller/category
keonjeo Apr 20, 2020
e6c008a
add go.mod and go.sum file for controller/order
keonjeo Apr 20, 2020
1e564a9
add go.mod and go.sum file for controller/product
keonjeo Apr 20, 2020
5a3c0ad
add go.mod and go.sum file for controller/ueditor
keonjeo Apr 20, 2020
bc32a6a
add go.mod and go.sum file for controller/user
keonjeo Apr 20, 2020
872c778
add go.mod and go.sum file for controller/visit
keonjeo Apr 20, 2020
7af5d92
add go.mod and go.sum file for route
keonjeo Apr 20, 2020
f52b8dc
add go.mod and go.sum file for wemall directory
keonjeo Apr 20, 2020
9056739
add Makefile for make dep
keonjeo Apr 20, 2020
4c38b82
update Makefile soft-link path
keonjeo Apr 21, 2020
c547dec
update Makefile soft-link path
keonjeo Apr 21, 2020
0a4eb7d
XXX
keonjeo Apr 21, 2020
8eb0cb1
upgrade iris from v6.2 to v12
keonjeo Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .go-pkgset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wemall
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go1.13.5
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.17.0
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: run dep

### 这里的依赖关系是有先后顺序的 (如果修改到wemall目录下面的依赖, 需要维护安装依赖的顺序)
SUB_DIRS = utils config model controller route

dep:
make deps
@go get -v && go mod tidy
deps: $(patsubst %, deps/%, $(SUB_DIRS))
deps/%:
@echo ">>>>>>>>>>>>>>>> 正在安装 $(@F) 相关的依赖 >>>>>>>>>>>>>>>>"
@cd $(@F) && make dep
@echo "<<<<<<<<<<<<<<<< $(@F)相关的依赖, 安装完成 <<<<<<<<<<<<<<<<"
@echo ""
@echo ""
@echo ""

run:
go run main.go
4 changes: 4 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: dep

dep:
@go get -v && go mod tidy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $ go run main.go

| 库 | 说明 |
|:---------|:-----------------------|
| gopkg.in/kataras/iris.v6 | iris web框架 |
| github.com/kataras/iris/v12 | iris web框架 |
| github.com/jinzhu/gorm | gorm 持久层框架 |
| github.com/satori/go.uuid | uuid生成工具 |

Expand Down
1 change: 1 addition & 0 deletions config/Makefile
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"io/ioutil"
"regexp"
"wemall/utils"
"utils"
)

var jsonData map[string]interface{}
Expand Down
7 changes: 7 additions & 0 deletions config/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module wemall/config

go 1.13

replace utils => ./../utils

require utils v0.0.0-00010101000000-000000000000
7 changes: 7 additions & 0 deletions config/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8=
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
15 changes: 15 additions & 0 deletions controller/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: dep

### 这里的依赖关系是有先后顺序的 (如果修改到controller目录下面的依赖, 需要维护安装依赖的顺序)
SUB_DIRS = common admin cart category order product ueditor user visit

dep:
make deps
deps: $(patsubst %, deps/%, $(SUB_DIRS))
deps/%:
@echo ">>>>>>>>>>>>>>>> 正在安装 controller/$(@F) 相关的依赖 >>>>>>>>>>>>>>>>"
cd $(@F) && make dep
@echo "<<<<<<<<<<<<<<<< controller/$(@F)相关的依赖, 安装完成 <<<<<<<<<<<<<<<<"
@echo ""
@echo ""
@echo ""
1 change: 1 addition & 0 deletions controller/admin/Makefile
4 changes: 2 additions & 2 deletions controller/admin/admin.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package admin

import (
"gopkg.in/kataras/iris.v6"
"github.com/kataras/iris/v12"
)

// Authentication 授权
func Authentication(ctx *iris.Context) {
func Authentication(ctx iris.Context) {
if true {
ctx.Next()
}
Expand Down
28 changes: 28 additions & 0 deletions controller/admin/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module wemall/controller/admin

go 1.13

require (
github.com/ajg/form v1.5.1 // indirect
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/kataras/iris/v12 v12.1.8
github.com/klauspost/compress v1.10.4 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/moul/http2curl v1.0.0 // indirect
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/valyala/fasthttp v1.11.0 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
230 changes: 230 additions & 0 deletions controller/admin/go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions controller/cart/Makefile
28 changes: 17 additions & 11 deletions controller/cart/cart.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package cart

import (
"gopkg.in/kataras/iris.v6"
"wemall/model"
"wemall/controller/common"
"config"
"controller/common"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/sessions"
"model"
)

var (
cookieNameForSessionID = config.ServerConfig.SessionID
sess = sessions.New(sessions.Config{Cookie: cookieNameForSessionID})
)

// Create 购物车中添加商品
func Create(ctx *iris.Context) {
func Create(ctx iris.Context) {
SendErrJSON := common.SendErrJSON
var cart model.Cart

Expand All @@ -27,8 +34,8 @@ func Create(ctx *iris.Context) {
return
}

session := ctx.Session()
openID := session.GetString("weAppOpenID")
session := sess.Start(ctx)
openID := session.GetString("weAppOpenID")

if openID == "" {
SendErrJSON("登录超时", ctx)
Expand All @@ -40,13 +47,12 @@ func Create(ctx *iris.Context) {
SendErrJSON("error", ctx)
return
}
ctx.JSON(iris.StatusOK, iris.Map{
"errNo" : model.ErrorCode.SUCCESS,
"msg" : "success",
"data" : iris.Map{
_, _ = ctx.JSON(iris.Map{
"errNo": model.ErrorCode.SUCCESS,
"msg": "success",
"data": iris.Map{
"id": cart.ID,
},
})
return
}

17 changes: 17 additions & 0 deletions controller/cart/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module wemall/controller/cart

go 1.13

require (
config v0.0.0-00010101000000-000000000000
controller/common v0.0.0-00010101000000-000000000000
github.com/kataras/iris/v12 v12.1.8
model v0.0.0-00010101000000-000000000000
)

replace (
config => ./../../config
controller/common => ./../../controller/common
model => ./../../model
utils => ./../../utils
)
Loading