正在显示
8 个修改的文件
包含
37 行增加
和
9 行删除
| @@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | @@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | ||
| 37 | user_center_app_secret ="cykbjnfqgctn" | 37 | user_center_app_secret ="cykbjnfqgctn" |
| 38 | 38 | ||
| 39 | #Html5 | 39 | #Html5 |
| 40 | -h5_host = "https://web-open.fjmaimaimai.com" | 40 | +h5_host = "https://web-open-test.fjmaimaimai.com" |
| 41 | 41 | ||
| 42 | #审核中心 | 42 | #审核中心 |
| 43 | suplus_host ="http://suplus-approve-dev.fjmaimaimai.com" | 43 | suplus_host ="http://suplus-approve-dev.fjmaimaimai.com" |
| @@ -38,7 +38,7 @@ user_center_app_secret ="cykbjnfqgctn" | @@ -38,7 +38,7 @@ user_center_app_secret ="cykbjnfqgctn" | ||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | #Html5 | 40 | #Html5 |
| 41 | -h5_host = "https://web-open.fjmaimaimai.com" | 41 | +h5_host = "https://web-open-test.fjmaimaimai.com" |
| 42 | 42 | ||
| 43 | #审核中心 | 43 | #审核中心 |
| 44 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" | 44 | suplus_approve_host ="http://suplus-approve-dev.fjmaimaimai.com" |
| @@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | @@ -37,7 +37,7 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b" | ||
| 37 | user_center_app_secret ="cykbjnfqgctn" | 37 | user_center_app_secret ="cykbjnfqgctn" |
| 38 | 38 | ||
| 39 | #Html5 | 39 | #Html5 |
| 40 | -h5_host = "https://web-open.fjmaimaimai.com" | 40 | +h5_host = "https://web-open-test.fjmaimaimai.com" |
| 41 | 41 | ||
| 42 | #审核中心 | 42 | #审核中心 |
| 43 | suplus_host ="http://suplus-approve-test.fjmaimaimai.com" | 43 | suplus_host ="http://suplus-approve-test.fjmaimaimai.com" |
| @@ -4,6 +4,7 @@ go 1.12 | @@ -4,6 +4,7 @@ go 1.12 | ||
| 4 | 4 | ||
| 5 | require ( | 5 | require ( |
| 6 | github.com/astaxie/beego v1.10.0 | 6 | github.com/astaxie/beego v1.10.0 |
| 7 | + github.com/disintegration/imaging v1.6.2 | ||
| 7 | github.com/go-sql-driver/mysql v1.4.1 | 8 | github.com/go-sql-driver/mysql v1.4.1 |
| 8 | github.com/gomodule/redigo v1.7.0 | 9 | github.com/gomodule/redigo v1.7.0 |
| 9 | github.com/gorilla/websocket v1.4.1 | 10 | github.com/gorilla/websocket v1.4.1 |
| @@ -13,7 +14,6 @@ require ( | @@ -13,7 +14,6 @@ require ( | ||
| 13 | github.com/satori/go.uuid v1.2.0 | 14 | github.com/satori/go.uuid v1.2.0 |
| 14 | github.com/sony/sonyflake v1.0.0 | 15 | github.com/sony/sonyflake v1.0.0 |
| 15 | gitlab.fjmaimaimai.com/mmm-go/gocomm v0.0.1 | 16 | gitlab.fjmaimaimai.com/mmm-go/gocomm v0.0.1 |
| 16 | - golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect | ||
| 17 | google.golang.org/appengine v1.6.2 // indirect | 17 | google.golang.org/appengine v1.6.2 // indirect |
| 18 | ) | 18 | ) |
| 19 | 19 |
| @@ -26,7 +26,7 @@ func GetUserBaseInfoAggregation(id int64, companyId int64) (v *protocol.UserBase | @@ -26,7 +26,7 @@ func GetUserBaseInfoAggregation(id int64, companyId int64) (v *protocol.UserBase | ||
| 26 | return | 26 | return |
| 27 | } | 27 | } |
| 28 | if len(v.UserCompany.NickName) > 0 { | 28 | if len(v.UserCompany.NickName) > 0 { |
| 29 | - v.User.NickName = v.UserCompany.NickName //公司里面的用户名称 | 29 | + v.User.NickName = v.User.NickName |
| 30 | } | 30 | } |
| 31 | wg.Add(3) | 31 | wg.Add(3) |
| 32 | go func() { | 32 | go func() { |
| @@ -3,6 +3,7 @@ package chance | @@ -3,6 +3,7 @@ package chance | ||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/json" | 4 | "encoding/json" |
| 5 | "fmt" | 5 | "fmt" |
| 6 | + "github.com/astaxie/beego" | ||
| 6 | "github.com/astaxie/beego/orm" | 7 | "github.com/astaxie/beego/orm" |
| 7 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" | 8 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" |
| 8 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" | 9 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/idgen" |
| @@ -190,7 +191,7 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques | @@ -190,7 +191,7 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques | ||
| 190 | Icon: item.Icon, | 191 | Icon: item.Icon, |
| 191 | Doc: item.Doc, | 192 | Doc: item.Doc, |
| 192 | FormList: make([]*protocol.Form, len(forms)), | 193 | FormList: make([]*protocol.Form, len(forms)), |
| 193 | - Link: fmt.Sprintf("%v?templateId=%v", item.Id), | 194 | + Link: fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id), |
| 194 | } | 195 | } |
| 195 | for j := range forms { | 196 | for j := range forms { |
| 196 | form := forms[j] | 197 | form := forms[j] |
| @@ -105,7 +105,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen | @@ -105,7 +105,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen | ||
| 105 | Title: bulletin.Title, | 105 | Title: bulletin.Title, |
| 106 | Control: int(bulletin.AllowClose), | 106 | Control: int(bulletin.AllowClose), |
| 107 | //link:'https://web-open.fjmaimaimai.com/#/ability/announcement?id='+announcementCfgData[i].id+'&uid='+param.uid | 107 | //link:'https://web-open.fjmaimaimai.com/#/ability/announcement?id='+announcementCfgData[i].id+'&uid='+param.uid |
| 108 | - Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId), | 108 | + Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v&oppo", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId), |
| 109 | } | 109 | } |
| 110 | item.Cover = protocol.Cover{ | 110 | item.Cover = protocol.Cover{ |
| 111 | Path: bulletin.Cover, | 111 | Path: bulletin.Cover, |
| @@ -2,6 +2,7 @@ package upload | @@ -2,6 +2,7 @@ package upload | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "github.com/disintegration/imaging" | ||
| 5 | "io" | 6 | "io" |
| 6 | "mime/multipart" | 7 | "mime/multipart" |
| 7 | "os" | 8 | "os" |
| @@ -69,8 +70,9 @@ func UploadFile(request *protocol.FileRequest) (rsp *protocol.FileResponse, err | @@ -69,8 +70,9 @@ func UploadFile(request *protocol.FileRequest) (rsp *protocol.FileResponse, err | ||
| 69 | virtualPath = beego.AppConfig.String("source_host") + filepath.Join(virtualPath, request.FileType, date) | 70 | virtualPath = beego.AppConfig.String("source_host") + filepath.Join(virtualPath, request.FileType, date) |
| 70 | for i := range request.Files { | 71 | for i := range request.Files { |
| 71 | f := request.Files[i] | 72 | f := request.Files[i] |
| 73 | + prefix := fmt.Sprintf("%v_%v", time.Now().Unix(), common.RandomString(32)) | ||
| 72 | subfix := path.Ext(f.Filename) | 74 | subfix := path.Ext(f.Filename) |
| 73 | - filename = fmt.Sprintf("%v_%v%v", time.Now().Unix(), common.RandomString(32), subfix) | 75 | + filename = fmt.Sprintf("%v%v", prefix, subfix) |
| 74 | src, err = f.Open() | 76 | src, err = f.Open() |
| 75 | if err != nil { | 77 | if err != nil { |
| 76 | log.Error(err) | 78 | log.Error(err) |
| @@ -88,10 +90,35 @@ func UploadFile(request *protocol.FileRequest) (rsp *protocol.FileResponse, err | @@ -88,10 +90,35 @@ func UploadFile(request *protocol.FileRequest) (rsp *protocol.FileResponse, err | ||
| 88 | return | 90 | return |
| 89 | } | 91 | } |
| 90 | rsp.Paths = append(rsp.Paths, filepath.Join(virtualPath, filename)) | 92 | rsp.Paths = append(rsp.Paths, filepath.Join(virtualPath, filename)) |
| 93 | + ResizeImage(request.FileType, sourcePath, prefix, subfix, f) | ||
| 91 | } | 94 | } |
| 92 | return | 95 | return |
| 93 | } | 96 | } |
| 94 | 97 | ||
| 95 | -func ResizeImage(fileType int, fileName string, file *multipart.FileHeader) (err error) { | 98 | +func ResizeImage(fileType, sourcePath, prefix, subfix string, file *multipart.FileHeader) (err error) { |
| 99 | + var ( | ||
| 100 | + src multipart.File | ||
| 101 | + thumbName = "_thumb" | ||
| 102 | + ) | ||
| 103 | + if fileType != protocol.FileImage { | ||
| 104 | + return | ||
| 105 | + } | ||
| 106 | + filename := fmt.Sprintf("%v%v%v", prefix, thumbName, subfix) | ||
| 107 | + filename = filepath.Join(sourcePath, filename) | ||
| 108 | + if src, err = file.Open(); err != nil { | ||
| 109 | + log.Error(err) | ||
| 110 | + return | ||
| 111 | + } | ||
| 112 | + image, err := imaging.Decode(src) | ||
| 113 | + if err != nil { | ||
| 114 | + fmt.Println(err) | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + image = imaging.Resize(image, 0, 200, imaging.Lanczos) | ||
| 118 | + err = imaging.Save(image, filename) | ||
| 119 | + if err != nil { | ||
| 120 | + log.Error(err) | ||
| 121 | + } | ||
| 122 | + log.Debug(fmt.Sprintf("resize iamge:%v", filename)) | ||
| 96 | return | 123 | return |
| 97 | } | 124 | } |
-
请 注册 或 登录 后发表评论