wangxingcheng 3 éve
szülő
commit
c335edc6ab

+ 1 - 1
opms_libary/micro_srv/micro_srv.go

@@ -271,7 +271,7 @@ func validToken(token string) gtoken.Resp {
 		return grsp
 	}
 
-	authService := InitMicroSrvClient("Admin", "micro_srv.auth")
+	authService := InitMicroSrvClient("Auth", "micro_srv.auth")
 	defer authService.Close()
 	rsp := &auth.Response{}
 	err := authService.Call(context.TODO(), "ValidToken", token, rsp)

+ 1 - 1
opms_parent/app/model/base_product.go

@@ -23,7 +23,7 @@ type AddBaseProductReq struct {
 	ProdCode  string     `p:"prodCode" v:"required#产品编号不能为空"`
 	ProdName  string     `p:"prodName" v:"required#产品名称不能为空"`
 	ProdClass string     `p:"prodClass" v:"required#产品分类不能为空"`
-	GuidPrice float64    `p:"guidPrice" v:"required#建议成交价"`
+	GuidPrice float64    `p:"guidPrice" json:"guidPrice,string" v:"required#建议成交价"`
 	Remark    string
 }
 //修改数据

+ 15 - 4
opms_parent/app/service/base_product.go

@@ -6,8 +6,9 @@ import (
 	"fmt"
 	"github.com/gogf/gf/errors/gerror"
 	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/os/gtime"
 	"github.com/gogf/gf/util/gconv"
-
+	"time"
 )
 
 type baseProductService struct {
@@ -44,11 +45,15 @@ func (p *baseProductService)GetList (req *model.BaseProductSearchReq)(total int,
 }
 //添加信息
 func (p *baseProductService)Create (req *model.AddBaseProductReq) (err error){
+	t1 := gtime.New(time.Now())
+	fmt.Println(t1)
 	productData := new(model.BaseProduct)
 	if err = gconv.Struct(req, productData); err != nil {
 		return
 	}
 	Model := dao.BaseProduct.M
+	productData.CreatedTime = t1
+	productData.UpdatedTime = t1
 	res, err := Model.Insert(productData)
 	if err != nil {
 		return
@@ -72,15 +77,21 @@ func (p *baseProductService)Delete(id int64)(err error){
 }
 //修改数据
 func(p *baseProductService)Update(req *model.UpdateBaseProductReq)(err error){
-	 db := dao.BaseProduct.M
-	if i, _ := db.Where("id!=?", req.Id).Count(); i == 0 {
+	uptime := gtime.New(time.Now())
+	db := dao.BaseProduct.M
+	record, err := db.FindOne("Id", req.Id)
+	if err != nil || record.IsEmpty(){
 		err = gerror.New("该数据不存在")
-		return
+		return err
 	}
+	fmt.Println(record.Map())
 	productData := new(model.BaseProduct)
 	if err = gconv.Struct(req, productData); err != nil {
 		return
 	}
+	mapinfo:=record.Map()
+	productData.CreatedTime = mapinfo[""]
+	productData.UpdatedTime = uptime
 	_,err=db.Where(req.Id).Update(productData)
 	if err!=nil{
 		g.Log().Error(err)

+ 1 - 1
opms_parent/config/config.toml

@@ -19,4 +19,4 @@
         link = "mysql:root:Dashoo#190801@ali@tcp(192.168.0.252:3306)/dashoo_crm"
 
 [micro_srv]
-    auth = "dashoo.opms.admin-0.0.1"
+    auth = "dashoo.opms.admin-0.0.1,127.0.0.1:8887"