فهرست منبع

Merge branch 'dev2.7' of http://192.168.3.207:10080/qmx/qfw into dev2.7

wangshan 5 سال پیش
والد
کامیت
9d3d0c4db6

+ 3 - 3
common/src/qfw/util/jy/jy.go

@@ -163,7 +163,7 @@ func SendSMS(tplcode /*模板代码*/, mobile /*手机号码*/ string, param map
 
 //发送验证码
 func SendPhoneIdentCode(phone string, session *httpsession.Session) bool {
-	lastSentTime, _ := session.Get("identCodeTime").(int64)
+	lastSentTime := util.Int64All(session.Get("identCodeTime"))
 	//60秒之内不允许重复发
 	if lastSentTime > 0 && time.Now().Unix()-lastSentTime <= 60 {
 		return false
@@ -182,8 +182,8 @@ func SendPhoneIdentCode(phone string, session *httpsession.Session) bool {
 
 //短信验证码校验
 func CheckPhoneIdent(session *httpsession.Session, code string) string {
-	identCodeKey, _ := session.Get("identCodeValue").(string)
-	if identCodeKey != "" && identCodeKey == code {
+	identCodeValue, _ := session.Get("identCodeValue").(string)
+	if identCodeValue != "" && identCodeValue == code {
 		identCodeKey, _ := session.Get("identCodeKey").(string)
 		ClearPhoneIdentSession(session)
 		return identCodeKey

+ 99 - 0
core/src/qfw/manage/auth.go

@@ -0,0 +1,99 @@
+package manage
+
+import (
+	"errors"
+	"fmt"
+	"log"
+	cutil "qfw/coreutil"
+	"time"
+
+	. "qfw/coreconfig"
+	"qfw/util"
+
+	"github.com/go-xweb/xweb"
+)
+
+//企业审核
+type EntAuth struct {
+	*xweb.Action
+	list    xweb.Mapper `xweb:"/manage/entauth/list"`        //列表页面请求
+	listReq xweb.Mapper `xweb:"/manage/entauth/listReq"`     //列表页面
+	detail  xweb.Mapper `xweb:"/manage/entauth/detail/(.*)"` //三级页展示
+	change  xweb.Mapper `xweb:"/manage/entauth/change"`      //审核修改
+}
+
+func init() {
+	xweb.AddAction(&EntAuth{})
+}
+func (this *EntAuth) List() {
+	this.Render("/manage/auth/list.html")
+}
+func (this *EntAuth) ListReq() {
+	r := func() *FuncResult {
+		cPage, _ := this.GetInt("currentPage")
+		pageSize, _ := this.GetInt("perPage")
+		queryStr := this.GetString("query")
+		status := this.GetString("status")
+		if pageSize == 0 {
+			return &FuncResult{false, errors.New("请求参数有误"), nil}
+		}
+		var sql = ``
+		if queryStr != "" {
+			sql += ` and name like '%` + queryStr + `%' `
+		}
+		if status != "" {
+			sql += fmt.Sprintf(` and auth_status = %s `, status)
+		}
+		count := cutil.Mysql.CountBySql("SELECT count(*) FROM entniche_info  WHERE legal_name != '' " + sql)
+		list := cutil.Mysql.SelectBySql("SELECT id,auth_time,audit_time,auth_status,name,phone FROM entniche_info  WHERE legal_name != '' " + sql + "order by createtime desc " + fmt.Sprintf("limit %d,%d", (cPage-1)*pageSize, pageSize))
+
+		return &FuncResult{true, nil, map[string]interface{}{
+			"currentPage": cPage,
+			"data":        list,
+			"totalRows":   count,
+		}}
+	}()
+	if r.Err != nil {
+		log.Printf("anth ListReq err:%v\n", r.Err.Error())
+	}
+	this.ServeJson(r.Data)
+}
+
+func (this *EntAuth) Detail(id string) error {
+	rData := cutil.Mysql.FindOne("entniche_info", map[string]interface{}{"id": id}, "", "")
+	if rData == nil || len(*rData) == 0 {
+		return errors.New("not find data")
+	}
+	(*rData)["legal_idcard_front"] = SysConfig.JyWebdomain + (*rData)["legal_idcard_front"].(string)
+	(*rData)["legal_idcard_after"] = SysConfig.JyWebdomain + (*rData)["legal_idcard_after"].(string)
+	(*rData)["license"] = SysConfig.JyWebdomain + (*rData)["license"].(string)
+	this.T["data"] = rData
+	return this.Render("/manage/auth/detail.html", &this.T)
+}
+
+func (this *EntAuth) Change() {
+	r := func() *FuncResult {
+		id := this.GetString("id")
+		status := this.GetString("status")
+		reason := this.GetString("reason")
+		if id == "" {
+			return &FuncResult{false, errors.New("未找到此条记录"), nil}
+		}
+		if status == "-1" && reason == "" || !(status == "1" || status == "-1") {
+			return &FuncResult{false, errors.New("缺少参数"), nil}
+		}
+		if status == "1" {
+			reason = ""
+		}
+		ok := cutil.Mysql.Update("entniche_info", map[string]interface{}{"id": id},
+			map[string]interface{}{"auth_reason": reason, "auth_status": status, "audit_time": time.Now().Format(util.Date_Full_Layout)})
+		if !ok {
+			return &FuncResult{false, errors.New("数据库操作失败"), nil}
+		}
+		return &FuncResult{true, nil, nil}
+	}()
+	if r.Err != nil {
+		log.Printf("anth ListReq err:%v\n", r.Err.Error())
+	}
+	this.ServeJson(r.Format())
+}

+ 309 - 0
core/src/web/templates/manage/auth/detail.html

@@ -0,0 +1,309 @@
+<html>
+<head>
+    <title>课程详情</title>
+    {{include "/common/inc.html"}}
+    <link href="{{Msg "seo" "cdn"}}/css/message.css" rel="stylesheet">
+    <script src="/js/validform-min.js"></script>
+    <script type="text/javascript" src="/js/zDrag.js"></script>
+    <script type="text/javascript" src="/js/zDialog.js"></script>
+    <script src="{{Msg "seo" "cdn"}}/js/jquery.cityselect.js"></script>
+    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/My97DatePicker/WdatePicker.js"></script>
+    <style type="text/css">
+        .widget-content {
+            table-layout: fixed;
+            font-size: 14px;
+        }
+
+        #course {
+            background-color: #f5f5f5;
+        }
+
+        #tr1 td img {
+            border: 1px solid #999999;
+            width: 78px;
+            height: 78px;
+            margin: 0;
+            padding: 0;
+            margin-bottom: 20px;
+        }
+
+        .delbtn {
+            position: absolute;
+            margin: 0 0 0 -10px;
+            padding: 0 0 0 0;
+            background-color: #00ffff;
+            cursor: pointer;
+        }
+
+        .delbtn img {
+            height: 15px !important;
+            width: 15px !important;
+            margin-right: -20px !important;
+            margin-top: -8px !important;
+        }
+
+        /*修改弹框样式*/
+        .modal {
+            top: 10%;
+        }
+
+        .modal-dialog {
+            width: 400px;
+            text-align: center;
+        }
+
+        .modal-dialog .bootbox-close-button.close {
+            display: none;
+        }
+
+        .modal-dialog .modal-header .modal-title {
+            color: #4E5051;
+            font-size: 18px;
+        }
+
+        .modal-dialog .bootbox-body {
+            color: #4E5051;
+            font-size: 14px;
+        }
+
+        .modal-dialog .modal-header,
+        .modal-dialog .modal-footer {
+            border: none;
+
+        }
+
+        .modal-dialog .modal-footer {
+            display: flex;
+            justify-content: space-between;
+        }
+
+        .modal-dialog .modal-footer .bootbox-cancel {
+            width: 110px;
+            height: 38px;
+            left: 24px;
+            top: 112px;
+
+            background: #C2C2C2;
+            border-radius: 4px;
+            border-color: #C2C2C2;
+            color: #ffff;
+        }
+
+        .modal-dialog .modal-footer .bootbox-accept {
+            width: 110px;
+            height: 38px;
+            left: 226px;
+            top: 112px;
+
+            background: #4DB443;
+            border-radius: 4px;
+            border-color: #4DB443;
+            color: #ffff;
+        }
+        .entImg{
+            height:120px;
+            margin-right:10px;
+        }
+        .entImg-group{
+          display: flex;
+        }
+        #save{
+          margin:0px 25px;
+          color: #fff;
+          border-color: #4DB443;
+          background-color: #4DB443;
+        }
+        #cancel{
+          margin:0px 25px;
+          color: #4DB443;
+          border-color: #4DB443;
+          background-color: #fff
+        }
+        .mimg{
+        		width:950px;
+        }
+    </style>
+</head>
+<body>
+
+{{include "/manage/audithead.html"}}
+<!-- 中间 -->
+<div class="row" style="width:96%; margin:0 auto; margin-top:10px;">
+    <div>
+        {{include "/manage/slider.html"}}
+
+        <div id="content" class="send">
+            <div class="widget-box">
+                <div class="widget-content nopadding">
+                    <div class="head">
+                        <div class="title">企业资料</div>
+                        <div style="clear:both;"></div>
+                    </div>
+                    <div class="sendform">
+                        <form class="registerform form-horizontal" role="form" method="post">                
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">企业名称:</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" readonly="readonly" value="{{.T.data.name}}"/>
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">统一社会信用代码:</label>
+                                <div class="col-sm-5" >
+                                    <input class="form-control" readonly="readonly" value="{{.T.data.code}}"/>
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">法人:</label>
+                                <div class="col-sm-3" >
+                                    <input class="form-control" readonly="readonly" value="{{.T.data.legal_name}}"/>
+                                </div>
+                            </div>
+
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">法人身份证号码:</label>
+                                <div class="col-sm-5">
+                                    <input class="form-control" readonly="readonly" value="{{.T.data.legal_idcard}}"/>
+                                </div>
+                            </div>
+                            
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">营业执照:</label>
+                                <div class="col-sm-5">
+                                    <img class="entImg" src="{{.T.data.license}}">
+                                </div>
+                            </div>
+                            
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">法人身份证:</label>
+                                <div class="col-sm-5 entImg-group">
+                                    <img class="entImg" src="{{.T.data.legal_idcard_front}}">
+                                    <img class="entImg" src="{{.T.data.legal_idcard_after}}">
+                                </div>
+                            </div>
+                            
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">企业创建时间:</label>
+                                <div class="col-sm-3">
+                                    <input class="form-control" readonly="readonly"  value="{{.T.data.createtime}}"/>
+                                </div>
+                            </div>
+                            
+                            <div class="form-group">
+                                <label class="col-sm-3 control-label" for="name">提交审核时间:</label>
+                                <div class="col-sm-3">
+                                    <input class="form-control" readonly="readonly"  value="{{.T.data.auth_time}}"/>
+                                </div>
+                            </div>
+
+                        </form>
+                    </div>
+
+                    <div class="head">
+                        <div style="clear:both;"></div>
+                    </div>
+                    <div class="sendform form-horizontal"> 
+                          <div class="form-group">
+                              <label class="col-sm-3 control-label" for="name">审核:</label>
+                              <div class="col-sm-5" style="margin-top: 7px;">
+                                  <input type="radio" name="pass" value="1" style="margin:0px 10px 0px 0px;cursor: pointer;"/>通过
+                                  <input type="radio" name="pass" value="-1" style="margin:0px 10px 0px 30px;cursor: pointer;"/>不通过
+                              </div>
+                          </div> 
+                         <div class="form-group">
+                              <label class="col-sm-3 control-label" for="name">未通过原因:</label>
+                              <div class="col-sm-5">
+                                  <input id="reason" class="form-control" value="{{.T.data.auth_reason}}"/>
+                              </div>
+                          </div>
+                          <div class="col-sm-10" style="margin-left:20%">
+                            <button class="btn" type="button" id="save">保存</button>
+                            <button class="btn" type="button" id="cancel">重置</button>
+                          </div>
+                    </div>
+            </div>
+        </div>
+
+    </div>
+</div>
+
+<!--显示图片-->
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
+   aria-labelledby="myModalLabel" aria-hidden="true">
+   <div class="modal-dialog mimg">
+      <div class="modal-content">
+         <div class="modal-header">
+            <button type="button" class="close" data-dismiss="modal" 
+               aria-hidden="true">×
+            </button>
+         </div>
+         <div class="modal-body" id="imgshow" style="cursor:pointer;width:100%;" >
+
+         </div>
+         <div class="modal-footer">
+            <button type="button" class="btn btn-default" 
+               data-dismiss="modal">关闭
+            </button>
+         </div>
+      </div><!-- /.modal-content -->
+   </div><!-- /.modal-dialog -->
+</div><!-- /.modal -->
+{{include "/common/bottom.html"}}
+<script type="text/javascript" src="/js/bootbox.js"></script>
+<script>
+  $(function(){
+    var status={{.T.data.auth_status}}
+    $("input[name='pass']").on("click",function(){
+      if($(this).val()==1){
+        $("#reason").val("");
+        $("#reason").attr("readonly","readonly")
+      }else{
+        $("#reason").removeAttr("readonly")
+      }
+    })
+    if(status===1){
+      $("input[name='pass']:eq(0)").trigger("click");
+    }else if(status===-1){
+      $("input[name='pass']:eq(1)").trigger("click");
+    }
+    
+    $(".entImg").on("click",function(){
+      showdiv(this)
+    })
+    
+    $("#cancel").on("click",function(){window.location.reload()})
+    $("#save").on("click",function(){
+      var status=$('input[name="pass"]:checked').val();
+      var reason=$('#reason').val();
+      if(status==="-1"){
+        if(reason==""){
+          alert("请输入未通过原因")
+          return
+        }
+      }else if(status==="1"){
+        reason="";
+      }else{
+         alert("未知输入")
+      }
+      $.post("/manage/entauth/change",{"id":{{.T.data.id}},"status":status,"reason":reason},function(r){
+        if(r.success){
+          window.history.back();
+        }else{
+          alert(r.errMsg)
+        }
+      },"json")
+    })
+  })
+   function showdiv(t) { 
+  	var ht=$(t).attr("src");
+    if(ht==""||ht==undefined){
+      return
+    }
+    $('#myModal').modal({
+   		keyboard: true
+	  });	
+  	$("#imgshow").html("<img style='width:100%' src='"+ht+"'/>")
+   }
+</script>
+</body>
+</html>

+ 298 - 0
core/src/web/templates/manage/auth/list.html

@@ -0,0 +1,298 @@
+<html>
+<head>
+    <title>企业审核</title>
+    {{include "/common/inc.html"}}
+    <script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js"></script>
+    <script src="/js/qfwtable.js"></script>
+    <style type="text/css">
+        #course {
+            background-color: #f5f5f5;
+        }
+
+        #content table {
+            table-layout: fixed;
+            border: 0px;
+            font-size: 14px;
+        }
+
+        #sidebar {
+            margin-left: 0px;
+        }
+
+        .table > thead > tr > th:nth-child(1) {
+            width: 30%;
+        }
+
+        .table > thead > tr > th:nth-child(2) {
+            width: 10%;
+        }
+
+        .table > thead > tr > th:nth-child(3) {
+            width: 15%;
+        }
+
+        .table > thead > tr > th:nth-child(4) {
+            width: 15%;
+        }
+
+        .table > thead > tr > th:nth-child(5) {
+            width: 10%;
+        }
+
+        .table > thead > tr > th:nth-child(6), .table > tbody > tr > td:nth-child(6) {
+            width: 20%;
+            /*text-align: center;*/
+        }
+
+
+        .table > thead > tr > th {
+            border: 0px;
+            font-size: 14px;
+        }
+
+        .table > tbody > tr > td {
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            overflow: hidden;
+            border: 0px;
+            border-bottom: 1px dashed #999999;
+        }
+
+        .table > tbody > tr {
+            cursor: pointer;
+        }
+
+        .addCourse {
+            float: right;
+            margin-right: 20px;
+            color: #fff;
+            background-color: #38b44a;
+            border-color: #38b44a;
+            border-radius: 4px;
+            padding: 8px 12px;
+            margin: 5px;
+        }
+
+        .pagination > .active > a:hover, .pagination > .active > a:focus {
+            background-color: #18CC7D;
+        }
+
+        .editBtn {
+            display: flex;
+        }
+
+        .editBtn span {
+            padding: 3px 7px;
+            border: 1px solid;
+            border-radius: 4px;
+            margin: 0 3px;
+        }
+
+        .yellowStyle {
+            color: #EAB62F;
+            border-color: #EAB62F;
+        }
+
+        .greenStyle {
+            color: #4DB443;
+            border-color: #4DB443;
+        }
+
+        .redStyle {
+            color: #F5585C;
+            border-color: #F5585C;
+        }
+
+        /*修改弹框样式*/
+        .modal {
+            top: 33%;
+        }
+
+        .modal-dialog {
+            width: 400px;
+            text-align: center;
+        }
+
+        .modal-dialog .bootbox-close-button.close {
+            display: none;
+        }
+
+        .modal-dialog .modal-header .modal-title {
+            color: #4E5051;
+            font-size: 18px;
+        }
+
+        .modal-dialog .bootbox-body {
+            color: #4E5051;
+            font-size: 14px;
+        }
+
+        .modal-dialog .modal-header,
+        .modal-dialog .modal-footer {
+            border: none;
+
+        }
+
+        .modal-dialog .modal-footer{
+            display: flex;
+            justify-content: space-between;
+        }
+
+        .modal-dialog .modal-footer .bootbox-cancel{
+            width: 110px;
+            height: 38px;
+            left: 24px;
+            top: 112px;
+
+            background: #C2C2C2;
+            border-radius: 4px;
+            border-color: #C2C2C2;
+            color: #ffff;
+        }
+
+        .modal-dialog .modal-footer .bootbox-accept{
+            width: 110px;
+            height: 38px;
+            left: 226px;
+            top: 112px;
+
+            background: #4DB443;
+            border-radius: 4px;
+            border-color: #4DB443;
+            color: #ffff;
+        }
+
+
+    </style>
+</head>
+<body>
+{{include "/manage/audithead.html"}}
+<div class="row" style="width:96%; margin:0 auto;">
+    {{include "/manage/slider.html"}}
+    <div id="content">
+        <div id="audit"></div>
+    </div>
+</div>
+{{include "/common/bottom.html"}}
+</body>
+<script type="text/javascript" src="/js/bootbox.js"></script>
+<script>
+    $(function () {
+        $("#audit").datatable({
+            perPage: 10
+            ,
+            showPagination: true
+            ,
+            checkbox: "" //check radio
+            ,
+            checkboxHeader: false
+            ,
+            idField: "_id"
+            ,
+            classname: "table-hover"
+            ,
+            css: {"height": "550px"}
+            ,
+            buttons: ['<div style="width:50%;margin:5px" class="input-group pull-right" id="search"><input type="text" id="searchtext" value=""  data-original-title="Search" class="form-control" placeholder="请输入检索条件"><span class="input-group-btn"><button class="btn btn-success" onclick="SearchContent()" data-original-title="Search" id="searchtip" type="button" style="height:38px;">检索</button></span></div><div style="margin:5px;" class="controls pull-right"><select class="form-control" id="status"><option value="">  认证状态  </option><option value="1">  通过 </option><option value="-1">  未通过 </option><option value="0">  未认证 </option></select></div>']
+            ,
+            url: '/manage/entauth/listReq'
+            ,
+            columns: [
+                {
+                    title: "企业名称", field: "name"
+                },
+                {
+                    title: "绑定手机号", field: "phone"
+                },
+                {
+                    title: "提交时间", field: "auth_time"
+                },
+                {
+                    title: "处理时间", field: "audit_time"
+                },
+                {
+                    title: "状态", field: "auth_status", callback: function (data) {
+                        if (data.auth_status === -1) {
+                            return "未通过"
+                        } else if (data.auth_status === 1) {
+                            return "通过"
+                        } else {
+                            return "未审核"
+                        }
+                    }
+                },
+                {
+                    title: "操作", field: "applybill_company", callback: function (data) {
+                      return  "<div class='editBtn'><span class='greenStyle' onclick='window.location.href=\"" + "/manage/entauth/detail/" + data.id + "\"'>管理</span></div>"
+                    }
+                }
+            ]
+        });
+
+        $("select").change(function () {
+            var find = $("#audit").data("datatable");
+            if (!find.options.opost) find.options.opost = find.options.post || {};
+            find.options.post = $.extend(find.options.opost, {
+                status: $("#status").val(),
+            });
+            find.options.currentPage = 1;
+            find.render();
+        });
+
+        $(".addCourse").on("click", function () {
+            window.location.href = "/manage/course/page/add/new"
+        })
+    });
+
+    //点击跳转新页面
+    function redirect(code) {
+        //sessionStorage.setItem("contentHtml",$("#content").prop("outerHTML"));
+        window.open("/manage/dataExport/dataDetail/" + code);
+    }
+
+    //
+    function SearchContent() {
+        var find = $("#audit").data("datatable");
+        if (!find.options.opost) find.options.opost = find.options.post || {};
+        find.options.post = $.extend(find.options.opost, {query: $("#searchtext").val()});
+        find.options.currentPage = 1;
+        find.render();
+    }
+
+    function doCheck(flag, id) {
+        var tipMsg = "";
+        if (flag === "on") {
+            tipMsg = "确定发布课程?";
+        } else if (flag === "off") {
+            tipMsg = "课程下线后将无法购买,确定是否下线?";
+        } else {
+            return
+        }
+
+        bootbox.confirm({
+            title: "提示",
+            message: tipMsg,
+            buttons: {
+                cancel: {
+                    label: '取消'
+                },
+                confirm: {
+                    label: '确定'
+                }
+            },
+            callback: function (result) {
+                if (!result) {
+                    return
+                }
+                $.post("/manage/course/changeStatus", {id: id, flag: flag}, function (r) {
+                    if (r.success) {
+                        $("#audit").data("datatable").render();
+                    } else {
+                        bootbox.alert(r.errMsg)
+                    }
+                })
+            }
+        });
+    }
+</script>
+</html>