浏览代码

会员中心

zhangjinkun@topnet.net.cn 9 年之前
父节点
当前提交
fe1b427187

+ 19 - 18
common/src/qfw/util/credit/credit.go

@@ -6,8 +6,6 @@ import (
 	"qfw/util"
 	"qfw/util"
 	mogo "qfw/util/mongodb"
 	mogo "qfw/util/mongodb"
 	"qfw/util/rpc"
 	"qfw/util/rpc"
-	"strconv"
-	"strings"
 )
 )
 
 
 var Rc rpc.RpcCall
 var Rc rpc.RpcCall
@@ -16,14 +14,21 @@ var CreditA map[string]uint64
 var SysConfig map[string]interface{}
 var SysConfig map[string]interface{}
 
 
 const (
 const (
-	A_ZC   = "a1" //注册
-	A_RZ   = "a2" //认证
-	A_CJMP = "a3" //创建名片
-	A_BYX  = "a4" //绑定邮箱
-	A_BSJ  = "a5" //绑定手机
-	A_SCMP = "a6" //收藏名片
-	A_SCFW = "a7" //收藏服务
-	A_SYJY = "a8" //使用剑鱼
+	A_ZC     = "a1"  //注册
+	A_RZ     = "a2"  //认证
+	A_CJMP   = "a3"  //创建名片
+	A_BYX    = "a4"  //绑定邮箱
+	A_BSJ    = "a5"  //绑定手机
+	A_SCMP   = "a6"  //收藏名片
+	A_SCFW   = "a7"  //收藏服务
+	A_SYJY   = "a8"  //使用剑鱼
+	A_QYCX   = "a9"  //使用企业查询
+	A_FFW    = "a10" //发服务
+	A_FXQ    = "a11" //发需求
+	A_CKGXW  = "a12" //查看关系网
+	A_FXFW   = "a13" //分享服务
+	A_WCJY   = "a14" //完成交易
+	A_WCJYPJ = "a15" //完成交易评价
 
 
 	B_QD   = "b1" //签到
 	B_QD   = "b1" //签到
 	B_FFW  = "b2" //发服务
 	B_FFW  = "b2" //发服务
@@ -31,7 +36,7 @@ const (
 	B_FXFW = "b4" //分享服务
 	B_FXFW = "b4" //分享服务
 	C_JY   = "c1" //交易
 	C_JY   = "c1" //交易
 	C_PJ   = "c2" //评价
 	C_PJ   = "c2" //评价
-	C_TG   = "c3" //推广用户
+	C_TG   = "c3" //邀请用户
 
 
 	D_WXCZ  = "d1" //微信充值
 	D_WXCZ  = "d1" //微信充值
 	E_EWMZR = "e1" //二维码转入
 	E_EWMZR = "e1" //二维码转入
@@ -41,15 +46,11 @@ const (
 
 
 func init() {
 func init() {
 	util.ReadConfig(&SysConfig)
 	util.ReadConfig(&SysConfig)
-	tmp := strings.Split(SysConfig["credit_a"].(string), ",")
 	CreditA = make(map[string]uint64)
 	CreditA = make(map[string]uint64)
-	for _, v := range tmp {
-		if len(v) > 1 {
-			n, _ := strconv.Atoi(v[1:])
-			CreditA[v] = uint64(n)
-		}
+	//初始化一次性任务
+	for i := 1; i < 16; i++ {
+		CreditA["a"+fmt.Sprint(i)] = uint64(i)
 	}
 	}
-
 	Rc = rpc.RpcCall{Addr: SysConfig["creditRpc"].(string)}
 	Rc = rpc.RpcCall{Addr: SysConfig["creditRpc"].(string)}
 }
 }
 
 

+ 0 - 1
core/src/config.json

@@ -29,7 +29,6 @@
     "chatServer": "127.0.0.1:83",
     "chatServer": "127.0.0.1:83",
     "chatRpc": "127.0.0.1:88",
     "chatRpc": "127.0.0.1:88",
 	"creditRpc":"127.0.0.1:8765",
 	"creditRpc":"127.0.0.1:8765",
-	"credit_a":"a1,a2,a3,a4,a5,a6,a7,a8",
 	"domainName":"http://www.qimingxing.info"
 	"domainName":"http://www.qimingxing.info"
 
 
 }
 }

+ 1 - 0
core/src/main.go

@@ -11,6 +11,7 @@ import (
 	_ "qfw/front"
 	_ "qfw/front"
 	_ "qfw/manage"
 	_ "qfw/manage"
 	_ "qfw/member"
 	_ "qfw/member"
+	_ "qfw/member/credit"
 	_ "qfw/member/message"
 	_ "qfw/member/message"
 	_ "qfw/microwebsite"
 	_ "qfw/microwebsite"
 	_ "qfw/mobile"
 	_ "qfw/mobile"

+ 13 - 0
core/src/qfw/member/credit/credit.go

@@ -0,0 +1,13 @@
+// credit
+/**积分模块
+**张金坤
+**/
+package credit
+
+import (
+	"github.com/go-xweb/xweb"
+)
+
+func init() {
+	xweb.AddAction(&credit{})
+}

+ 50 - 0
core/src/qfw/member/credit/creditdetail.go

@@ -0,0 +1,50 @@
+/**积分模块
+**张金坤
+**/
+package credit
+
+import (
+	"github.com/go-xweb/xweb"
+	"log"
+	"qfw/util"
+	cd "qfw/util/credit"
+	"qfw/util/mongodb"
+)
+
+type credit struct {
+	*xweb.Action
+	myCredit   xweb.Mapper `xweb:"/member/credit/myCredit"`   //我的积分
+	creditRule xweb.Mapper `xweb:"/member/credit/creditRule"` //积分规则
+}
+
+func (c *credit) MyCredit() error {
+	userId := util.ObjToString(c.GetSession("userId"))
+	log.Println("userId", userId)
+	if len(userId) > 0 {
+		user := *mongodb.FindById("user", userId, nil)
+		c.T["user"] = user
+		credit_a := util.IntAll(user["credit_a"])
+		c.T["A_RZ"] = cd.AIsHasDo(cd.A_RZ, credit_a)         //认证
+		c.T["A_CJMP"] = cd.AIsHasDo(cd.A_CJMP, credit_a)     //创建名片
+		c.T["A_BYX"] = cd.AIsHasDo(cd.A_BYX, credit_a)       //绑定邮箱
+		c.T["A_BSJ"] = cd.AIsHasDo(cd.A_BSJ, credit_a)       //绑定手机
+		c.T["A_SCMP"] = cd.AIsHasDo(cd.A_SCMP, credit_a)     //收藏名片
+		c.T["A_SCFW"] = cd.AIsHasDo(cd.A_SCFW, credit_a)     //收藏服务
+		c.T["A_SYJY"] = cd.AIsHasDo(cd.A_SYJY, credit_a)     //使用剑鱼
+		c.T["A_QYCX"] = cd.AIsHasDo(cd.A_QYCX, credit_a)     //使用企业查询
+		c.T["A_FFW"] = cd.AIsHasDo(cd.A_FFW, credit_a)       //发服务
+		c.T["A_FXQ"] = cd.AIsHasDo(cd.A_FXQ, credit_a)       //发需求
+		c.T["A_CKGXW"] = cd.AIsHasDo(cd.A_CKGXW, credit_a)   //查看关系网
+		c.T["A_FXFW"] = cd.AIsHasDo(cd.A_FXFW, credit_a)     //分享服务
+		c.T["A_WCJY"] = cd.AIsHasDo(cd.A_WCJY, credit_a)     //完成交易
+		c.T["A_WCJYPJ"] = cd.AIsHasDo(cd.A_WCJYPJ, credit_a) //完成交易评价
+		return c.Render("/member/credit/mycredit.html", &c.T)
+	} else {
+		return nil
+	}
+	return c.Render("/member/credit/mycredit.html")
+}
+
+func (c *credit) CreditRule() error {
+	return c.Render("/member/credit/creditrule.html")
+}

+ 22 - 1
core/src/web/templates/common/memberleft.html

@@ -39,7 +39,7 @@
 	background: none;
 	background: none;
 	color: inherit;
 	color: inherit;
 }
 }
-.member-left .menu-childnode{
+.member-left .menu-childnode .menu-childnode2{
 	font-weight: normal;
 	font-weight: normal;
 	text-indent: 1em;
 	text-indent: 1em;
 }
 }
@@ -51,6 +51,10 @@
 	font-size: 12px;
 	font-size: 12px;
 	vertical-align: middle;
 	vertical-align: middle;
 }
 }
