xuzhiheng 2 éve
szülő
commit
a853443ab2
4 módosított fájl, 857 hozzáadás és 4 törlés
  1. 116 0
      service/coverage
  2. 613 0
      service/coverage.html
  3. 3 4
      service/service.go
  4. 125 0
      service/service_test.go

+ 116 - 0
service/coverage

@@ -0,0 +1,116 @@
+mode: set
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:23.102,27.47 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:61.2,62.18 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:65.2,69.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:27.47,30.45 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:30.45,33.4 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:33.9,34.30 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:34.30,37.38 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:56.5,57.44 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:37.38,39.26 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:39.26,41.7 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:41.12,44.12 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:46.11,55.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:62.18,64.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:72.102,78.8 5 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:81.2,84.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:78.8,80.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:87.105,97.35 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:125.2,128.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:97.35,98.27 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:98.27,100.45 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:100.45,111.5 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:111.10,122.5 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:131.108,134.35 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:147.2,150.3 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:134.35,135.27 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:135.27,145.4 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:153.51,155.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:155.35,158.46 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:158.46,161.67 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:161.67,163.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:163.10,163.41 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:163.41,165.5 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:170.73,183.42 13 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:186.2,197.9 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:200.2,200.18 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:324.2,324.13 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:183.42,185.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:197.9,199.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:200.18,202.39 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:206.3,207.51 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:202.39,205.4 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:207.51,210.32 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:213.4,215.49 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:230.4,232.51 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:210.32,212.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:215.49,216.41 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:216.41,217.24 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:217.24,218.25 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:218.25,220.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:220.13,222.8 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:223.12,225.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:226.11,228.6 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:232.51,235.41 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:240.5,241.20 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:235.41,237.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:237.11,239.6 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:241.20,244.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:245.10,258.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:258.21,260.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:260.11,263.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:266.8,267.51 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:321.3,322.31 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:267.51,270.32 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:273.4,275.49 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:290.4,292.51 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:270.32,272.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:275.49,276.41 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:276.41,277.24 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:277.24,278.25 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:278.25,280.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:280.13,282.8 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:283.12,285.7 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:286.11,288.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:292.51,296.20 4 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:296.20,299.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:300.10,313.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:313.21,315.6 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:315.11,318.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:327.33,330.37 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:337.2,337.15 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:330.37,331.28 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:331.28,332.25 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:332.25,334.5 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:340.30,354.2 13 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:356.73,367.42 10 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:373.2,374.19 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:377.2,378.13 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:367.42,369.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:374.19,376.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:381.149,396.12 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:401.2,401.10 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:404.2,404.13 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:396.12,400.3 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:401.10,403.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:408.30,409.18 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:412.2,414.41 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:409.18,411.3 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:414.41,417.21 3 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:417.21,421.4 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:425.42,438.2 12 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:440.25,442.35 2 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:442.35,447.40 5 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:447.40,450.47 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:450.47,453.68 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:453.68,456.6 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:456.11,456.42 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:456.42,461.6 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:467.38,471.35 4 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:509.2,509.15 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:471.35,474.50 3 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:474.50,476.4 1 1
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:476.9,478.54 2 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:478.54,480.5 1 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:480.10,503.18 6 0
+bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go:503.18,505.6 1 0

+ 613 - 0
service/coverage.html

