DishServer
文件大小: 24k
源码售价: 10 个金币 积分规则     积分充值
资源说明:#cs ____________________________________ Au3 版本: 脚本作者:wozijisunfly Email: QQ/TM: 脚本版本: v-1.1.1 脚本功能: 服务器端,分析数据 #ce _______________脚本开始_________________ #include #Include #include #include #include #include #include #include #include If ProcessExists("DishServerSQLite.exe") Then MsgBox(0,"ShoeMe","有一吃货要订饭啊!") Exit EndIf Global $SQLitepath,$SQLitename,$hQuery, $aRow,$SQLite_Data_Path $SQLitepath = "D:\Glutton\" $SQLitename = "Result.db" $SQLite_Data_Path = $SQLitepath & $SQLitename If Not FileExists($SQLitepath) Then DirCreate($SQLitepath) EndIf _SQLite_Startup() If Not FileExists($SQLite_Data_Path) Then SQLCreate() EndIf Dim $delicia[100][2] = [["小鸡炖蘑菇","15 刀/份"],["猪肉炖粉条","15 刀/份"],["地三鲜","10 刀/份"],["溜肥肠","10 刀/份"],["酸菜小炒","10 刀/份"],["东北乱炖","10 刀/份"],["锅包肉","10 刀/份"],["拌凉菜","10 刀/份"],["红烧肘子","30 刀/份"],["酸菜汆肉","18 刀/份"],["血肠","15 刀/份"]] $gui = GUICreate("吃货集中营",650,580) $dateviwe = GUICtrlCreateDate("", 10, 13, 100, 20, $DTS_SHORTDATEFORMAT) $name = GUICtrlCreateInput("",130,13,100,20) $searchOne = GUICtrlCreateButton(" 查 找 ",250,10) $flush = GUICtrlCreateButton(" 刷 新 ",330,10) $createUser = GUICtrlCreateButton("用户维护",410,10) $fixtime = GUICtrlCreateInput("15",470,9,24) GUICtrlSetLimit(-1,2,2) GUICtrlSetBkColor(-1,0xaaaaaa) GUICtrlSetFont(-1,12) $fix = GUICtrlCreateButton(" 定 时 ",500,10) $close = GUICtrlCreateButton(" 关 闭 ",560,10) Global $view1 = GUICtrlCreateEdit("----------------------------------------------", 10, 40,630,535,$ES_READONLY + $ES_AUTOVSCROLL + $ES_WANTRETURN + $WS_VSCROLL + $ES_MULTILINE) GUICtrlSetLimit(-1,535) GUICtrlSetFont(-1,20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $searchOne $os = @OSVersion If StringCompare($os,"WIN_XP",1) = 0 Then $ymd = StringSplit(GUICtrlRead($dateviwe),"-") $y = $ymd[1] If StringLen($ymd[2]) = 1 Then $m = "0" & $ymd[2] Else $m = $ymd[2] EndIf If StringLen($ymd[3]) = 1 Then $day = "0" & $ymd[3] Else $day = $ymd[3] EndIf $date = $y & "-" & $m & "-" & $day $getString = GUICtrlRead($name) FindDish($date,$getString) If StringLen($getString) <> 0 Then CheckIDOrName($getString) EndIf ContinueLoop ElseIf StringCompare($os,"WIN_7",1) = 0 Then $ymd = StringSplit(GUICtrlRead($dateviwe),"/") $y = $ymd[1] If StringLen($ymd[2]) = 1 Then $m = "0" & $ymd[2] Else $m = $ymd[2] EndIf If StringLen($ymd[3]) = 1 Then $day = "0" & $ymd[3] Else $day = $ymd[3] EndIf $date = $y & "-" & $m & "-" & $day $getString = GUICtrlRead($name) FindDish($date,$getString) ContinueLoop Else MsgBox(0,"ShowMe","检测报告:未知系统,请回到火星去吧,地球真的很危险。") ContinueLoop EndIf Case $flush ; 显示当前目录中所有文件的文件名 $search = FileFindFirstFile("D:\Glutton\*.*") GUICtrlSetData($view1,"") GUICtrlSetData($view1,"----------------------------------------------") ; 检查搜索是否成功 If $search = -1 Then MsgBox(0, "ShowMe", "没有文件/目录 匹配搜索") ExitLoop EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If StringCompare(StringRight($file, 8),".cai.log") = 0 Then $allfilename = "D:\Glutton\" & $file $file1 = FileOpen($allfilename, 0) ; 检查打开的文件是否可读 If $file1 = -1 Then MsgBox(0, "ShowMe", "不能打开文件.") ExitLoop EndIf ; 每次读取一行文本,直到文件结束. While 1 $line = FileReadLine($file1) If @error = -1 Then ExitLoop $xxoo = StringSplit($line,"#") $one = StringSplit($xxoo[1],"-") $two = StringSplit($xxoo[2],"-") $three = StringSplit($xxoo[3],"-") $num = $one[0] $fenstr = "" If StringCompare($one[1],"first") = 0 Then For $i = 4 To $num $fen = StringSplit($one[$i],"*") $fenstr = $fenstr & $fen[1] & "份" & $delicia[$fen[2] - 1][0] & "###" Next $cal = @YEAR & "-" & @MON & "-" & @MDAY $edit = GUICtrlRead($view1) & @CRLF & $fenstr & $one[2] & "--米饭:" & $two[2] & "份--价格:"& $three[2] & "元" & $cal & @CRLF & "----------------------------------------------" $menu = "食为天" $useraccount = $one[2] $userAName = $one[3] $dish = $fenstr $rice = "--米饭:" & $two[2] & "份" $price = "--价格:"& $three[2] & "元" InsertDish($cal,$menu,$useraccount,$userAName,$dish,$rice,$price) FileWriteLine("D:\Glutton\EveryOne.txt",$cal & "=" & $line) FileClose($file1) FileDelete($allfilename) ;FileMove($allfilename,StringReplace($allfilename,"cai",$cal,2),1) GUICtrlSetData($view1,$edit) ExitLoop ElseIf StringCompare($one[1],"second") = 0 Then For $i = 4 To $num $fen = StringSplit($one[$i],"*") $fenstr = $fenstr & $fen[1] & "份" & $delicia[$fen[2] - 1][0] & "###" Next $cal = @YEAR & "-" & @MON & "-" & @MDAY $edit = GUICtrlRead($view1) & @CRLF & $fenstr & $one[2] & "--米饭:" & $two[2] & "份--价格:"& $three[2] & "元" & $cal & @CRLF & "----------------------------------------------" $menu = "品人生" $useraccount = $one[2] $userAName = $one[3] $dish = $fenstr $rice = "**米饭:" & $two[2] & "份" $price = "**价格:"& $three[2] & "元" InsertDish($cal,$menu,$useraccount,$userAName,$dish,$rice,$price) FileWriteLine("D:\Glutton\EveryOne.txt",$cal & "=" & $line) FileClose($file1) FileDelete($allfilename) ;FileMove($allfilename,StringReplace($allfilename,"cai",$cal,2),1) GUICtrlSetData($view1,$edit) ExitLoop Else MsgBox(0,"ShowMe","处理文件失败,请查看问题所在。") ExitLoop EndIf Wend FileClose($file) EndIf WEnd ; 关闭搜索句柄 FileClose($search) Case $createUser GUICtrlSetState($searchOne,$GUI_DISABLE) GUICtrlSetState($flush,$GUI_DISABLE) GUICtrlSetState($createUser,$GUI_DISABLE) GUICtrlSetState($fix,$GUI_DISABLE) GUICtrlSetState($close,$GUI_DISABLE) $userGUI = GUICreate("",550,650, Default, Default, Default);, $WS_EX_TOPMOST) GUISetBkColor($userGUI,0xff0000) GUISetStyle(BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW),$userGUI) GUICtrlCreateLabel("工号:",70,10) $acc = GUICtrlCreateInput("",100,10,70) GUICtrlCreateLabel("姓名:",180,10) $user = GUICtrlCreateInput("",220,10,70) $insert = GUICtrlCreateButton(" 插 入 ",300,7,70) GUICtrlCreateLabel("I D :",70,37) $updateID = GUICtrlCreateInput("",100,35,70) GUICtrlCreateLabel("工号:",180,37) $updateAcc = GUICtrlCreateInput("",220,35,70) GUICtrlCreateLabel("姓名:",300,37) $updateName = GUICtrlCreateInput("",340,35,70) $update = GUICtrlCreateButton(" 修 改 ",420,34,70) GUICtrlCreateLabel("工号:",70,62) $searchAcc = GUICtrlCreateInput("",100,60,70) GUICtrlCreateLabel("姓名:",180,62) $searchName = GUICtrlCreateInput("",220,60,70) $find = GUICtrlCreateButton(" 查 找 ",300,60,70) $checkFind = GUICtrlCreateButton(" 精确查找 ",420,60,70) GUICtrlCreateLabel("I D :",70,85) $deleteID = GUICtrlCreateInput("",100,85,70) $delete = GUICtrlCreateButton(" 删 除 ",220,87,70) $deleteAll = GUICtrlCreateButton(" 彻底删除 ",300,87,70) $closeUser = GUICtrlCreateButton(" 关 闭 ",420,87,70) $GUI_ListBox = GUICtrlCreateListView("", 10, 117, 530, 520, 0x0010) GUICtrlSetFont(-1,12) _GUICtrlListView_AddColumn($GUI_ListBox, " ID", 45, 0) _GUICtrlListView_AddColumn($GUI_ListBox, "姓名 ", 120, 1) _GUICtrlListView_AddColumn($GUI_ListBox, "工号 ", 110, 1) _GUICtrlListView_AddColumn($GUI_ListBox, "创建时间 ", 170, 1) _GUICtrlListView_AddColumn($GUI_ListBox, "状态 ", 60, 1) GUISetState() Do $msgUser = GUIGetMsg() Select Case $msgUser = $insert $account = GUICtrlRead($acc) $username = GUICtrlRead($user) If StringLen($account) = 0 Or StringLen($username) = 0 Then MsgBox(0,"ShowMe","必须填写吃货工号和姓名!") ContinueLoop Else InsertUser($account,$username) GUICtrlSetData($acc,"") GUICtrlSetData($user,"") EndIf Case $msgUser = $find $usernum = TotalUser() $searchUserAcc = GUICtrlRead($searchAcc) $searchUserName = GUICtrlRead($searchName) SearchUser($searchUserAcc,$searchUserName,$usernum) Case $msgUser = $checkFind $searchUserAcc = GUICtrlRead($searchAcc) $searchUserName = GUICtrlRead($searchName) If StringLen($searchUserAcc) = 0 And StringLen($searchUserName) = 0 Then MsgBox(0,"ShowMe","至少要给我一个寻找的机会吧?给我一个条件啊!") ContinueLoop Else SeearchCheckUser($searchUserAcc,$searchUserName) EndIf Case $msgUser = $update $userID = GUICtrlRead($updateID) $account = GUICtrlRead($updateAcc) $username = GUICtrlRead($updateName) If StringLen($userID) = 0 Then MsgBox(0,"ShowMe","给我一个ID,我给你一个新人!~") ContinueLoop Else UpdateUser($userID,$account,$username) $usernum = TotalUser() SearchUser("","",$usernum) EndIf Case $msgUser = $delete $userID = GUICtrlRead($deleteID) If StringLen($userID) = 0 Then MsgBox(0,"ShowMe","给个删除的理由啊!") ContinueLoop Else DeleteUser($userID,0) $usernum = TotalUser() SearchUser("","",$usernum) EndIf Case $msgUser = $deleteAll $userID = GUICtrlRead($deleteID) If StringLen($userID) = 0 Then MsgBox(0,"ShowMe","那么大的仇也不知道ID吗?") ContinueLoop Else $return = MsgBox(33,"ShowMe","何必呢?真有那么大的仇吗?") If $return = 1 Then DeleteUser($userID,1) $usernum = TotalUser() SearchUser("","",$usernum) ElseIf $return = 2 Then MsgBox(0,"ShowMe","这说明你心存仁慈,替那个倒霉蛋感激你!",4) ContinueLoop Else MsgBox(0,"ERROR","中毒了吗?请查毒。") ContinueLoop EndIf EndIf EndSelect Until $msgUser = $closeUser GUIDelete($userGUI) GUICtrlSetState($searchOne,$GUI_ENABLE) GUICtrlSetState($flush,$GUI_ENABLE) GUICtrlSetState($createUser,$GUI_ENABLE) GUICtrlSetState($fix,$GUI_ENABLE) GUICtrlSetState($close,$GUI_ENABLE) Case $fix $ft = GUICtrlRead($fixtime) If Not StringRegExp($ft, '[0-9]{2}', 0) Then MsgBox(0,"ShowMe","整点儿数字让我来读一下啊!") ContinueLoop EndIf If $ft > 23 Or $ft < 10 Then MsgBox(0,"ShowMe","你们家下午的时间有 " & $ft & " 点吗?") ContinueLoop Else $getNameAndPrice = FixedTime($ft) If StringLen($getNameAndPrice) = 0 Then ContinueLoop Else CheckUserAndPrice($getNameAndPrice) EndIf EndIf Case $close _SQLite_Shutdown () Exit Case $GUI_EVENT_CLOSE _SQLite_Shutdown () Exit EndSwitch WEnd Func SQLCreate() _SQLite_Open($SQLite_Data_Path) _SQLite_Exec(-1, "Create Table IF NOT Exists ID2Name (ID INTEGER PRIMARY KEY ASC, Name Text, Account Text,Date Text,Show INTEGER);") _SQLite_Exec(-1, "Create Table IF NOT Exists DishTable (ID INTEGER PRIMARY KEY ASC,Date Text,Menu Test, Account Text,AName Text,Dish Text,Rice Text,Price Text,x1 Text,x2 Text,x3 Text,x4 Text,x5 Text);") ;Menu那家餐馆,Dish菜肴,Account是@ComputerName,AName是@UserName,xn预留字段 ;x1:TIME,x2一天内预定的次数, ;_SQLite_Exec(-1, "Create INDEX name_account ON ID2Name(Name,Account);") _SQLite_Close () EndFunc Func FindDish($da,$get) $db = _SQLite_Open($SQLite_Data_Path) GUICtrlSetData($view1,"") GUICtrlSetData($view1,"----------------------------------------------") If StringLen($get) = 0 Then $s = "SELECT * FROM DishTable WHERE " If StringLen($da) = 10 Then $s1 = "Date = '" & $da & "' ORDER BY ID DESC;" Else $s1 = "1 = 1 ORDER BY ID DESC;" EndIf $sql = $s & $s1 _SQLite_Query(-1, $sql, $hQuery) While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $Temp = $aRow[0] If $Temp = "" Then GUICtrlSetData($view1,GUICtrlRead($view1) & @CRLF & "唤醒一下饥饿人们吧!") Else $findname = $aRow[4] & " : " $findAccount = $aRow[3] $findmenu = @CRLF & $aRow[2] & @CRLF $findDish = $aRow[5] & @CRLF $findRice = $aRow[6] & @CRLF $findPrice = $aRow[7] & "今天:" & $aRow[1] & "时间:" & $aRow[8] & @CRLF & "猛击了" & $aRow[9] & "次" $findString = $findname & $findAccount & $findmenu & $findDish & $findRice & $findPrice GUICtrlSetData($view1,GUICtrlRead($view1) & @CRLF & $findString& @CRLF & "----------------------------------------------") EndIf WEnd Else $s = "SELECT * FROM DishTable WHERE " If StringLen($da) = 10 Then $s1 = "Date = '" & $da & "' AND Account LIKE '%" & $get & "%' ORDER BY ID DESC;" Else $s1 = "1 = 1 ORDER BY ID DESC;" EndIf $sql = $s & $s1 _SQLite_Query(-1, $sql, $hQuery) While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $Temp = $aRow[0] If $Temp = "" Then GUICtrlSetData($view1,GUICtrlRead($view1) & @CRLF & "唤醒一下饥饿人们吧!") Else $findname = $aRow[4] & " : " $findAccount = $aRow[3] $findmenu = @CRLF & $aRow[2] & @CRLF $findDish = $aRow[5] & @CRLF $findRice = $aRow[6] & @CRLF $findPrice = $aRow[7] & "今天:" & $aRow[1] & "时间:" & $aRow[8] & @CRLF & "狠狠的点击了" & $aRow[9] & "次" $findString = $findname & $findAccount & $findmenu & $findDish & $findRice & $findPrice GUICtrlSetData($view1,GUICtrlRead($view1) & @CRLF & $findString & @CRLF & "----------------------------------------------") EndIf WEnd EndIf _SQLite_Close () EndFunc Func CheckIDOrName($get) $an = "SELECT * FROM ID2Name WHERE Account LIKE '%" & $get & "%' OR Name LIKE '%" & $get & "%' ORDER BY ID DESC;" _SQLite_Open($SQLite_Data_Path) _SQLite_QuerySingleRow(-1,$an,$aRow) $Temp = $aRow[0] If $Temp = "" Then MsgBox(0,"ShowMe","用户维护中没有此人,建议收编她他它!") Else ;TODO=========== EndIf _SQLite_Close() EndFunc Func InsertDish($da,$me,$ua,$un,$di,$ri,$pri) _SQLite_Open($SQLite_Data_Path) _SQLite_QuerySingleRow(-1,"SELECT * FROM DishTable WHERE Date = '" & $da & "' AND Account = '" & $ua & "';", $aRow) $Temp = $aRow[0] If $Temp = "" Then _SQLite_Exec(-1, "Insert into DishTable(ID ,Date ,Menu , Account ,AName ,Dish ,Rice ,Price ,x1 ,x2 ,x3 ,x4 ,x5) values (null,'" & $da & "','" & $me &"','" & $ua & "','" & $un & "','" & $di & "','" & $ri & "','" & $pri & "',CURRENT_TIME,'1',null,null,null);") Else $x2 = $aRow[9] + 1 _SQLite_Exec(-1, "UPDATE DishTable SET x2 = '" & $x2 & "',x1 = CURRENT_TIME,Menu = '" & $me & "',Dish = '" & $di & "',Rice = '" & $ri & "',Price = '" & $pri & "' WHERE Date = '" & $da & "' AND Account = '" & $ua & "';") EndIf _SQLite_Close () EndFunc Func InsertUser($acc1,$name1) _SQLite_Open($SQLite_Data_Path) _SQLite_QuerySingleRow(-1, "SELECT * FROM ID2Name WHERE Account = '" & $acc1 & "';", $aRow) $Temp = $aRow[0] If $Temp = "" Then _SQLite_Exec(-1, "Insert into ID2Name values (null,'" & $name1 & "','" & $acc1 &"',CURRENT_TIMESTAMP,1);") Else MsgBox(0,"ShowMe","已有此人,不建议还添加介个吃货!") EndIf _SQLite_Close () EndFunc Func TotalUser() _SQLite_Open($SQLite_Data_Path) $sql = "SELECT COUNT(*) FROM ID2Name;" _SQLite_QuerySingleRow(-1,$sql,$aRow) _SQLite_Close() Return $aRow[0] EndFunc Func SearchUser($acc1,$name1,$usernum) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($GUI_ListBox)) _SQLite_Open($SQLite_Data_Path) $s = "SELECT * FROM ID2Name WHERE " If StringLen($acc1) = 0 And StringLen($name1) <> 0 Then $s1 = "Name like '%" & $name1 & "%' AND Show = 1 ORDER BY ID DESC;" ElseIf StringLen($acc1) <> 0 And StringLen($name1) = 0 Then $s1 = "Account like '%" & $acc1 & "%' AND Show = 1 ORDER BY ID DESC;" ElseIf StringLen($acc1) <> 0 And StringLen($name1) <> 0 Then $s1 = "Name like '%" & $name1 & "%' AND Account like '%" & $acc1 & "%' AND Show = 1 ORDER BY ID DESC;" Else $s1 = "1 = 1 ORDER BY ID DESC;" EndIf $sql = $s & $s1 _SQLite_Query(-1, $sql, $hQuery) While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK If StringLen($usernum) = 2 And StringLen($aRow[0]) < 2 Then $aRow[0] = "0" & $aRow[0] ElseIf StringLen($usernum) = 3 And StringLen($aRow[0]) < 3 Then If StringLen($aRow[0]) = 1 Then $aRow[0] = "00" & $aRow[0] ElseIf StringLen($aRow[0]) = 2 Then $aRow[0] = "0" & $aRow[0] Else $aRow[0] = $aRow[0] EndIf ElseIf StringLen($usernum) = 4 And StringLen($aRow[0]) < 4 Then If StringLen($aRow[0]) = 1 Then $aRow[0] = "000" & $aRow[0] ElseIf StringLen($aRow[0]) = 2 Then $aRow[0] = "00" & $aRow[0] ElseIf StringLen($aRow[0]) = 3 Then $aRow[0] = "0" & $aRow[0] Else $aRow[0] = $aRow[0] EndIf ElseIf StringLen($usernum) = 1 Then $aRow[0] = $aRow[0] Else MsgBox(0,"Error","若真有10万多人,程序有问题,修改SearchUser()方法.若没有,电脑有病毒了!") EndIf _GUICtrlListView_AddItem($GUI_ListBox, $aRow[0]) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[1], 1) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[2], 2) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[3], 3) If $aRow[4] = 1 Then _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "活着", 4) ElseIf $aRow[4] = 0 Then _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "Over", 4) Else _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "未知", 4) EndIf WEnd _SQLite_Close() EndFunc Func SeearchCheckUser($acc1,$name1) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($GUI_ListBox)) _SQLite_Open($SQLite_Data_Path) $s = "SELECT * FROM ID2Name WHERE " If StringLen($acc1) = 0 And StringLen($name1) <> 0 Then $s1 = "Name = '" & $name1 & "' AND Show = 1 ORDER BY ID DESC;" ElseIf StringLen($acc1) <> 0 And StringLen($name1) = 0 Then $s1 = "Account = '" & $acc1 & "' AND Show = 1 ORDER BY ID DESC;" ElseIf StringLen($acc1) <> 0 And StringLen($name1) <> 0 Then $s1 = "Name = '" & $name1 & "' AND Account = '" & $acc1 & "' AND Show = 1 ORDER BY ID DESC;" Else $s1 = "1 = 1 ORDER BY ID DESC;" EndIf $sql = $s & $s1 _SQLite_QuerySingleRow(-1, $sql, $aRow) $Temp = $aRow[0] If $Temp = "" Then MsgBox(0,"ShowMe","我已经很用力的找了,但是没有找到,不管你信不信,反正我信了!") Else _GUICtrlListView_AddItem($GUI_ListBox, $aRow[0]) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[1], 1) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[2], 2) _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), $aRow[3], 3) If $aRow[4] = 1 Then _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "活着", 4) ElseIf $aRow[4] = 0 Then _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "Over", 4) Else _GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow[0]), "未知", 4) EndIf EndIf _SQLite_Close() EndFunc Func UpdateUser($id,$acc1,$name1) _SQLite_Open ($SQLite_Data_Path) $s = "UPDATE ID2Name SET " _SQLite_QuerySingleRow(-1, "SELECT * FROM ID2Name WHERE ID = '" & $id & "';", $aRow) $Temp = $aRow[0] $show = $aRow[4] If $Temp = "" Then MsgBox(0,"ShowMe","查无此人 * ID * !") Else _SQLite_QuerySingleRow(-1, "SELECT * FROM ID2Name WHERE Account = '" & $acc1 & "';", $aRow) $YES = $aRow[0] If $YES = "" Then If $show <> 1 And StringLen($acc1) = 0 And StringLen($name1) = 0 Then $updateshow = " Show = 1 WHERE ID = '" & $id & "';" $signshow = 0 ElseIf $show <> 1 And (StringLen($acc1) <> 0 Or StringLen($name1) <> 0) Then $updateshow = " , Show = 1 WHERE ID = '" & $id & "';" $signshow = 0 ElseIf $show = 1 And (StringLen($acc1) <> 0 Or StringLen($name1) <> 0) Then $updateshow = " WHERE ID = '" & $id & "';" $signshow = 0 Else $signshow = 1 EndIf If StringLen($acc1) = 0 And StringLen($name1) <> 0 Then $s1 = "Name = '" & $name1 & "'" ElseIf StringLen($acc1) <> 0 And StringLen($name1) = 0 Then $s1 = "Account = '" & $acc1 & "'" ElseIf StringLen($acc1) <> 0 And StringLen($name1) <> 0 Then $s1 = "Name = '" & $name1 & "' , Account = '" & $acc1 & "'" Else $s1 = "" If $signshow = 1 Then MsgBox(0,"ShowMe","没有需要执行更新的数据!") _SQLite_Close() Return EndIf EndIf $sql = $s & $s1 & $updateshow _SQLite_Exec(-1,$sql) Else MsgBox(0,"ShowMe","存在相同的工号,这是不合理的,重新设置工号。") EndIf EndIf _SQLite_Close() EndFunc Func DeleteUser($id,$sign) _SQLite_Open ($SQLite_Data_Path) _SQLite_QuerySingleRow(-1, "SELECT * FROM ID2Name WHERE ID = '" & $id & "';", $aRow) $Temp = $aRow[0] If $Temp = "" Then MsgBox(0,"ShowMe","查无此人!") Else If $sign = 0 Then _SQLite_Exec(-1, "UPDATE ID2Name SET Show = 0 WHERE ID = '" & $id & "';") ElseIf $sign = 1 Then _SQLite_Exec(-1, "DELETE FROM ID2Name WHERE ID = '" & $id & "';") Else MsgBox(0,"ERROR","很抱歉程序运行出错,请退出并检查是否有虫子入侵!~") EndIf EndIf _SQLite_Close () EndFunc Func FixedTime($time) GUICtrlSetState($searchOne,$GUI_DISABLE) GUICtrlSetState($flush,$GUI_DISABLE) GUICtrlSetState($createUser,$GUI_DISABLE) GUICtrlSetState($fix,$GUI_DISABLE) GUICtrlSetState($close,$GUI_DISABLE) $needPrice = "" While 1 $ftime = @HOUR If StringCompare($ftime,$time) = 0 Then $db = _SQLite_Open($SQLite_Data_Path) $need = "" $cal = @YEAR & "-" & @MON & "-" & @MDAY _SQLite_Query(-1, "SELECT * FROM DishTable WHERE Date = '" & $cal & "';", $hQuery) While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $data = $aRow[0] If $data = "" Then MsgBox(0,"ShowMe","尽日无人看微雨,精神食粮当饭吃!") ExitLoop Else $accFromTable = $aRow[3] $getData = $aRow[7] If StringCompare($getData,"NoBody") = 0 Then MsgBox(0,"ShowMe","无法搜索到这个家伙:" & $accFromTable & ",建议添加到用户维护中,以便结算今日订餐费用。") Else $needPrice = $accFromTable & "|" & $getData & "*" & $needPrice EndIf EndIf WEnd _SQLite_Close() ExitLoop Else Sleep(300000) EndIf WEnd GUICtrlSetState($searchOne,$GUI_ENABLE) GUICtrlSetState($flush,$GUI_ENABLE) GUICtrlSetState($createUser,$GUI_ENABLE) GUICtrlSetState($fix,$GUI_ENABLE) GUICtrlSetState($close,$GUI_ENABLE) Return $needPrice EndFunc Func CheckUserAndPrice($getNameAndPrice) _SQLite_Open($SQLite_Data_Path) $np = StringSplit($getNameAndPrice,"*") For $i = 1 To $np[0] - 1 $neednp = StringSplit($np[$i],"|") $needn = $neednp[1] $needp = $neednp[2] _SQLite_Query(-1, "SELECT Account,Name FROM ID2Name WHERE Show = 1 ORDER BY ID DESC;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK $data = $aRow[0] If $data = "" Then MsgBox(0,"ShowMe","为伊消得表憔悴!创建几个用户吧!") ExitLoop Else If StringInStr($needn,$aRow[0],2) <> 0 Then ;Send("^!z") If Not ProcessExists("notepad.exe") Then Run("notepad.exe") EndIf Sleep(3000) Send($aRow[0]) Send("{ENTER}") Send("亲爱的:" & $aRow[1] & " 先生/小姐" & @LF & " 您今天觅食的费用为:" & $needp & "整,请及时付费哦!~~~") Send("{ENTER}") Else ContinueLoop EndIf EndIf WEnd Next _SQLite_Close() EndFunc
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。