+.member-left .a-com-collapse2{
+	font-size: 12px;
+	vertical-align: middle;
+}
 .member-left .identType img{
 .member-left .identType img{
 	width: 20px;
 	width: 20px;
 	height: 20px;
 	height: 20px;
@@ -120,6 +124,7 @@ var MemberLeftMenu = {
 				html += this.callCenterMenu();
 				html += this.callCenterMenu();
 			}
 			}
 			html += this.serviceMerchantMenu()+this.orderManageMenu()+this.bidManageMenu();
 			html += this.serviceMerchantMenu()+this.orderManageMenu()+this.bidManageMenu();
+			html += this.vipMenu()+this.myCredit()+this.creditRule();
 		}else if(isCanEditEnt){
 		}else if(isCanEditEnt){
 			html += this.myYellowPageMenu(editEnterHref);
 			html += this.myYellowPageMenu(editEnterHref);
 			if(/^[1]$/.test(role)){//黄页编辑者
 			if(/^[1]$/.test(role)){//黄页编辑者
@@ -135,6 +140,10 @@ var MemberLeftMenu = {
 			$(this).children(".a-com-collapse").toggleClass("glyphicon-menu-up");
 			$(this).children(".a-com-collapse").toggleClass("glyphicon-menu-up");
 			$(".menu-childnode").toggleClass("hide");
 			$(".menu-childnode").toggleClass("hide");
 		});
 		});
