|
@@ -5,15 +5,16 @@ local tools = require "tools"
|
|
|
local skynet = require "skynet"
|
|
|
local mysql = require "skynet.db.mysql"
|
|
|
local config = require "run_config"
|
|
|
+local cjson = require "cjson"
|
|
|
local db
|
|
|
local mysqldtaskbx = {}
|
|
|
-
|
|
|
+-- SELECT * FROM products WHERE JSON_CONTAINS(main_id_info, '111') LIMIT 100
|
|
|
function M.set_products_main_id(msg_body)
|
|
|
- local isok ,key = tools.checkData({"main_id","id"},msg_body)
|
|
|
+ local isok ,key = tools.checkData({"main_id_info","id"},msg_body)
|
|
|
if not isok then
|
|
|
return false,string.format("缺少字段: %s.", key)
|
|
|
end
|
|
|
- local sql = string.format("UPDATE products SET main_id = %d WHERE id = %d ",msg_body.main_id,msg_body.id)
|
|
|
+ local sql = string.format("UPDATE products SET main_id_info = '%s' WHERE id = %d ",cjson.encode(msg_body.main_id_info),msg_body.id)
|
|
|
mysqldtaskbx.Singleton().query(sql)
|
|
|
return true, {}
|
|
|
end
|