Merge master
commit
85d55df6fe
@ -1,10 +1,11 @@
|
||||
config/config.php
|
||||
config/config-backup.php
|
||||
config/conf.php
|
||||
scripts/.loc_hash
|
||||
.idea
|
||||
/public/uploads
|
||||
public/uploads/*
|
||||
!public/uploads/default.png
|
||||
/tmp
|
||||
vendor
|
||||
composer.json
|
||||
composer.lock
|
||||
/src/Framework/SwiftMailerFactory.php
|
||||
/src/Framework/SwiftMailerFactory.php
|
||||
|
@ -0,0 +1,82 @@
|
||||
.container_main {
|
||||
background-color: #2E2E2E;
|
||||
}
|
||||
.tableau {
|
||||
width:100%;
|
||||
background-color: white;
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
/* border-spacing: 1px; // pour contrer les style de base */
|
||||
}
|
||||
/* Entête */
|
||||
.tableau th {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
padding: 0rem;
|
||||
text-align: center;
|
||||
border-left: lightgray 1px solid;
|
||||
background-color:#999690;
|
||||
color:#fff;
|
||||
}
|
||||
.tableau .colonne_image {
|
||||
padding: 0; !important;
|
||||
}
|
||||
.tableau td {
|
||||
border-bottom: solid 1px black;
|
||||
border-left: lightgray 1px solid;
|
||||
padding-left: 0.7rem;
|
||||
}
|
||||
.align_droite {
|
||||
|
||||
text-align: right;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
.breadcrumb {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.toggle_radio {
|
||||
position: relative;
|
||||
background: rgba(0,0,0,.1);
|
||||
margin: -3px auto 4px 10px;
|
||||
overflow: hidden;
|
||||
padding: 0 !important;
|
||||
border-radius: 50px;
|
||||
height: 28px;
|
||||
width: 215px;
|
||||
}
|
||||
.toggle_radio > * {
|
||||
float: left;
|
||||
}
|
||||
.toggle_radio input[type=radio]{
|
||||
display: none;
|
||||
}
|
||||
.toggle_radio label{
|
||||
color: rgba(0,0,0,.9);
|
||||
z-index: 0;
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 20px;
|
||||
margin: 3px 3px;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.toggle_option_slider{
|
||||
width: 100px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
border-radius: 50px;
|
||||
transition: all .4s ease;
|
||||
}
|
||||
|
||||
#first_toggle:checked ~ .toggle_option_slider{
|
||||
background: rgba(0,0,0,.3);
|
||||
left: 3px;
|
||||
}
|
||||
#second_toggle:checked ~ .toggle_option_slider{
|
||||
background: rgba(0,0,0,.3);
|
||||
left: 109px;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
[ "$EUID" -ne 0 ] && sudo="sudo" || sudo=""
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
|
||||
start=`date +%s`
|
||||
date=$(date +'%d-%m-%y à %H:%M')
|
||||
echo "### $date ###"
|
||||
|
||||
## Initialisation
|
||||
DUNITER=$(grep g1_node $SCRIPTPATH/../config/config.php | awk '{ print $3}' | tr -d ';' | tr -d "'")
|
||||
TXBLOCKS=$(curl -s $DUNITER/blockchain/with/tx | jq '.result.blocks[]')
|
||||
TXBLOCKS=$(echo "$TXBLOCKS" | tail -n 2 | tr '\n' ' ')
|
||||
keyword="\[Achat GMarche] : "
|
||||
[ ! -e $SCRIPTPATH/.loc_hash ] && touch $SCRIPTPATH/.loc_hash
|
||||
|
||||
## Récupération des transactions avec commentaire GMarche
|
||||
|
||||
for i in $TXBLOCKS; do
|
||||
result=$(curl -s $DUNITER/blockchain/block/$i | jq '.transactions[].hash, .transactions[].comment' | grep -v '""' | tr -d '"' | grep -B1 "$keyword")
|
||||
rhash=$(echo "$result" | head -n1)
|
||||
rcom=$(echo "$result" | tail -n1)
|
||||
if [[ ! -z $result && -z $(grep $rhash $SCRIPTPATH/.loc_hash) ]]; then
|
||||
isSell+=$(echo -e "$rcom;")
|
||||
echo "$rhash" >> $SCRIPTPATH/.loc_hash
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
## Ajout des transactions en piscine pour les users GMarche
|
||||
|
||||
req="SELECT pubkey FROM users;"
|
||||
usersPubkeys=$($sudo mysql --database gmarche -e "$req" | grep .)
|
||||
|
||||
for i in $usersPubkeys; do
|
||||
result=$(curl -s $DUNITER/tx/history/$i/pending | jq '. | select(.history.sending == [])' | jq '.history.pending[].hash,.history.pending[].comment' | tr -d '"')
|
||||
rhash=$(echo "$result" | head -n1)
|
||||
rcom=$(echo "$result" | tail -n1)
|
||||
if [[ ! -z $result && -z $(grep $rhash $SCRIPTPATH/.loc_hash) ]]; then
|
||||
isSell+=$(echo -e "$rcom;")
|
||||
echo "$rhash" >> $SCRIPTPATH/.loc_hash
|
||||
fi
|
||||
done
|
||||
|
||||
## Retrait de l'identifiant gmarche des commentaires
|
||||
isSell=$(echo $isSell | sed "s/$keyword//g")
|
||||
|
||||
[[ ! -z $isSell ]] && echo "$isSell est vendu"
|
||||
|
||||
## Retrait d'un quantité pour les articles vendu
|
||||
IFS=';'; ADDR=($isSell); unset IFS;
|
||||
for i in "${ADDR[@]}"; do
|
||||
#req="UPDATE products SET status = 'solde' WHERE name = '$i';"
|
||||
req="UPDATE products SET quantite = CASE WHEN quantite = 0 THEN quantite ELSE quantite - 1 END WHERE name = '$i';"
|
||||
$sudo mysql --database gmarche -e "$req"
|
||||
done
|
||||
|
||||
#$sudo mysql --database gmarche -e "SELECT name,status FROM products;"
|
||||
|
||||
end=`date +%s`
|
||||
runtime=$((end-start))
|
||||
echo "Temps d'execution: ${runtime}s"
|
||||
exit 0
|
Loading…
Reference in New Issue