MainController.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. namespace ghs\controllers;
  3. use common\components\util;
  4. use Yii;
  5. use GatewayClient\Gateway;
  6. class MainController extends BaseController
  7. {
  8. public function actionDemo()
  9. {
  10. return $this->renderPartial('demo');
  11. }
  12. public function actionIndex()
  13. {
  14. return $this->renderPartial('index');
  15. }
  16. //新客户 shish 2019.12.29
  17. public function actionVisit()
  18. {
  19. $data = json_encode(array(
  20. 'type' => 'msg',
  21. 'msg' => 'aaaa',
  22. ));
  23. $id = 'merchantConsole_' . $this->sjId;
  24. $online = Gateway::getClientIdByUid($id);
  25. if ($online) {
  26. //直接发送
  27. Gateway::sendToUid($id, json_encode($data));
  28. } else {
  29. //保存
  30. }
  31. }
  32. //新订单 shish 2019.12.29
  33. public function actionOrder()
  34. {
  35. $data = json_encode(array(
  36. 'type' => 'msg',
  37. 'msg' => 'aaaa',
  38. ));
  39. $id = 'merchantConsole_' . $this->sjId;
  40. $online = Gateway::getClientIdByUid($id);
  41. if ($online) {
  42. //直接发送
  43. Gateway::sendToUid($id, json_encode($data));
  44. } else {
  45. //保存
  46. }
  47. }
  48. //经营概况 shish 2021.1.27
  49. public function actionProfile()
  50. {
  51. $base = [
  52. 'balance' => 5020.00,
  53. 'mayGathering' => 10,
  54. 'mayPay' => 20,
  55. 'stockCost' => 2000,
  56. 'stockNum' => 100,
  57. 'stockWarning' => 5,
  58. 'today' => 90,
  59. 'todayCompareYesterday' => -5,
  60. 'latestSeven' => 9000,
  61. 'latestSevenSameTerm' => 10,
  62. 'latestThirty' => 8000,
  63. 'latestThirtySameTerm' => -9,
  64. ];
  65. $more = [
  66. 'today' => [
  67. 'income' => 10,
  68. 'expend' => 2,
  69. 'saleNum' => 1,
  70. 'saleAmount' => 100,
  71. 'purchaseNum' => 2,
  72. 'purchaseAmount' => 3,
  73. ],
  74. 'yesterday' => [
  75. 'income' => 10,
  76. 'expend' => 2,
  77. 'saleNum' => 1,
  78. 'saleAmount' => 100,
  79. 'purchaseNum' => 2,
  80. 'purchaseAmount' => 3,
  81. ],
  82. 'latestSeven' => [
  83. 'income' => 10,
  84. 'expend' => 2,
  85. 'saleNum' => 1,
  86. 'saleAmount' => 100,
  87. 'purchaseNum' => 2,
  88. 'purchaseAmount' => 3,
  89. ],
  90. 'latestThirty' => [
  91. 'income' => 10,
  92. 'expend' => 2,
  93. 'saleNum' => 1,
  94. 'saleAmount' => 100,
  95. 'purchaseNum' => 2,
  96. 'purchaseAmount' => 3,
  97. ],
  98. ];
  99. util::success(['base' => $base, 'more' => $more]);
  100. }
  101. }