重新索引

This commit is contained in:
hoteas 2023-03-03 02:46:29 +08:00
parent 3a7603fa54
commit 3c0946510e
10 changed files with 924 additions and 779 deletions

View File

@ -491,8 +491,8 @@ func decodeData2Sql(table [][]string, this *Context, orgId int) error {
companyData := Map{
"name": rowData["IEDCQYM"],
//"sn": rowData["IEDCTYSHXYDM"],
//"address": rowData["IEDCQYDZ"],
//"unit": rowData["IEDCSDMC"],
"address": rowData["IEDCQYDZ"],
"unit": rowData["IEDCSDMC"],
"zdmj": rowData["IEDCZDMJ"],
"yysr": rowData["IEDCYYSR1"],
"lrze": rowData["IEDCLRZE1"],
@ -509,6 +509,45 @@ func decodeData2Sql(table [][]string, this *Context, orgId int) error {
//"lat": lat,
//"lng": lng,
}
if companyData["name"] == nil && companyData["yysr"] == nil && companyData["sn"] == nil {
companyData = Map{
"name": rowData["IEDCQYMC"],
"sn": rowData["IEDCTYSHXYDM"],
"address": rowData["IEDCQYDZ"],
"unit": rowData["IEDCSDMC"],
"zdmj": rowData["IEDCYDMJ"],
"yysr": rowData["IEDC2NYYSR"],
"lrze": rowData["IEDC2NLRZE"],
"yjsj": rowData["IEDCYNSJ"],
"yfjf": rowData["IEDCNYFFY"],
"zgrs": rowData["IEDCSBRS"],
"zywrwpfdl": rowData["IEDCZYWRWPFDL"],
"zhnh": rowData["IEDCZHNH"],
"admin_id": this.Session("admin_id").ToInt(),
"upload_data": rowData.ToJsonString(),
"org_id": orgId,
//"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
//"lat": lat,
//"lng": lng,
}
}
if companyData.GetString("name") == "" {
companyData["name"] = rowData["IEDCQYMC"]
}
if companyData.GetString("sn") == "" && rowData["IEDCTYSHXYDM"] != nil {
companyData["sn"] = rowData["sn"]
}
if companyData.GetString("address") == "" && rowData["IEDCQYDZ"] != nil {
companyData["address"] = rowData["IEDCQYDZ"]
}
if companyData.GetString("unit") == "" && rowData["IEDCSDMC"] != nil {
companyData["unit"] = rowData["IEDCSDMC"]
}
//行业ID
//org := this.Db.Get("org", "id,name", Map{"id": orgId})
//regin := "全国"

View File

@ -7,6 +7,7 @@ import (
"code.hoteas.com/golang/hotime/dri/tencent"
"fmt"
"github.com/silenceper/wechat"
"github.com/silenceper/wechat/cache"
"gopkg.in/chanxuehong/wechat.v2/mch/core"
"gopkg.in/chanxuehong/wechat.v2/mch/pay"
"io/ioutil"
@ -93,15 +94,15 @@ func getCompany(name, path string) Map {
}
//微信获取个人信息
//func Weixin(this *Context) *wechat.Wechat {
// if weixin == nil {
// cache1 := cache.Cache(WechatCache{this.CacheIns})
// config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
// weixin = wechat.NewWechat(&config)
// }
//
// return weixin
//}
func Weixin(this *Context) *wechat.Wechat {
if weixin == nil {
cache1 := cache.NewMemory()
config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
weixin = wechat.NewWechat(&config)
}
return weixin
}
//微信获取个人信息
func WxPayClient(this *Context, sn string, money int64, openid string) Map {

View File

@ -126,7 +126,7 @@ var User = Ctr{
name := this.Req.FormValue("name")
phone := this.Req.FormValue("phone")
code := this.Req.FormValue("code")
authImg := this.Req.FormValue("auth_img")
//authImg := this.Req.FormValue("auth_img")
categoryId := ObjToInt(this.Req.FormValue("category_id"))
companyImg := this.Req.FormValue("company_img")
companyName := this.Req.FormValue("company_name")
@ -137,7 +137,11 @@ var User = Ctr{
return
}
if name == "" || phone == "" || authImg == "" || categoryId == 0 || companyImg == "" || companyName == "" || companySn == "" {
if name == "" || phone == "" ||
//authImg == "" ||
categoryId == 0 ||
//companyImg == "" ||
companyName == "" || companySn == "" {
this.Display(3, "参数异常")
return
}
@ -192,7 +196,7 @@ var User = Ctr{
//"idcard_front_img": idcardFrontImg,
"company_id": company.GetCeilInt("id"),
//"idcard_back_img": idcardBackImg,
"auth_img": authImg,
//"auth_img": authImg,
"modify_time": t,
"status": 1,
"company_img": companyImg}
@ -286,7 +290,7 @@ var User = Ctr{
//uimgPath:=time.Now().Format(this.Config.GetString("uimgPath"))
path := time.Now().Format(this.Config.GetString("wxFilePath"))
os.MkdirAll(this.Config.GetString("tpt")+"/"+path, os.ModeDir)
filePath := path + Md5(ObjToStr(time.Now().Unix())) + ".jpg"
filePath := "/" + path + Md5(ObjToStr(time.Now().Unix())) + ".jpg"
err2 := ioutil.WriteFile(this.Config.GetString("tpt")+"/"+filePath, btes, 0666) //buffer输出到jpg文件中不做处理直接写到文件

View File

@ -4,8 +4,8 @@ import (
. "code.hoteas.com/golang/hotime"
. "code.hoteas.com/golang/hotime/cache"
. "code.hoteas.com/golang/hotime/common"
//"github.com/silenceper/wechat"
//"github.com/silenceper/wechat/cache"
"fmt"
"time"
)
@ -44,106 +44,106 @@ var Wechat = Ctr{
this.Display(0, this.Session("wechatInfo").ToMap())
},
//微信注册0已经完整的注册了1还没有注册
//"codebase": func(this *Context) {
// wx := Weixin(this)
// //auth := wx.GetOauth(this.Req, this.Resp)
//auth :=wx.GetOauth()
// resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
// if err != nil {
// this.Display(6, "code错误")
"codebase": func(this *Context) {
wx := Weixin(this)
//auth := wx.GetOauth(this.Req, this.Resp)
auth := wx.GetOauth()
resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
if err != nil {
this.Display(6, "code错误")
return
}
//判断用户是否已经注册
user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
if user != nil {
this.Session("user_id", user.Get("id"))
this.Display(0, 0)
return
}
user_id := this.Db.Insert("user", Map{"create_time": time.Now().Unix(), "modify_time": time.Now().Unix(), "state": 2})
if user_id == 0 {
this.Display(4, "创建用户失败")
return
}
wid := this.Db.Insert("wechat", Map{"openid": resToken.OpenID, "appid": this.Config.GetString("wechatAppID"), "state": 1, "user_id": user_id})
if wid == 0 {
this.Display(4, "关联微信失败!")
return
}
this.Session("user_id", user.Get("id"))
this.Display(0, 1)
},
//微信注册0已经完整的注册了1还没有注册
"code": func(this *Context) {
orgId := ObjToInt(this.Req.FormValue("org_id"))
//if orgId==0{
// this.Display(3, "缺少组织id")
// return
// }
//
// //判断用户是否已经注册
// user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
// if user != nil {
// this.Session("user_id", user.Get("id"))
// this.Display(0, 0)
// return
// }
//
// user_id := this.Db.Insert("user", Map{"time": time.Now().Unix(), "state": 2})
// if user_id == 0 {
// this.Display(4, "创建用户失败")
// return
// }
//
// wid := this.Db.Insert("wechat", Map{"openid": resToken.OpenID, "appid": this.Config.GetString("wechatAppID"), "state": 1, "user_id": user_id})
// if wid == 0 {
// this.Display(4, "关联微信失败!")
// return
// }
//
// this.Session("user_id", user.Get("id"))
//
// this.Display(0, 1)
//},
////微信注册0已经完整的注册了1还没有注册
//"code": func(this *Context) {
//
// orgId := ObjToInt(this.Req.FormValue("org_id"))
// //if orgId==0{
// // this.Display(3, "缺少组织id")
// // return
// //}
//
// wx := Weixin(this)
// //auth := wx.GetOauth(this.Req, this.Resp)
// auth := wx.GetOauth()
// resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
// if err != nil {
// this.Display(5, "code错误")
// return
// }
//
// //判断用户是否已经注册
// user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
// if user != nil && user.GetCeilInt("id") != 0 && user.GetCeilInt("state") == 0 {
// this.Session("user_id", user.Get("id"))
// this.Display(0, Map{"type": 0, "token": this.SessionId})
// return
// }
// //getUserInfo
// userInfo, err := auth.GetUserInfo(resToken.AccessToken, resToken.OpenID)
// if err != nil {
// this.Display(6, "微信个人信息无法获取")
// return
// }
//
// //wechatInfo := ObjToMap(userInfo)
// t := time.Now().Unix()
// wechatInfo := Map{
// "openid": userInfo.OpenID,
// "acttoken": resToken.AccessToken,
// "retoken": resToken.RefreshToken,
// "appid": this.Config.GetString("wechatAppID"),
// "unionid": userInfo.Unionid,
// "nickname": userInfo.Nickname,
// "avatar": userInfo.HeadImgURL,
// }
// if orgId != 0 {
// wechatInfo["org_id"] = orgId
// wechatInfo["status"] = 0
// }
//
// wechatDb := this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
//
// if wechatDb != nil {
//
// this.Db.Update("wechat", wechatInfo, Map{"id": wechatDb.GetCeilInt("id")})
// //userInfo["wid"]=wechatDb.GetCeilInt("wid")
// } else {
// wechatInfo["create_time"] = t
// wechatInfo["id"] = this.Db.Insert("wechat", wechatInfo)
// }
// wechatDb = this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
//
// this.Session("wechatInfo", wechatDb)
// fmt.Println(wechatDb)
// fmt.Println(this.Session("wechatInfo"))
// //this.Display(0, 1)
// this.Display(0, Map{"type": 1, "token": this.SessionId})
//},
//}
wx := Weixin(this)
//auth := wx.GetOauth(this.Req, this.Resp)
auth := wx.GetOauth()
resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
if err != nil {
this.Display(5, "code错误")
return
}
//判断用户是否已经注册
user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
if user != nil && user.GetCeilInt("id") != 0 && user.GetCeilInt("state") == 0 {
this.Session("user_id", user.Get("id"))
this.Display(0, Map{"type": 0, "token": this.SessionId})
return
}
//getUserInfo
userInfo, err := auth.GetUserInfo(resToken.AccessToken, resToken.OpenID)
if err != nil {
this.Display(6, "微信个人信息无法获取")
return
}
//wechatInfo := ObjToMap(userInfo)
t := time.Now().Unix()
wechatInfo := Map{
"openid": userInfo.OpenID,
"acttoken": resToken.AccessToken,
"retoken": resToken.RefreshToken,
"appid": this.Config.GetString("wechatAppID"),
"unionid": userInfo.Unionid,
"nickname": userInfo.Nickname,
"avatar": userInfo.HeadImgURL,
}
if orgId != 0 {
wechatInfo["org_id"] = orgId
wechatInfo["status"] = 0
}
wechatDb := this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
if wechatDb != nil {
this.Db.Update("wechat", wechatInfo, Map{"id": wechatDb.GetCeilInt("id")})
//userInfo["wid"]=wechatDb.GetCeilInt("wid")
} else {
wechatInfo["create_time"] = t
wechatInfo["id"] = this.Db.Insert("wechat", wechatInfo)
}
wechatDb = this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
this.Session("wechatInfo", wechatDb)
fmt.Println(wechatDb)
fmt.Println(this.Session("wechatInfo"))
//this.Display(0, 1)
this.Display(0, Map{"type": 1, "token": this.SessionId})
},
//网页签名
"sign": func(this *Context) {

View File

@ -77,7 +77,7 @@
"menus": [
{
"auth": ["show"],
"icon": "Setting",
"icon": "House",
"label": "首 页",
"name": "HelloWorld"
},
@ -85,7 +85,7 @@
"auth": [
"show"
],
"icon": "Setting",
"icon": "Monitor",
"label": "企业管理",
"menus": [
{
@ -133,7 +133,143 @@
"auth": [
"show"
],
"icon": "Setting",
"icon": "Histogram",
"label": "产业分析",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "产业分析",
"table": "industry_analyse"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "产业分类",
"table": "industry"
}
],
"name": "sys:industry"
},
{
"auth": [
"show"
],
"icon": "Grid",
"label": "区域评价",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "区域评价",
"table": "org_analyse"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "区域管理",
"table": "org"
}
],
"name": "sys:org"
},
{
"auth": [
"show"
],
"icon": "Promotion",
"label": "调查管理",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "调查管理",
"table": "question"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "调查结果",
"table": "question_company"
}
],
"name": "sys:question"
},
{
"auth": [
"show"
],
"icon": "Memo",
"label": "指标管理",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "指标分类",
"table": "tag_ctg"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "指标管理",
"table": "tag"
}
],
"name": "sys:tag"
},
{
"auth": [
"show"
],
"icon": "Collection",
"label": "行业分类",
"menus": [
{
@ -163,6 +299,7 @@
],
"name": "sys:category"
},
{
"auth": [
"show"
@ -214,18 +351,7 @@
"label": "微信信息",
"table": "wechat"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "地区管理",
"table": "area"
},
{
"auth": [
"show",
@ -252,143 +378,6 @@
}
],
"name": "sys"
},
{
"auth": [
"show"
],
"icon": "Setting",
"label": "产业分析",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "产业分析",
"table": "industry_analyse"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "产业分类",
"table": "industry"
}
],
"name": "sys:industry"
},
{
"auth": [
"show"
],
"icon": "Setting",
"label": "行业评价",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "行业评价",
"table": "org_analyse"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "部门管理",
"table": "org"
}
],
"name": "sys:org"
},
{
"auth": [
"show"
],
"icon": "Setting",
"label": "指标分类",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "指标分类",
"table": "tag_ctg"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "指标管理",
"table": "tag"
}
],
"name": "sys:tag"
},
{
"auth": [
"show"
],
"icon": "Setting",
"label": "调查管理",
"menus": [
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "调查管理",
"table": "question"
},
{
"auth": [
"show",
"add",
"delete",
"edit",
"info",
"download"
],
"label": "调查结果",
"table": "question_company"
}
],
"name": "sys:question"
}
],
"name": "admin",

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,15 @@
{
"aliyunApiCode": "06c6a07e89dd45c88de040ee1489eef7",
"avatarPath": "avatar/2006/01/02/",
"baiduAk": "ZeT902EZvVgIoGVWEFK3osUm",
"cache": {
"db": {
"db": false,
"session": true
"session": true,
"timeout": 7200
},
"memory": {
"db": true,
"db": false,
"session": true,
"timeout": 7200
}
@ -19,7 +22,7 @@
"table": "admin"
}
],
"crossDomain": "auto",
"crossDomain": "",
"db": {
"mysql": {
"host": "192.168.6.253",
@ -47,6 +50,8 @@
"sessionName": "HOTIME",
"smsKey": "b0eb4bf0198b9983cffcb85b69fdf4fa",
"smsLogin": "【政企超链接】您的验证码为:{code}请在5分钟内使用切勿将验证码泄露于他人如非本人操作请忽略。",
"tencentSecretId": "AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G",
"tencentSecretKey": "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K",
"tpt": "tpt",
"wechatAppID": "wx2edb802f5c3ae1ae",
"wechatAppSecret": "4ff97e523c3de6bad47051b568522386",

View File

@ -269,6 +269,16 @@
"strict": false,
"type": ""
},
{
"add": true,
"edit": true,
"info": true,
"list": false,
"must": false,
"name": "auth_img",
"strict": false,
"type": "image"
},
{
"add": false,
"edit": false,

BIN
iedc.zip

Binary file not shown.

View File

@ -3,11 +3,10 @@ package main
import (
"code.hoteas.com/golang/hotime"
"code.hoteas.com/golang/hotime/dri/aliyun"
"code.hoteas.com/golang/hotime/dri/baidu"
"code.hoteas.com/golang/hotime/dri/tencent"
"strings"
//"../dri/aliyun"
"code.hoteas.com/golang/hotime/dri/baidu"
"code.hoteas.com/golang/hotime/dri/ddsms"
"fmt"
"iedc-go/admin"
@ -19,7 +18,6 @@ func main() {
date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00")
fmt.Println(date, date.Unix())
baidu.BaiDuMap.Init("ZeT902EZvVgIoGVWEFK3osUm")
//fmt.Println("0123456"[1:7])
appIns := hotime.Init("config/config.json")
notNeedLogin := []string{"token", "login", "test", "auth", "upload", "info"} //不需要登录的操作
@ -82,8 +80,9 @@ func main() {
ddsms.DDY.Init(appIns.Config.GetString("smsKey"))
}
tencent.Company.Init("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K")
aliyun.Company.Init("06c6a07e89dd45c88de040ee1489eef7")
tencent.Company.Init(appIns.Config.GetString("tencentSecretId"), appIns.Config.GetString("tencentSecretKey"))
aliyun.Company.Init(appIns.Config.GetString("aliyunApiCode"))
baidu.BaiDuMap.Init(appIns.Config.GetString("baiduAk"))
appIns.Run(hotime.Router{
"app": app.Project,
})