Explorar o código

更新返回值结构

wangshan %!s(int64=5) %!d(string=hai) anos
pai
achega
b5244ba1dc

+ 0 - 96
src/jfw/modules/app/src/web/staticres/jyapp/css/searchindex.css

@@ -226,102 +226,6 @@ a{
 	word-break: break-all;
 	white-space: normal !important;
 }
-/*==========bootstrap样式 start===========*/
-.btn{
-	padding-top: 6px;
-	padding-bottom: 6px;
-}
-.btn.disabled, .btn.disabled.active, .btn.disabled.focus, .btn.disabled:active, .btn.disabled:focus, .btn.disabled:hover, .btn[disabled], .btn[disabled].active, .btn[disabled].focus, .btn[disabled]:active, .btn[disabled]:focus, .btn[disabled]:hover, fieldset[disabled] .btn, fieldset[disabled] .btn.active, fieldset[disabled] .btn.focus, fieldset[disabled] .btn:active, fieldset[disabled] .btn:focus, fieldset[disabled] .btn:hover{
-	color: #FFFFFF;
-	background-color: #aea79f;
-	border-color: #aea79f;
-}
-.btn-sm, .btn-group-sm > .btn{
-	padding-top: 3px;
-	padding-bottom: 3px;
-}
-.btn-xs, .btn-group-xs > .btn{
-	padding-top: 0px;
-	padding-bottom: 0px;
-}
-.form-control{
-	border-radius: 0px;
-}
-.hide{
-	display: none;
-}
-.j-clearicon{
-	position: absolute;
-    width: 20px;
-    height: 20px;
-    top: 50%;
-    margin-top: -10px;
-    right: 20px;
-    cursor: pointer;
-    display: none;
-}
-.modal-open .modal {
-    overflow-x: hidden;
-    overflow-y: auto;
-}
-.fade.in {
-    opacity: 1;
-}
-.modal {
-    display: none;
-    overflow: hidden;
-    position: fixed;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-    z-index: 1050;
-    -webkit-overflow-scrolling: touch;
-    outline: 0;
-}
-.fade {
-    opacity: 0;
-    -webkit-transition: opacity .15s linear;
-    -o-transition: opacity .15s linear;
-    transition: opacity .15s linear;
-}
-.modal.fade .modal-dialog {
-    -webkit-transform: translate(0,-25%);
-    -ms-transform: translate(0,-25%);
-    -o-transform: translate(0,-25%);
-    transform: translate(0,-25%);
-    -webkit-transition: -webkit-transform .3s ease-out;
-    -o-transition: -o-transform .3s ease-out;
-    transition: transform .3s ease-out;
-}
-.modal.in .modal-dialog {
-    -webkit-transform: translate(0,0);
-    -ms-transform: translate(0,0);
-    -o-transform: translate(0,0);
-    transform: translate(0,0);
-}
-.modal-dialog {
-    position: relative;
-    width: auto;
-    margin: 10px;
-}
-.modal-backdrop.fade {
-    opacity: 0;
-    filter: alpha(opacity=0);
-}
-.modal-backdrop.in {
-    opacity: .5;
-    filter: alpha(opacity=50);
-}
-.modal-backdrop {
-    position: fixed;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-    z-index: 1040;
-    background-color: #000;
-}
 /*********************common.css*************************/
 ul{
 	list-style: none;

+ 2 - 2
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -1254,7 +1254,7 @@ function getParam(name) {
 var tipFlag = true;
 function distribInfo(tt){
 	var myHref = window.location.href;
-//	alert(myHref+"--:"+tt)
+	alert(myHref+"--:"+tt)
 	if (myHref.indexOf("free/login")>-1&&(myHref.indexOf("appUrl=")>-1||myHref.indexOf("url=")>-1)){
 		//清除客户端粘贴板
 		try{
@@ -1316,7 +1316,7 @@ var DisWord_Tip_Invite = function(imgUrl,modular,nickName,appUrl){
 	var html = '<div style="background: #fff;border-radius: 7px;">'
 				+'<div style="display: flex;padding: 24px">'
 				+'<div style="width: 54px;height: 54px;border-radius: 4px;margin-right: 10px;" class="_img">'
-				+'<img src="'+imgUrl+'"/>'
+				+'<img style="border: 0;vertical-align: middle;max-width: 100%;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);" src="'+imgUrl+'"/>'
 				+'</div>'
 				+'<div style="padding: 4px 0px;" class="_info">'
 				+'<p style="font-family: PingFang SC;font-style: normal;font-weight: normal;font-size: 15px;line-height: 22px;color:#000;">您的好友  '+nickName+'</p>'

+ 97 - 0
src/jfw/modules/app/src/web/staticres/jyapp/local/layout.css

@@ -346,3 +346,100 @@ ul, li, ol {
     font-family: Avenir,Helvetica,Arial,sans-serif;
 }
 .jy-app-header .icon-left {}
+
+/*==========bootstrap样式 start===========*/
+.btn{
+	padding-top: 6px;
+	padding-bottom: 6px;
+}
+.btn.disabled, .btn.disabled.active, .btn.disabled.focus, .btn.disabled:active, .btn.disabled:focus, .btn.disabled:hover, .btn[disabled], .btn[disabled].active, .btn[disabled].focus, .btn[disabled]:active, .btn[disabled]:focus, .btn[disabled]:hover, fieldset[disabled] .btn, fieldset[disabled] .btn.active, fieldset[disabled] .btn.focus, fieldset[disabled] .btn:active, fieldset[disabled] .btn:focus, fieldset[disabled] .btn:hover{
+	color: #FFFFFF;
+	background-color: #aea79f;
+	border-color: #aea79f;
+}
+.btn-sm, .btn-group-sm > .btn{
+	padding-top: 3px;
+	padding-bottom: 3px;
+}
+.btn-xs, .btn-group-xs > .btn{
+	padding-top: 0px;
+	padding-bottom: 0px;
+}
+.form-control{
+	border-radius: 0px;
+}
+.hide{
+	display: none;
+}
+.j-clearicon{
+	position: absolute;
+    width: 20px;
+    height: 20px;
+    top: 50%;
+    margin-top: -10px;
+    right: 20px;
+    cursor: pointer;
+    display: none;
+}
+.modal-open .modal {
+    overflow-x: hidden;
+    overflow-y: auto;
+}
+.fade.in {
+    opacity: 1;
+}
+.modal {
+    display: none;
+    overflow: hidden;
+    position: fixed;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    z-index: 1050;
+    -webkit-overflow-scrolling: touch;
+    outline: 0;
+}
+.fade {
+    opacity: 0;
+    -webkit-transition: opacity .15s linear;
+    -o-transition: opacity .15s linear;
+    transition: opacity .15s linear;
+}
+.modal.fade .modal-dialog {
+    -webkit-transform: translate(0,-25%);
+    -ms-transform: translate(0,-25%);
+    -o-transform: translate(0,-25%);
+    transform: translate(0,-25%);
+    -webkit-transition: -webkit-transform .3s ease-out;
+    -o-transition: -o-transform .3s ease-out;
+    transition: transform .3s ease-out;
+}
+.modal.in .modal-dialog {
+    -webkit-transform: translate(0,0);
+    -ms-transform: translate(0,0);
+    -o-transform: translate(0,0);
+    transform: translate(0,0);
+}
+.modal-dialog {
+    position: relative;
+    width: auto;
+    margin: 10px;
+}
+.modal-backdrop.fade {
+    opacity: 0;
+    filter: alpha(opacity=0);
+}
+.modal-backdrop.in {
+    opacity: .5;
+    filter: alpha(opacity=50);
+}
+.modal-backdrop {
+    position: fixed;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    z-index: 1040;
+    background-color: #000;
+}

+ 46 - 37
src/jfw/modules/distribution/src/service/action/share.go

@@ -24,22 +24,27 @@ type Share struct {
 	shareLogs    xweb.Mapper `xweb:"/share/shareLogs"`    //分享记录日志
 }
 
+//1000:请求方式有误;1001:需要登录;1002:缺失参数;1003:无效参数;1004:没有权限
+var error_code = []int{1000, 1001, 1002, 1003, 1004}
+var error_msg = []string{"请求方式有误", "需要登录", "缺失参数", "无效参数", "没有权限"}
+
 //
 func init() {
 	xweb.AddAction(&Share{})
 }
 
-var METHOD = "POST"
+var METHOD = "GET"
 
 //所有产品信息 和 所属产品得个人分销统计
 func (this *Share) ProductInfo() error {
 	defer util.Catch()
 	res := map[string]interface{}{
-		"flag": false,
-		"msg":  "请求方式有误",
+		"error_code": error_code[0],
+		"error_msg":  error_msg[0],
 	}
 	if this.Method() == METHOD {
-		res["msg"] = "未登录"
+		res["error_msg"] = error_msg[1]
+		res["error_code"] = error_code[1]
 		userId, _ := this.Session().Get("userId").(string)
 		if userId != "" {
 			if p_data, ok := MQFW.Find("dis_product", nil, `{"l_createdate":1}`, nil, false, -1, -1); ok && p_data != nil {
@@ -60,11 +65,11 @@ func (this *Share) ProductInfo() error {
 					}
 				}
 				res["data"] = *p_data
-				res["msg"] = ""
-				res["flag"] = true
 			} else {
 				log.Println("查询产品信息报错")
 			}
+			res["error_msg"] = ""
+			res["error_code"] = 0
 		}
 	}
 	this.ServeJson(res)
@@ -107,9 +112,11 @@ func analyseWord(discored string) (name, url, appUrl, shareNickname string) {
 func (this *Share) GetWordInfo() {
 	defer util.Catch()
 	res := map[string]interface{}{
-		"flag":    false,
-		"msg":     "请求方式有误",
-		"isLogin": false,
+		"error_code": error_msg[0],
+		"error_msg":  error_msg[0],
+		"data": map[string]interface{}{
+			"isLogin": false,
+		},
 	}
 	if this.Method() == METHOD {
 		isLogin := false
@@ -122,13 +129,16 @@ func (this *Share) GetWordInfo() {
 			ct_one := strings.Split(copyTxt, ":")[1]
 			discored := strings.Split(ct_one, ",")[0]
 			if discored != "" {
-				res = CopyInfo(discored)
-				res["isLogin"] = isLogin
+				res_ := CopyInfo(discored)
+				res_["isLogin"] = isLogin
+				res["data"] = res_
+				res["error_code"] = 0
+				res["error_msg"] = ""
 			} else {
-				res["msg"] = "口令有误"
+				res["error_msg"] = error_msg[2]
 			}
 		} else {
-			res["msg"] = "接受内容有误"
+			res["error_msg"] = error_msg[2]
 		}
 	}
 	this.ServeJson(res)
@@ -148,13 +158,10 @@ func CopyInfo(discored string) (res map[string]interface{}) {
 			}
 		}
 		res = map[string]interface{}{
-			"flag": true,
-			"msg": map[string]interface{}{
-				"shareNickname": shareNickname,                                             //昵称
-				"modular":       name,                                                      //产品名称
-				"appUrl":        appUrl,                                                    //跳转链接
-				"imgUrl":        imgUrl + "?v=" + strconv.FormatInt(time.Now().Unix(), 10), //产品图片
-			},
+			"shareNickname": shareNickname,                                             //昵称
+			"modular":       name,                                                      //产品名称
+			"appUrl":        appUrl,                                                    //跳转链接
+			"imgUrl":        imgUrl + "?v=" + strconv.FormatInt(time.Now().Unix(), 10), //产品图片
 		}
 	}
 	return
@@ -164,8 +171,8 @@ func CopyInfo(discored string) (res map[string]interface{}) {
 func (this *Share) GetWordShare() {
 	defer util.Catch()
 	res := map[string]interface{}{
-		"flag": false,
-		"msg":  "请求方式有误",
+		"error_code": error_code[0],
+		"error_msg":  error_msg[0],
 	}
 	if this.Method() == METHOD {
 		//模块  A:超级订阅  B:数据导出  C:数据报告等
@@ -173,28 +180,30 @@ func (this *Share) GetWordShare() {
 		if modular != "" {
 			userId, _ := this.GetSession("userId").(string)
 			if userId != "" {
+				s_nickname, _ := this.GetSession("s_nickname").(string)
 				word := redis.GetStr("other", "DIS_"+userId)
-				if word != "" {
-					res["msg"] = word
-				} else {
-					s_nickname, _ := this.GetSession("s_nickname").(string)
-					v := VarLSCPool.GetJob()
-					res["msg"] = map[string]interface{}{
-						"disWord":   modular + v,                                           //口令
-						"shareLink": Sysconfig.Webdomain + "/F/" + modular + v,             //微信分享链接
-						"erUrl":     Sysconfig.Webdomain + "/wx/yjmstr/DIS_" + modular + v, //二维码地址
-					}
+				if word == "" {
+					word = VarLSCPool.GetJob()
 					//用户昵称存redis   app粘贴时备用
-					redis.Put("other", "DIS_"+v, s_nickname+"##"+userId, -1)
+					redis.Put("other", "DIS_"+word, s_nickname+"##"+userId, -1)
 					//用户信息绑定分享口令
-					redis.Put("other", "DIS_"+userId, modular+v, -1)
+					redis.Put("other", "DIS_"+userId, modular+word, -1)
+					word = modular + word
+				}
+				res["data"] = map[string]interface{}{
+					"disWord":   word,                                           //口令
+					"shareLink": Sysconfig.Webdomain + "/F/" + word,             //微信分享链接
+					"erUrl":     Sysconfig.Webdomain + "/wx/yjmstr/DIS_" + word, //二维码地址
 				}
-				res["flag"] = true
+				res["error_code"] = 0
+				res["error_msg"] = ""
 			} else {
-				res["msg"] = "未登录"
+				res["error_msg"] = error_msg[1]
+				res["error_code"] = error_code[1]
 			}
 		} else {
-			res["msg"] = "缺少参数"
+			res["error_msg"] = error_msg[2]
+			res["error_code"] = error_code[2]
 		}
 	}
 	this.ServeJson(res)