huangjiajun vor 2 Monaten
Ursprung
Commit
c5f6c02700
3 geänderte Dateien mit 33 neuen und 0 gelöschten Zeilen
  1. +7
    -0
      app/db/model/city.go
  2. +25
    -0
      app/hdl/hdl_store.go
  3. +1
    -0
      app/router/router.go

+ 7
- 0
app/db/model/city.go Datei anzeigen

@@ -0,0 +1,7 @@
package model

type City struct {
Name string `json:"name" xorm:"VARCHAR(64)"`
Id string `json:"id" xorm:"not null pk VARCHAR(12)"`
ProvinceId string `json:"province_id" xorm:"index VARCHAR(12)"`
}

+ 25
- 0
app/hdl/hdl_store.go Datei anzeigen

@@ -1,11 +1,36 @@
package hdl

import (
"applet/app/db"
"applet/app/e"
"applet/app/svc"
"fmt"
"github.com/gin-gonic/gin"
)

func City(c *gin.Context) {
var arg = make(map[string]string)
c.ShouldBindJSON(&arg)
sql := `select IF(city.name='省直辖县级行政区划' or city.name='市辖区',province.name,city.name) as newname from city
LEFT JOIN province on province.id=city.province_id
where %s
order by CONVERT(newname USING gbk)`
str := "1=1"
if arg["name"] != "" {
str += " and newname like '%" + arg["name"] + "%'"
}
sql = fmt.Sprintf(sql, str)
nativeString, _ := db.QueryNativeString(svc.MasterDb(c), sql)
nodeList := make([]map[string]string, 0)
for _, item := range nativeString {
tmp := map[string]string{
"name": item["newname"],
}
nodeList = append(nodeList, tmp)
}
e.OutSuc(c, nodeList, nil)
return
}
func BankStoreCate(c *gin.Context) {
var res = []map[string]string{
{"name": "全部网点", "value": ""},


+ 1
- 0
app/router/router.go Datei anzeigen

@@ -45,6 +45,7 @@ func routeCommunityTeam(r *gin.RouterGroup) {
r.Use(mw.CheckBody) //body参数转换
r.Use(mw.CheckSign) //签名校验
r.Use(mw.Checker)
r.POST("/city", hdl.City)
r.GET("/bank/store/cate", hdl.BankStoreCate)
r.POST("/bank/store/list", hdl.BankStore)
r.POST("/store", hdl.Store)


Laden…
Abbrechen
Speichern