cxfoot/commands/TestController.php
2023-10-27 14:25:12 +08:00

61 lines
1.9 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2021年6月8日
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\commands;
use app\modules\api\models\MsgCentreForm;
use yii\console\Controller;
use yii\console\ExitCode;
use app\models\Balance;
/**
* This command echoes the first argument that you have entered.
*
* This command is provided as an example for you to learn how to create console commands.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class TestController extends Controller
{
/**
* This command echoes what you have entered as the message.
* @param string $message the message to be echoed.
* @return int Exit code
*/
public function actionTest()
{
return ExitCode::OK;
}
public function actionAdd()
{
$array = ['ball_mark' => '高尔夫球车','ball_cart' => 'G30','start_date' =>'1667803007','end_date' => '1668803007','price' => '100','object_id' => 1];
$data = MsgCentreForm::add(6,3,$array);
return $this->responseHandler($data);
}
public function actionAddRedisBall()
{
$redis = \Yii::$app->redis;
$json = '{"status":true,"data":{"orig_data":"n2fT0DQ2MDExNTIxMDkxNzQ3MgAAAAAAODk4NjAzMjEyNDU5MjYzNjczOTYfAAAAZAAAAAAAAAAAAAAAAAAAAAC1","TIMESTAMP":-1620585520,"IMEI":"460115210917472","SIMID":"89860321245926367396","CSQ":31,"OPERATION_ENABLE":0,"OPERATION_LEVEL":0,"MODE":0,"ELEC_PERCENT":100,"RANGE":0,"RANGE_CURRENT":0,"RUNTIME":0,"RUNTIME_CURRENT":0}}';
$key = 'api:cxaibc:mqtt:data:10086_Detail';
$redis->set($key,$json);
$key2 = "api:cxaibc:mqtt:warn_status:10086";
$json2 = '{"WARN_HARDWARE":1668813994,"WARN_LOW_POWER":1667813994,"WARN_FALLDOWN":1667813994,"GPS_STORE": 1667813994,"GPS_CALL":1667813994}';
$redis->set($key2,$json2);
echo 'ok';
}
}