瀏覽代碼

修复数据库插入订单

neo 1 年之前
父節點
當前提交
70b2f40722
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 2 1
      dev/modules/order.lua
  2. 7 3
      dev/utils/util_order.lua

+ 2 - 1
dev/modules/order.lua

@@ -32,7 +32,8 @@ function root:mysql_get_init_columns()
32 32
         type = "int(11) DEFAULT 0 COMMENT '支付类型'",
33 33
         readStatus = "int(11) DEFAULT 0 COMMENT '状态:1客户端是否已经被轮询获取'",
34 34
         cut = "tinyint(1) DEFAULT 0 COMMENT '状态: 1 订单扣除'",
35
-        gameStatus = "tinyint(1) DEFAULT 0 COMMENT '游戏服处理:0未处理,1处理'"
35
+        gameStatus = "tinyint(1) DEFAULT 0 COMMENT '游戏服处理:0未处理,1处理'",
36
+        bandShareCode = "varchar(45) DEFAULT NULL COMMENT '绑定推广码'"
36 37
     }
37 38
 end
38 39
 

+ 7 - 3
dev/utils/util_order.lua

@@ -11,6 +11,8 @@ local timeUtil = require("utils.timeUtil")
11 11
 local mysqlUtil = require("utils.mysqlUtil")
12 12
 local util_user = require("utils.util_user")
13 13
 
14
+local userData = require("data.user")
15
+
14 16
 local root = {}
15 17
 
16 18
 -- 新增订单
@@ -18,10 +20,11 @@ function root:add_order(orderAction)
18 20
     if orderAction == nil then
19 21
         return false
20 22
     end
23
+    local bandShareCode = userData:get_key_info(tonumber(orderAction.uid), "bandShareCode")
21 24
     local sql =
22 25
         string.format(
23
-        "INSERT INTO `mdl_order` (`pay`,`orderNo`,`uid`,`diamond`,`gold`,`itemId`,`amount`,`time`,`status`,`resMsg`," ..
24
-            "`channel`,`type`,`createtime`,`cut`) VALUES ('%s','%s',%d,%s,%s,%d,%s,%d,%d,'%s',%d,%d,'%s',%d); ",
26
+        "INSERT INTO `mdl_order` (`payName`,`orderNo`,`uid`,`diamond`,`gold`,`gid`,`amount`,`time`,`status`,`resMsg`," ..
27
+            "`channel`,`type`,`createtime`,`cut`,`bandShareCode`) VALUES ('%s','%s',%d,%s,%s,%d,%s,%d,%d,'%s',%d,%d,'%s',%d,'%s'); ",
25 28
         orderAction.pay or "",
26 29
         orderAction.orderNo or "",
27 30
         tonumber(orderAction.uid) or 0,
@@ -35,7 +38,8 @@ function root:add_order(orderAction)
35 38
         tonumber(orderAction.channel) or 0,
36 39
         tonumber(orderAction.type) or 0,
37 40
         orderAction.createtime or "",
38
-        tonumber(orderAction.cut) or 0
41
+        tonumber(orderAction.cut) or 0,
42
+        bandShareCode or ""
39 43
     )
40 44
 
41 45
     return mysqlUtil:insert(sql)