Skip to content

Commit

Permalink
add release
Browse files Browse the repository at this point in the history
  • Loading branch information
YangXiaosa committed Jan 16, 2023
1 parent b9c6d42 commit fe2f386
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Binary file added release/Supermarket.exe
Binary file not shown.
Binary file added release/Supermarket_1.1.0_x64_en-US.msi
Binary file not shown.
4 changes: 2 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn user_add_score(card: &str, add_score: i32, operate_why: &str) -> String {
fn search_user(card: &str, name: &str, phone: &str,) -> String {
let mut query = String::from("SELECT * FROM users WHERE 1 = 1");
if card != "" {
query.push_str(&format!(" and card_id = '{}'", card));
query.push_str(&format!(" and card_id like '%{}%'", card));
}
if name != "" {
query.push_str(&format!(" and name like '%{}%'", name));
Expand Down Expand Up @@ -200,7 +200,7 @@ fn next_card() -> String {
#[tauri::command]
fn search_like(filed: &str, param: &str) -> String {
let connection = sqlite::open(DB_PATH).unwrap();
let query = format!("SELECT distinct {} FROM users WHERE {} like '%{}%'", filed, filed, param);
let query = format!("SELECT distinct {} FROM users WHERE {} like '%{}%' limit 10", filed, filed, param);
let mut statement = connection.prepare(query).unwrap();
let mut result = json::JsonValue::new_array();
while let Ok(State::Row) = statement.next() {
Expand Down
8 changes: 8 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@
table.render({elem: "#userList", toolbar: '#toolbaruserList'});
async function searchUser(card, name, phone) {
let result = JSON.parse(await invoke("search_user", { card: card, name: name, phone:phone}));
if (result.length === 0) {
layer.msg("没有找到数据", {time: 2000});
return;
}
result.forEach(data => {
data.create_time = new Date(data.create_time).toLocaleString();
});
Expand Down Expand Up @@ -353,6 +357,10 @@
param.logStart = logStart === "" ? 0 : new Date(logStart + " 00:00:00").getTime();
param.logEnd = logEnd === "" ? 0 : new Date(logEnd + " 23:59:59").getTime();
let result = JSON.parse(await invoke("search_log", param));
if (result.length === 0) {
layer.msg("没有找到数据", {time: 2000});
return;
}
result.forEach(data => {
data.operate_time = new Date(data.operate_time).toLocaleString();
});
Expand Down

0 comments on commit fe2f386

Please sign in to comment.