UserController.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace saas\controllers;
  3. use biz\merchant\classes\MerchantExtendClass;
  4. use biz\merchant\services\MerchantAssetService;
  5. use biz\merchant\services\ShopService;
  6. use biz\retail\services\RetailAssetService;
  7. use biz\user\services\UserService;
  8. use common\components\httpUtil;
  9. use common\components\qrCodeUtil;
  10. use common\components\util;
  11. use Yii;
  12. class UserController extends BaseController
  13. {
  14. public function actionList()
  15. {
  16. $get = Yii::$app->request->get();
  17. $type = isset($get['type']) ? $get['type'] : -1;
  18. $where = [];
  19. switch ($type) {
  20. case 1:
  21. //粉丝
  22. $where['subscribe'] = 1;
  23. break;
  24. case 2:
  25. //会员
  26. $where['member>'] = -1;
  27. break;
  28. default:
  29. }
  30. $list = UserService::getUserList($where);
  31. $asset = RetailAssetService::getAsset();
  32. $list['asset'] = $asset;
  33. util::success($list);
  34. }
  35. //客户列表 shish 2019.11.30
  36. public function actionOaList()
  37. {
  38. $get = Yii::$app->request->get();
  39. $type = isset($get['type']) ? $get['type'] : -1;
  40. $merchantId = 12358;
  41. $where = ['merchantId' => $merchantId];
  42. switch ($type) {
  43. case 1:
  44. //粉丝
  45. $where['subscribe'] = 1;
  46. break;
  47. case 2:
  48. //会员
  49. $where['member>'] = -1;
  50. break;
  51. default:
  52. }
  53. $list = UserService::getUserList($where);
  54. $merchantAsset = MerchantAssetService::getByMerchantId($merchantId);
  55. $list['asset'] = $merchantAsset;
  56. util::success($list);
  57. }
  58. //会员申请码查看 shish 2020.2.15
  59. public function actionApplyCode()
  60. {
  61. $id = Yii::$app->request->get('id');
  62. $shop = ShopService::getById($id);
  63. $merchantId = isset($shop['merchantId']) ? $shop['merchantId'] : 0;
  64. if (empty($merchantId)) {
  65. util::fail('没有找到商家');
  66. }
  67. $url = MerchantExtendClass::getApplyMemberCode($merchantId);
  68. echo "<img width='300' src='{$url}' />";
  69. }
  70. //收款码查看 shish 2020.2.20
  71. public function actionGatheringCode()
  72. {
  73. $id = Yii::$app->request->get('id');
  74. $shop = ShopService::getById($id);
  75. $merchantId = isset($shop['merchantId']) ? $shop['merchantId'] : 0;
  76. if (empty($merchantId)) {
  77. util::fail('没有找到商家');
  78. }
  79. $url = Yii::$app->params['mDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $id;
  80. //强制转成https
  81. $url = httpUtil::becomeHttps($url);
  82. $logo = !empty($this->merchant['logo']) ? $webRoot . $this->merchant['logo'] : '';
  83. $gatheringQrcodeUrl = qrCodeUtil::generate($url, $unique, $logo, 10);
  84. }
  85. }