UserController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace admin\controllers;
  3. use biz\admin\services\AdminService;
  4. use biz\user\services\UserService;
  5. use Yii;
  6. use common\components\stringUtil;
  7. use common\components\util;
  8. class UserController extends BaseController
  9. {
  10. public $enableCsrfValidation = false;
  11. //客户列表 shish 2019.11.30
  12. public function actionGetList()
  13. {
  14. $get = Yii::$app->request->get();
  15. //组建where
  16. $type = isset($get['type']) ? $get['type'] : 0;
  17. $search = isset($get['search']) ? $get['search'] : '';
  18. $where = ['merchantId' => $this->merchantId];
  19. switch ($type) {
  20. case 1:
  21. //粉丝
  22. $where['subscribe'] = 1;
  23. break;
  24. case 2:
  25. //会员
  26. $where['isMember'] = 1;
  27. break;
  28. default:
  29. }
  30. if (!empty($search)) {
  31. if (stringUtil::isMobieNumber($search)) {
  32. $where['mobile'] = $search;
  33. } else {
  34. $where['userName'] = ['like', $search];
  35. }
  36. }
  37. $list = UserService::getUserList($where);
  38. util::success($list);
  39. }
  40. //获取客户基本和资产信息 shish 2019.11.30
  41. public function actionGetInfo()
  42. {
  43. $userId = Yii::$app->request->get('userId');
  44. $info = UserService::getUserInfo($userId);
  45. if (isset($info['merchantId']) == false || $this->merchantId != $info['merchantId']) {
  46. util::fail('没有权限');
  47. }
  48. util::success($info);
  49. }
  50. //获取客户基本、资产和订单完整信息 2019.11.30
  51. public function actionGetFullInfo()
  52. {
  53. $userId = Yii::$app->request->get('userId');
  54. $info = UserService::getFullUserInfo($userId);
  55. if (isset($info['merchantId']) == false || $this->merchantId != $info['merchantId']) {
  56. util::fail('没有权限');
  57. }
  58. util::success($info);
  59. }
  60. //添加客户,申请会员时会自动同步资产 shish 2019.11.30
  61. public function actionAdd()
  62. {
  63. $post = Yii::$app->request->post();
  64. if ($post['mobile'] != $post['confirmMobile']) {
  65. util::fail('二次输入手机号不一样');
  66. }
  67. $confirmPassword = isset($post['confirmPassword']) ? $post['confirmPassword'] : '';
  68. $verify = AdminService::verifyConfirmPassword($this->adminId, $confirmPassword);
  69. if ($verify == false) {
  70. util::fail('密码错误');
  71. }
  72. }
  73. }