Commit 66e1fb92 by huangchengyi

1.0

parent 46601ca6
...@@ -17,3 +17,4 @@ Homestead.json ...@@ -17,3 +17,4 @@ Homestead.json
cmd/cmd.exe cmd/cmd.exe
cmd/move/logs/ cmd/move/logs/
/cmd/dong/logs/*.log /cmd/dong/logs/*.log
logs
...@@ -4,14 +4,13 @@ import ( ...@@ -4,14 +4,13 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/bilibili/kratos/pkg/database/sql" "github.com/bilibili/kratos/pkg/database/sql"
//"github.com/pkg/errors" "github.com/pkg/errors"
//"strconv" "strconv"
"kaopu-server/internal/model"
"os" "os"
) )
const ( 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 " _sql2 = "select * from lie_basic_info "
) )
...@@ -22,37 +21,35 @@ var( ...@@ -22,37 +21,35 @@ var(
//计算逾期分数 //计算逾期分数
func (d *dao) CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) { func (d *dao) CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) {
var ( var (
// rows *sql.Rows rows *sql.Rows
row *sql.Row
mod *model.Models
) )
mod = new(model.Models) ////mod = new(model.Models)
row = d.db.QueryRow(ctx, _sql1,project_id) //row = d.db.QueryRow(ctx, _sql1,project_id)
if err = row.Scan(&mod.Id, &mod.Project_name); err != nil { ////if err = row.Scan(&mod.Id, &mod.Project_name); err != nil {
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 return
} }
fmt.Println(mod.Id) defer rows.Close()
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()
//if err != nil{ if err != nil{
// fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
// return return
//} }
//
//project_res,_ = getAllParam(rows); // project_res,_ = getAllParam(rows); //
//if project_res == nil { if project_res == nil {
// return return
//} }
//fmt.Println(project_res) fmt.Println(project_res)
//os.Exit(1) os.Exit(1)
return return
} }
......
package model package model
// Kratos hello kratos. // Kratos hello kratos.
type Models struct { type Model struct {
Id int64 `json:"id"` Id int64 `json:"id"`
Project_id string `json:"project_id"` Project_id string `json:"project_id"`
Project_name string `json:"project_name"` 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