本文整理匯總了Golang中github.com/hjqhezgh/lessgo.Prop.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Prop.Name方法的具體用法?Golang Prop.Name怎麽用?Golang Prop.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hjqhezgh/lessgo.Prop
的用法示例。
在下文中一共展示了Prop.Name方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CallCenterStatisticsAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by ce.cid limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 11; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例2: ChildSignInLogListAction
func ChildSignInLogListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
childId := r.FormValue("childId")
startTime := r.FormValue("startTime-ge")
endTime := r.FormValue("endTime-le")
params := []interface{}{}
sql := `
select si.sid,si.sign_time,contr.contract_no,si.card_id,cour.name,contr.apply_time,cour1.name courseName1
from sign_in si
left join class_schedule_detail csd on csd.id=si.schedule_detail_id
left join contract contr on contr.id=si.contract_id
left join course cour on cour.cid=contr.course_id
left join course cour1 on cour1.cid=csd.course_id
where si.child_id=? and si.is_free=2 `
params = append(params, childId)
if startTime != "" {
sql += " and si.sign_time>=? "
params = append(params, startTime)
}
if endTime != "" {
sql += " and si.sign_time<=? "
params = append(params, endTime)
}
countSql := ""
countSql = "select count(1) from (" + sql + ") num"
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
//.........這裏部分代碼省略.........
示例3: TmkStatisticsAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by em.user_id limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 10; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例4: ClassScheduleAttachListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
params = append(params, scheduleId)
params = append(params, "%["+childId+"]%")
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " limit ?,? "
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 5; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例5: ConsultantPhoneListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
lessgo.Log.Debug(sql + " limit ?,?")
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql+" limit ?,?", params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
model.Id = fmt.Sprint(r.Intn(1000))
model.Props = []*lessgo.Prop{}
fillObjects := []interface{}{}
for i := 0; i < 7; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例6: TmkStatisticsDetailAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " limit ?,?"
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
lessgo.Log.Debug(sql)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
model.Id = fmt.Sprint(r.Intn(1000))
model.Props = []*lessgo.Prop{}
fillObjects := []interface{}{}
for i := 0; i < 11; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例7: CenterCallCenterDetailAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by tc.cd_create_time desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 10; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例8: GalleryListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by gal.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 5; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例9: ValidForCallCenterListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by c.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 8; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例10: WyClassListAction
func WyClassListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
dataType := ""
roleCodes := strings.Split(employee.RoleCode, ",")
for _, roleCode := range roleCodes {
if roleCode == "admin" || roleCode == "yyzj" || roleCode == "zjl" || roleCode == "yyzy" || roleCode == "tmk" {
dataType = "all"
break
} else {
dataType = "center"
break
}
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
centerId := r.FormValue("cid-eq")
params := []interface{}{}
sql := "select c.class_id,c.name,ce.name as cename,cou.name as courseName,c.end_time,c.deadline,c.max_child_num,tea.really_name as teacherName,ass.really_name as assName,c.center_id from wyclass c left join center ce on ce.cid=c.center_id left join employee tea on tea.user_id=c.teacher_id left join employee ass on ass.user_id=c.assistant_id left join course cou on c.course_id=cou.cid where 1=1 and (c.start_time is null or c.start_time = '') "
if dataType == "center" {
userId, _ := strconv.Atoi(employee.UserId)
_employee, err := FindEmployeeById(userId)
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
params = append(params, _employee.CenterId)
sql += " and ce.cid=? "
}
if centerId != "" && dataType == "all" {
params = append(params, centerId)
sql += " and c.center_id=? "
}
countSql := ""
countSql = "select count(1) from (" + sql + ") num"
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
//.........這裏部分代碼省略.........
示例11: TmkAllConsumerListAction
func TmkAllConsumerListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
dataType := ""
roleCodes := strings.Split(employee.RoleCode, ",")
for _, roleCode := range roleCodes {
if roleCode == "tmk" || roleCode == "yyzj" {
dataType = "all"
break
} else {
dataType = "center"
break
}
}
centerId1 := r.FormValue("centerId-eq")
status := r.FormValue("status-eq")
// lastContractStartTime := r.FormValue("lastContractStartTime-ge")
// lastContractEndTime := r.FormValue("lastContractEndTime-le")
kw := r.FormValue("kw-like")
partTimeName := r.FormValue("partTimeName-eq")
level := r.FormValue("level-eq")
comeFromId := r.FormValue("comeFromId-eq")
//番茄田邏輯補丁,番茄田添加的用戶都屬於福州台江中心
if centerId1 == "1" {
centerId1 = "7"
}
params := []interface{}{}
paramsForCount := []interface{}{}
sql := `select cons.id,ce.name as centerName,e.really_name,cons.level,cont.name,cont.phone,cons.child,cons.birthday,cons.year,cons.contact_status,cons.parent_id,d.remark,cf.name comeFromName,cons.parttime_name
from
(select a.consumer_id,min(a.id) contacts_id from contacts a left join consumer_new b on a.consumer_id=b.id
where (a.name like ? or b.child like ? or a.phone like ? or b.home_phone like ?) and b.is_own_by_tmk=2 and b.pay_time is null and b.contact_status!=5 `
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
if dataType == "center" {
userId, _ := strconv.Atoi(employee.UserId)
_employee, err := FindEmployeeById(userId)
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
//番茄田邏輯補丁,番茄田添加的用戶都屬於福州台江中心
if _employee.CenterId == "1" {
_employee.CenterId = "7"
//.........這裏部分代碼省略.........
示例12: ConsumerContactRecordListAction
/*
select c.aid,ce.name as centerName,e.really_name,c.start_time,c.seconds,c.inout,c.localphone,c.filename,c.is_upload_finish,c.contractName,c.note from(
select a.aid,a.start_time,a.seconds,a.inout,a.localphone,a.filename,a.is_upload_finish,contract_phone.name contractName,a.note,a.cid from audio a
inner join (select phone,name from contacts where consumer_id=1) contract_phone on
contract_phone.phone=a.remotephone
union
select a.aid,a.start_time,a.seconds,a.inout,a.localphone,a.filename,a.is_upload_finish,'家庭電話' contractName,a.note,a.cid from audio a
inner join (select home_phone,child from consumer_new where id=1 and home_phone is not null and home_phone !='') b on
b.home_phone=a.remotephone
)c
left join employee e on e.center_id=c.cid and e.phone_in_center=c.localphone
left join center ce on ce.cid=e.center_id
*/
func ConsumerContactRecordListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
id := r.FormValue("consumerId")
params := []interface{}{}
sql := " select c.aid,ce.name as centerName,e.really_name,c.start_time,c.seconds,c.inout,c.localphone,c.filename,c.is_upload_finish,c.contractName,c.note,c.cid from( "
sql += " select a.aid,a.start_time,a.seconds,a.inout,a.localphone,a.filename,a.is_upload_finish,contract_phone.name contractName,a.note,a.cid from audio a "
sql += " inner join (select phone,name from contacts where consumer_id=?) contract_phone on "
sql += " contract_phone.phone=a.remotephone "
sql += " union "
sql += " select a.aid,a.start_time,a.seconds,a.inout,a.localphone,a.filename,a.is_upload_finish,'家庭電話' contractName,a.note,a.cid from audio a "
sql += " inner join (select home_phone,child from consumer_new where id=? and home_phone is not null and home_phone !='') b on "
sql += " b.home_phone=a.remotephone "
sql += " )c "
sql += " left join employee e on e.center_id=c.cid and e.phone_in_center=c.localphone "
sql += " left join center ce on ce.cid=e.center_id "
params = append(params, id)
params = append(params, id)
countSql := ""
countSql = "select count(1) from (" + sql + ") num"
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
//.........這裏部分代碼省略.........
示例13: TmkConsumerSelfListAction
/*
select cons.*,cont.name,cont.phone
from
tmk_consumer tc
left join (select c.consumer_id,min(c.id) contacts_id from contacts c group by c.consumer_id) a on a.consumer_id=tc.consumer_id
left join contacts cont on cont.id=a.contacts_id
left join consumer_new cons on cons.id=a.consumer_id
*/
func TmkConsumerSelfListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
centerId1 := r.FormValue("centerId-eq")
status := r.FormValue("status-eq")
lastContractStartTime := r.FormValue("lastContractStartTime-ge")
lastContractEndTime := r.FormValue("lastContractEndTime-le")
kw := r.FormValue("kw-like")
payStatus := r.FormValue("payStatus-eq")
timeType := r.FormValue("timeType-eq")
partTimeName := r.FormValue("partTimeName-eq")
level := r.FormValue("level-eq")
comeFromId := r.FormValue("comeFromId-eq")
params := []interface{}{}
sql := " select cons.id,ce.name as centerName,cont.name,cons.level,cont.phone,cons.child,cons.birthday,cons.year,cons.contact_status,cons.parent_id,b.remark,cons.center_id,cons.pay_status,cons.pay_time,cf.name comeFromName,cons.parttime_name "
sql += " from tmk_consumer tc"
sql += " inner join (select c.consumer_id,min(c.id) contacts_id from contacts c "
if kw != "" {
sql += "left join consumer_new b on b.id=c.consumer_id where c.phone like ? or c.name like ? or b.child like ? or b.remark like ? or b.home_phone like ? "
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
params = append(params, "%"+kw+"%")
}
sql += " group by c.consumer_id)a on a.consumer_id=tc.consumer_id "
sql += " left join consumer_new cons on cons.id=a.consumer_id "
sql += " left join contacts cont on cont.id=a.contacts_id "
sql += " left join center ce on ce.cid=cons.center_id "
sql += " left join come_from cf on cf.id=cons.come_from_id "
sql += " left join (select consumer_id,GROUP_CONCAT(concat(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i'),' ',note) ORDER BY id DESC SEPARATOR '<br/>') remark from consumer_contact_log group by consumer_id) b on b.consumer_id=cons.id "
sql += " where tc.tmk_id= " + employee.UserId
if status != "" {
params = append(params, status)
sql += " and cons.contact_status=? "
}
if lastContractStartTime != "" && timeType == "1" {
params = append(params, lastContractStartTime)
sql += " and cons.sign_in_time>=? "
}
if lastContractStartTime != "" && timeType == "2" {
params = append(params, lastContractStartTime)
sql += " and cons.pay_time>=? "
}
if lastContractEndTime != "" && timeType == "1" {
//.........這裏部分代碼省略.........
示例14: EmployeeSignInListAction
//.........這裏部分代碼省略.........
lessgo.Log.Debug(countSql)
db := lessgo.GetMySQL()
defer db.Close()
rows, err := db.Query(countSql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
totalNum := 0
if rows.Next() {
err := rows.Scan(&totalNum)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
if currPageNo > totalPage {
currPageNo = totalPage
}
sql += " order by esi.id desc limit ?,?"
lessgo.Log.Debug(sql)
params = append(params, (currPageNo-1)*pageSize)
params = append(params, pageSize)
rows, err = db.Query(sql, params...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects := []interface{}{}
for rows.Next() {
model := new(lessgo.Model)
fillObjects := []interface{}{}
fillObjects = append(fillObjects, &model.Id)
for i := 0; i < 2; i++ {
prop := new(lessgo.Prop)
prop.Name = fmt.Sprint(i)
prop.Value = ""
fillObjects = append(fillObjects, &prop.Value)
model.Props = append(model.Props, prop)
}
err = commonlib.PutRecord(rows, fillObjects...)
if err != nil {
lessgo.Log.Warn(err.Error())
m["success"] = false
m["code"] = 100
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
return
}
objects = append(objects, model)
}
pageData := commonlib.BulidTraditionPage(currPageNo, pageSize, totalNum, objects)
m["PageData"] = pageData
m["DataLength"] = len(pageData.Datas) - 1
if len(pageData.Datas) > 0 {
m["FieldLength"] = len(pageData.Datas[0].(*lessgo.Model).Props) - 1
}
commonlib.RenderTemplate(w, r, "entity_page.json", m, template.FuncMap{"getPropValue": lessgo.GetPropValue, "compareInt": lessgo.CompareInt, "dealJsonString": lessgo.DealJsonString}, "../lessgo/template/entity_page.json")
}
示例15: ConsultantPhoneDetailListAction
/*
select a.aid,cons.child,b.remark,cont.name contName,a.remotephone,ce.name centerName,a.start_time,a.seconds,a.inout,a.is_upload_finish,cons.id,a.filename,a.cid,e1.really_name
from
(
select au.* from audio au
left join employee e on e.phone_in_center=au.localphone and e.center_id=au.cid
where e.user_id=37 and au.remotephone != '' and au.remotephone is not null order by au.aid desc,au.start_time desc limit 0,20
) a
left join contacts cont on a.remotephone=cont.phone
left join consumer_new cons on cont.consumer_id=cons.id
left join employee e2 on e2.phone_in_center=a.localphone and e2.center_id=a.cid
left join center ce on ce.cid=cons.center_id
left join (select consumer_id,GROUP_CONCAT(concat(DATE_FORMAT(create_time,'%Y-%m-%d %H:%i'),' ',note) ORDER BY id SEPARATOR '<br/>') remark from consumer_contact_log group by consumer_id) b on b.consumer_id=cons.id
left join employee e1 on e1.user_id=cons.current_tmk_id
*/
func ConsultantPhoneDetailListAction(w http.ResponseWriter, r *http.Request) {
m := make(map[string]interface{})
employee := lessgo.GetCurrentEmployee(r)
if employee.UserId == "" {
lessgo.Log.Warn("用戶未登陸")
m["success"] = false
m["code"] = 100
m["msg"] = "用戶未登陸"
commonlib.OutputJson(w, m, " ")
return
}
err := r.ParseForm()
if err != nil {
m["success"] = false
m["code"] = 100
m["msg"] = "出現錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
pageNoString := r.FormValue("page")
pageNo := 1
if pageNoString != "" {
pageNo, err = strconv.Atoi(pageNoString)
if err != nil {
pageNo = 1
lessgo.Log.Warn("錯誤的pageNo:", pageNo)
}
}
pageSizeString := r.FormValue("rows")
pageSize := 10
if pageSizeString != "" {
pageSize, err = strconv.Atoi(pageSizeString)
if err != nil {
lessgo.Log.Warn("錯誤的pageSize:", pageSize)
}
}
eid := r.FormValue("eid")
year := r.FormValue("year-eq")
month := r.FormValue("month-eq")
week := r.FormValue("week-eq")
startTime := r.FormValue("start_time-eq")
st := ""
et := ""
flag := true
if startTime != "" {
st = startTime + " 00:00:00"
et = startTime + " 23:59:59"
} else {
if week != "" && month != "" && year != "" {
st, et, flag = lessgo.FindRangeTimeDim("", "", year+month+week)
} else if month != "" && year != "" {
st, et, flag = lessgo.FindRangeTimeDim("", year+month, "")
} else if year != "" {
st, et, flag = lessgo.FindRangeTimeDim(year, "", "")
}
}
params := []interface{}{}
sql := `select a.aid,cons.child,b.remark,cont.name contName,a.remotephone,ce.name centerName,a.start_time,a.seconds,a.inout,a.is_upload_finish,cons.id,a.filename,a.cid,e1.really_name
from
(
select au.* from audio au
left join employee e on e.phone_in_center=au.localphone and e.center_id=au.cid
where e.user_id=? and au.remotephone != '' and au.remotephone is not null %v order by au.aid desc,au.start_time desc limit ?,?
) a
left join contacts cont on a.remotephone=cont.phone
left join consumer_new cons on cont.consumer_id=cons.id
left join employee e2 on e2.phone_in_center=a.localphone and e2.center_id=a.cid
left join center ce on ce.cid=cons.center_id
%v
left join employee e1 on e1.user_id=cons.current_tmk_id`
params = append(params, eid)
//.........這裏部分代碼省略.........