UserController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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\util;
  9. use Yii;
  10. class UserController extends BaseController
  11. {
  12. public function actionList()
  13. {
  14. $get = Yii::$app->request->get();
  15. $type = isset($get['type']) ? $get['type'] : -1;
  16. $where = [];
  17. switch ($type) {
  18. case 1:
  19. //粉丝
  20. $where['subscribe'] = 1;
  21. break;
  22. case 2:
  23. //会员
  24. $where['member>'] = -1;
  25. break;
  26. default:
  27. }
  28. $list = UserService::getUserList($where);
  29. $asset = RetailAssetService::getAsset();
  30. $list['asset'] = $asset;
  31. util::success($list);
  32. }
  33. //客户列表 shish 2019.11.30
  34. public function actionOaList()
  35. {
  36. $get = Yii::$app->request->get();
  37. $type = isset($get['type']) ? $get['type'] : -1;
  38. $merchantId = 12358;
  39. $where = ['merchantId' => $merchantId];
  40. switch ($type) {
  41. case 1:
  42. //粉丝
  43. $where['subscribe'] = 1;
  44. break;
  45. case 2:
  46. //会员
  47. $where['member>'] = -1;
  48. break;
  49. default:
  50. }
  51. $list = UserService::getUserList($where);
  52. $merchantAsset = MerchantAssetService::getByMerchantId($merchantId);
  53. $list['asset'] = $merchantAsset;
  54. util::success($list);
  55. }
  56. //会员申请码查看 shish 2020.2.15
  57. public function actionApplyCode()
  58. {
  59. $id = Yii::$app->request->get('id');
  60. $shop = ShopService::getById($id);
  61. $merchantId = isset($shop['merchantId']) ? $shop['merchantId'] : 0;
  62. if (empty($merchantId)) {
  63. util::fail('没有找到商家');
  64. }
  65. $url = MerchantExtendClass::getApplyMemberCode($merchantId);
  66. echo "<img width='100' src='{$url}' />";
  67. }
  68. }