Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fcae886
setup
jungjunhyung99 Sep 9, 2022
29e1773
Merge pull request #1 from jungjunhyung99/dev
jungjunhyung99 Sep 9, 2022
2af7b32
Test Commit
minho2618 Oct 12, 2022
3f95fba
Merge pull request #2 from jungjunhyung99/test
minho2618 Oct 12, 2022
d1b8a13
temp
jungjunhyung99 Nov 1, 2022
8cc0668
Merge pull request #3 from jungjunhyung99/dev
jungjunhyung99 Nov 1, 2022
ed7c666
temp2
jungjunhyung99 Nov 1, 2022
6f77987
Merge pull request #4 from jungjunhyung99/dev
jungjunhyung99 Nov 1, 2022
cc63d9f
백엔드 기본 구성
minho2618 Nov 6, 2022
f59dc2a
11.06 백엔드 구성
minho2618 Nov 6, 2022
4d6cefe
11/07 DbConnect.php 깃허브에 올리지 않도록 변경(보안이슈)
minho2618 Nov 7, 2022
1decb5c
Merge pull request #5 from jungjunhyung99/backend
minho2618 Nov 7, 2022
69d700b
add a game
jungjunhyung99 Nov 14, 2022
7f93f9d
game
jungjunhyung99 Nov 15, 2022
89d1d11
temp game
jungjunhyung99 Nov 18, 2022
1635b74
키오스크 기능(임시) 추가
jungjunhyung99 Nov 22, 2022
0ce09eb
middle report
jungjunhyung99 Nov 28, 2022
2c0ef2d
기능개선
jungjunhyung99 Dec 28, 2022
989d50b
12/28 PHP 수정
minho2618 Dec 28, 2022
1309ad3
Merge pull request #6 from jungjunhyung99/backend-2
minho2618 Dec 28, 2022
86b4a5c
1월 5일 branch 생성
minho2618 Jan 5, 2023
40789a4
카페 키오스크
jungjunhyung99 Jan 7, 2023
626e34b
Merge branch 'main' of https://github.com/jungjunhyung99/KT-kiosk
jungjunhyung99 Jan 7, 2023
56b70d7
게임 개선
jungjunhyung99 Jan 8, 2023
8fc4115
글자게임 완성
jungjunhyung99 Jan 21, 2023
42419d3
백엔드 코드 수정
minho2618 Jan 25, 2023
92a1cd3
Merge pull request #7 from jungjunhyung99/backend
minho2618 Jan 25, 2023
782b60c
last dance
jungjunhyung99 Jan 25, 2023
eb3b51d
last
jungjunhyung99 Jan 25, 2023
e2456c8
Merge pull request #8 from jungjunhyung99/real
jungjunhyung99 Jan 25, 2023
0523aad
complete
jungjunhyung99 Jan 27, 2023
f0b019c
g
jungjunhyung99 Jan 27, 2023
8953420
Merge pull request #9 from jungjunhyung99/real
jungjunhyung99 Jan 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
KT-react/api/DbConnect.php

23 changes: 23 additions & 0 deletions KT-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
70 changes: 70 additions & 0 deletions KT-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
91 changes: 91 additions & 0 deletions KT-react/api/kiosk_answer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");

include 'DBConnect.php';
$objDb = new DbConnect();
$conn = $objDb->connect();


$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'POST':
$input = json_decode(file_get_contents('php://input'));

$sql = "SELECT * FROM kiosk_answer WHERE store = :store AND level = :level";
$stmt = $conn->prepare($sql);

$stmt->bindParam(':store', $input->store);
$stmt->bindParam(':level', $input->level);

if ($stmt->execute()) {
$result = $stmt->fetch(PDO::FETCH_ASSOC);
} else {
echo "stmt execute failed";
return;
}
$json_answer = json_encode($input->basket);
$answer = json_decode($json_answer, true);

// print_r($answer);
// print_r($result);
$result_basket = json_decode($result["basket"], true);

// print_r($result_basket);

ksort($result_basket);
ksort($answer);


$return1 = array_diff_assoc_recursive($result_basket, $answer);
$return2 = array_diff_assoc_recursive($answer, $result_basket);

$return = array(
'in' => $return1,
'not_in' => $return2
);

echo json_encode($return);

break;

case 'GET':
$sql = "SELECT * FROM kiosk_answer WHERE store = :store AND level = :level";
$stmt = $conn->prepare($sql);

$stmt->bindParam(':store', $_GET['store']);
$stmt->bindParam(':level', $_GET['level']);

$stmt->execute();

$result = $stmt->fetch(PDO::FETCH_ASSOC);

echo json_encode($result);

break;
}


function array_diff_assoc_recursive($array1, $array2)
{
$difference=array();
foreach ($array1 as $key => $value) {
if ($key === "name") {
$difference[$key] = $value;
}
if (is_array($value)) {
if (!isset($array2[$key]) || !is_array($array2[$key])) {
$difference[$key] = $value;
} else {
$new_diff = array_diff_assoc_recursive($value, $array2[$key]);
if (!empty($new_diff)) {
$difference[$key] = $new_diff;
}
}
} elseif (!array_key_exists($key, $array2) || $array2[$key] !== $value) {
$difference[$key] = $value;
}
}
return $difference;
}
49 changes: 49 additions & 0 deletions KT-react/api/kiosk_result.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

// CORS 문제 해결용
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");

// DbConnect 참조
include 'DBConnect.php';
$objDb = new DbConnect();
$conn = $objDb->connect();

$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
// kiosk_result
case 'POST':
$result = json_decode(file_get_contents('php://input'));

$sql = "INSERT INTO kiosk_result(id, store, level, basket, start_time, end_time) VALUES(NULL, :store, :level, :basket, :start_time, :end_time)";
$stmt = $conn->prepare($sql);

$start_time = date('Y-m-d');
$end_time = date('Y-m-d');

$stmt->bindParam(':store', $result->store);
$stmt->bindParam(':level', $result->level);

$basketArr = json_encode($result->basket);
$stmt->bindValue(':basket', $basketArr);

$stmt->bindParam(':start_time', $result->start_time);
$stmt->bindParam(':end_time', $result->end_time);

if ($stmt->execute()) {
$response = ['status' => 1, 'message' => 'Record created successfully.'];
} else {
$response = ['status' => 0, 'message' => 'Failed to create record.'];
}
echo json_encode($response);
break;

case 'GET':
$sql = "SELECT * FROM kiosk_result";
$stmt = $conn->prepare($sql);
$stmt->execute();
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($users);

break;
}
Loading