MainController.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. namespace ghs\controllers;
  3. use common\components\imgUtil;
  4. use common\components\util;
  5. use Yii;
  6. use GatewayClient\Gateway;
  7. class MainController extends BaseController
  8. {
  9. public function actionDemo()
  10. {
  11. return $this->renderPartial('demo');
  12. }
  13. public function actionIndex()
  14. {
  15. return $this->renderPartial('index');
  16. }
  17. //新客户 shish 2019.12.29
  18. public function actionVisit()
  19. {
  20. $data = json_encode(array(
  21. 'type' => 'msg',
  22. 'msg' => 'aaaa',
  23. ));
  24. $id = 'merchantConsole_' . $this->sjId;
  25. $online = Gateway::getClientIdByUid($id);
  26. if ($online) {
  27. //直接发送
  28. Gateway::sendToUid($id, json_encode($data));
  29. } else {
  30. //保存
  31. }
  32. }
  33. //新订单 shish 2019.12.29
  34. public function actionOrder()
  35. {
  36. $data = json_encode(array(
  37. 'type' => 'msg',
  38. 'msg' => 'aaaa',
  39. ));
  40. $id = 'merchantConsole_' . $this->sjId;
  41. $online = Gateway::getClientIdByUid($id);
  42. if ($online) {
  43. //直接发送
  44. Gateway::sendToUid($id, json_encode($data));
  45. } else {
  46. //保存
  47. }
  48. }
  49. //经营概况 shish 2021.1.27
  50. public function actionProfile()
  51. {
  52. $base = [
  53. 'balance' => 5020.00,
  54. 'mayGathering' => 10,
  55. 'mayPay' => 20,
  56. 'stockCost' => 2000,
  57. 'stockNum' => 100,
  58. 'stockWarning' => 5,
  59. 'today' => 90,
  60. 'todayCompareYesterday' => -5,
  61. 'latestSeven' => 9000,
  62. 'latestSevenSameTerm' => 10,
  63. 'latestThirty' => 8000,
  64. 'latestThirtySameTerm' => -9,
  65. ];
  66. $more = [
  67. 'today' => [
  68. 'income' => 10,
  69. 'expend' => 2,
  70. 'saleNum' => 1,
  71. 'saleAmount' => 100,
  72. 'purchaseNum' => 2,
  73. 'purchaseAmount' => 3,
  74. ],
  75. 'yesterday' => [
  76. 'income' => 10,
  77. 'expend' => 2,
  78. 'saleNum' => 1,
  79. 'saleAmount' => 100,
  80. 'purchaseNum' => 2,
  81. 'purchaseAmount' => 3,
  82. ],
  83. 'latestSeven' => [
  84. 'income' => 10,
  85. 'expend' => 2,
  86. 'saleNum' => 1,
  87. 'saleAmount' => 100,
  88. 'purchaseNum' => 2,
  89. 'purchaseAmount' => 3,
  90. ],
  91. 'latestThirty' => [
  92. 'income' => 10,
  93. 'expend' => 2,
  94. 'saleNum' => 1,
  95. 'saleAmount' => 100,
  96. 'purchaseNum' => 2,
  97. 'purchaseAmount' => 3,
  98. ],
  99. ];
  100. util::success(['base' => $base, 'more' => $more]);
  101. }
  102. //我的 shish 2021.1.30
  103. public function actionMy()
  104. {
  105. $shop = $this->shop;
  106. $balance = $shop['balance'] ?? 0.00;
  107. $txBalance = $shop['txBalance'] ?? 0.00;
  108. $sj = $this->sj;
  109. $shopImg = $shop['avatar'] ?? '';
  110. $deadline = $sj['deadline'] ?? '';
  111. $relation = $this->shopAdmin;
  112. $adminName = $relation['adminName'];
  113. $shopAdminId = $relation['id'];
  114. $mobile = $relation['mobile'] ?? '';
  115. $sjName = $sj['merchantName'] ?? '';
  116. $shopName = $shop['shopName'] ?? '';
  117. $cashAccount = $shop['cashAccount'] ?? '';
  118. $data = [
  119. 'balance' => $balance,
  120. 'txBalance' => $txBalance,
  121. 'deadline' => $deadline,
  122. 'adminName' => $adminName,
  123. 'adminMobile' => $mobile,
  124. 'sjName' => $sjName,
  125. 'shopName' => $shopName,
  126. 'shopImg' => $shopImg,
  127. 'cashAccount' => $cashAccount,
  128. 'shopAdminId' => $shopAdminId,
  129. 'shopId' => $this->shopId,
  130. ];
  131. util::success($data);
  132. }
  133. }