TestController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace backend\controllers;
  3. use backend\helpers\RandomHelper;
  4. use backend\models\Mt4Trades;
  5. use common\helpers\MtKit;
  6. use common\lib\Mt4Deposit;
  7. use common\lib\Mt4ManagerApi;
  8. use yii\web\Controller;
  9. use yii\web\Response;
  10. class TestController extends Controller
  11. {
  12. public function actionTestOpenUser()
  13. {
  14. $result = MtKit::openUser(629060, RandomHelper::getRandomStringForMt4(), RandomHelper::getRandomStringForMt4(), RandomHelper::getRandomStringForMt4(),
  15. '测试' . time(), 'XCBVARSTDUSD', 'test@qq.com', '13800000000', 100, '中国', '广东', '深圳', 'sz', '', '', 0);
  16. return $this->outJson(1, $result);
  17. }
  18. public function actionTestOpenUserDemo()
  19. {
  20. $result = MtKit::openUserDemo(null, RandomHelper::getRandomStringForMt4(), RandomHelper::getRandomStringForMt4(), RandomHelper::getRandomStringForMt4(),
  21. '测试' . time(), 1, 'test@qq.com', '13800000000', 100, 'China', null, 'sz', 'sz', null, null, null);
  22. return $this->outJson(1, $result);
  23. }
  24. public function actionTestDeposit()
  25. {
  26. $query = Mt4Trades::find();
  27. $query->where(['LOGIN' => 20000021, 'CLOSE_TIME' => '1970-01-01 00:00:00']);
  28. $query->andWhere(['<', 'CMD', 2]);
  29. $result = $query->count();
  30. $api = new Mt4ManagerApi();
  31. // $result = $api->balance('deposit', '20000021', 100);
  32. $result = $api->userUpdate('20000005', ['enable_read_only' => 0]);
  33. return $this->outJson(1, $result);
  34. }
  35. public function actionTestGroups()
  36. {
  37. $result = MtKit::getGroups();
  38. return $this->outJson(1, $result);
  39. }
  40. public function actionOcean()
  41. {
  42. $cache = \Yii::$app->redis;
  43. $lastCode = $cache->set('ocean1111', 111);
  44. $lastCode = $cache->get('ocean1111');
  45. var_dump($lastCode);
  46. die('xxx');
  47. }
  48. }