|
@@ -178,7 +178,7 @@ class Robots
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
foreach (self::$robots as $robot) {
|
|
foreach (self::$robots as $robot) {
|
|
|
- (new RobotsInfoRds)->set(false, $robot['uid'], $robot);
|
|
|
|
|
|
|
+ (new RobotsInfoRds)->hset(false, $robot['uid'], $robot);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -187,7 +187,7 @@ class Robots
|
|
|
*/
|
|
*/
|
|
|
public static function from_redis()
|
|
public static function from_redis()
|
|
|
{
|
|
{
|
|
|
- $robots = (new RobotsInfoRds)->getAll(false);
|
|
|
|
|
|
|
+ $robots = (new RobotsInfoRds)->hget_all(false);
|
|
|
foreach ($robots as $k => $v) {
|
|
foreach ($robots as $k => $v) {
|
|
|
$robots[$k] = json_decode($v, true);
|
|
$robots[$k] = json_decode($v, true);
|
|
|
}
|
|
}
|
|
@@ -215,14 +215,14 @@ class Robots
|
|
|
$value = tw_divf(tw_rand(500, 5000), 100.0, 2);
|
|
$value = tw_divf(tw_rand(500, 5000), 100.0, 2);
|
|
|
|
|
|
|
|
// get - update - set
|
|
// get - update - set
|
|
|
- $srobot = (new RobotsInfoRds)->get(false, $uid);
|
|
|
|
|
|
|
+ $srobot = (new RobotsInfoRds)->hget(false, $uid);
|
|
|
if (!$srobot) {
|
|
if (!$srobot) {
|
|
|
console::log('not found: uid=' . $uid);
|
|
console::log('not found: uid=' . $uid);
|
|
|
}
|
|
}
|
|
|
$robot = json_decode($srobot, true);
|
|
$robot = json_decode($srobot, true);
|
|
|
$robot['value'] = tw_addf($robot['value'], $value, 2);
|
|
$robot['value'] = tw_addf($robot['value'], $value, 2);
|
|
|
|
|
|
|
|
- (new RobotsInfoRds)->set(false, $uid, $robot);
|
|
|
|
|
|
|
+ (new RobotsInfoRds)->hset(false, $uid, $robot);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -239,7 +239,7 @@ class Robots
|
|
|
*/
|
|
*/
|
|
|
public static function first_n_by_value(int $n): array
|
|
public static function first_n_by_value(int $n): array
|
|
|
{
|
|
{
|
|
|
- $robots = (new RobotsInfoRds)->getAll(false);
|
|
|
|
|
|
|
+ $robots = (new RobotsInfoRds)->hget_all(false);
|
|
|
foreach ($robots as $uid => $robot) {
|
|
foreach ($robots as $uid => $robot) {
|
|
|
$robots[$uid] = json_decode($robot, true);
|
|
$robots[$uid] = json_decode($robot, true);
|
|
|
}
|
|
}
|