@@ -0,0 +1,613 @@
+
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+		<title>service: Go Coverage Report</title>
+		<style>
+			body {
+				background: black;
+				color: rgb(80, 80, 80);
+			}
+			body, pre, #legend span {
+				font-family: Menlo, monospace;
+				font-weight: bold;
+			}
+			#topbar {
+				background: black;
+				position: fixed;
+				top: 0; left: 0; right: 0;
+				height: 42px;
+				border-bottom: 1px solid rgb(80, 80, 80);
+			}
+			#content {
+				margin-top: 50px;
+			}
+			#nav, #legend {
+				float: left;
+				margin-left: 10px;
+			}
+			#legend {
+				margin-top: 12px;
+			}
+			#nav {
+				margin-top: 10px;
+			}
+			#legend span {
+				margin: 0 5px;
+			}
+			.cov0 { color: rgb(192, 0, 0) }
+.cov1 { color: rgb(128, 128, 128) }
+.cov2 { color: rgb(116, 140, 131) }
+.cov3 { color: rgb(104, 152, 134) }
+.cov4 { color: rgb(92, 164, 137) }
+.cov5 { color: rgb(80, 176, 140) }
+.cov6 { color: rgb(68, 188, 143) }
+.cov7 { color: rgb(56, 200, 146) }
+.cov8 { color: rgb(44, 212, 149) }
+.cov9 { color: rgb(32, 224, 152) }
+.cov10 { color: rgb(20, 236, 155) }
+
+		</style>
+	</head>
+	<body>
+		<div id="topbar">
+			<div id="nav">
+				<select id="files">
+				
+				<option value="file0">bp.jydev.jianyu360.cn/BaseService/entManageApplication/service/service.go (60.1%)</option>
+				
+				</select>
+			</div>
+			<div id="legend">
+				<span>not tracked</span>
+			
+				<span class="cov0">not covered</span>
+				<span class="cov8">covered</span>
+			
+			</div>
+		</div>
+		<div id="content">
+		
+		<pre class="file" id="file0" style="display: none">package service
+
+import (
+        "encoding/json"
+        "fmt"
+        "log"
+        "strconv"
+        "strings"
+        "time"
+
+        "context"
+
+        "app.yhyue.com/moapp/jybase/mongodb"
+        . "bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
+        "bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/entmanageapplication"
+        "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
+
+        // "github.com/zeromicro/go-zero/core/logx"
+        "app.yhyue.com/moapp/jybase/common"
+        "app.yhyue.com/moapp/jybase/redis"
+)
+
+func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp <span class="cov8" title="1">{
+        timeStr, ok, id, msg, code := time.Now().Format("2006-01-02 15:04:05"), false, int64(0), "", int64(0)
+        UserArr := strings.Split(this.EntUserId, ",")
+        sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
+        if sourceData != nil &amp;&amp; len(*sourceData) &gt; 0 </span><span class="cov8" title="1">{
+                empower_count := common.IntAll((*sourceData)["empower_count"])
+                use_count := common.IntAll((*sourceData)["use_count"])
+                if empower_count-use_count &lt; len(UserArr) </span><span class="cov0" title="0">{
+                        msg = "购买数量不足"
+                        code = int64(-1)
+                }</span> else<span class="cov8" title="1"> {
+                        for _, v := range UserArr </span><span class="cov8" title="1">{
+                                entUserId, _ := strconv.Atoi(v)
+                                data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, "", "")
+                                if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                                        dataStatus := common.IntAll((*data)["status"])
+                                        if dataStatus == -1 </span><span class="cov8" title="1">{
+                                                ok = JyMysql.Update(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, map[string]interface{}{"wait_empower_id": this.WaitEmpowerId, "status": 1, "update_time": timeStr})
+                                        }</span> else<span class="cov0" title="0"> {
+                                                msg = "人员已经拥有权限,请先删除原有权限"
+                                                code = int64(-1)
+                                                break</span>
+                                        }
+                                } else<span class="cov0" title="0"> {
+                                        id = JyMysql.Insert(EntnichePower, map[string]interface{}{
+                                                "wait_empower_id": this.WaitEmpowerId,
+                                                "ent_id":          this.EntId,
+                                                "ent_user_id":     entUserId,
+                                                "status":          1,
+                                                "create_time":     timeStr,
+                                                "update_time":     timeStr,
+                                        })
+                                }</span>
+                                <span class="cov8" title="1">JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
+                                addPower(this.WaitEmpowerId, entUserId)</span>
+                        }
+                }
+        }
+        <span class="cov8" title="1">status := 0
+        if ok || id &gt; 0 </span><span class="cov8" title="1">{
+                status = 1
+        }</span>
+        <span class="cov8" title="1">return &amp;entmanageapplication.AddUsePersonResp{
+                ErrorCode: code,
+                ErrorMsg:  msg,
+                Data:      &amp;entmanageapplication.AddUsePerson{Status: int64(status)},
+        }</span>
+}
+
+func DelUsePerson(this *entmanageapplication.DelUsePersonReq) *entmanageapplication.AddUsePersonResp <span class="cov8" title="1">{
+        timeStr := time.Now().Format("2006-01-02 15:04:05")
+        ok := JyMysql.Update(EntnichePower, map[string]interface{}{"id": this.EntnichePowerId},
+                map[string]interface{}{"status": -1, "update_time": timeStr})
+        delPower(this.EntnichePowerId)
+        status := 0
+        if ok </span><span class="cov8" title="1">{
+                status = 1
+        }</span>
+        <span class="cov8" title="1">return &amp;entmanageapplication.AddUsePersonResp{
+                ErrorCode: 0,
+                Data:      &amp;entmanageapplication.AddUsePerson{Status: int64(status)},
+        }</span>
+}
+
+func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplication.UsePersonListResp <span class="cov8" title="1">{
+        data := JyMysql.SelectBySql(`select a.id,a.wait_empower_id,c.name,c.phone,c.mail,g.name as department,e.name as role from entniche_power a 
+                INNER JOIN entniche_user c on (a.ent_user_id=c.id and a.ent_id = c.ent_id) 
+                LEFT JOIN entniche_user_role d on (c.id=d.user_id) 
+                LEFT JOIN entniche_role e on (d.role_id=e.id) 
+                LEFT JOIN entniche_department_user f on (a.ent_user_id=f.user_id) 
+                LEFT JOIN entniche_department g on (g.id=f.dept_id) 
+                where a.status = 1 and a.ent_id = ?
+                order by a.update_time desc`, this.EntId)
+        arr := []*entmanageapplication.UsePersonList{}
+        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                for _, v := range *data </span><span class="cov8" title="1">{
+                        wait_empower_id := common.Int64All(v["wait_empower_id"])
+                        if wait_empower_id == this.WaitEmpowerId </span><span class="cov0" title="0">{
+                                obj := &amp;entmanageapplication.UsePersonList{
+                                        EntnichePowerId: common.Int64All(v["id"]),
+                                        Name:            common.ObjToString(v["name"]),
+                                        Phone:           common.ObjToString(v["phone"]),
+                                        Email:           common.ObjToString(v["mail"]),
+                                        Department:      common.ObjToString(v["department"]),
+                                        Role:            common.ObjToString(v["role"]),
+                                        Status:          1,
+                                }
+                                arr = append(arr, obj)
+                        }</span> else<span class="cov8" title="1"> {
+                                obj := &amp;entmanageapplication.UsePersonList{
+                                        EntnichePowerId: common.Int64All(v["id"]),
+                                        Name:            common.ObjToString(v["name"]),
+                                        Phone:           common.ObjToString(v["phone"]),
+                                        Email:           common.ObjToString(v["mail"]),
+                                        Department:      common.ObjToString(v["department"]),
+                                        Role:            common.ObjToString(v["role"]),
+                                        Status:          2,
+                                }
+                                arr = append(arr, obj)
+                        }</span>
+                }
+        }
+        <span class="cov8" title="1">return &amp;entmanageapplication.UsePersonListResp{
+                ErrorCode: 0,
+                Data:      arr,
+        }</span>
+}
+
+func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageapplication.BuyProductListResp <span class="cov8" title="1">{
+        data := JyMysql.Find(EntnicheWaitEmpower, map[string]interface{}{"ent_id": this.EntId}, "", "create_time desc", 0, 0)
+        arr := []*entmanageapplication.BuyProductList{}
+        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                for _, v := range *data </span><span class="cov8" title="1">{
+                        obj := &amp;entmanageapplication.BuyProductList{
+                                WaitEmpowerId: common.Int64All(v["id"]),
+                                ProductType:   common.ObjToString(v["product_type"]),
+                                UseCount:      common.Int64All(v["use_count"]),
+                                EmpowerCount:  common.Int64All(v["empower_count"]),
+                                ProvinceCount: common.Int64All(v["province_count"]),
+                                EndTime:       common.ObjToString(v["end_time"]),
+                        }
+                        arr = append(arr, obj)
+                }</span>
+        }
+        <span class="cov8" title="1">return &amp;entmanageapplication.BuyProductListResp{
+                ErrorCode: 0,
+                Data:      arr,
+        }</span>
+}
+
+func addPower(waitEmpowerId int64, entUserId int) <span class="cov8" title="1">{
+        data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
+        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                orderId := common.Int64All((*data)["order_id"])
+                orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
+                if orderData != nil &amp;&amp; len(*orderData) &gt; 0 </span><span class="cov8" title="1">{
+                        productType := common.ObjToString((*orderData)["product_type"])
+                        userId := getUserId(entUserId)
+                        if productType == "VIP订阅" || productType == "超级订阅" </span><span class="cov0" title="0">{
+                                openPowerVip(*orderData, userId)
+                        }</span> else<span class="cov8" title="1"> if productType == "大会员" </span><span class="cov8" title="1">{
+                                openPowerBig(*orderData, userId)
+                        }</span>
+                }
+        }
+}
+
+func openPowerBig(orderData map[string]interface{}, userId string) bool <span class="cov8" title="1">{
+        filterMap := common.ObjToMap(orderData["filter"])
+        startTime := common.ObjToString(orderData["vip_starttime"])
+        endTime := common.ObjToString(orderData["vip_endtime"])
+        tmp := "2006-01-02 15:04:05"
+        startdate, _ := time.ParseInLocation(tmp, startTime, time.Local)
+        enddate, _ := time.ParseInLocation(tmp, endTime, time.Local)
+        level := common.IntAll((*filterMap)["level"])
+        comboId := common.IntAll((*filterMap)["comboId"])
+        payCycle := common.IntAll((*filterMap)["payCycle"])
+        serversId := common.ObjToString((*filterMap)["serversId"])
+        serverMap := GetServerPid()
+        dataType := 1
+        if startdate.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
+                dataType = 2
+        }</span>
+        <span class="cov8" title="1">sets := map[string]interface{}{
+                "i_member_status":      level,
+                "i_member_starttime":   startdate.Unix(),
+                "i_member_endtime":     enddate.Unix(),
+                "i_mainaccount":        1,
+                "o_member_jy.i_wxpush": 1,
+        }
+        set := map[string]interface{}{
+                "$set": sets,
+        }
+        ok := Mgo.UpdateById("user", userId, set)
+        if !ok </span><span class="cov0" title="0">{
+                log.Println("大会员创建订单user表大会员状态更新失败")
+        }</span>
+        <span class="cov8" title="1">if comboId != 0 </span><span class="cov8" title="1">{
+                datas := JyMysql.FindOne("bigmember_combo", map[string]interface{}{"id": comboId}, "", "")
+                if datas == nil || len(*datas) == 0 </span><span class="cov0" title="0">{
+                        log.Println("未找到此套餐")
+                        return false
+                }</span>
+                <span class="cov8" title="1">s_servers := common.ObjToString((*datas)["s_servers"])
+                for _, s := range strings.Split(s_servers, ",") </span><span class="cov8" title="1">{
+                        serverId, _ := strconv.Atoi(s)
+                        mainId := serverId
+                        if serverMap[serverId] != 0 </span><span class="cov0" title="0">{
+                                serverId = serverMap[serverId]
+                        }</span>
+                        <span class="cov8" title="1">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+                        frequency := 0
+                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov8" title="1">{
+                                if serverId == 11 || serverId == 15 </span><span class="cov8" title="1">{
+                                        if serverId == 15 </span><span class="cov8" title="1">{
+                                                if payCycle &gt;= 12 </span><span class="cov0" title="0">{
+                                                        frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+                                                }</span> else<span class="cov8" title="1"> {
+                                                        frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                                }</span>
+                                        } else<span class="cov0" title="0"> {
+                                                frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                        }</span>
+                                } else<span class="cov8" title="1"> {
+                                        frequency = common.IntAll((*serverData)["s_count_month"])
+                                }</span>
+                        }
+                        <span class="cov8" title="1">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+                        serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov8" title="1">{
+                                i_status := common.If(dataType == 1, 0, 1)
+                                sql := ""
+                                if serverId == 17 || serverId == 18 </span><span class="cov0" title="0">{
+                                        sql = "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                }</span> else<span class="cov8" title="1"> {
+                                        sql = "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                }</span>
+                                <span class="cov8" title="1">status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+                                if status1 &lt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("新建服务-更新服务表出错", userId)
+                                        return false
+                                }</span>
+                        } else<span class="cov0" title="0"> {
+                                insert := map[string]interface{}{
+                                        "s_smainid":    mainId,
+                                        "s_userid":     userId,
+                                        "s_serviceid":  serverId,
+                                        "i_frequency":  frequency,
+                                        "l_starttime":  startdate.Format(tmp),
+                                        "l_endtime":    enddate.Format(tmp),
+                                        "i_status":     common.If(dataType == 1, 0, 1),
+                                        "l_createtime": time.Now().Format(tmp),
+                                        "l_updatetime": time.Now().Format(tmp),
+                                }
+                                order_id := JyMysql.Insert(BigServiceUser, insert)
+                                if order_id &gt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("用户服务表插入成功", userId)
+                                }</span> else<span class="cov0" title="0"> {
+                                        log.Println("用户服务表插入失败", userId)
+                                        return false
+                                }</span>
+                        }
+                }
+        } else<span class="cov0" title="0"> {
+                for _, s := range strings.Split(serversId, ",") </span><span class="cov0" title="0">{
+                        serverId, _ := strconv.Atoi(s)
+                        mainId := serverId
+                        if serverMap[serverId] != 0 </span><span class="cov0" title="0">{
+                                serverId = serverMap[serverId]
+                        }</span>
+                        <span class="cov0" title="0">serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
+                        frequency := 0
+                        if serverData != nil &amp;&amp; len(*serverData) &gt; 0 </span><span class="cov0" title="0">{
+                                if serverId == 11 || serverId == 15 </span><span class="cov0" title="0">{
+                                        if serverId == 15 </span><span class="cov0" title="0">{
+                                                if payCycle &gt;= 12 </span><span class="cov0" title="0">{
+                                                        frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
+                                                }</span> else<span class="cov0" title="0"> {
+                                                        frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                                }</span>
+                                        } else<span class="cov0" title="0"> {
+                                                frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
+                                        }</span>
+                                } else<span class="cov0" title="0"> {
+                                        frequency = common.IntAll((*serverData)["s_count_month"])
+                                }</span>
+                        }
+                        <span class="cov0" title="0">sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status = -1"
+                        serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
+                        if serverDatas != nil &amp;&amp; len(*serverDatas) &gt; 0 </span><span class="cov0" title="0">{
+                                i_status := common.If(dataType == 1, 0, 1)
+                                sql := "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
+                                status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
+                                if status1 &lt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("新建服务-更新服务表出错")
+                                        return false
+                                }</span>
+                        } else<span class="cov0" title="0"> {
+                                insert := map[string]interface{}{
+                                        "s_userid":     userId,
+                                        "s_smainid":    mainId,
+                                        "s_serviceid":  serverId,
+                                        "i_frequency":  frequency,
+                                        "l_starttime":  startdate.Format(tmp),
+                                        "l_endtime":    enddate.Format(tmp),
+                                        "i_status":     common.If(dataType == 1, 0, 1),
+                                        "l_createtime": time.Now().Format(tmp),
+                                        "l_updatetime": time.Now().Format(tmp),
+                                }
+                                order_id := JyMysql.Insert(BigServiceUser, insert)
+                                if order_id &gt; 0 </span><span class="cov0" title="0">{
+                                        log.Println("用户服务表插入成功", userId)
+                                }</span> else<span class="cov0" title="0"> {
+                                        log.Println("用户服务表插入失败")
+                                        return false
+                                }</span>
+                        }
+                }
+                <span class="cov0" title="0">RedisDel(userId)
+                ClearBigVipUserPower(userId)</span>
+        }
+        <span class="cov8" title="1">return true</span>
+}
+
+func GetServerPid() map[int]int <span class="cov8" title="1">{
+        pidMap := map[int]int{}
+        datas := JyMysql.Find("bigmember_service", map[string]interface{}{"i_status": 0}, "id,i_pid", "", 0, 0)
+        if datas != nil &amp;&amp; len(*datas) &gt; 0 </span><span class="cov8" title="1">{
+                for _, v := range *datas </span><span class="cov8" title="1">{
+                        if v["i_pid"] != nil </span><span class="cov8" title="1">{
+                                pidMap[common.IntAll(v["id"])] = common.IntAll(v["i_pid"])
+                        }</span>
+                }
+        }
+        <span class="cov8" title="1">return pidMap</span>
+}
+
+func RedisDel(userId string) <span class="cov8" title="1">{
+        redis.Del("newother", BigKey+userId)
+        cacheKey := fmt.Sprintf(PowerCacheKey, userId)
+        baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
+        redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
+        redisMenuKeyWX := fmt.Sprintf(RedisMenuKeyWX, userId)
+        redisMenuKeyAPP := fmt.Sprintf(RedisMenuKeyAPP, userId)
+        userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
+        redis.Del(NewOther, cacheKey)
+        redis.Del(NewOther, baseInfoCacheKey)
+        redis.Del(NewOther, redisMenuKeyPC)
+        redis.Del(NewOther, redisMenuKeyWX)
+        redis.Del(NewOther, redisMenuKeyAPP)
+        redis.Del(NewOther, userPowerRedisKey)
+}</span>
+
+func openPowerVip(orderData map[string]interface{}, userId string) bool <span class="cov0" title="0">{
+        vms := VipSimpleMsg{}
+        json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &amp;vms)
+        startTime := common.ObjToString(orderData["vip_starttime"])
+        endTime := common.ObjToString(orderData["vip_endtime"])
+        Date_Full_Layout := "2006-01-02 15:04:05"
+        user_phone := common.ObjToString(orderData["user_phone"])
+
+        startdate, _ := time.ParseInLocation(Date_Full_Layout, startTime, time.Local)
+        enddate, _ := time.ParseInLocation(Date_Full_Layout, endTime, time.Local)
+        dataType := 1
+        if startdate.Unix() &gt; time.Now().Unix() </span><span class="cov0" title="0">{
+                dataType = 2
+        }</span>
+
+        //为用户开通超级订阅权限
+        //是否开通超级订阅 -1 试用到期 -2 正式到期 1 试用 2 开通
+        <span class="cov0" title="0">isTrial := false
+        if dataType == 2 </span><span class="cov0" title="0">{
+                isTrial = true
+        }</span>
+        <span class="cov0" title="0">isOk := StartSubVip(user_phone, *vms.Area, *vms.NewBuyset, startdate, enddate, isTrial, userId)
+        return isOk</span>
+}
+
+func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuySet, startTime, endTime time.Time, isTrial bool, userId string) bool <span class="cov0" title="0">{
+        set := map[string]interface{}{
+                "o_vipjy.i_trial":      -1,                        //已激活试用
+                "o_vipjy.o_area":       area,                      //设置地区
+                "o_vipjy.o_buyset":     newBuyset,                 //购买内容 城市、省份、行业数量
+                "l_vip_starttime":      startTime.Unix(),          //开始时间
+                "l_vip_endtime":        endTime.Unix(),            //结束时间
+                "i_vip_status":         common.If(isTrial, -2, 2), //1试用 2正式 -2 试用到期
+                "i_vip_expire_tip":     0,                         //消息提示初始化
+                "o_vipjy.a_buyerclass": []interface{}{},           //设置行业
+        }
+        isOk := Mgo.UpdateById("user", userId, map[string]interface{}{
+                "$set": set,
+        })
+
+        go func() </span><span class="cov0" title="0">{
+                MergeKws(userId)
+                redis.Del(NewOther, "pl_indexMessage_"+userId)
+                ClearBigVipUserPower(userId)
+        }</span>()
+        <span class="cov0" title="0">if isOk </span><span class="cov0" title="0">{
+                return true
+        }</span>
+        <span class="cov0" title="0">return true</span>
+}
+
+// 初始化vip订阅关键词
+func MergeKws(userId string) <span class="cov0" title="0">{
+        if userId == "" </span><span class="cov0" title="0">{ //11-11 取消此操作
+                return
+        }</span>
+        <span class="cov0" title="0">data, ok := Mgo.FindById("user", userId, `{"o_jy":1,"o_vipjy":1}`)
+        var o_vipjy map[string]interface{}
+        if ok &amp;&amp; data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov0" title="0">{
+                o_vipjy, _ = (*data)["o_vipjy"].(map[string]interface{})
+                a_items, _ := o_vipjy["a_items"].([]interface{})
+                if a_items == nil </span><span class="cov0" title="0">{ //首次
+                        Mgo.UpdateById("user", userId, map[string]interface{}{
+                                "$set": map[string]interface{}{"o_vipjy.i_matchway": 1, "o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_apppush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.a_infotype": []string{}, "o_vipjy.a_items": []string{}, "o_vipjy.l_modifydate": time.Now().Unix()},
+                        })
+                }</span>
+        }
+}
+
+func ClearBigVipUserPower(userId string) <span class="cov8" title="1">{
+        cacheKey := fmt.Sprintf(PowerCacheKey, userId)
+        baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
+        redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
+        redisMenuKeyWX := fmt.Sprintf(RedisMenuKeyWX, userId)
+        redisMenuKeyAPP := fmt.Sprintf(RedisMenuKeyAPP, userId)
+        userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
+        redis.Del(NewOther, cacheKey)
+        redis.Del(NewOther, baseInfoCacheKey)
+        redis.Del(NewOther, redisMenuKeyPC)
+        redis.Del(NewOther, redisMenuKeyWX)
+        redis.Del(NewOther, redisMenuKeyAPP)
+        redis.Del(NewOther, userPowerRedisKey)
+}</span>
+
+func delPower(id int64) <span class="cov8" title="1">{
+        data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": id}, "", "")
+        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
+                entUserId := common.IntAll((*data)["ent_user_id"])
+                JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ?`, waitEmpowerId)
+                eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
+                if eOData != nil &amp;&amp; len(*eOData) &gt; 0 </span><span class="cov8" title="1">{
+                        orderId := common.Int64All((*eOData)["order_id"])
+                        orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
+                        if orderData != nil &amp;&amp; len(*orderData) &gt; 0 </span><span class="cov8" title="1">{
+                                productType := common.ObjToString((*orderData)["product_type"])
+                                userId := getUserId(entUserId)
+                                if productType == "VIP订阅" || productType == "超级订阅" </span><span class="cov0" title="0">{
+                                        Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_vip_status": -2}})
+                                        ClearBigVipUserPower(userId)
+                                }</span> else<span class="cov8" title="1"> if productType == "大会员" </span><span class="cov8" title="1">{
+                                        Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_member_status": -2}})
+                                        RedisDel(userId)
+                                        ClearBigVipUserPower(userId)
+                                        JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
+                                }</span>
+                        }
+                }
+        }
+}
+
+func getUserId(entUserId int) string <span class="cov8" title="1">{
+        data := JyMysql.FindOne(EntnicheUser, map[string]interface{}{"id": entUserId}, "", "")
+        userId := ""
+        now := time.Now()
+        if data != nil &amp;&amp; len(*data) &gt; 0 </span><span class="cov8" title="1">{
+                phone := common.ObjToString((*data)["phone"])
+                userData, ok := Mgo.FindOne("user", map[string]interface{}{"s_phone": phone})
+                if ok &amp;&amp; userData != nil &amp;&amp; len(*userData) &gt; 0 </span><span class="cov8" title="1">{
+                        userId = mongodb.BsonIdToSId((*userData)["_id"])
+                }</span> else<span class="cov0" title="0"> {
+                        userDatas, oks := Mgo.FindOne("user", map[string]interface{}{"s_m_phone": phone})
+                        if oks &amp;&amp; userDatas != nil &amp;&amp; len(*userDatas) &gt; 0 </span><span class="cov0" title="0">{
+                                userId = mongodb.BsonIdToSId((*userDatas)["_id"])
+                        }</span> else<span class="cov0" title="0"> {
+                                ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+                                res, _ := UserCenterRpc.UserAdd(ctx, &amp;usercenter.UserAddReq{
+                                        Appid: "10000",
+                                        Phone: phone,
+                                })
+                                data := map[string]interface{}{
+                                        "i_appid":       2,
+                                        "s_phone":       phone,
+                                        "s_password":    "",
+                                        "l_registedate": now.Unix(),
+                                        "i_ts_guide":    2,
+                                        "o_jy": map[string]interface{}{
+                                                "i_wxpush":     1,
+                                                "i_apppush":    1,
+                                                "i_ratemode":   2,
+                                                "l_modifydate": now.Unix(),
+                                        },
+                                        "s_regsource":  "qmx_admin",
+                                        "base_user_id": res.Data.Id,
+                                }
+                                _id := Mgo.Save("user", data)
+                                log.Println("新增用户", _id)
+                                if _id != "" </span><span class="cov0" title="0">{
+                                        userId = _id
+                                }</span>
+                        }
+                }
+        }
+        <span class="cov8" title="1">return userId</span>
+}
+</pre>
+		
+		</div>
+	</body>
+	<script>
+	(function() {
+		var files = document.getElementById('files');
+		var visible;
+		files.addEventListener('change', onChange, false);
+		function select(part) {
+			if (visible)
+				visible.style.display = 'none';
+			visible = document.getElementById(part);
+			if (!visible)
+				return;
+			files.value = part;
+			visible.style.display = 'block';
+			location.hash = part;
+		}
+		function onChange() {
+			select(files.value);
+			window.scrollTo(0, 0);
+		}
+		if (location.hash != "") {
+			select(location.hash.substr(1));
+		}
+		if (!visible) {
+			select("file0");
+		}
+	})();
+	</script>
+</html>

+ 3 - 4
service/service.go

@@ -158,7 +158,7 @@ func addPower(waitEmpowerId int64, entUserId int) {
 		if orderData != nil && len(*orderData) > 0 {
 			productType := common.ObjToString((*orderData)["product_type"])
 			userId := getUserId(entUserId)
-			if productType == "VIP订阅" || productType == "超级订阅" {
+			if productType == "VIP订阅" {
 				openPowerVip(*orderData, userId)
 			} else if productType == "大会员" {
 				openPowerBig(*orderData, userId)
@@ -319,7 +319,6 @@ func openPowerBig(orderData map[string]interface{}, userId string) bool {
 			}
 		}
 		RedisDel(userId)
-		ClearBigVipUserPower(userId)
 	}
 	return true
 }
@@ -338,7 +337,7 @@ func GetServerPid() map[int]int {
 }
 
 func RedisDel(userId string) {
-	redis.Del("newother", BigKey+userId)
+	redis.Del(NewOther, BigKey+userId)
 	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
 	baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
 	redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
@@ -450,7 +449,7 @@ func delPower(id int64) {
 			if orderData != nil && len(*orderData) > 0 {
 				productType := common.ObjToString((*orderData)["product_type"])
 				userId := getUserId(entUserId)
-				if productType == "VIP订阅" || productType == "超级订阅" {
+				if productType == "VIP订阅" {
 					Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_vip_status": -2}})
 					ClearBigVipUserPower(userId)
 				} else if productType == "大会员" {

+ 125 - 0
service/service_test.go

@@ -0,0 +1,125 @@
+package service
+
+import (
+	// "reflect"
+	"testing"
+
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"app.yhyue.com/moapp/jybase/redis"
+	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
+	"bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/pb"
+)
+
+func init() {
+	entity.JyMysql = &mysql.Mysql{
+		Address:      "192.168.3.11:3366",
+		UserName:     "root",
+		PassWord:     "Topnet123",
+		DBName:       "jianyu",
+		MaxOpenConns: 5,
+		MaxIdleConns: 5,
+	}
+	entity.JyMysql.Init()
+	entity.Mgo = mongodb.NewMgo("192.168.3.206:27080", "qfw", 10)
+	redis.InitRedisBySize("newother=192.168.3.206:1712", 100, 30, 300)
+}
+
+func TestAddUsePerson(t *testing.T) {
+	tests := []struct {
+		name string
+		args *pb.AddUsePersonReq
+		want string
+	}{
+		{
+			name: "添加使用人员",
+			args: &pb.AddUsePersonReq{
+				EntId:         15023,
+				EntUserId:     "4576",
+				WaitEmpowerId: 18,
+			},
+			want: "",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			AddUsePerson(tt.args)
+			// if got := AddUsePerson(tt.args); !reflect.DeepEqual(got, tt.want) {
+			// 	t.Errorf("AddUsePerson() = %v, want %v", got, tt.want)
+			// }
+		})
+	}
+}
+
+func TestBuyProductList(t *testing.T) {
+	tests := []struct {
+		name string
+		args *pb.BuyProductListReq
+		want string
+	}{
+		{
+			name: "已购产品列表",
+			args: &pb.BuyProductListReq{
+				EntId: 15023,
+			},
+			want: "",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			BuyProductList(tt.args)
+			// if got := BuyProductList(tt.args); !reflect.DeepEqual(got, tt.want) {
+			// 	t.Errorf("BuyProductList() = %v, want %v", got, tt.want)
+			// }
+		})
+	}
+}
+
+func TestDelUsePerson(t *testing.T) {
+	tests := []struct {
+		name string
+		args *pb.DelUsePersonReq
+		want string
+	}{
+		{
+			name: "删除使用人员",
+			args: &pb.DelUsePersonReq{
+				EntnichePowerId: 52,
+			},
+			want: "",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			DelUsePerson(tt.args)
+			// if got := DelUsePerson(tt.args); !reflect.DeepEqual(got, tt.want) {
+			// 	t.Errorf("DelUsePerson() = %v, want %v", got, tt.want)
+			// }
+		})
+	}
+}
+
+func TestUsePersonList(t *testing.T) {
+	tests := []struct {
+		name string
+		args *pb.UsePersonListReq
+		want string
+	}{
+		{
+			name: "使用人员列表",
+			args: &pb.UsePersonListReq{
+				EntId:         15023,
+				WaitEmpowerId: 18,
+			},
+			want: "",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			UsePersonList(tt.args)
+			// if got := UsePersonList(tt.args); !reflect.DeepEqual(got, tt.want) {
+			// 	t.Errorf("UsePersonList() = %v, want %v", got, tt.want)
+			// }
+		})
+	}
+}