+		$("#vipMenu").click(function(){
+			$(this).children(".a-com-collapse2").toggleClass("glyphicon-menu-up");
+			$(".menu-childnode2").toggleClass("hide");
+		});
 	},
 	},
 	//实名认证菜单
 	//实名认证菜单
 	autheMenu: function(){
 	autheMenu: function(){
@@ -188,6 +197,18 @@ var MemberLeftMenu = {
 	//需求管理
 	//需求管理
 	bidManageMenu: function(){
 	bidManageMenu: function(){
 		return '<a onclick="window.location.href=\'/member/bidManage\'" class="menu-childnode list-group-item"><i class="glyphicon"></i>投标管理</a>';
 		return '<a onclick="window.location.href=\'/member/bidManage\'" class="menu-childnode list-group-item"><i class="glyphicon"></i>投标管理</a>';
+	},
+	//vip会有菜单
+	vipMenu: function(){
+		return '<a class="list-group-item" id="vipMenu"><i class="glyphicon zhanghao"></i>会员中心<i class="a-com-collapse2 bootstrap-glyphicon glyphicon glyphicon-menu-down"></i></a>';
+	},
+	//我的积分
+	myCredit: function(){
+		return '<a onclick="window.location.href=\'/member/credit/myCredit\'" class="menu-childnode2 list-group-item"><i class="glyphicon"></i>我的积分</a>';
+	},
+	//积分规则
+	creditRule: function(){
+		return '<a onclick="window.location.href=\'/member/credit/creditRule\'" class="menu-childnode2 list-group-item"><i class="glyphicon"></i>积分规则</a>';
 	}
 	}
  };
  };
 $(function (){
 $(function (){

+ 257 - 0
core/src/web/templates/member/credit/mycredit.html

@@ -0,0 +1,257 @@
+<html>
+<head>
+<title>我的积分</title>
+{{include "/common/inc.html"}}
+<script src="/js/qfwtable.js"></script>
+<style>
+.credit-explain {
+    background-color: #FCF8E3;
+    padding: 10px 0px;
+    border: 1px solid #F5DC99;
+    text-indent: 1em;
+}
+.credit {
+    padding: 10px 0px;
+}
+ 
+.ok-sign{
+    vertical-align: middle;
+	color:#A0D468;
+	font-size:22px
+}
+.n-ok-sign{
+    vertical-align: middle;
+	color:#CCCCCC;
+	font-size:22px
+}
+.mx{
+ 	color: #415FCF;
+	cursor:pointer;
+ 	padding: 10px 10px;
+}
+.rowone{
+	font-size:14;
+}
+.rowtwo{
+	font-size:14;background-color:#F7F8FA;
+}
+.btzrw{
+	height:45px;
+	border-bottom:1px solid #FF5A5F;
+}
+.btzrw-z{
+	background:#FF5A5F;
+	float:left;height:45px;
+	width:110px;color:white;
+	line-height:45px;
+	text-align:center;
+}
+.btzrw-ms{
+	float:left;line-height:45px;
+	padding:0 5px;
+}
+</style>
+</head>
+<body>
+{{$identType := session "identType"}}
+<!-- 头部 -->
+{{include "/common/head.html"}}
+<!-- 中间 -->
+<div class="a-content member-content">
+	<div class="member-left">
+		{{include "/common/memberleft.html"}}
+	</div>
+	<div class="member-right">
+		<div class="member-panel">
+			<div class="panel-title-out">
+				<i class="glyphicon zhanghao"></i><span>我的积分</span>
+			</div>	
+			<div class="panel-body message a-border-t-only"  >	
+				<ul class="nav nav-tabs msgheader" style="margin-top:10px;position:relative">
+		                <li class="active" v="0"><a href="#list_0" data-toggle="tab" id="c_0" name="all" value="0">我的积分</a></li>
+		                <li v="1"><a href="#list_1" data-toggle="tab" id="c_1" name="all" value="1">积分明细</a></li>
+		    	</ul>
+				<div class="tab-content" id="list_0">
+					<div class="credit-explain">当前积分 <span style="font-size:22;color:red">{{$.T.user.i_credit}}</span><span class="mx" onclick="outoClick('c_1')">查看积分明细</span></div>
+					<div class="credit">
+						<div class="btzrw">
+							<div class="btzrw-z">做任务赚积分</div>
+							<div class="btzrw-ms">(完成全部带 * 号的任务,可以额外获得1001积分哦)</div>
+						</div>
+						<table class="table a-table margin-t-20">
+							<tr style="text-align:center;">
+								<td width="60%"><b>任务描述</b></td>
+								<td width="10%" align="center"><b>状态</b></td>
+								<td width="30%" align="center"><b>操作</b></td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 新用户注册,得50积分</td>
+								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
+								<td width="30%" style="padding:110px"></td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 完成实名认证,得100积分</td>
+								{{if eq .T.A_RZ true}}
+								<td width="10%" align="center">
+								<span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
+								<td width="30%" style="padding:110px"></td>
+								{{else}}
+								<td width="10%" align="center">
+								<span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">
+								去 <button class="btn btn-primary" onclick="toUrl('')">完成验证</button></td>
+								{{end}}
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 绑定邮箱,得50积分</td>
+								{{if .T.A_BYX}}
+								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
+								<td width="30%" style="padding:110px"></td>
+								{{else}}
+								<td width="10%" align="center">
+								<span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成
+								</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">绑定邮箱</span></td>
+								{{end}}
+								
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 绑定手机,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">绑定手机</span></td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 完善你的企业黄页,得50积分</td>
+								{{if .T.A_CJMP}}
+								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
+								<td width="30%" style="padding:110px"></td>
+								{{else}}
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去 <button class="btn btn-primary" onclick="toUrl('')">完善资料</button></td>
+								{{end}}
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 完成一次企业查询,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">企业社区</span>查询</td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 发布一条服务信息,得50积分(实名认证后才可使用)</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">发服务</span></td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">*  发布一条需求信息,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">发需求</span></td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 去剑鱼订阅一组关键词,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">剑鱼</span></td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 查看神奇的关系网,得50积分(实名认证后才可查看)</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">企业社区</span>查看</td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 分享一条服务/需求信息,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span>分享</td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 完成一次交易,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span></td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">* 完成一次交易评价,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span></td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">* 邀请新用户,得150积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 未完成</td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">邀请</span></td>
+							</tr>
+						</table>
+						<div class="btzrw">
+							<div class="btzrw-z">日常任务</div>
+							<div class="btzrw-ms"></div>
+						</div>
+						<table class="table a-table margin-t-20">
+							<tr style="text-align:center;">
+								<td width="60%"><b>任务描述</b></td>
+								<td width="10%" align="center"><b>状态</b></td>
+								<td width="30%" align="center"><b>操作</b></td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">连续签到第一天,得10积分</td>
+								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
+								<td width="30%" style="padding:110px"></td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">0/5</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">企业社区</span>完成</td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">发布3条服务,得60积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">0/3</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span>完成</td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">发布3条需求,得60积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">0/3</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span>完成</td>
+							</tr>
+							<tr class="rowone">
+								<td width="60%" style="text-indent: 7em;">分享2条服务/需求信息,得40积分</td>
+								<td width="10%" align="center"><span class="n-ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">0/2</span></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">服务市场</span>分享</td>
+							</tr>
+							<tr class="rowtwo">
+								<td width="60%" style="text-indent: 7em;">邀请一个新用户(微信剑鱼分享邀请新用户),得150积分</td>
+								<td width="10%" align="center"></td>
+								<td width="30%" style="padding:110px">去<span class="mx" onclick="toUrl('')">邀请</span></td>
+							</tr>
+							</table>
+						</div>
+					</div>
+				</div>
+				<div class="tab-content hide" id="list_1">
+					<div class="tab-pane" >
+						 222
+					</div>
+				</div>
+			</div>	
+		</div>
+	</div>
+</div>
+ 
+<!-- 底部 -->
+{{include "/common/bottom.html"}}
+<script type="text/javascript">
+$(function(){
+	$("#c_0,#c_1").click(function(){
+		var _v=$(this).attr("value")
+		checkContent("list_"+_v)
+	})
+})
+function checkContent(id){
+	$(".tab-content").each(function(){
+	    if($(this).attr("id")!=id){
+			$(this).addClass("hide");
+		}else{
+			$(this).removeClass("hide");
+		}
+	});
+}
+
+function outoClick(id){ 
+	document.getElementById(id).click();
+}
+</script>
+</body>
+</html>