diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 2bf8a26..18a0b90 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,9 +5,14 @@
+
+
+
+
+
+
+
-
-
@@ -38,6 +43,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -48,23 +63,43 @@
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
@@ -80,16 +115,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -100,11 +125,11 @@
-
+
-
-
+
+
@@ -112,26 +137,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -187,6 +192,7 @@
+
@@ -244,7 +250,29 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -265,12 +293,13 @@
+
+
+
+
-
-
-
+
+ 1504596978308
+
+
+
+ 1504596978308
+
+
-
+
@@ -674,7 +710,8 @@
-
+
+
@@ -683,20 +720,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -803,20 +826,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -927,24 +936,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -988,7 +979,7 @@
-
+
@@ -1003,16 +994,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -1039,13 +1020,73 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/config.json b/config/config.json
deleted file mode 100644
index aebc893..0000000
--- a/config/config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "HOTIME-MAP": 1504577466932974800,
- "cacheLongTime": 2592000,
- "cacheShortTime": 7200,
- "dbHost": "127.0.0.1",
- "dbName": "test",
- "dbPort": "3306",
- "dbPwd": "root",
- "dbUser": "root",
- "defFile": [
- "index.html",
- "index.htm"
- ],
- "error": {},
- "logLevel": 0,
- "port": "80",
- "sessionName": "HOTIME",
- "tpt": "tpt"
-}
\ No newline at end of file
diff --git a/dri/ddsms/ddsms.go b/dri/ddsms/ddsms.go
new file mode 100644
index 0000000..2a154d1
--- /dev/null
+++ b/dri/ddsms/ddsms.go
@@ -0,0 +1,89 @@
+package ddsms
+
+import (
+ "encoding/json"
+ "errors"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "strings"
+)
+
+type DDY struct {
+ ApiKey string
+ YzmUrl string
+ TzUrl string
+}
+
+func (this *DDY) Init(apikey string, uzmurl string, tzurl string) {
+ this.ApiKey = apikey
+ this.YzmUrl = uzmurl
+ this.TzUrl = tzurl
+}
+
+//发送短信验证码 code验证码如:123456 返回true表示发送成功flase表示发送失败
+func (this *DDY) SendYZM(umoblie string, tpt string, data map[string]string) (bool, error) {
+ for k, v := range data {
+ tpt = strings.Replace(tpt, "{"+k+"}", v, -1)
+ }
+ return this.send(this.YzmUrl, umoblie, tpt)
+}
+
+//发送通知
+func (this *DDY) SendTz(umoblie []string, tpt string, data map[string]string) (bool, error) {
+ for k, v := range data {
+ tpt = strings.Replace(tpt, "["+k+"]", v, -1)
+ }
+ umobleStr := ""
+ for i, v := range umoblie {
+ if i == 0 {
+ umobleStr = v
+ continue
+ }
+ umobleStr += "," + v
+ }
+ return this.send(this.TzUrl, umobleStr, tpt)
+}
+
+//发送短信
+func (this *DDY) send(mUrl string, umoblie string, content string) (bool, error) {
+
+ data_send_sms_yzm := url.Values{"apikey": {this.ApiKey}, "mobile": {umoblie}, "content": {content}}
+ res, err := this.httpsPostForm(mUrl, data_send_sms_yzm)
+ if err != nil && res == "" {
+ return false, errors.New("连接错误")
+ }
+
+ var msg interface{}
+ err1 := json.Unmarshal([]byte(res), &msg)
+ if err1 != nil {
+ return false, errors.New("json解析错误")
+ }
+
+ resmsg := msg.(map[string]interface{})
+ rcode := int(resmsg["code"].(float64))
+ result := resmsg["msg"].(string)
+ if rcode != 1 {
+ return false, errors.New(result)
+ }
+
+ return true, nil
+}
+
+//调用url发送短信的连接
+func (this *DDY) httpsPostForm(url string, data url.Values) (string, error) {
+ resp, err := http.PostForm(url, data)
+
+ if err != nil {
+ return "", err
+ }
+
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return "", err
+ }
+
+ return string(body), nil
+
+}
diff --git a/dri/upload/upload.go b/dri/upload/upload.go
new file mode 100644
index 0000000..4447397
--- /dev/null
+++ b/dri/upload/upload.go
@@ -0,0 +1,70 @@
+package upload
+
+import (
+ "errors"
+ "go.hoteas.com/hotime"
+ "io"
+ "mime/multipart"
+ "net/http"
+ "os"
+ "strings"
+ "time"
+)
+
+type Upload struct {
+ Path string
+}
+
+func (this *Upload) UpFile(Request *http.Request, fieldName, savefilepath, savePath string) (string, error) {
+ Request.ParseMultipartForm(32 << 20)
+ var filePath string
+ files := Request.MultipartForm.File
+ var file multipart.File
+ err := errors.New("")
+
+ for k, _ := range files {
+ fieldName = k
+ file, _, err = Request.FormFile(fieldName)
+ if err != nil {
+ return "", errors.New("上传头像失败")
+ }
+ }
+
+ if strings.EqualFold(savePath, "") {
+
+ t := time.Now().Unix()
+ data := time.Unix(int64(t), 0).Format("2006-01")
+ path := ""
+ if strings.EqualFold(savefilepath, "") {
+ path = this.Path + data
+ } else {
+ path = savefilepath + data
+ }
+
+ _, err1 := os.Stat(path)
+ if err1 != nil {
+ if os.IsNotExist(err1) {
+ err := os.MkdirAll(path, os.ModePerm)
+ if err != nil {
+ return "", errors.New("服务器创建头像文件夹失败")
+ }
+ }
+ }
+ filename := time.Unix(int64(t), 0).Format("2006-01-02-15-22-25") + hotime.ObjToStr(hotime.Rand(6))
+ filePath = path + "/" + filename + this.Path
+ } else {
+ filePath = savePath
+ }
+
+ header, err := os.OpenFile(filePath, os.O_CREATE, 0666)
+ if err != nil {
+ return "", errors.New("服务器创建头像文件失败")
+ }
+ _, err = io.Copy(header, file)
+
+ if err != nil {
+ return "", errors.New("服务器复制头像文件失败")
+
+ }
+ return filePath, nil
+}