Giter VIP home page Giter VIP logo

mogutouerp's Issues

缺少index.html文件

运行命令$ go run main.go router.go -c conf/
router.go:13:12: pattern index.html: no matching files found

报错缺少index.html文件,请问index.html文件在哪?

你好,编译的时候出现报错

go build -o mogutou main.go router.go
router.go:4:2: cannot find package "github.com/Allenxuxu/mogutouERP/api" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/Allenxuxu/mogutouERP/api (from $GOROOT)
/Users/jacky/go/src/github.com/Allenxuxu/mogutouERP/api (from $GOPATH)
router.go:5:2: cannot find package "github.com/Allenxuxu/mogutouERP/middleware" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/Allenxuxu/mogutouERP/middleware (from $GOROOT)
/Users/jacky/go/src/github.com/Allenxuxu/mogutouERP/middleware (from $GOPATH)
main.go:7:2: cannot find package "github.com/Allenxuxu/mogutouERP/tree/master/models" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/Allenxuxu/mogutouERP/tree/master/models (from $GOROOT)
/Users/jacky/go/src/github.com/Allenxuxu/mogutouERP/tree/master/models (from $GOPATH)
main.go:8:2: cannot find package "github.com/Allenxuxu/mogutouERP/tree/master/pkg/token" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/Allenxuxu/mogutouERP/tree/master/pkg/token (from $GOROOT)
/Users/jacky/go/src/github.com/Allenxuxu/mogutouERP/tree/master/pkg/token (from $GOPATH)
router.go:6:2: cannot find package "github.com/gin-contrib/cors" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/gin-contrib/cors (from $GOROOT)
/Users/jacky/go/src/github.com/gin-contrib/cors (from $GOPATH)
main.go:9:2: cannot find package "github.com/gin-gonic/gin" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/gin-gonic/gin (from $GOROOT)
/Users/jacky/go/src/github.com/gin-gonic/gin (from $GOPATH)
main.go:10:2: cannot find package "github.com/jinzhu/gorm/dialects/mysql" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/jinzhu/gorm/dialects/mysql (from $GOROOT)
/Users/jacky/go/src/github.com/jinzhu/gorm/dialects/mysql (from $GOPATH)
main.go:11:2: cannot find package "github.com/micro/go-micro/config" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/micro/go-micro/config (from $GOROOT)
/Users/jacky/go/src/github.com/micro/go-micro/config (from $GOPATH)
main.go:12:2: cannot find package "github.com/micro/go-micro/config/source/file" in any of:
/usr/local/Cellar/go/1.13.4/libexec/src/github.com/micro/go-micro/config/source/file (from $GOROOT)
/Users/jacky/go/src/github.com/micro/go-micro/config/source/file (from $GOPATH)
make: *** [build] Error 1

google了一下没找到解决办法,请问怎么弄?macos下的go环境
谢谢

Gorm选择与字段冲突

2022/10/26 20:26:18 D:/golang/data/src/mogutouERP/mogutouERP/models/purchaseOrder.go:162
[error] invalid field found for struct github.com/Allenxuxu/mogutouERP/models.PurchaseOrderInfo's field Goods, need to define a valid foreign key for relations or it need to implement the Valuer/Scanner interface

func getPurchaseOrder(tx *gorm.DB, orderID string) (*PurchaseOrderInfo, error) {
	var order PurchaseOrderInfo
	err := tx.Table("purchase_orders").Select(
		"id, created_at, operator, amount, remarks, state, freight").Where("id = ?", orderID).First(&order).Error
	if err != nil {
		return nil, err
	}

	err = tx.Raw(`select t2.id, t2.name, t2.colour, t2.size, t2.brand, t1.number from purchase_goods as t1 left outer join
			commodities as t2 on t1.goods_id = t2.id where t1.purchase_order_id = ?`, orderID).Scan(&order.Goods).Error
	if err != nil {
		return nil, err
	}
	return &order, nil
}

order 的数据结构是:

type PurchaseOrderInfo struct {
	PurchaseOrder
	Goods []Commodity
}
type PurchaseOrder struct {
	gorm.Model
	Operator string `gorm:"size:255"`
	Remarks  string
	Amount   float32
	Freight  float32
	State    string `gorm:"default:'未完成'"`
}
// Commodity 商品表
type Commodity struct {
	ID            string `gorm:"primary_key"`
	Name          string
	Colour        string
	Size          string
	Brand         string
	Number        uint
	PresaleNumber uint
	SalesVolume   uint
	Price         float32
	PurchasePrice float32
}

跨域问题

后端采用的docker 部署
image
image

前端配置
image

结果
image

运行问题

用go mod 初始化后,下载不了依赖。
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.