"{$arr_req["NonStop"]}", "{$arr_req["CarrierIdentity"]}", "{$arr_req["Remark"]}", "{$arr_req["Flag"]}", {$_SESSION["user_id"]} ) EOD; error_log("{$g_today} sql: \n{$sql}\n", 3, '/tmp/errors.log'); $result = $mysqli->query("{$sql}"); if (!$result) { #error_log("$g_today query now_running error. ".$mysqli->error."\n",3,'./errors.log'); printf("{$g_today} query now_running error. sql: {$sql}. error: " . $mysqli->error . "\n"); $mysqli->close(); exit; } $ruleid = $mysqli->insert_id; $realid = sprintf("AA%08s", $ruleid); $sql = "update strategy set id=\"{$realid}\" where i={$ruleid};"; $result = $mysqli->query($sql); if (!$result) { result_no("{$g_today} strategy error. sql: {$sql}. error: " . $mysqli->error); $mysqli->close(); exit; } $mysqli->close(); #2, save to lua conf from db save_luaconf(); } } } }
$arr_cabin_class = split('[/]', $cabin_class); $strategy .= "\t\tcabin_class={"; for ($j = 0; $j < count($arr_cabin_class); $j++) { if ($j != 0) { $strategy .= ","; } $strategy .= "\"" . $arr_cabin_class[$j] . "\""; } $strategy .= "},agent={$agent}, award={$award}, noaward={$noaward}, single={$single}, round={$round}\n"; $strategy .= "\t},\n"; } $strategy .= "},\n"; $strategy .= "}\n"; echo "{$strategy}\n"; error_log("{$g_today} strategy: \n{$strategy}\n", 3, './errors.log'); } else { result_no("post data is NULL or json format is wrong. post: " . file_get_contents('php://input')); } function result_no($result_info, $use_original) { global $g_today; $arr = array(); $arr["result"] = "no"; if ($use_original != null && $use_original != "") { $arr["result_info"] = $result_info; } else { $arr["result_info"] = "系统异常"; } error_log("{$g_today} web output. error. {$result_info}\n", 3, './errors.log'); echo json_encode($arr, true); }
} else { if ($arr_req["Action"] == "Delete") { #req: Action=Delete&ID=AA00373524 #rsp: OK if ($arr_req["ID"] == null && !array_key_exists("ID", $arr_req)) { printf("id is null\n"); exit; } $arr_id = split('[,]', $arr_req["ID"]); $ids = ""; for ($j = 0; $j < count($arr_id); $j++) { if ($ids != "") { $ids .= ","; } $ids .= "\"" . $arr_id[$j] . "\""; } $mysqli = sql_connect(); $sql = "delete from strategy where id in ({$ids})"; $result = $mysqli->query("{$sql}"); if (!$result) { result_no("{$g_today} query now_running error. " . $mysqli->error); exit; } echo "OK"; #$arr_result=array(); #result_ok($arr_result); exit; } } } }