fuwencai 8 mesi fa
parent
commit
ac6c623e79
2 ha cambiato i file con 21 aggiunte e 3 eliminazioni
  1. 6 3
      src/codeManage/models/contactWay.go
  2. 15 0
      test.http

+ 6 - 3
src/codeManage/models/contactWay.go

@@ -50,7 +50,10 @@ func (w *ContactWay) List(page utils.Page) (data map[string]interface{}) {
 		"list":  []map[string]interface{}{},
 		"total": 0,
 	}
-	countQ := fmt.Sprintf("select count(*) from %s where is_del=0", entity.WxQyCodeTable)
+	if page.PageSize >= 100 || page.PageSize <= 0 {
+		page.PageSize = 10
+	}
+	countQ := fmt.Sprintf("select count(*) as count from %s where is_del=0", entity.WxQyCodeTable)
 	totalRs := config.JysqlDB.SelectBySql(countQ)
 	if totalRs == nil || len(*totalRs) == 0 {
 		return
@@ -59,7 +62,7 @@ func (w *ContactWay) List(page utils.Page) (data map[string]interface{}) {
 	if total == 0 {
 		return
 	}
-	query := fmt.Sprintf("select wqc.*,count(*) from %s wqc left join %s wqr on wqc.config_id = wqr.config_id where wqc.is_del=0 and wqr.state<3 group by wqc.config_id limit ?,?", entity.WxQyCodeTable, entity.WxQRelationTable)
+	query := fmt.Sprintf("select wqc.*,count(wqc.id) as count from %s wqc left join %s wqr on wqc.config_id = wqr.config_id and wqr.state<3  where wqc.is_del=0 group by wqc.config_id  order by wqc.id  limit ?,?", entity.WxQyCodeTable, entity.WxQRelationTable)
 	// 查列表
 	rs := config.JysqlDB.SelectBySql(query, page.Offset, page.PageSize)
 	if rs == nil || len(*rs) == 0 {
@@ -147,7 +150,7 @@ func (w *ContactWay) Save() error {
 	// 保存
 	if w.ConfigId == "" {
 		randomCode := util.VarLSCPool.GetJob()
-		state := fmt.Sprintf("cc_%s", randomCode)
+		state := fmt.Sprintf("CC_%s", randomCode)
 		acwOutput := qywc.AddContactWay(entity.AddContactWayInput{Type: 2, Scene: w.Scene, Remark: w.Remark, SkipVerify: w.SkipVerify, State: state, User: w.User})
 		if acwOutput == nil || acwOutput.Errcode != 0 {
 			log.Println("ContactWay Save:  调用AddContactWay失败:", acwOutput)

File diff suppressed because it is too large
+ 15 - 0
test.http


Some files were not shown because too many files changed in this diff