Browse Source

完善空值

xuzhiheng 2 years ago
parent
commit
9a0a340953
4 changed files with 14 additions and 11 deletions
  1. 2 2
      api/etc/entmanageapplication-api.yaml
  2. 1 0
      entity/entity.go
  3. 3 3
      rpc/etc/entmanageapplication.yaml
  4. 8 6
      service/service.go

+ 2 - 2
api/etc/entmanageapplication-api.yaml

@@ -1,10 +1,10 @@
 Name: entManageApplication-api
 Host: 0.0.0.0
-Port: 9998
+Port: 9997
 EntManageApplicationRpc:
   Etcd:
     Hosts:
-    - 127.0.0.1:2379
+    - 192.168.3.240:2379
     Key: entmanageapplication.rpc
 GatewayRpcConf:
   Etcd:

+ 1 - 0
entity/entity.go

@@ -22,6 +22,7 @@ const (
 	EntnicheWaitEmpower       = "entniche_wait_empower"
 	EntnicheOrder             = "entniche_order"
 	Order                     = "dataexport_order"
+	BigServiceUser            = "bigmember_service_user"
 )
 
 // 订单简单信息

+ 3 - 3
rpc/etc/entmanageapplication.yaml

@@ -1,11 +1,11 @@
 Name: entmanageapplication.rpc
-ListenOn: 127.0.0.1:8080
+ListenOn: 192.168.3.240:9998
 Etcd:
   Hosts:
-  - 127.0.0.1:2379
+  - 192.168.3.240:2379
   Key: entmanageapplication.rpc
 Mode: test
-RedisAddrs: newother=192.168.3.240:1712
+RedisAddrs: newother=192.168.3.206:1712
 Mysql:
   JianYu:
     DBName: jianyu

+ 8 - 6
service/service.go

@@ -31,6 +31,7 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
 			"update_time":     timeStr,
 		})
 	}
+	JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
 	addPower(this.WaitEmpowerId)
 	status := 0
 	if ok || id > 0 {
@@ -185,10 +186,10 @@ func openPowerBig(orderData map[string]interface{}) bool {
 					frequency = common.IntAll((*serverData)["s_count_month"])
 				}
 			}
-			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status != -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 && len(*serverDatas) > 0 {
-				i_status := common.If(dataType == 1, 0, 1) //TODO
+				i_status := common.If(dataType == 1, 0, 1)
 				sql := ""
 				if serverId == 17 || serverId == 18 {
 					sql = "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
@@ -212,7 +213,7 @@ func openPowerBig(orderData map[string]interface{}) bool {
 					"l_createtime": time.Now().Format(tmp),
 					"l_updatetime": time.Now().Format(tmp),
 				}
-				order_id := JyMysql.Insert("bigmember_service_user", insert)
+				order_id := JyMysql.Insert(BigServiceUser, insert)
 				if order_id > 0 {
 					log.Println("用户服务表插入成功", userId)
 				} else {
@@ -245,7 +246,7 @@ func openPowerBig(orderData map[string]interface{}) bool {
 					frequency = common.IntAll((*serverData)["s_count_month"])
 				}
 			}
-			sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and  i_status != -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 && len(*serverDatas) > 0 {
 				i_status := common.If(dataType == 1, 0, 1)
@@ -267,7 +268,7 @@ func openPowerBig(orderData map[string]interface{}) bool {
 					"l_createtime": time.Now().Format(tmp),
 					"l_updatetime": time.Now().Format(tmp),
 				}
-				order_id := JyMysql.Insert("bigmember_service_user", insert)
+				order_id := JyMysql.Insert(BigServiceUser, insert)
 				if order_id > 0 {
 					log.Println("用户服务表插入成功", userId)
 				} else {
@@ -419,6 +420,7 @@ func delPower(entnichePowerId int64) {
 	data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": entnichePowerId}, "", "")
 	if data != nil && len(*data) > 0 {
 		waitEmpowerId := common.Int64All((*data)["wait_empower_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 && len(*eOData) > 0 {
 			orderId := common.Int64All((*eOData)["order_id"])
@@ -433,7 +435,7 @@ func delPower(entnichePowerId int64) {
 					Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_member_status": -2}})
 					RedisDel(userId)
 					ClearBigVipUserPower(userId)
-					DelBigPower(userId)
+					JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
 				}
 			}
 		}