|
|
@@ -150,30 +150,30 @@ func (self *RailsadminController) GenerateXcxQrcode() {
|
|
|
beego.AppConfig.String("AliOssBucket"), wxUser.InviteQrcodeUrl)
|
|
|
|
|
|
qrcodeUrl := ""
|
|
|
- if err == nil {
|
|
|
- scene := fmt.Sprintf("invite_wx_%d", wxUser.Id)
|
|
|
- qrcodeData := wx_mp.GenerateQrcode(wx_mp.QR_SCENE, homeUrl, scene, width)
|
|
|
- beego.BeeLogger.Warn("invite_controller.GenerateQrcode() data_array: %d", qrcodeData)
|
|
|
- filename := fmt.Sprintf("invite_qrcode_%d.jpg", wxUser.Id)
|
|
|
- localPath := fmt.Sprintf("%s/%s", beego.AppConfig.String("InviteQrcodePath"), filename)
|
|
|
- err := ioutil.WriteFile(localPath, qrcodeData, 0644)
|
|
|
- if err != nil {
|
|
|
- beego.BeeLogger.Error(err.Error())
|
|
|
- }
|
|
|
- uploadPath := fmt.Sprintf("qrcode_path/invite/%s", filename)
|
|
|
- //上传到阿里云原目录下面
|
|
|
- err = ali_oss.PutObjectFromFile(beego.AppConfig.String("AliOssEndPoint"),
|
|
|
- beego.AppConfig.String("AliOssAccessId"),
|
|
|
- beego.AppConfig.String("AliOssAccessSecret"),
|
|
|
- beego.AppConfig.String("AliOssBucket"), "", uploadPath, localPath)
|
|
|
- if err != nil {
|
|
|
- beego.BeeLogger.Error("Upload Pngs err: %s", err)
|
|
|
- } else {
|
|
|
- wxUser.InviteQrcodeUrl = uploadPath
|
|
|
- wxUser.Save()
|
|
|
- qrcodeUrl = self.GetFullImgUrl(uploadPath)
|
|
|
- }
|
|
|
+
|
|
|
+ scene := fmt.Sprintf("invite_wx_%d", wxUser.Id)
|
|
|
+ qrcodeData := wx_mp.GenerateQrcode(wx_mp.QR_SCENE, homeUrl, scene, width)
|
|
|
+ beego.BeeLogger.Warn("invite_controller.GenerateQrcode() data_array: %d", qrcodeData)
|
|
|
+ filename := fmt.Sprintf("invite_qrcode_%d.jpg", wxUser.Id)
|
|
|
+ localPath := fmt.Sprintf("%s/%s", beego.AppConfig.String("InviteQrcodePath"), filename)
|
|
|
+ err = ioutil.WriteFile(localPath, qrcodeData, 0644)
|
|
|
+ if err != nil {
|
|
|
+ beego.BeeLogger.Error(err.Error())
|
|
|
}
|
|
|
+ uploadPath := fmt.Sprintf("qrcode_path/invite/%s", filename)
|
|
|
+ //上传到阿里云原目录下面
|
|
|
+ err = ali_oss.PutObjectFromFile(beego.AppConfig.String("AliOssEndPoint"),
|
|
|
+ beego.AppConfig.String("AliOssAccessId"),
|
|
|
+ beego.AppConfig.String("AliOssAccessSecret"),
|
|
|
+ beego.AppConfig.String("AliOssBucket"), "", uploadPath, localPath)
|
|
|
+ if err != nil {
|
|
|
+ beego.BeeLogger.Error("Upload Pngs err: %s", err)
|
|
|
+ } else {
|
|
|
+ wxUser.InviteQrcodeUrl = uploadPath
|
|
|
+ wxUser.Save()
|
|
|
+ qrcodeUrl = self.GetFullImgUrl(uploadPath)
|
|
|
+ }
|
|
|
+
|
|
|
self.Data["json"] = &Ret{QrcodeUrl: qrcodeUrl}
|
|
|
self.ServeJSON()
|
|
|
}
|