diff --git a/main.go b/main.go index de23805..d48384e 100644 --- a/main.go +++ b/main.go @@ -101,9 +101,13 @@ func imain() { preset.PreSettring(app) //注册路由 routes.Hub(app) + savePath,_ := utils.GetCurrentPath("web/public") + //app.RegisterView(iris.HTML(savePath, ".html")) + // 设置静态资源 + app.HandleDir("/public", savePath) //app.RegisterView(iris.HTML("./web/public", ".html")) // 设置静态资源 - app.HandleDir("/public", "./web/public") + //app.HandleDir("/public", "./web/public") //数据备份 go db.CornTime() //启动监听端口 diff --git a/utils/wxfunc/wxApi.go b/utils/wxfunc/wxApi.go new file mode 100644 index 0000000..8a48233 --- /dev/null +++ b/utils/wxfunc/wxApi.go @@ -0,0 +1,89 @@ +package wxfunc + +import ( + "crypto/sha1" + "encoding/json" + "fmt" + "errors" + "github.com/xlstudio/wxbizdatacrypt" + "net/http" +) + +/** + * 常量 + * @param appid string 小程序的appid + */ +const appId = "wxe0d79550e7f33316" +const secret = "2bb0e3104b315def0db87c131bbc351f" + +//加密数据解密算法 + +/** + * 检验数据的真实性,并且获取解密后的明文. + * @param encryptedData string 加密的用户数据 + * @param iv string 与用户数据一同返回的初始向量 + * @param sessionKey string 与用户数据一同返回的初始向量 + * + * @return map type. +*/ +func DecryptData(encryptedData string, iv string, sessionKey string) (interface{}, error) { + + pc := wxbizdatacrypt.WxBizDataCrypt{AppId: appId, SessionKey: sessionKey} + result, err := pc.Decrypt(encryptedData, iv, true) //第三个参数解释: 需要返回 JSON 数据类型时 使用 true, 需要返回 map 数据类型时 使用 false + if err != nil { + return nil, err + } + return result, nil +} + + +type WXLoginResp struct { + OpenId string `json:"openid"` + SessionKey string `json:"session_key"` + UnionId string `json:"unionid"` + ErrCode int `json:"errcode"` + ErrMsg string `json:"errmsg"` +} + +// 这个函数以 code 作为输入, 返回调用微信接口得到的对象指针和异常情况 +func WXLogin(code string) (*WXLoginResp, error) { + url := "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code" + + // 合成url, 这里的appId和secret是在微信公众平台上获取的 + url = fmt.Sprintf(url, appId, secret, code) + + // 创建http get请求 + resp,err := http.Get(url) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + // 解析http请求中body 数据到我们定义的结构体中 + wxResp := WXLoginResp{} + decoder := json.NewDecoder(resp.Body) + if err := decoder.Decode(&wxResp); err != nil { + return nil, err + } + + // 判断微信接口返回的是否是一个异常情况 + if wxResp.ErrCode != 0 { + return nil, errors.New(fmt.Sprintf("ErrCode:%s ErrMsg:%s", wxResp.ErrCode, wxResp.ErrMsg)) + } + + return &wxResp, nil +} + + +// 校验微信返回的用户数据 +func ValidateUserInfo(rawData, sessionKey, signature string) bool { + signature2 := GetSha1(rawData + sessionKey) + return signature == signature2 +} +// SHA-1 加密 +func GetSha1(str string) string { + data := []byte(str) + has := sha1.Sum(data) + res := fmt.Sprintf("%x", has) //将[]byte转成16进制 + return res +} \ No newline at end of file diff --git a/web/controllers/wxSmall/wx_surveysheet_controller.go b/web/controllers/wxSmall/wx_surveysheet_controller.go new file mode 100644 index 0000000..b3b7dac --- /dev/null +++ b/web/controllers/wxSmall/wx_surveysheet_controller.go @@ -0,0 +1,130 @@ +package wxSmall + +import ( + "SSW_WebPlatform/utils" + "SSW_WebPlatform/web/middleware/glog" + "SSW_WebPlatform/web/models" + "SSW_WebPlatform/web/models/wxSmall" + "SSW_WebPlatform/web/supports" + "github.com/kataras/iris/v12" + "strings" + "time" +) + +//查询楼栋信息 +func GetBuildings(ctx iris.Context) { + me := new(models.Buildingtab) + me.Cid, _ = ctx.URLParamInt("cid") + if utils.ValueIsEmpty(me.Cid) { + supports.Error(ctx, iris.StatusBadRequest, "项目编号不能为空!", nil) + return + } + result, err := me.SelectAll() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) + return + } + supports.Ok(ctx, supports.OptionSuccess, result) +} + +//查询调查问卷 +func GetWxCSurveysheet(ctx iris.Context) { + me := new(models.CSurveysheet) + me.Cid, _ = ctx.URLParamInt("cid") + me.Cnr, _ = ctx.URLParamInt("cid") + me.Surveysheetid = ctx.URLParam("surveysheetid") + result, err := me.WxSelectOne() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) + return + } + //查询缓存 + wx := new(wxSmall.WxUserCache) + wx.Cid, _ = ctx.URLParamInt("cid") + wx.Uid, _ = ctx.URLParamInt("uid") + wx.Surveysheetid = ctx.URLParam("surveysheetid") + data, err := wx.SelectCacheInfo() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) + return + } + cache := make(map[string]wxSmall.WxCacheSurveysheetResultlst) + for _, v := range data { + key := strings.TrimSpace(v.Subjectid) + value := v + cache[key] = value + } + for kk, vv := range result.Valst { + key := strings.TrimSpace(vv.Subjectid) + val, ok := cache[key] + if ok { + result.Valst[kk].QuestionNaireItem.Subjectid = val.Subjectid + result.Valst[kk].QuestionNaireItem.Optioninput = val.Optioninput + result.Valst[kk].QuestionNaireItem.Selected_options = val.SelectedOptions + } + } + supports.Ok(ctx, supports.OptionSuccess, result) +} + +//提交试卷 +func InsertWXCSurveysheetResult(ctx iris.Context) { + data := new(models.CSurveysheetResult) + if err := ctx.ReadJSON(data); err != nil { + supports.Error(ctx, iris.StatusBadRequest, "json解析错误", nil) + return + } + data.Lastmodifyby = "wx" + data.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + data.Lastmodifytime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + err := data.Add() + if err != nil { + glog.InfoExt("问题调研", "add err is :", err) + supports.Error(ctx, iris.StatusBadRequest, "添加失败!", nil) + return + } + //删除缓存 + cache := new(wxSmall.WxUserCache) + cache.Uid = data.Uid + cache.Surveysheetid = data.Surveysheetid + cache.Cid = data.Cid + cache.DelCache() + supports.Ok(ctx, supports.OptionSuccess, "") +} + +//缓存试卷 +func AddWxCacheSurveysheetResult(ctx iris.Context) { + var data models.CSurveysheetResult + if err := ctx.ReadJSON(&data); err != nil { + supports.Error(ctx, iris.StatusBadRequest, "json解析错误", nil) + return + } + + //第一步:查询缓存用户关联表,有就更新,没有就插入 + cache := new(wxSmall.WxUserCache) + cache.Uid = data.Uid + cache.Surveysheetid = data.Surveysheetid + cache.Cid = data.Cid + cache.Status = 0 + cache.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + cache.Lastmodifytime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + + _, err := cache.LoadInfo() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, "查询缓存失败", nil) + return + } + //第二步:题目信息,插入缓存表里,有就更新,没有就插入 + wxsurvey := new(wxSmall.WxCacheSurveysheetResult) + wxsurvey.Lastmodifyby = "wx" + wxsurvey.Createtime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + wxsurvey.Lastmodifytime = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss") + wxsurvey.Surveynr = data.Surveynr + wxsurvey.Uid = data.Uid + err = wxsurvey.Add(data) + if err != nil { + glog.InfoExt("问题调研", "add err is :", err) + supports.Error(ctx, iris.StatusBadRequest, "添加失败!", nil) + return + } + supports.Ok(ctx, supports.OptionSuccess, "") +} diff --git a/web/controllers/wxSmall/wxlogin.go b/web/controllers/wxSmall/wxlogin.go new file mode 100644 index 0000000..478756a --- /dev/null +++ b/web/controllers/wxSmall/wxlogin.go @@ -0,0 +1,140 @@ +package wxSmall + +import ( + "SSW_WebPlatform/utils" + "SSW_WebPlatform/utils/wxfunc" + "SSW_WebPlatform/web/models" + "SSW_WebPlatform/web/models/wxSmall" + "SSW_WebPlatform/web/supports" + "fmt" + "github.com/kataras/iris/v12" + "time" +) + +//微信授权登录 +func Wxlogin(ctx iris.Context) { + + data := new(wxSmall.UserData) + if err := ctx.ReadJSON(data); err != nil { + supports.Error(ctx, iris.StatusBadRequest, "json解析错误", nil) + return + } + //code := data.Code // 获取code + // 根据code获取 openID 和 session_key + //wxLoginResp, err := wxfunc.WXLogin(code) + //if err != nil { + // supports.Error(ctx, iris.StatusBadRequest, "获取session_key失败", nil) + // return + //} + + //判断数据库里用户表是否存在此用户 + user := new(wxSmall.WxUser) + //user.Openid = wxLoginResp.OpenId + user.Openid = "123456" + wxuser, err := user.SelectOneByOpenid() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) + return + } + if wxuser == nil { + //添加信息 + //userInfo, err := wxfunc.DecryptData(data.EncryptedData,data.Iv,wxLoginResp.SessionKey) + //if err != nil { + // supports.Error(ctx, iris.StatusBadRequest, "数据解密失败", nil) + // return + //} + //Info := userInfo.(map[string]interface{}) + //user.Nickname = utils.ValueToString(Info["nickName"],"") + //user.Gender = utils.ValueToInt(Info["gender"],0) + //user.Avatarurl = utils.ValueToString(Info["avatarUrl"],"") + //user.Province = utils.ValueToString(Info["province"],"") + //user.City =utils.ValueToString(Info["city"],"") + //user.Country =utils.ValueToString(Info["country"],"") + //user.Sessionkey = wxLoginResp.SessionKey + //user.Openid = wxLoginResp.OpenId + //user.Unionid = wxLoginResp.UnionId + user.Gender = 1 + user.Nickname = "风云争霸" + user.Sessionkey = "123456" + user.Openid = "123456" + user.Unionid = "123456" + err = user.Add() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, "用户信息录入失败", nil) + return + } + wxuser, err = user.SelectOneByOpenid() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, "用户信息查询失败", nil) + return + } + } else { + ok := wxfunc.ValidateUserInfo(data.RawData, wxuser.Sessionkey, data.Signatrue) + if !ok { + //过期,更新 + user.Uid = wxuser.Uid + //user.Sessionkey = wxLoginResp.SessionKey + user.Sessionkey = "123456" + err = user.Update() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, "用户信息更新失败", nil) + return + } + } + } + + supports.Ok(ctx, supports.OptionSuccess, wxuser) +} + +//查询是否已经做过调查 +func WxCheckResult(ctx iris.Context) { + + cache := new(wxSmall.WxUserCache) + cache.Cid, _ = ctx.URLParamInt("cid") + cache.Uid, _ = ctx.URLParamInt("uid") + cache.Surveysheetid = ctx.URLParam("surveysheetid") + ok, err := cache.SelectResultInfo() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil) + return + } + if ok { + supports.Ok(ctx, supports.OptionSuccess, true) + } else { + supports.Ok(ctx, supports.OptionSuccess, false) + } + +} + +//判断二维码是否过期 +func WxCheckBarcode(ctx iris.Context) { + + me := new(models.CSurveysheet) + me.Cid, _ = ctx.URLParamInt("cid") + me.Cnr, _ = ctx.URLParamInt("cid") + lenDays, _ := ctx.URLParamInt("lenDays") + me.Surveysheetid = ctx.URLParam("surveysheetid") + result, err := me.SelectInfo() + if err != nil { + supports.Error(ctx, iris.StatusBadRequest, err.Error(), nil) + return + } + fmt.Println(result) + if utils.ValueIsEmpty(result.Surveydate) { + supports.Ok(ctx, supports.OptionSuccess, "没有设置调研时间!") + return + } + nowDate := time.Now() + begDate,_ := utils.TimeParseyyyyMMdd(result.Surveydate) + endDate := begDate.AddDate(0,0,lenDays) + //判断 + if nowDate.Before(begDate){ + supports.Ok(ctx, supports.OptionSuccess, "未开始") + } + if nowDate.After(begDate) && nowDate.Before(endDate){ + supports.Ok(ctx, supports.OptionSuccess, "未过期") + } else { + supports.Ok(ctx, supports.OptionSuccess, "已过期") + } + +} diff --git a/web/middleware/middleware.go b/web/middleware/middleware.go index 1f68737..cfe562d 100644 --- a/web/middleware/middleware.go +++ b/web/middleware/middleware.go @@ -15,7 +15,7 @@ type Middleware struct { func ServeHTTP(ctx iris.Context) { path := ctx.Path() // 过滤静态资源、login接口、首页等...不需要验证 - if checkURL(path) || strings.Contains(path, "/public") { + if checkURL(path) || strings.Contains(path, "/public") || strings.Contains(path, "/api"){ ctx.Next() return } diff --git a/web/models/c_surveysheet.go b/web/models/c_surveysheet.go index 6787e26..ca42bda 100644 --- a/web/models/c_surveysheet.go +++ b/web/models/c_surveysheet.go @@ -22,7 +22,9 @@ type CSurveysheet struct { Lastmodifytime string `json:"lastmodifytime" xorm:"default 'NULL' comment('最近更新时间') VARCHAR(40)"` Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` Valst []CSurveysheetSubjectlst `json:"valst" xorm:"-"` + } + type Cvalst struct { SubjectType string `json:"subject_type"` CSurveysheetSubjectlst []CSurveysheetSubjectlst `json:"c_surveysheet_subjectlst"` @@ -433,6 +435,31 @@ func (t *CSurveysheet) SelectOne(level int) (CSurveysheet, error) { return data, nil } +//查卷子 +func (t *CSurveysheet) WxSelectOne() (CSurveysheet, error) { + e := db.MasterEngine() + var data CSurveysheet + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveysheetid}).Get(&data) + if err != nil { + return data, err + } + datalist := make([]CSurveysheetSubjectlst, 0) + err = e.Table("c_surveysheet_subjectlst").Where("cid = ? and cnr = ? and surveysheetid = ?", t.Cid, t.Cnr, t.Surveysheetid).Asc("pos").Find(&datalist) + if err != nil { + return data, err + } + for k, v := range datalist { + list := make([]CSurveysheetOptionlst, 0) + err = e.Table("c_surveysheet_optionlst").Where("cid = ? and cnr = ? and surveysheetid = ? and subjectid = ?", t.Cid, t.Cnr, t.Surveysheetid, v.Subjectid).Desc("optionid").Find(&list) + if err != nil { + return data, err + } + datalist[k].Valst = list + } + data.Valst = datalist + return data, nil +} + //分页 func (t *CSurveysheet) GetPage(pageSize int, pageIndex int) ([]CSurveysheet, int, error) { data := make([]CSurveysheet, 0) @@ -467,3 +494,15 @@ func (t *CSurveysheet) SelectArr() (data []CSurveysheet, err error) { } return data, nil } + + +//查卷子信息 +func (t *CSurveysheet) SelectInfo() (CSurveysheet, error) { + e := db.MasterEngine() + var data CSurveysheet + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveysheetid}).Get(&data) + if err != nil { + return data, err + } + return data, nil +} \ No newline at end of file diff --git a/web/models/c_surveysheet_result.go b/web/models/c_surveysheet_result.go index 7321f98..b8c1a54 100644 --- a/web/models/c_surveysheet_result.go +++ b/web/models/c_surveysheet_result.go @@ -47,6 +47,7 @@ type CSurveysheetResult struct { Createtime string `json:"createtime" xorm:"default 'NULL' comment('创建时间') VARCHAR(40)"` Lastmodifytime string `json:"lastmodifytime" xorm:"default 'NULL' comment('最近更新时间') VARCHAR(40)"` Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` + Uid int `json:"uid" xorm:"-"` Valst []CSurveysheetResultlst `json:"valst" xorm:"-"` } @@ -93,7 +94,7 @@ func (t *CSurveysheetResult) Add() error { CSurveysheet.Surveysheetid = t.Surveysheetid CSurveysheet.Cnr = t.Cnr CSurveysheet.Surveyfinishedcount = subject.Surveyfinishedcount + 1 - if CSurveysheet.Surveyfinishedcount == subject.Surveysamplecount { + if CSurveysheet.Surveyfinishedcount >= subject.Surveysamplecount { CSurveysheet.Status = 2 } else { CSurveysheet.Status = 1 @@ -1186,7 +1187,7 @@ func (c *CSurveysheetResult) Statistic(selectType string) (result StatisticData, for index, buildCate := range result.BuildingCate { buildCate.CateMap = make([]map[string]float64, 0) for _, cateData := range buildCate.CateData { - tempMap := make(map[string]float64,0) + tempMap := make(map[string]float64, 0) tempMap[cateData.CateId] = cateData.SatisfactionPercent buildCate.CateMap = append(buildCate.CateMap, tempMap) } diff --git a/web/models/c_surveysheet_subjectlst.go b/web/models/c_surveysheet_subjectlst.go index 1e6c1c5..debb42a 100644 --- a/web/models/c_surveysheet_subjectlst.go +++ b/web/models/c_surveysheet_subjectlst.go @@ -18,8 +18,16 @@ type CSurveysheetSubjectlst struct { Lastmodifytime string `json:"lastmodifytime" xorm:"default 'NULL' comment('最近更新时间') VARCHAR(40)"` Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` Valst []CSurveysheetOptionlst `json:"valst" xorm:"-"` + QuestionNaireItem QuestionNaireItem `json:"questionNaireItem" xorm:"-"` } func (t *CSurveysheetSubjectlst) TableName() string { return "c_surveysheet_subjectlst" } + +type QuestionNaireItem struct { + Subjectid string `json:"subjectid"` + Optioninput string `json:"optioninput"` + Optiontext string `json:"optiontext"` + Selected_options string `json:"selected_options"` +} diff --git a/web/models/wxSmall/wx_cache_surveysheet_result.go b/web/models/wxSmall/wx_cache_surveysheet_result.go new file mode 100644 index 0000000..84325f6 --- /dev/null +++ b/web/models/wxSmall/wx_cache_surveysheet_result.go @@ -0,0 +1,285 @@ +// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved. +package wxSmall + +import ( + "SSW_WebPlatform/db" + "SSW_WebPlatform/utils" + "SSW_WebPlatform/web/middleware/glog" + "SSW_WebPlatform/web/models" + "strings" + "time" + "xorm.io/core" +) + +type WxCacheSurveysheetResult struct { + Cid int `json:"cid" xorm:"not null pk comment('公司ID') INT(11)"` + Cnr int `json:"cnr" xorm:"not null pk comment('小区编号') INT(11)"` + Surveysheetid string `json:"surveysheetid" xorm:"not null pk VARCHAR(40)"` + Surveynr int `json:"surveynr" xorm:"not null pk comment('调研问卷流水号') INT(11)"` + Uid int `json:"uid" xorm:"not NULL pk INT(10)"` + Room string `json:"room" xorm:"default 'NULL' VARCHAR(32)"` + Unit string `json:"unit" xorm:"default 'NULL' VARCHAR(32)"` + Buildingid string `json:"buildingid" xorm:"default 'NULL' VARCHAR(32)"` + Surveyperson string `json:"surveyperson" xorm:"default 'NULL' comment('指定调研人') VARCHAR(40)"` + Surveysamplecount int `json:"surveysamplecount" xorm:"not null comment('调研取样数') INT(11)"` + Surveyfinishedcount int `json:"surveyfinishedcount" xorm:"not null comment('调研问卷实际已完成数') INT(11)"` + Planstartdate string `json:"planstartdate" xorm:"default '''' VARCHAR(20)"` + Planendate string `json:"planendate" xorm:"default '''' VARCHAR(20)"` + Actstartdate string `json:"actstartdate" xorm:"default '''' VARCHAR(20)"` + Actenddate string `json:"actenddate" xorm:"default '''' VARCHAR(20)"` + Status int `json:"status" xorm:"not null comment('状态') INT(11)"` + Remark string `json:"remark" xorm:"default 'NULL' comment('备注') VARCHAR(255)"` + Signature string `json:"signature" xorm:"default 'NULL' comment('电子签名') VARCHAR(255)"` + Createtime string `json:"createtime" xorm:"default '''' comment('创建时间') VARCHAR(40)"` + Lastmodifytime string `json:"lastmodifytime" xorm:"default '''' comment('最近更新时间') VARCHAR(40)"` + Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` + Sex string `json:"sex" xorm:"default '''' comment('被访问者性别 male 和female') VARCHAR(10)"` + Persontype int `json:"persontype" xorm:"default NULL comment('被访问者类型 业主1 租户2') TINYINT(1)"` + Age int `json:"age" xorm:"default NULL comment('被访问者年龄 1-22岁以下 2-22到59岁 3-60岁以上') TINYINT(1)"` + Livetime int `json:"livetime" xorm:"default NULL comment('被访问者居住时间 1-1年以内 2-1到3年 2-3到5年 3-5年以上') TINYINT(1)"` + Personname string `json:"personname" xorm:"default '''' comment('被访问者姓名') VARCHAR(40)"` + Valst []WxCacheSurveysheetResultlst `json:"valst" xorm:"-"` +} + +/******数据表名******/ +func (t *WxCacheSurveysheetResult) TableName() string { + return "wx_cache_surveysheet_result" +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据添加 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResult) Add(data models.CSurveysheetResult) error { + engine := db.MasterEngine() + session := engine.NewSession() + defer session.Close() + // add Begin() before any action + err := session.Begin() + if err != nil { + return err + } + //查询信息 + subject := new(models.CSurveysheet) + subject.Cid = data.Cid + subject.Surveysheetid = data.Surveysheetid + subject.Cnr = data.Cnr + _, err = engine.Table("c_surveysheet").ID(core.PK{subject.Cid, subject.Cnr, subject.Surveysheetid}).Get(subject) + if err != nil { + session.Rollback() + return err + } + //判断是否已经添加缓存 + cache := new(WxCacheSurveysheetResult) + ok,err := session.Table("wx_cache_surveysheet_result").Where("cid =? and uid = ? and surveysheetid = ?", t.Cid, t.Uid, t.Surveysheetid).Get(cache) + if err != nil { + session.Rollback() + return err + } + + surveynr := 0 + if ok{ + //更新 + surveynr = data.Surveynr + }else{ + snr := new(models.Snrtab) + snr.Cid = data.Cid + id, err := snr.GetNextSnr("Cachenr") + if err != nil { + session.Rollback() + return err + } + surveynr = utils.ValueToInt(id, 0) + //添加答题 + Survey := new(WxCacheSurveysheetResult) + Survey.Surveyperson = subject.Surveyperson + Survey.Surveysamplecount = subject.Surveysamplecount + Survey.Surveyfinishedcount = subject.Surveyfinishedcount + Survey.Cid = data.Cid + Survey.Cnr = data.Cnr + Survey.Uid = t.Uid + Survey.Surveysheetid = data.Surveysheetid + Survey.Buildingid = data.Buildingid + Survey.Unit = data.Unit + Survey.Room = data.Room + Survey.Surveynr = surveynr + Survey.Remark = data.Remark + Survey.Signature = data.Signature + Survey.Planstartdate = data.Planstartdate + Survey.Planendate = data.Planendate + Survey.Actenddate = utils.TimeFormat(time.Now(), "yyyy-MM-dd HH:mm:ss") + //查询是否存在, + + _, err = session.Table("wx_cache_surveysheet_result").Insert(Survey) + if err != nil { + glog.InfoExt("问题调研", "添加题目 err1 is :", err) + session.Rollback() + return err + } + } + + + //记录答案 + for _, v := range data.Valst { + //查询答案分值 + datalist := make([]models.CSurveysheetOptionlst, 0) + SelectedOptions := strings.Split(v.SelectedOptions, ",") + glog.InfoExt("问题调研", "添加问题 SelectedOptionsis :", SelectedOptions) + err = engine.Table("c_surveysheet_optionlst").Where("cid = ? and subjectid = ?", data.Cid, v.Subjectid).In("optionid", SelectedOptions).Find(&datalist) + glog.InfoExt("问题调研", "添加问题 datalist :", datalist) + for _, vv := range datalist { + + //判断是否已经添加缓存 + cachelst := new(WxCacheSurveysheetResultlst) + ok,err := session.Table("wx_cache_surveysheet_resultlst").Where("cid =? and uid = ? and surveysheetid = ? and surveynr = ? and subjectid = ?", t.Cid, t.Uid, t.Surveysheetid,surveynr,vv.Subjectid).Get(cachelst) + if err != nil { + session.Rollback() + return err + } + if ok{ + //更新 + subject := new(WxCacheSurveysheetResultlst) + subject.Cid = data.Cid + subject.Cnr = data.Cnr + subject.Uid = t.Uid + subject.Subjectid = vv.Subjectid + subject.Surveynr = surveynr + subject.Surveysheetid = data.Surveysheetid + subject.Status = v.Status + subject.SelectedOptions = vv.Optionid + subject.Assessmentvalue = vv.Optionvalue + subject.Remark = v.Remark + subject.Optiontype = vv.Optiontype + subject.Optioninput = v.Optioninput + subject.Lastmodifyby = data.Lastmodifyby + subject.Createtime = data.Createtime + subject.Lastmodifytime = data.Lastmodifytime + _, err = session.Table("wx_cache_surveysheet_resultlst").Where("cid =? and uid = ? and surveysheetid = ? and surveynr = ? and subjectid = ?", t.Cid, t.Uid, t.Surveysheetid,surveynr,vv.Subjectid).Update(subject) + if err != nil { + glog.InfoExt("问题调研", "添加问题 err2 is :", err) + session.Rollback() + return err + } + }else{ + subject := new(WxCacheSurveysheetResultlst) + subject.Cid = data.Cid + subject.Cnr = data.Cnr + subject.Uid = t.Uid + subject.Subjectid = vv.Subjectid + subject.Surveynr = surveynr + subject.Surveysheetid = data.Surveysheetid + subject.Status = v.Status + subject.SelectedOptions = vv.Optionid + subject.Assessmentvalue = vv.Optionvalue + subject.Remark = v.Remark + subject.Optiontype = vv.Optiontype + subject.Optioninput = v.Optioninput + subject.Lastmodifyby = data.Lastmodifyby + subject.Createtime = data.Createtime + subject.Lastmodifytime = data.Lastmodifytime + _, err = session.Table("wx_cache_surveysheet_resultlst").Insert(subject) + if err != nil { + glog.InfoExt("问题调研", "添加问题 err2 is :", err) + session.Rollback() + return err + } + } + + } + + } + + err = session.Commit() + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据删除 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResult) Del() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveysheetid, t.Surveynr}).Delete(&WxCacheSurveysheetResult{}) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据修改 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResult) Update() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveysheetid, t.Surveynr}).Update(t) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResult) SelectOne() (WxCacheSurveysheetResult, error) { + e := db.MasterEngine() + var data WxCacheSurveysheetResult + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveysheetid, t.Surveynr}).Get(&data) + if err != nil { + return data, err + } + return data, nil +} diff --git a/web/models/wxSmall/wx_cache_surveysheet_resultlst.go b/web/models/wxSmall/wx_cache_surveysheet_resultlst.go new file mode 100644 index 0000000..465f07a --- /dev/null +++ b/web/models/wxSmall/wx_cache_surveysheet_resultlst.go @@ -0,0 +1,141 @@ +// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved. +package wxSmall + +import ( + "errors" + "SSW_WebPlatform/db" + "xorm.io/core" +) + +type WxCacheSurveysheetResultlst struct { + Cid int `json:"cid" xorm:"not null pk comment('公司ID') INT(11)"` + Cnr int `json:"cnr" xorm:"not null pk comment('小区编号') INT(11)"` + Surveynr int `json:"surveynr" xorm:"not null pk comment('流水号') INT(11)"` + Surveysheetid string `json:"surveysheetid" xorm:"not null pk VARCHAR(40)"` + Subjectid string `json:"subjectid" xorm:"not null pk comment('问题ID') VARCHAR(20)"` + Uid int `json:"uid" xorm:"default NULL INT(10)"` + Optioninput string `json:"optioninput" xorm:"default 'NULL' VARCHAR(255)"` + Optiontype int `json:"optiontype" xorm:"default NULL INT(8)"` + Status int `json:"status" xorm:"not null comment('状态') INT(11)"` + SelectedOptions string `json:"selected_options" xorm:"not null pk comment('用户选择项') VARCHAR(40)"` + Assessmentvalue int `json:"assessmentvalue" xorm:"default NULL comment('评估值') INT(11)"` + Remark string `json:"remark" xorm:"default 'NULL' comment('备注') VARCHAR(255)"` + Createtime string `json:"createtime" xorm:"default '''' comment('创建时间') VARCHAR(40)"` + Lastmodifytime string `json:"lastmodifytime" xorm:"default '''' comment('最近更新时间') VARCHAR(40)"` + Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` +} + +/******数据表名******/ +func (t *WxCacheSurveysheetResultlst) TableName() string { + return "wx_cache_surveysheet_resultlst" +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据添加 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResultlst) Add() error { + e := db.MasterEngine() + count := new(WxCacheSurveysheetResultlst) + affw, err := e.Table(t.TableName()).ID(core.PK{t.Cid, t.Cnr, t.Surveynr, t.Surveysheetid, t.Subjectid, t.SelectedOptions}).Count(count) + if err != nil { + return err + } + if affw > 0 { + return errors.New("数据已经存在!") + } + _, err = e.Table(t.TableName()).Insert(t) + + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据删除 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResultlst) Del() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveynr, t.Surveysheetid, t.Subjectid, t.SelectedOptions}).Delete(&WxCacheSurveysheetResultlst{}) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据修改 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResultlst) Update() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveynr, t.Surveysheetid, t.Subjectid, t.SelectedOptions}).Update(t) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxCacheSurveysheetResultlst) SelectOne() (WxCacheSurveysheetResultlst, error) { + e := db.MasterEngine() + var data WxCacheSurveysheetResultlst + _, err := e.ID(core.PK{t.Cid, t.Cnr, t.Surveynr, t.Surveysheetid, t.Subjectid, t.SelectedOptions}).Get(&data) + if err != nil { + return data, err + } + return data, nil +} diff --git a/web/models/wxSmall/wx_user.go b/web/models/wxSmall/wx_user.go new file mode 100644 index 0000000..4c0953f --- /dev/null +++ b/web/models/wxSmall/wx_user.go @@ -0,0 +1,187 @@ +// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved. +package wxSmall + +import ( + "SSW_WebPlatform/db" + "xorm.io/core" +) + +type WxUser struct { + Uid int `json:"uid" xorm:"not null pk autoincr INT(11)"` + Openid string `json:"openid" xorm:"not null VARCHAR(128)"` + Cid int `json:"cid" xorm:"default NULL INT(11)"` + Name string `json:"name" xorm:"default 'NULL' VARCHAR(32)"` + Phone string `json:"phone" xorm:"default 'NULL' VARCHAR(16)"` + Nickname string `json:"nickname" xorm:"default 'NULL' VARCHAR(32)"` + Gender int `json:"gender" xorm:"default NULL comment('性别') INT(1)"` + Language string `json:"language" xorm:"default 'NULL' VARCHAR(16)"` + City string `json:"city" xorm:"default 'NULL' VARCHAR(16)"` + Province string `json:"province" xorm:"default 'NULL' VARCHAR(16)"` + Country string `json:"country" xorm:"default 'NULL' VARCHAR(16)"` + Avatarurl string `json:"avatarurl" xorm:"default 'NULL' VARCHAR(255)"` + Unionid string `json:"unionid" xorm:"default 'NULL' VARCHAR(128)"` + Sessionkey string `json:"sessionkey" xorm:"default 'NULL' VARCHAR(128)"` + Building string `json:"building" xorm:"default 'NULL' VARCHAR(10)"` + Uint string `json:"uint" xorm:"default 'NULL' VARCHAR(10)"` + Room string `json:"room" xorm:"default 'NULL' VARCHAR(10)"` + Remark string `json:"remark" xorm:"default 'NULL' VARCHAR(128)"` + Createtime string `json:"createtime" xorm:"default '''' comment('创建时间') VARCHAR(40)"` + Lastmodifytime string `json:"lastmodifytime" xorm:"default '''' comment('最近更新时间') VARCHAR(40)"` + Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` +} + +type UserInfo struct { + NickName string `json:"nickName"` + Country string `json:"country"` + Province string `json:"province"` + City string `json:"city"` + Language string `json:"language"` + Gender int `json:"gender"` + AvatarUrl string `json:"avatarUrl"` +} + +type UserData struct { + UserInfo UserInfo + RawData string `json:"rawData"` + Signatrue string `json:"signature"` + EncryptedData string `json:"encryptedData"` + Iv string `json:"iv"` + CloudId string `json:"cloudID"` + Code string `json:"code"` +} + +/******数据表名******/ +func (t *WxUser) TableName() string { + return "wx_user" +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据添加 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUser) Add() error { + e := db.MasterEngine() + _, err := e.Table(t.TableName()).Insert(t) + + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据删除 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUser) Del() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Uid}).Delete(&WxUser{}) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据修改 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUser) Update() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Uid}).Update(t) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUser) SelectOne() (WxUser, error) { + e := db.MasterEngine() + var data WxUser + _, err := e.ID(core.PK{t.Uid}).Get(&data) + if err != nil { + return data, err + } + return data, nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUser) SelectOneByOpenid() (*WxUser, error) { + e := db.MasterEngine() + data := new(WxUser) + ok, err := e.Where("openid = ?", t.Openid).Get(data) + if err != nil { + return nil, err + } + if !ok { + return nil, err + } + return data, nil +} diff --git a/web/models/wxSmall/wx_user_cache.go b/web/models/wxSmall/wx_user_cache.go new file mode 100644 index 0000000..47f572a --- /dev/null +++ b/web/models/wxSmall/wx_user_cache.go @@ -0,0 +1,246 @@ +// Copyright (c) Shenyang Leading Edge Intelligent Technology Co., Ltd. All rights reserved. +package wxSmall + +import ( + "SSW_WebPlatform/db" + "xorm.io/core" +) + +type WxUserCache struct { + Id int `json:"id" xorm:"not null pk autoincr INT(10)"` + Uid int `json:"uid" xorm:"default NULL INT(10)"` + Cid int `json:"cid" xorm:"default NULL INT(6)"` + Surveysheetid string `json:"surveysheetid" xorm:"default NULL VARCHAR(40)"` + Status int `json:"status" xorm:"default NULL INT(1)"` + Createtime string `json:"createtime" xorm:"default '''' comment('创建时间') VARCHAR(40)"` + Lastmodifytime string `json:"lastmodifytime" xorm:"default '''' comment('最近更新时间') VARCHAR(40)"` + Lastmodifyby string `json:"lastmodifyby" xorm:"default 'NULL' comment('修改人员') VARCHAR(40)"` +} + +/******数据表名******/ +func (t *WxUserCache) TableName() string { + return "wx_user_cache" +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据添加 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) Add() error { + e := db.MasterEngine() + _, err := e.Table(t.TableName()).Insert(t) + + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据删除 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) Del() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Id}).Delete(&WxUserCache{}) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据修改 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) Update() error { + e := db.MasterEngine() + _, err := e.ID(core.PK{t.Id}).Update(t) + if err != nil { + return err + } + return nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) SelectOne() (WxUserCache, error) { + e := db.MasterEngine() + var data WxUserCache + _, err := e.ID(core.PK{t.Id}).Get(&data) + if err != nil { + return data, err + } + return data, nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据查找 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) LoadInfo() (WxUserCache, error) { + e := db.MasterEngine() + var data WxUserCache + ok, err := e.Where("cid =? and uid = ? and surveysheetid = ?", t.Cid, t.Uid, t.Surveysheetid).Get(&data) + if err != nil { + return data, err + } + if ok { + return data, nil + } + _, err = e.Table(t.TableName()).Insert(t) + if err != nil { + return data, err + } + return *t, nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 查询缓存数据 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) SelectCacheInfo() ([]WxCacheSurveysheetResultlst, error) { + e := db.MasterEngine() + data := make([]WxCacheSurveysheetResultlst, 0) + err := e.Table("wx_cache_surveysheet_resultlst").Join("INNER", "wx_user_cache", "wx_cache_surveysheet_resultlst.cid = wx_user_cache.cid and wx_cache_surveysheet_resultlst.uid = wx_user_cache.uid and wx_cache_surveysheet_resultlst.surveysheetid = wx_user_cache.surveysheetid").Where("wx_user_cache.cid =? and wx_user_cache.uid = ? and wx_user_cache.surveysheetid = ? and wx_user_cache.status = ?", t.Cid, t.Uid, t.Surveysheetid,0).Find(&data) + if err != nil { + return data, err + } + return data, nil +} + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 数据删除缓存 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) DelCache() error { + e := db.MasterEngine() + //更新状态为已经完成 + _, err := e.Table("wx_user_cache").Where("cid =? and uid = ? and surveysheetid = ?", t.Cid, t.Uid, t.Surveysheetid).Update(map[string]interface{}{"status":1}) + if err != nil { + return err + } + _, err = e.Table("wx_cache_surveysheet_result").Where("cid =? and uid = ? and surveysheetid = ?", t.Cid, t.Uid, t.Surveysheetid).Delete(&WxCacheSurveysheetResult{}) + if err != nil { + return err + } + _, err = e.Table("wx_cache_surveysheet_resultlst").Where("cid =? and uid = ? and surveysheetid = ?", t.Cid, t.Uid, t.Surveysheetid).Delete(&WxCacheSurveysheetResultlst{}) + if err != nil { + return err + } + return nil +} + + + +/****************************************************************************** + * + * @Function Name : + *----------------------------------------------------------------------------- + * + * @Description : 查询缓存数据 + * + * @Function Parameters: + * + * @Return Value : + * + * @Author : Lou Wenzhi + * + * @Date : 2021/3/6 8:47 + * + ******************************************************************************/ +func (t *WxUserCache) SelectResultInfo() (bool, error) { + e := db.MasterEngine() + var data WxUserCache + ok,err := e.Table("wx_user_cache").Where("cid =? and uid = ? and surveysheetid = ? and status = ?", t.Cid, t.Uid, t.Surveysheetid,1).Get(&data) + if err != nil { + return false, err + } + return ok, nil +} \ No newline at end of file diff --git a/web/public/logo.png b/web/public/logo.png new file mode 100644 index 0000000..05128bb Binary files /dev/null and b/web/public/logo.png differ diff --git a/web/routes/routes.go b/web/routes/routes.go index 9e8ddaa..267c362 100644 --- a/web/routes/routes.go +++ b/web/routes/routes.go @@ -1,6 +1,7 @@ package routes import ( + "SSW_WebPlatform/web/controllers/wxSmall" "github.com/kataras/iris/v12" "SSW_WebPlatform/web/controllers" "SSW_WebPlatform/web/middleware" @@ -154,4 +155,17 @@ func Hub(app *iris.Application) { } + // 权限API模块 + api := main.Party("/api") + api.Get("/getbuildings", wxSmall.GetBuildings) //查询楼栋 + api.Post("/wxlogin", wxSmall.Wxlogin) //登录 + { + wx_surveysheet := api.Party("/wx_surveysheet") + wx_surveysheet.Get("/checkresult", wxSmall.WxCheckResult) //是否做过调查 + wx_surveysheet.Get("/checkbarcode", wxSmall.WxCheckBarcode) //判断二维码是否过期 + wx_surveysheet.Get("/selectinfo", wxSmall.GetWxCSurveysheet) //查询试卷 + wx_surveysheet.Post("/addinfo", wxSmall.InsertWXCSurveysheetResult) //提交试卷 + wx_surveysheet.Post("/addinfocache", wxSmall.AddWxCacheSurveysheetResult) //提交试卷缓存 + } + }