Commit 66e1fb92 by huangchengyi

1.0

parent 46601ca6
......@@ -17,3 +17,4 @@ Homestead.json
cmd/cmd.exe
cmd/move/logs/
/cmd/dong/logs/*.log
logs
......@@ -4,14 +4,13 @@ import (
"context"
"fmt"
"github.com/bilibili/kratos/pkg/database/sql"
//"github.com/pkg/errors"
//"strconv"
"kaopu-server/internal/model"
"github.com/pkg/errors"
"strconv"
"os"
)
const (
_sql1= "select id,project_name from lie_model where project_id=? limit 1" //查询项目配置
_sql1= "select id,project_name from lie_model where project_id=%s limit 1" //查询项目配置
_sql2 = "select * from lie_basic_info "
)
......@@ -22,37 +21,35 @@ var(
//计算逾期分数
func (d *dao) CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) {
var (
// rows *sql.Rows
row *sql.Row
mod *model.Models
rows *sql.Rows
)
mod = new(model.Models)
row = d.db.QueryRow(ctx, _sql1,project_id)
if err = row.Scan(&mod.Id, &mod.Project_name); err != nil {
err = nil
////mod = new(model.Models)
//row = d.db.QueryRow(ctx, _sql1,project_id)
////if err = row.Scan(&mod.Id, &mod.Project_name); err != nil {
//// err = nil
//// return
////}
//project_res,_ = getAllParam(row);
//fmt.Println(project_res)
//os.Exit(1)
//查询项目配置
if rows, err = d.db.Query(ctx, fmt.Sprintf(_sql1,strconv.Itoa(project_id))); err != nil {
err = errors.WithStack(err)
return
}
fmt.Println(mod.Id)
os.Exit(1)
//if row, err = d.db.QueryRow(ctx, _sql1,project_id); err != nil {
////查询项目配置
////if rows, err = d.db.Query(ctx, fmt.Sprintf(_sql2,strconv.Itoa(project_id))); err != nil {
// err = errors.WithStack(err)
// return
//}
//defer rows.Close()
defer rows.Close()
//if err != nil{
// fmt.Println("select fail,err:",err)
// return
//}
//
//project_res,_ = getAllParam(rows); //
//if project_res == nil {
// return
//}
//fmt.Println(project_res)
//os.Exit(1)
if err != nil{
fmt.Println("select fail,err:",err)
return
}
project_res,_ = getAllParam(rows); //
if project_res == nil {
return
}
fmt.Println(project_res)
os.Exit(1)
return
}
......
package model
// Kratos hello kratos.
type Models struct {
type Model struct {
Id int64 `json:"id"`
Project_id string `json:"project_id"`
Project_name string `json:"project_name"`
......
File mode changed
[2019/11/21 17:21:53.592] [WARN] [/Users/gongyang/go/pkg/mod/github.com/bilibili/kratos@v0.3.1/pkg/database/sql/sql.go:679] sql_client slow log statement: Query query(SELECT user_id, user_name FROM ys_users ) args([]) time: 1.001553417s
[2019/11/21 17:22:25.088] [WARN] [/Users/gongyang/go/pkg/mod/github.com/bilibili/kratos@v0.3.1/pkg/database/sql/sql.go:679] sql_client slow log statement: Query query(SELECT * FROM lie_com_credits ) args([]) time: 1.004363403s
[2019/11/21 17:23:29.451] [WARN] [/Users/gongyang/go/pkg/mod/github.com/bilibili/kratos@v0.3.1/pkg/database/sql/sql.go:679] sql_client slow log statement: Query query(SELECT * FROM lie_com_credits ) args([]) time: 1.003427317s
[2019/11/21 17:24:18.153] [WARN] [/Users/gongyang/go/pkg/mod/github.com/bilibili/kratos@v0.3.1/pkg/database/sql/sql.go:679] sql_client slow log statement: Query query(SELECT * FROM lie_com_credits ) args([]) time: 1.004311142s
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment