本文整理匯總了Golang中github.com/hjqhezgh/lessgo.Prop.Value方法的典型用法代碼示例。如果您正苦於以下問題:Golang Prop.Value方法的具體用法?Golang Prop.Value怎麽用?Golang Prop.Value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hjqhezgh/lessgo.Prop
的用法示例。
在下文中一共展示了Prop.Value方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CallCenterStatisticsAction
/*
select ce.cid,ce.name,a.num as '全部名單', b.num as '未聯係', c.num as '待確認', d.num as '已廢棄', e.num as '已邀約',f.num as '已簽到' from center ce
left join
(select count(1) num,center_id from consumer_new group by center_id )a on a.center_id=ce.cid
left join
(select count(1) num,center_id from consumer_new where contact_status=1 group by center_id )b on a.center_id=ce.cid
left join
(select count(1) num,center_id from consumer_new where contact_status=2 group by center_id )c on b.center_id=ce.cid
left join
(select count(1) num,center_id from consumer_new where contact_status=3 group by center_id )d on c.center_id=ce.cid
left join
(select count(1) num,center_id from consumer_new where contact_status=4 group by center_id )e on d.center_id=ce.cid
left join
(select count(1) num,center_id from consumer_new where contact_status=5 group by center_id )f on e.center_id=ce.cid
*/
func CallCenterStatisticsAction(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 == "admin" || roleCode == "yyzj" || roleCode == "zjl" || roleCode == "yyzy" {
dataType = "all"
break
} else {
dataType = "center"
break
}
}
startTime := r.FormValue("startTime-ge")
endTime := r.FormValue("endTime-le")
params := []interface{}{}
sql := " select ce.cid,ce.name,a.num as '全部名單', b.num as '未聯係', c.num as '撥打電話數', d.num as '邀約數', e.num as '簽到數',f.num as '定金',g.num as '全額',1,2,3 from center ce "
sql += " left join "
sql += " (select count(1) num,center_id from consumer_new group by center_id )a on a.center_id=ce.cid "
sql += " left join "
sql += " (select count(1) num,center_id from consumer_new where contact_status=1 group by center_id )b on b.center_id=ce.cid "
sql += " left join "
sql += " (select count(1) num,cid from audio where start_time >=? and start_time<=? group by cid )c on c.cid=ce.cid "
sql += " left join "
sql += " (select count(1) num,ch.center_id from schedule_detail_child sdc left join child ch on sdc.child_id=ch.cid where sdc.is_free=1 and sdc.create_time>=? and sdc.create_time <=? group by ch.center_id)d on d.center_id=ce.cid "
sql += " left join "
sql += " (select count(1) num,ch.center_id from sign_in si left join child ch on si.child_id=ch.cid where si.type=1 and si.is_free=1 and si.sign_time>=? and si.sign_time<=? group by ch.center_id )e on e.center_id=ce.cid "
sql += " left join "
sql += " (select count(1) num,center_id from consumer_new where pay_status=1 and pay_time>=? and pay_time<=? group by center_id )f on f.center_id=ce.cid "
sql += " left join "
sql += " (select count(1) num,center_id from consumer_new where pay_status=2 and pay_time>=? and pay_time<=? group by center_id )g on g.center_id=ce.cid where ce.cid!=9 " //屏蔽總部數據
defaultStartTime := "2000-01-01 00:0:000"
defaultEndTime := "2999-12-31 00:00:00"
if startTime != "" {
defaultStartTime = startTime
}
//.........這裏部分代碼省略.........
示例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
/*
select em.user_id,aa.num as '電話數',bb.num as '名單數',cc.num as '邀約數',dd.num as '簽到數',ee.num as '繳費數'
from employee em left join
(select count(1) num,e.user_id from audio a left join employee e on a.cid=e.center_id and a.localphone=e.phone_in_center
where e.user_id is not null group by e.user_id ) aa on em.user_id= aa.user_id
left join
(select count(1) num,tmk_id from tmk_consumer group by tmk_id )bb on em.user_id=bb.tmk_id
left join
(select count(1) num,create_user from wyclass_free_child where create_time>=? and create_time <=? group by create_user) cc on em.user_id=cc.tmk_id
left join
(select count(1) num,tmk_id from(select tc.tmk_id,tc.consumer_id,wfsi.sign_in_time from tmk_consumer tc left join wyclass_free_sign_in wfsi on tc.consumer_id=wfsi.consumer_id
where wfsi.sign_in_time is not null ) a group by tmk_id )dd on em.user_id=dd.tmk_id
left join
(select count(1) num,tmk_id from(select tc.tmk_id,tc.consumer_id,pl.pay_time from tmk_consumer tc left join pay_log pl on tc.consumer_id=pl.consumer_id
where pl.pay_time is not null) b group by tmk_id) ee on em.user_id=ee.tmk_id
where cc.num is not null
order by em.user_id
*/
func TmkStatisticsAction(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)
}
}
centerId := r.FormValue("centerId-eq")
startTime := r.FormValue("startTime-ge")
endTime := r.FormValue("endTime-le")
employeeId := r.FormValue("employee_id-eq")
dataType := ""
roleCodes := strings.Split(employee.RoleCode, ",")
for _, roleCode := range roleCodes {
if roleCode == "admin" || roleCode == "yyzj" || roleCode == "zjl" || roleCode == "yyzy" {
dataType = "all"
break
} else if roleCode == "cd" {
dataType = "center"
break
} else {
dataType = "self"
break
}
}
params := []interface{}{}
sql := `select em.user_id,em.really_name,aa.num as '電話數',bb.num as '名單數',cc.num as '邀約數',dd.num as '簽到數',ee.num as '定金',ff.num as '全額',1,2,3
from employee em left join
(select count(1) num,e.user_id from audio a left join employee e on a.cid=e.center_id and a.localphone=e.phone_in_center
where e.user_id is not null and start_time >=? and start_time<=? group by e.user_id ) aa on em.user_id= aa.user_id
left join
(select count(1) num,tmk_id from tmk_consumer where tmk_create_time >=? and tmk_create_time<=? group by tmk_id )bb on em.user_id=bb.tmk_id
left join
(select count(1) num,create_user from schedule_detail_child where create_time>=? and create_time <=? and is_free=1 group by create_user) cc on em.user_id=cc.create_user
left join
(select count(1) num,tmk_id from( select tc.tmk_id,si.sid from tmk_consumer tc
left join consumer_new cons on tc.consumer_id=cons.id left join parent p on p.pid=cons.parent_id left join child ch on ch.pid=p.pid left join sign_in si on si.child_id=ch.cid
where si.type=1 and si.is_free=1 and sign_time>=? and sign_time<=? )a group by tmk_id )dd on em.user_id=dd.tmk_id
left join
(select count(1) num,tmk_id from(select tc.tmk_id,tc.consumer_id from tmk_consumer tc left join pay_log pl on tc.consumer_id=pl.consumer_id left join consumer_new cons on cons.id=tc.consumer_id
//.........這裏部分代碼省略.........
示例4: ClassScheduleAttachListAction
func ClassScheduleAttachListAction(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 {
lessgo.Log.Error(err.Error())
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")
scheduleId := r.FormValue("scheduleId")
params := []interface{}{}
sql := "select csa.id,csa.url,csa.intro,csa.upload_time,csa.pc_thumb_url,ce.domain_name from class_schedule_attach csa left join class_schedule_detail csd on csd.id=csa.schedule_detail_id left join center ce on ce.cid=csd.center_id where csa.schedule_detail_id=? and csa.relation_childs like ? "
lessgo.Log.Debug(sql)
db := lessgo.GetMySQL()
defer db.Close()
countSql := ""
countSql = "select count(1) from (" + sql + ") num"
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 ?,? "
//.........這裏部分代碼省略.........
示例5: ConsultantPhoneListAction
//顧問分頁數據服務
func ConsultantPhoneListAction(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 == "admin" || roleCode == "yyzj" || roleCode == "zjl" || roleCode == "yyzy" {
dataType = "all"
break
} else if roleCode == "cd" {
dataType = "center"
break
} else {
dataType = "self"
}
}
cid := r.FormValue("cid-eq")
employeeId := r.FormValue("employee_id-eq")
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 := ""
countSql := ""
if dataType == "all" {
sql += "select c.name,c.cid,e.user_id,e.really_name,phone_count.num a,rank.rowNo b,phone_count.localphone from (select count(*) num,localphone,cid from audio where remotephone!='' and remotephone is not null "
if cid != "" {
sql += " and cid=? "
params = append(params, cid)
}
if flag {
//.........這裏部分代碼省略.........
示例6: TmkStatisticsDetailAction
/*
select c.id,e.really_name,ce.name,c.mother,c.mother_phone,c.father,c.father_phone,c.home_phone,c.child,c.contact_status
from tmk_consumer tc
left join consumer c on tc.consumer_id=c.id
left join employee e on e.user_id=tc.employee_id
left join center ce on ce.cid=c.center_id
where tc.employee_id=?
*/
func TmkStatisticsDetailAction(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("id")
params := []interface{}{}
sql := " select c.id,e.user_id,e.really_name,ce.name,c.mother,c.mother_phone,c.father,c.father_phone,c.home_phone,c.child,c.contact_status "
sql += " from tmk_consumer tc "
sql += " left join consumer c on tc.consumer_id=c.id "
sql += " left join employee e on e.user_id=tc.employee_id "
sql += " left join center ce on ce.cid=c.center_id "
sql += " where tc.employee_id=? "
countSql := "select count(1) from tmk_consumer where employee_id=?"
params = append(params, id)
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
//.........這裏部分代碼省略.........
示例7: CenterCallCenterDetailAction
func CenterCallCenterDetailAction(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)
}
}
status := r.FormValue("status-eq")
name := r.FormValue("name-eq")
centerId := r.FormValue("id")
dataType := ""
roleIds := strings.Split(employee.RoleId, ",")
for _, roleId := range roleIds {
if roleId == "1" || roleId == "3" || roleId == "6" || roleId == "10" {
dataType = "all"
break
} else if roleId == "2" {
dataType = "center"
break
} else {
dataType = "self"
}
}
params := []interface{}{}
sql := ""
countSql := ""
sql += "select tc.id,e.really_name,c.mother,c.mother_phone,c.father,c.father_phone,c.home_phone,c.child,c.contact_status,c.id as 'cid',c.parent_id from tmk_consumer tc left join consumer c on tc.consumer_id=c.id left join employee e on e.user_id = tc.employee_id where tc.center_id=? "
if dataType == "all" {
params = append(params, centerId)
if status != "" {
if status == "no employee" {
sql += " and tc.employee_id is null or tc.employee_id=0 "
} else {
sql += " and c.contact_status=? "
params = append(params, status)
}
}
} else 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)
if status != "" {
if status == "no employee" {
sql += " and tc.employee_id is null or tc.employee_id=0 "
} else {
sql += " and c.contact_status=? "
//.........這裏部分代碼省略.........
示例8: GalleryListAction
//商品分類分頁數據服務
func GalleryListAction(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)
}
}
title := r.FormValue("title-like")
comment := r.FormValue("comment-like")
params := []interface{}{}
sql := "select gal.id, gal.title, gal.comment, gal.image_name, gal.image_suffix, "
sql += " (select GROUP_CONCAT(c.name) "
sql += " from category c left join category_gallery cg ON c.id = cg.category_id "
sql += " where cg.gallery_id = gal.id) as image_category "
sql += "from gallery gal where 1=1"
if strings.TrimSpace(title) != "" {
params = append(params, "%"+title+"%")
sql += " and gal.title like ? "
}
if strings.TrimSpace(comment) != "" {
params = append(params, "%"+comment+"%")
sql += " and gal.comment like ? "
}
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
m["msg"] = "係統發生錯誤,請聯係IT部門,錯誤信息:" + err.Error()
commonlib.OutputJson(w, m, " ")
return
}
}
totalPage := int(math.Ceil(float64(totalNum) / float64(pageSize)))
currPageNo := pageNo
//.........這裏部分代碼省略.........
示例9: ValidForCallCenterListAction
func ValidForCallCenterListAction(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)
}
}
status := r.FormValue("status-eq")
params := []interface{}{}
sql := "select c.id,e.really_name,c.mother,c.mother_phone,c.father,c.father_phone,c.home_phone,c.child,c.contact_status from consumer c left join employee e on e.user_id = c.employee_id where 1=1 and c.center_id=? and c.id not in (select consumer_id from tmk_consumer) "
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)
if status != "" {
sql += " and c.contact_status=? "
params = append(params, status)
} else {
sql += " and (c.contact_status=1 or c.contact_status=2) "
}
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
m["msg"] = "係統發生錯誤,請聯係IT部門"
commonlib.OutputJson(w, m, " ")
//.........這裏部分代碼省略.........
示例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
func EmployeeSignInListAction(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 := ""
roleIds := strings.Split(employee.RoleId, ",")
for _, roleId := range roleIds {
if roleId == "1" || roleId == "3" || roleId == "6" || roleId == "10" {
dataType = "all"
break
} else if roleId == "2" {
dataType = "center"
break
} else {
dataType = "self"
}
}
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")
st := r.FormValue("st-ge")
et := r.FormValue("et-le")
params := []interface{}{}
sql := "select esi.id,e.really_name,esi.sign_time from employee_sign_in esi left join employee e on esi.employee_id=e.user_id where 1=1 "
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 e.center_id=? "
}
if centerId != "" && dataType == "all" {
params = append(params, centerId)
sql += " and e.center_id=? "
}
if dataType == "self" {
params = append(params, employee.UserId)
sql += " and esi.employee_id=? "
}
if st != "" {
params = append(params, st)
sql += " and esi.sign_time >= ? "
}
if et != "" {
params = append(params, et)
sql += " and esi.sign_time <= ? "
//.........這裏部分代碼省略.........
示例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)
//.........這裏部分代碼省略.........