2 files deleted
633 files added
79 files modified
| | |
| | | // 活动分类 |
| | | $category = CategoryModel::getAll(); |
| | | $model = ActivityModel::detail($activity_id); |
| | | $model = $model->toArray(); |
| | | // 报名时间 |
| | | $model['register_start_time'] = date("Y-m-d H:i:s", $model['register_start_time']); |
| | | $model['register_end_time'] = date("Y-m-d H:i:s", $model['register_end_time']); |
| | | //活动时间 |
| | | $model['activity_start_time'] = date("Y-m-d H:i:s", $model['activity_start_time']); |
| | | $model['activity_end_time'] = date("Y-m-d H:i:s", $model['activity_end_time']); |
| | | |
| | | return $this->renderSuccess('', compact('category', 'model')); |
| | | } |
| | | // 活动详情 |
| | | $model = ActivityModel::detail($activity_id); |
| | | $data = json_decode($this->request->post('formData', '', null), true); |
| | | if(empty($data['start_time']) || empty($data['end_time'])){ |
| | | if(empty($data['activity_start_time']) || empty($data['activity_end_time'])){ |
| | | return $this->renderError('请选择活动时间'); |
| | | } |
| | | if (empty($data['latitude'])) { |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Apply as bonusApplyModel; |
| | | use app\common\model\plus\bonus\Setting; |
| | | use app\common\exception\BaseException; |
| | | |
| | | /** |
| | | * 队长申请 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | // 当前用户 |
| | | private $user; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | $this->user = $this->getUser(); // 用户信息 |
| | | } |
| | | |
| | | /** |
| | | * 提交队长申请 |
| | | */ |
| | | public function submit() |
| | | { |
| | | $data = $this->postData(); |
| | | if (empty($data['name']) || empty($data['mobile'])) { |
| | | throw new BaseException(['msg' => '用户名或者手机号为空']); |
| | | } |
| | | $model = new bonusApplyModel; |
| | | if ($model->submit($this->user, $data)) { |
| | | return $this->renderSuccess('成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | |
| | | /* |
| | | *获取队长协议 |
| | | */ |
| | | public function getAgreement() |
| | | { |
| | | $model = new Setting(); |
| | | $data = $model->getItem('license'); |
| | | return $this->renderSuccess('', compact('data')); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\common\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as bonusUserModel; |
| | | use app\common\exception\BaseException; |
| | | |
| | | /** |
| | | * 队长申请 |
| | | */ |
| | | class Bonus extends Controller |
| | | { |
| | | // 当前用户 |
| | | private $user; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | $this->user = $this->getUser(); // 用户信息 |
| | | //分红设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /* |
| | | *获取队长协议 |
| | | */ |
| | | public function canBuy() |
| | | { |
| | | $canBuy = Setting::isOpen() && Setting::isLimitBuy() && bonusUserModel::isBonusUser($this->user['user_id']); |
| | | $limit_word = $this->setting['basic']['values']['limit_word']; |
| | | return $this->renderSuccess('', compact('canBuy', 'limit_word')); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as bonusUserModel; |
| | | use app\api\model\plus\bonus\Cash as CashModel; |
| | | |
| | | /** |
| | | * 队长提现 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | private $user; |
| | | |
| | | private $bonus; |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 队长用户信息 |
| | | $this->bonus = bonusUserModel::detail($this->user['user_id']); |
| | | // 队长设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 提交提现申请 |
| | | */ |
| | | public function submit($data) |
| | | { |
| | | $formData = json_decode(htmlspecialchars_decode($data), true); |
| | | |
| | | $model = new CashModel; |
| | | if ($model->submit($this->bonus, $formData)) { |
| | | return $this->renderSuccess('申请提现成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | |
| | | /** |
| | | * 队长提现明细 |
| | | */ |
| | | public function lists($status = -1) |
| | | { |
| | | |
| | | $model = new CashModel; |
| | | return $this->renderSuccess('', [ |
| | | // 提现明细列表 |
| | | 'list' => $model->getList($this->user['user_id'], (int)$status,$this->postData()), |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as bonusUserModel; |
| | | use app\api\model\plus\bonus\Order as OrderModel; |
| | | |
| | | /** |
| | | * 队长订单 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | // 当前用户 |
| | | private $user; |
| | | // 队长用户信息 |
| | | private $Bonus; |
| | | // 队长设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 队长用户信息 |
| | | $this->Bonus = bonusUserModel::detail($this->user['user_id']); |
| | | // 队长设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 队长订单列表 |
| | | */ |
| | | public function lists($settled = -1) |
| | | { |
| | | $model = new OrderModel; |
| | | return $this->renderSuccess('', [ |
| | | // 提现明细列表 |
| | | 'list' => $model->getList($this->user['user_id'], (int)$settled), |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as bonusUserModel; |
| | | use app\common\service\qrcode\PosterService; |
| | | |
| | | /** |
| | | * 推广二维码 |
| | | */ |
| | | class Qrcode extends Controller |
| | | { |
| | | // 当前用户 |
| | | private $user; |
| | | // 队长 |
| | | private $bonus; |
| | | // 分销设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 队长用户信息 |
| | | $this->bonus = bonusUserModel::detail($this->user['user_id']); |
| | | // 队长设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 获取推广二维码 |
| | | */ |
| | | public function poster($source) |
| | | { |
| | | $Qrcode = new PosterService($this->bonus, $source); |
| | | return $this->renderSuccess('', [ |
| | | // 二维码图片地址 |
| | | 'qrcode' => $Qrcode->getImage(), |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\bonus; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as bonusUserModel; |
| | | use app\api\model\plus\agent\User as agentUserModel; |
| | | use app\api\model\plus\bonus\Referee as RefereeModel; |
| | | |
| | | /** |
| | | * 我的团队 |
| | | */ |
| | | class Team extends Controller |
| | | { |
| | | // 用户信息 |
| | | private $user; |
| | | // 队长用户信息 |
| | | private $bonus; |
| | | // 队长设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 队长用户信息 |
| | | $this->bonus = bonusUserModel::detail($this->user['user_id'],['user', 'referee','grade']); |
| | | // 队长设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 我的团队列表 |
| | | */ |
| | | public function lists($level = -1) |
| | | { |
| | | $model = new RefereeModel; |
| | | return $this->renderSuccess('', [ |
| | | // 队长用户信息 |
| | | 'bonus' => $this->bonus, |
| | | // 我的团队列表 |
| | | 'list' => $model->getList($this->user['user_id'], (int)$level), |
| | | // 基础设置 |
| | | 'setting' => $this->setting['basic']['values'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | ]); |
| | | } |
| | | } |
| | |
| | | use app\api\model\plus\business\chat\Chat as ChatModel; |
| | | use app\api\model\plus\business\chat\Conversation as ConversationModel; |
| | | use app\api\model\plus\business\chat\Participant; |
| | | use app\api\model\settings\Setting as SettingModel; |
| | | use app\api\model\user\User as UserModel; |
| | | use app\common\model\plus\business\Business as BusinessModel; |
| | | |
| | |
| | | // 更新会话时间 |
| | | $conversationModel = new ConversationModel(); |
| | | $conversationModel->updateConversationTime($conversationId); |
| | | |
| | | // 获取刚发送的消息 |
| | | $message = $chatModel->with(['sender'])->find($chatModel->chat_id); |
| | | |
| | | return $this->renderSuccess('发送成功', $message ? $message->toArray() : []); |
| | | // 准备WebSocket消息数据 |
| | | $wsMessage = [ |
| | | 'type' => 'message', |
| | | 'user_id' => $userId, |
| | | 'to_user_id' => 0, // 需要确定接收者ID |
| | | 'content' => $content, |
| | | 'conversation_id' => $conversationId, |
| | | 'business_card_id' => $businessCardId, |
| | | 'chat_id' => $chatModel->chat_id, |
| | | 'time' => date('Y-m-d H:i:s') |
| | | ]; |
| | | |
| | | // 确定接收者ID |
| | | $participantModel = new Participant(); |
| | | $participants = $participantModel->where('conversation_id', $conversationId) |
| | | ->where('user_id', '<>', $userId) |
| | | ->select(); |
| | | |
| | | if (!empty($participants)) { |
| | | $wsMessage['to_user_id'] = $participants[0]['user_id']; |
| | | } |
| | | |
| | | return $this->renderSuccess('发送成功', [ |
| | | 'message' => $chatModel->toArray(), |
| | | 'ws_message' => $wsMessage |
| | | ]); |
| | | } else { |
| | | return $this->renderError('发送失败'); |
| | | } |
| | |
| | | |
| | | $conversationModel = new ConversationModel(); |
| | | $conversations = $conversationModel->getUserConversations($param); |
| | | |
| | | // 为每个会话添加未读消息数量 |
| | | $chatModel = new ChatModel(); |
| | | foreach ($conversations as &$conversation) { |
| | | $conversation['unread_count'] = $chatModel->getUnreadCount($conversation['conversation_id'], $param['user_id']); |
| | | |
| | | $chatData=$chatModel->where('conversation_id',$conversation['conversation_id'])->order('create_time','desc')->find(); |
| | | // 获取最后一条消息 |
| | | if (!empty($conversation['messages'])) { |
| | | $conversation['last_message'] = end($conversation['messages']); |
| | | if (!empty($chatData)) { |
| | | $conversation['last_message'] = $chatData; |
| | | } |
| | | } |
| | | |
| | |
| | | $user = $this->getUser(); |
| | | $userId = $user['user_id']; |
| | | |
| | | $chatId = $this->request->post('chat_id/d', 0); |
| | | $conversationId = $this->request->post('conversation_id/d', 0); |
| | | $param=request()->param(); |
| | | |
| | | if (empty($chatId) && empty($conversationId)) { |
| | | if (empty($param['chat_id']) && empty($param['conversation_id'])) { |
| | | return $this->renderError('参数错误'); |
| | | } |
| | | |
| | | $chatModel = new ChatModel(); |
| | | |
| | | if (!empty($chatId)) { |
| | | if (!empty($param['chat_id'])) { |
| | | // 标记单条消息为已读 |
| | | $result = $chatModel->markAsRead($chatId, $userId); |
| | | $result = $chatModel->markAsRead($param['chat_id'], $userId); |
| | | $error=$chatModel->getError(); |
| | | } else { |
| | | $chatDate=$chatModel->where('conversation_id',$conversationId)->where('sender_id','<>',$userId)->find(); |
| | | $chatDate=$chatModel->where('conversation_id',$param['conversation_id'])->where('sender_id','<>',$userId)->find(); |
| | | if (empty($chatDate)){ |
| | | return $this->renderSuccess('标记成功'); |
| | | } |
| | | // 标记整个会话为已读 |
| | | $participantModel = new Participant(); |
| | | $result = $participantModel->markConversationAsRead($conversationId, $chatDate['sender_id']); |
| | | $result = $participantModel->markConversationAsRead($param['conversation_id'], $chatDate['sender_id']); |
| | | // 更新会话中所有消息的已读状态 |
| | | if ($result) { |
| | | $chatModel->where('conversation_id', $conversationId) |
| | | $chatModel->where('conversation_id', $param['conversation_id']) |
| | | ->where('sender_id', '<>', $userId) |
| | | ->where('is_read', 0) |
| | | ->update([ |
| | |
| | | if (!$businessCard) { |
| | | return $this->renderError('名片不存在'); |
| | | } |
| | | if ($businessCard['user_id'] == $userId) { |
| | | return $this->renderError('不能与自己建立会话'); |
| | | } |
| | | |
| | | $conversationModel = new ConversationModel(); |
| | | |
| | | // 检查是否已存在会话 |
| | | $conversation = $conversationModel->getConversationByBusinessCard($businessCardId); |
| | | |
| | | |
| | | if ($businessCard['user_id'] == $userId&&!$conversation) { |
| | | return $this->renderError('不能与自己建立会话'); |
| | | } |
| | | if (!$conversation) { |
| | | |
| | | // 创建新会话 |
| | |
| | | // 添加未读消息数量 |
| | | $chatModel = new ChatModel(); |
| | | $conversation['unread_count'] = $chatModel->getUnreadCount($conversation['conversation_id'], $userId); |
| | | |
| | | return $this->renderSuccess('获取成功', compact('conversation')); |
| | | |
| | | $wsUrl = SettingModel::getSysConfig()['url']; |
| | | return $this->renderSuccess('获取成功', compact('conversation','wsUrl')); |
| | | } else { |
| | | return $this->renderError('创建会话失败'); |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\agent\Referee; |
| | | use app\api\model\plus\vip\Apply as VipApplyModel; |
| | | use app\api\model\plus\vip\Setting as VipSettingModel; |
| | | use app\api\model\settings\Message as MessageModel; |
| | | use app\common\exception\BaseException; |
| | | use app\common\model\product\Product as ProductModel; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | /** |
| | | * VIP专区申请 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | // 当前用户 |
| | | private $user; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | $this->user = $this->getUser(); // 用户信息 |
| | | } |
| | | |
| | | /** |
| | | * 提交VIP专区申请 |
| | | */ |
| | | public function submit() |
| | | { |
| | | $data = $this->postData(); |
| | | if (empty($data['real_name']) || empty($data['mobile'])) { |
| | | throw new BaseException(['msg' => '姓名或者手机号为空']); |
| | | } |
| | | $model = new VipApplyModel; |
| | | if ($model->submit($this->user, $data)) { |
| | | return $this->renderSuccess('申请提交成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | |
| | | /** |
| | | * 获取VIP专区协议 |
| | | */ |
| | | public function getAgreement() |
| | | { |
| | | $model = new VipSettingModel(); |
| | | $data = $model::getItem('license'); |
| | | return $this->renderSuccess('', compact('data')); |
| | | } |
| | | |
| | | /** |
| | | * 检查是否已申请 |
| | | */ |
| | | public function checkApply() |
| | | { |
| | | $model = new VipApplyModel(); |
| | | $hasApply = $model->where('user_id', $this->user['user_id']) |
| | | ->where('apply_status', '<>', 30) |
| | | ->count(); |
| | | |
| | | return $this->renderSuccess('', ['has_apply' => $hasApply > 0]); |
| | | } |
| | | /** |
| | | * 分销商申请状态 |
| | | */ |
| | | public function apply($referee_id = null, $platform= '') |
| | | { |
| | | // 推荐人昵称 |
| | | $referee_name = '平台'; |
| | | // 如果之前有关联分销商,则继续关联之前的分销商 |
| | | $has_referee_id = Referee::getRefereeUserId($this->user['user_id'], 1); |
| | | $setting = VipSettingModel::getAll(); |
| | | if($has_referee_id > 0){ |
| | | $referee_id = $has_referee_id; |
| | | } |
| | | if ($referee_id > 0 && ($referee = VipUserModel::detail($referee_id))) { |
| | | $referee_name = $referee['user']['nickName']; |
| | | } |
| | | //商品列表 |
| | | $product_ids = $setting['basic']['values']['become__buy_product_ids']; |
| | | $productList = []; |
| | | if(count($product_ids) > 0){ |
| | | $productList = (new ProductModel)->getListByIds($product_ids); |
| | | } |
| | | |
| | | return $this->renderSuccess('', [ |
| | | // 当前是否为分销商 |
| | | 'is_bonus' => false, |
| | | // 当前是否在申请中 |
| | | 'is_applying' => false, |
| | | // 推荐人昵称 |
| | | 'referee_name' => $referee_name, |
| | | // 背景图 |
| | | 'background' => $setting['background']['values']['index'], |
| | | // 页面文字 |
| | | 'words' => $setting['words']['values'], |
| | | // 申请协议 |
| | | 'license' => '', |
| | | // 如果来源是小程序, 则获取小程序订阅消息id.获取售后通知. |
| | | 'template_arr' => MessageModel::getMessageByNameArr($platform, ['vip_apply_user']), |
| | | //商品列表 |
| | | 'productList' => $productList, |
| | | // 底部图 |
| | | 'bottom_background' => $setting['background']['values']['index'], |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\Setting as VipSettingModel; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\api\model\plus\vip\Cash as VipCashModel; |
| | | |
| | | /** |
| | | * VIP专区提现 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | private $user; |
| | | private $vipUser; |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // VIP专区用户信息 |
| | | $this->vipUser = VipUserModel::detail($this->user['user_id']); |
| | | // VIP专区设置 |
| | | $this->setting = VipSettingModel::getFrontSetting(); |
| | | } |
| | | |
| | | /** |
| | | * 提交提现申请 |
| | | */ |
| | | public function submit() |
| | | { |
| | | if (!$this->vipUser) { |
| | | return $this->renderError('您还不是VIP用户'); |
| | | } |
| | | |
| | | $data = $this->postData(); |
| | | $model = new VipCashModel; |
| | | $data=json_decode($data['data'],true); |
| | | if ($model->submit($this->vipUser, $data)) { |
| | | return $this->renderSuccess('申请提现成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | |
| | | /** |
| | | * VIP专区提现明细 |
| | | */ |
| | | public function lists($status = -1) |
| | | { |
| | | $model = new VipCashModel; |
| | | return $this->renderSuccess('', [ |
| | | // 提现明细列表 |
| | | 'list' => $model->getList($this->user['user_id'], (int)$status, $this->postData()), |
| | | // 页面文字 |
| | | 'words' => $this->setting['words'] ?? [], |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\api\model\plus\vip\Setting as VipSettingModel; |
| | | |
| | | |
| | | /** |
| | | * VIP专区首页 |
| | | */ |
| | | class Index extends Controller |
| | | { |
| | | private $user; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | $this->user = $this->getUser(); // 用户信息 |
| | | } |
| | | |
| | | /** |
| | | * VIP专区首页数据 |
| | | */ |
| | | public function index() |
| | | { |
| | | // 获取VIP专区设置 |
| | | $setting = VipSettingModel::getFrontSetting(); |
| | | |
| | | // 检查是否为VIP用户 |
| | | $isVip = VipUserModel::isVipUser($this->user['user_id']); |
| | | |
| | | $vipUser = null; |
| | | $statistics = []; |
| | | |
| | | if ($isVip) { |
| | | // 获取VIP用户信息 |
| | | $vipUser = VipUserModel::getDetail($this->user['user_id']); |
| | | // 获取统计数据 |
| | | $statistics = VipUserModel::getStatistics($this->user['user_id']); |
| | | } |
| | | |
| | | return $this->renderSuccess('', [ |
| | | 'setting' => $setting, |
| | | 'is_vip' => $isVip, |
| | | 'vip_user' => $vipUser, |
| | | 'statistics' => $statistics, |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\api\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * VIP专区订单 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | private $user; |
| | | private $vipUser; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // VIP专区用户信息 |
| | | $this->vipUser = VipUserModel::detail($this->user['user_id']); |
| | | } |
| | | |
| | | /** |
| | | * VIP专区订单列表 |
| | | */ |
| | | public function lists($type = -1) |
| | | { |
| | | if (!$this->vipUser) { |
| | | return $this->renderError('您还不是VIP用户'); |
| | | } |
| | | $model = new VipOrderModel; |
| | | return $this->renderSuccess('', [ |
| | | 'list' => $model->getList($this->vipUser['user_id'], (int)$type, $this->postData()), |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * VIP专区订单统计 |
| | | */ |
| | | public function statistics() |
| | | { |
| | | if (!$this->vipUser) { |
| | | return $this->renderError('您还不是VIP用户'); |
| | | } |
| | | |
| | | $statistics = VipOrderModel::getStatistics($this->vipUser['user_id']); |
| | | return $this->renderSuccess('', $statistics); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\common\service\qrcode\PosterService; |
| | | use app\api\model\plus\vip\Setting; |
| | | /** |
| | | * VIP专区二维码 |
| | | */ |
| | | class Qrcode extends Controller |
| | | { |
| | | |
| | | |
| | | // 当前用户 |
| | | private $user; |
| | | // 分销商 |
| | | private $agent; |
| | | // 分销设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 分销商用户信息 |
| | | $this->agent = VipUserModel::detail($this->user['user_id']); |
| | | // 分销商设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 获取推广二维码 |
| | | */ |
| | | public function poster($source) |
| | | { |
| | | $Qrcode = new PosterService($this->agent, $source); |
| | | return $this->renderSuccess('', [ |
| | | // 二维码图片地址 |
| | | 'qrcode' => $Qrcode->getImage(), |
| | | ]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\common\model\plus\vip\Referee as VipRefereeModel; |
| | | |
| | | /** |
| | | * VIP团队控制器 |
| | | */ |
| | | class Team extends Controller |
| | | { |
| | | // 用户 |
| | | private $user; |
| | | // VIP用户 |
| | | private $vip; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // VIP用户信息 |
| | | $this->vip = VipUserModel::detail($this->user['user_id']); |
| | | } |
| | | |
| | | /** |
| | | * 团队列表 |
| | | */ |
| | | public function lists() |
| | | { |
| | | // 判断用户是否是VIP |
| | | if (!$this->vip || $this->vip['is_delete']) { |
| | | return $this->renderError('您不是VIP用户'); |
| | | } |
| | | |
| | | // 获取团队成员列表 |
| | | $model = new VipRefereeModel(); |
| | | $team_list = $model->getList($this->user['user_id']); |
| | | |
| | | return $this->renderSuccess('', compact('team_list')); |
| | | } |
| | | |
| | | /** |
| | | * 团队统计信息 |
| | | */ |
| | | public function statistics() |
| | | { |
| | | // 判断用户是否是VIP |
| | | if (!$this->vip || $this->vip['is_delete']) { |
| | | return $this->renderError('您不是VIP用户'); |
| | | } |
| | | |
| | | // 获取团队统计信息 |
| | | $statistics = VipRefereeModel::getStatistics($this->user['user_id']); |
| | | |
| | | return $this->renderSuccess('', compact('statistics')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\plus\vip; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\vip\Setting; |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\api\model\settings\Message as MessageModel; |
| | | |
| | | /** |
| | | * VIP专区 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | // 用户 |
| | | private $user; |
| | | // VIP用户 |
| | | private $vip; |
| | | // VIP设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // VIP用户信息 |
| | | $this->vip = VipUserModel::detail($this->user['user_id']); |
| | | // VIP设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * VIP专区中心 |
| | | */ |
| | | public function center() |
| | | { |
| | | // 是否为VIP用户 |
| | | $is_vip = $this->isVipUser(); |
| | | if ($is_vip) { |
| | | event('VipUserGrade', $this->user['user_id']); |
| | | } |
| | | return $this->renderSuccess('', [ |
| | | // 当前是否为VIP用户 |
| | | 'is_vip' => $is_vip, |
| | | // 当前用户信息 |
| | | 'user' => $this->user, |
| | | // VIP用户信息 |
| | | 'vip' => $this->vip, |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['index'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * VIP用户提现信息 |
| | | */ |
| | | public function cash($platform = '') |
| | | { |
| | | // 如果来源是小程序, 则获取小程序订阅消息id.获取售后通知. |
| | | $template_arr = MessageModel::getMessageByNameArr($platform, ['agent_cash_user']); |
| | | return $this->renderSuccess('', [ |
| | | // 分销商用户信息 |
| | | 'agent' => $this->vip, |
| | | // 结算设置 |
| | | 'settlement' => $this->setting['settlement']['values'], |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['cash_apply'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | // 小程序消息 |
| | | 'template_arr' => $template_arr |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 是否为VIP用户 |
| | | * @return bool |
| | | */ |
| | | private function isVipUser() |
| | | { |
| | | return !!$this->vip && !$this->vip['is_delete']; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\supplier; |
| | | use app\api\controller\Controller; |
| | | use app\api\model\settings\Message as MessageModel; |
| | | use app\api\model\supplier\Cash as CashModel; |
| | | use app\api\model\supplier\Supplier; |
| | | use app\api\model\plus\agent\Setting; |
| | | /** |
| | | * 供应商提现 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | private $user; |
| | | private $Supplier; |
| | | private $setting; |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | $shop_supplier_id = $this->getSupplierUser($this->user)['shop_supplier_id']; |
| | | // 供应商用户信息 |
| | | $this->Supplier = Supplier::detail($shop_supplier_id); |
| | | // 供应商设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | /** |
| | | * 提交提现申请 |
| | | */ |
| | | public function submit($data) |
| | | { |
| | | $formData = json_decode(htmlspecialchars_decode($data), true); |
| | | |
| | | $model = new CashModel; |
| | | if ($model->submit($this->Supplier, $formData)) { |
| | | return $this->renderSuccess('申请提现成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | /** |
| | | * 分销商提现信息 |
| | | */ |
| | | public function cash($platform = '') |
| | | { |
| | | // 如果来源是小程序, 则获取小程序订阅消息id.获取售后通知. |
| | | $template_arr = MessageModel::getMessageByNameArr($platform, ['agent_cash_user']); |
| | | return $this->renderSuccess('', [ |
| | | // 分销商用户信息 |
| | | 'agent' => $this->Supplier, |
| | | // 结算设置 |
| | | 'settlement' => $this->setting['settlement']['values'], |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['cash_apply'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | // 小程序消息 |
| | | 'template_arr' => $template_arr |
| | | ]); |
| | | }/** |
| | | * 分销商提现明细 |
| | | */ |
| | | public function lists($status = -1) |
| | | { |
| | | |
| | | $model = new CashModel; |
| | | return $this->renderSuccess('', [ |
| | | // 提现明细列表 |
| | | 'list' => $model->getList($this->Supplier['shop_supplier_id'], (int)$status,$this->postData()), |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | ]); |
| | | } |
| | | } |
| | |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\supplier\DepositOrder as DepositOrderModel; |
| | | use app\api\model\supplier\DepositRefund as DepositRefundModel; |
| | | use app\api\model\supplier\Supplier as SupplierModel; |
| | | use app\api\model\plus\coupon\Coupon as CouponModel; |
| | | use app\api\model\page\Ad as AdModel; |
| | |
| | | use app\common\model\app\App as AppModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\api\model\store\Store as StoreModel; |
| | | |
| | | use app\api\model\supplier\member\Member as MemberModel; |
| | | /** |
| | | * 供应商 |
| | | */ |
| | |
| | | $supplier = SupplierModel::detail($data['shop_supplier_id']); |
| | | // 客服消息 |
| | | $msg_count = ChatModel::getNoReadCount($this->getSupplierUser($user)['supplier_user_id']); |
| | | return $this->renderSuccess('', compact('totalCount', 'todayCount', 'supplier', 'is_open', 'msg_count')); |
| | | $member=MemberModel::supplierDetail([ |
| | | 'shop_supplier_id'=>$data['shop_supplier_id'], |
| | | 'is_expire'=>0 |
| | | ]); |
| | | return $this->renderSuccess('', compact('totalCount', 'todayCount', 'supplier', 'is_open', 'msg_count','member')); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | // 生成订单 |
| | | $model = new DepositOrderModel; |
| | | $order_id = $model->createOrder($user, $supplier, $params['pay_type'], $params['pay_source']); |
| | | $order_id = $model->createOrder($user, $supplier); |
| | | if (!$order_id) { |
| | | return $this->renderError($model->getError() ?: '创建订单失败'); |
| | | } |
| | | // 在线支付 |
| | | $payment = DepositOrderModel::onOrderPayment($user, $model, $params['pay_type'], $params['pay_source']); |
| | | //$payment = DepositOrderModel::onOrderPayment($user, $model, $params['pay_type'], $params['pay_source']); |
| | | // 返回结算信息 |
| | | return $this->renderSuccess('', [ |
| | | 'order_id' => $order_id, // 订单id |
| | |
| | | return $this->renderError($model->getError() ?: '修改失败'); |
| | | } |
| | | } |
| | | public function refundDeposit() |
| | | { |
| | | $data = $this->postData(); |
| | | $model = new DepositRefundModel; |
| | | $shop_supplier=SupplierModel::detail($data['shop_supplier_id']); |
| | | if(!$shop_supplier){ |
| | | return $this->renderError('店铺不存在'); |
| | | } |
| | | if ($shop_supplier['status']==10){ |
| | | return $this->renderError('退还押金申请中,不能重复申请'); |
| | | } |
| | | $data['deposit_money']=$shop_supplier['deposit_money']; |
| | | if($model->add($data)){ |
| | | return $this->renderSuccess('提交成功'); |
| | | }else{ |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\supplier; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\supplier\member\Plan as MemberPlanModel; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | use app\common\model\app\App as AppModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | use app\common\service\supplier\MemberService; |
| | | use app\api\model\supplier\member\Order as MemberOrderModel; |
| | | use app\common\enum\order\OrderPayTypeEnum; |
| | | use app\api\service\order\PaymentService; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | |
| | | /** |
| | | * 供应商年卡控制器 |
| | | */ |
| | | class Member extends Controller |
| | | { |
| | | /** |
| | | * 获取年卡套餐列表 |
| | | */ |
| | | public function plans() |
| | | { |
| | | $plans = (new MemberPlanModel())->getEnabledPlans(); |
| | | return $this->renderSuccess('',compact('plans')); |
| | | } |
| | | |
| | | /** |
| | | * 创建年卡订单 |
| | | */ |
| | | public function createOrder() |
| | | { |
| | | $planId = $this->request->post('plan_id'); |
| | | $user = $this->getUser(); |
| | | $supplier = $this->getSupplierUser($user); |
| | | $supplierId = $supplier['shop_supplier_id']; |
| | | |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->createOrder($supplierId, $planId, $user); |
| | | |
| | | if (!$result['status']) { |
| | | return $this->renderError($result['msg']); |
| | | } |
| | | |
| | | return $this->renderSuccess( '创建订单成功',['order' => $result['data']]); |
| | | } |
| | | |
| | | /** |
| | | * 构建支付请求 |
| | | */ |
| | | public function pay() |
| | | { |
| | | // 获取订单信息 |
| | | $param = $this->request->param(); |
| | | |
| | | // 获取用户信息 |
| | | $user = $this->getUser(); |
| | | $supplier = $this->getSupplierUser($user); |
| | | $supplierId = $supplier['shop_supplier_id']; |
| | | |
| | | // 获取订单详情 |
| | | $order = MemberOrderModel::detail($param['order_id']); |
| | | if (!$order) { |
| | | return $this->renderError('订单不存在'); |
| | | } |
| | | |
| | | // 检查订单是否已支付 |
| | | if ($order['pay_status'] == 20) { |
| | | return $this->renderError('订单已支付'); |
| | | } |
| | | if ($this->request->isGet()) { |
| | | // 开启的支付类型 |
| | | $payTypes = AppModel::getPayType($supplier['app_id'], $param['pay_source']); |
| | | // 支付金额 |
| | | $payPrice = $order['price']; |
| | | $balance = $user['balance']; |
| | | return $this->renderSuccess('', compact('payTypes', 'payPrice', 'balance')); |
| | | } |
| | | // 更新支付方式 |
| | | $order->save(['pay_type' => $param['payType']]); |
| | | |
| | | // 余额支付 |
| | | if ($param['use_balance'] == 1 || $param['payType'] == OrderPayTypeEnum::BALANCE) { |
| | | // 检查余额是否足够 |
| | | if ($user['balance'] < $order['price']) { |
| | | return $this->renderError('余额不足'); |
| | | } |
| | | // 扣除余额并激活会员 |
| | | $user->where('user_id', '=', $user['user_id']) |
| | | ->dec('balance', $order['price']) |
| | | ->update(); |
| | | BalanceLogModel::add(BalanceLogSceneEnum::CONSUME, [ |
| | | 'user_id' => $user['user_id'], |
| | | 'money' => -$order['price'], |
| | | ], ['order_no' => $order['order_no']]); |
| | | //$user->setDecBalance($order['price'], '购买年卡'); |
| | | $memberService = new MemberService(); |
| | | $memberService->activateMember($param['order_id']); |
| | | return $this->renderSuccess('支付成功', [ |
| | | 'order_id' => $param['order_id'], |
| | | 'pay_type' => OrderPayTypeEnum::BALANCE, |
| | | ]); |
| | | } |
| | | |
| | | // 其他支付方式 (微信、支付宝等) |
| | | $payment = PaymentService::orderPayment( |
| | | $supplier['user'], |
| | | $order, |
| | | $param['payType'] |
| | | ); |
| | | // 支付类型 |
| | | $payTypes = [20, 30]; // 微信支付和支付宝支付 |
| | | if ($supplier['balance'] > 0) { |
| | | $payTypes[] = 10; // 余额支付 |
| | | } |
| | | |
| | | return $this->renderSuccess('支付信息获取成功', [ |
| | | 'order_id' => $param['order_id'], |
| | | 'pay_type' => $param['payType'], |
| | | 'payment' => $payment, |
| | | 'payTypes' => $payTypes, |
| | | 'payPrice' => $order['price'], |
| | | 'balance' => $supplier['balance'] |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 支付成功回调 |
| | | */ |
| | | public function payNotify() |
| | | { |
| | | $orderId = $this->request->post('order_id'); |
| | | |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->activateMember($orderId); |
| | | |
| | | if (!$result) { |
| | | return $this->renderError('激活年卡失败'); |
| | | } |
| | | |
| | | return $this->renderSuccess([], '年卡激活成功'); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前供应商年卡信息 |
| | | */ |
| | | public function info() |
| | | { |
| | | $user = $this->getUser(); |
| | | $supplier = $this->getSupplierUser($user); |
| | | $supplierId = $supplier['shop_supplier_id']; |
| | | |
| | | $supplier = SupplierModel::detail($supplierId); |
| | | $member = $supplier->getCurrentMember(); |
| | | |
| | | return $this->renderSuccess(compact('member')); |
| | | } |
| | | |
| | | /** |
| | | * 检查权限 |
| | | */ |
| | | public function checkPermission() |
| | | { |
| | | $permission = $this->request->post('permission'); |
| | | $user = $this->getUser(); |
| | | $supplier = $this->getSupplierUser($user); |
| | | $supplierId = $supplier['shop_supplier_id']; |
| | | |
| | | $memberService = new MemberService(); |
| | | $hasPermission = $memberService->checkPermission($supplierId, $permission); |
| | | |
| | | return $this->renderSuccess(['has_permission' => $hasPermission]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\controller\user; |
| | | |
| | | use app\api\controller\Controller; |
| | | use app\api\model\plus\bonus\Referee; |
| | | use app\api\model\plus\bonus\Setting; |
| | | use app\api\model\plus\bonus\User as BonusUserModel; |
| | | use app\api\model\plus\bonus\Apply as BonusApplyModel; |
| | | use app\api\model\settings\Message as MessageModel; |
| | | use app\common\model\product\Product as ProductModel; |
| | | |
| | | |
| | | /** |
| | | * 分销中心 |
| | | */ |
| | | class Bonus extends Controller |
| | | { |
| | | // 用户 |
| | | private $user; |
| | | // 分销商 |
| | | private $bonus; |
| | | // 分销设置 |
| | | private $setting; |
| | | |
| | | /** |
| | | * 构造方法 |
| | | */ |
| | | public function initialize() |
| | | { |
| | | parent::initialize(); |
| | | // 用户信息 |
| | | $this->user = $this->getUser(); |
| | | // 分销商用户信息 |
| | | $this->bonus = BonusUserModel::detail($this->user['user_id']); |
| | | // 分销商设置 |
| | | $this->setting = Setting::getAll(); |
| | | } |
| | | |
| | | /** |
| | | * 分销商中心 |
| | | */ |
| | | public function center() |
| | | { |
| | | return $this->renderSuccess('', [ |
| | | // 当前是否为分销商 |
| | | 'is_bonus' => $this->isBonusUser(), |
| | | // 当前是否在申请中 |
| | | 'is_applying' => BonusApplyModel::isApplying($this->user['user_id']), |
| | | // 当前用户信息 |
| | | 'user' => $this->user, |
| | | // 分销商用户信息 |
| | | 'bonus' => $this->bonus, |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['index'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | // 排位过期时间 by lyzflash 2023.01.26 |
| | | 'remain_time' => BonusUserModel::getExpireTime($this->user['user_id']), |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 分销商申请状态 |
| | | */ |
| | | public function apply($referee_id = null, $platform= '') |
| | | { |
| | | // 推荐人昵称 |
| | | $referee_name = '平台'; |
| | | // 如果之前有关联分销商,则继续关联之前的分销商 |
| | | $has_referee_id = Referee::getRefereeUserId($this->user['user_id'], 1); |
| | | if($has_referee_id > 0){ |
| | | $referee_id = $has_referee_id; |
| | | } |
| | | if ($referee_id > 0 && ($referee = BonusUserModel::detail($referee_id))) { |
| | | $referee_name = $referee['user']['nickName']; |
| | | } |
| | | //商品列表 |
| | | $product_ids = $this->setting['basic']['values']['become__buy_product_ids']; |
| | | $productList = []; |
| | | if(count($product_ids) > 0){ |
| | | $productList = (new ProductModel)->getListByIds($product_ids); |
| | | } |
| | | |
| | | return $this->renderSuccess('', [ |
| | | // 当前是否为分销商 |
| | | 'is_bonus' => $this->isBonusUser(), |
| | | // 当前是否在申请中 |
| | | 'is_applying' => BonusApplyModel::isApplying($this->user['user_id']), |
| | | // 推荐人昵称 |
| | | 'referee_name' => $referee_name, |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['apply'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | // 申请协议 |
| | | 'license' => $this->setting['license']['values']['license'], |
| | | // 如果来源是小程序, 则获取小程序订阅消息id.获取售后通知. |
| | | 'template_arr' => MessageModel::getMessageByNameArr($platform, ['bonus_apply_user']), |
| | | //商品列表 |
| | | 'productList' => $productList, |
| | | // 底部图 |
| | | 'bottom_background' => $this->setting['background']['values']['apply_bottom'], |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现信息 |
| | | */ |
| | | public function cash($platform = '') |
| | | { |
| | | // 如果来源是小程序, 则获取小程序订阅消息id.获取售后通知. |
| | | $template_arr = MessageModel::getMessageByNameArr($platform, ['bonus_cash_user']); |
| | | return $this->renderSuccess('', [ |
| | | // 分销商用户信息 |
| | | 'bonus' => $this->bonus, |
| | | // 结算设置 |
| | | 'settlement' => $this->setting['settlement']['values'], |
| | | // 背景图 |
| | | 'background' => $this->setting['background']['values']['cash_apply'], |
| | | // 页面文字 |
| | | 'words' => $this->setting['words']['values'], |
| | | // 小程序消息 |
| | | 'template_arr' => $template_arr, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 当前用户是否为分销商 |
| | | */ |
| | | private function isBonusUser() |
| | | { |
| | | return !!$this->bonus && !$this->bonus['is_delete']; |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | $data = [ |
| | | 'user_id' => $user['user_id'], |
| | | 'branch_id' => $activity['branch_id'], |
| | | 'branch_id' => $params['branch_id'], |
| | | 'real_name' => $params['real_name'], |
| | | 'mobile' => $params['mobile'], |
| | | 'company' => $params['company'], |
| | |
| | | ->join('user', 'user.user_id = A.user_id', 'left') |
| | | ->join('branch_position', 'branch_position.position_id = A.position_id', 'left') |
| | | ->where('A.is_delete', '=', 0) |
| | | ->where('A.position_id', '<>', 0) |
| | | ->where('A.position_id', '<>', 3) |
| | | ->order(['branch_position.weight' => 'desc', 'A.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($params['branch_id'])) { |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\api\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\plus\bonus\Apply as ApplyModel; |
| | | |
| | | /** |
| | | * 分销商申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | * @var array |
| | | */ |
| | | protected $hidden = [ |
| | | 'create_time', |
| | | 'update_time', |
| | | ]; |
| | | |
| | | /** |
| | | * 是否为分销商申请中 |
| | | */ |
| | | public static function isApplying($user_id) |
| | | { |
| | | $detail = self::detail(['user_id' => $user_id]); |
| | | return $detail ? ((int)$detail['apply_status']['value'] === 10) : false; |
| | | } |
| | | |
| | | /** |
| | | * 提交申请 |
| | | */ |
| | | public function submit($user, $data) |
| | | { |
| | | // 成为分销商条件 |
| | | $config = Setting::getItem('condition'); |
| | | // 如果之前有关联分销商,则继续关联之前的分销商 |
| | | $has_referee_id = Referee::getRefereeUserId($user['user_id'], 1); |
| | | if($has_referee_id > 0){ |
| | | $referee_id = $has_referee_id; |
| | | }else{ |
| | | $referee_id = $data['referee_id'] > 0 ?$data['referee_id']:0; |
| | | } |
| | | // 数据整理 |
| | | $data = [ |
| | | 'user_id' => $user['user_id'], |
| | | 'real_name' => trim($data['name']), |
| | | 'mobile' => trim($data['mobile']), |
| | | 'referee_id' => $referee_id, |
| | | 'apply_type' => $config['become'], |
| | | 'apply_time' => time(), |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($config['become'] == 10) { |
| | | $data['apply_status'] = 10; |
| | | } elseif ($config['become'] == 20) { |
| | | $data['apply_status'] = 20; |
| | | } |
| | | return $this->add($user, $data); |
| | | } |
| | | |
| | | /** |
| | | * 更新分销商申请信息 |
| | | */ |
| | | private function add($user, $data) |
| | | { |
| | | // 实例化模型 |
| | | $model = self::detail(['user_id' => $user['user_id']]) ?: $this; |
| | | // 更新记录 |
| | | $this->startTrans(); |
| | | try { |
| | | // 保存申请信息 |
| | | $model->save($data); |
| | | // 无需审核,自动通过 |
| | | if ($data['apply_type'] == 20) { |
| | | // 新增分销商用户记录 |
| | | User::add($user['user_id'], [ |
| | | 'real_name' => $data['real_name'], |
| | | 'mobile' => $data['mobile'], |
| | | 'referee_id' => $data['referee_id'] |
| | | ]); |
| | | } |
| | | // 记录推荐人关系 |
| | | if ($data['referee_id'] > 0) { |
| | | RefereeModel::createRelation($user['user_id'], $data['referee_id']); |
| | | } |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Capital as CapitalModel; |
| | | |
| | | /** |
| | | * 分销商资金明细模型 |
| | | */ |
| | | class Capital extends CapitalModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'create_time', |
| | | 'update_time', |
| | | ]; |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\exception\BaseException; |
| | | use app\common\model\plus\bonus\Cash as CashModel; |
| | | use app\common\model\user\User as UserModel; |
| | | use app\common\model\plus\yms\Setting as YmsSettingModel; |
| | | use app\common\model\plus\yms\User as YmsUserModel; |
| | | |
| | | /** |
| | | * 分销商提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'update_time', |
| | | ]; |
| | | |
| | | /** |
| | | * 完税待完成提现申请详情 |
| | | */ |
| | | public static function getPayDetail($cashNo, $apply_status) |
| | | { |
| | | $model = new static(); |
| | | $model = $model->where('cash_no', '=', $cashNo); |
| | | if($apply_status > 0){ |
| | | $model = $model->where('apply_status', '=', 50); |
| | | } |
| | | return $model->find(); |
| | | } |
| | | |
| | | /** |
| | | * 获取分销商提现明细 |
| | | */ |
| | | public function getList($user_id, $apply_status = -1,$limit=15) |
| | | { |
| | | $model = $this; |
| | | $apply_status > -1 && $model = $model->where('apply_status', '=', $apply_status); |
| | | return $model->where('user_id', '=', $user_id)->order(['create_time' => 'desc']) |
| | | ->paginate($limit); |
| | | } |
| | | |
| | | /** |
| | | * 提交申请 |
| | | */ |
| | | public function submit($user, $data) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | // 数据验证 |
| | | $this->validation($user, $data,['is_open'=>0]); |
| | | // 新增申请记录 |
| | | $this->save(array_merge($data, [ |
| | | 'user_id' => $user['user_id'], |
| | | 'apply_status' => 10, |
| | | 'app_id' => self::$app_id, |
| | | 'cash_no' => $this->createCashNo(), |
| | | 'is_yms' => 0, // 是否使用完税系统打款 by lyzflash |
| | | ])); |
| | | // 将支付宝或银行卡信息保存到用户表 by lyzflash |
| | | $this->saveAccount($user['user_id'], $data, ['is_open'=>0]); |
| | | // 冻结用户资金 |
| | | $user->freezeMoney($data['money']); |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 数据验证 |
| | | */ |
| | | private function validation($user, $data, $ymsSetting) |
| | | { |
| | | // 结算设置 |
| | | $settlement = Setting::getItem('settlement'); |
| | | // 最低提现分红 |
| | | if ($data['money'] <= 0) { |
| | | throw new BaseException(['msg' => '提现金额不正确']); |
| | | } |
| | | if ($user['money'] <= 0) { |
| | | throw new BaseException(['msg' => '当前用户没有可提现分红']); |
| | | } |
| | | if ($data['money'] > $user['money']) { |
| | | throw new BaseException(['msg' => '提现金额不能大于可提现分红']); |
| | | } |
| | | if ($data['money'] < $settlement['min_money']) { |
| | | throw new BaseException(['msg' => '最低提现金额为' . $settlement['min_money']]); |
| | | } |
| | | if (!in_array($data['pay_type'], $settlement['pay_type'])) { |
| | | throw new BaseException(['msg' => '提现方式不正确']); |
| | | } |
| | | if ($data['pay_type'] == '20') { |
| | | if (empty($data['alipay_name']) || empty($data['alipay_account'])) { |
| | | throw new BaseException(['msg' => '请补全提现信息']); |
| | | } |
| | | } elseif ($data['pay_type'] == '30' && $ymsSetting['is_open'] == '0') { |
| | | if (empty($data['bank_name']) || empty($data['bank_account']) || empty($data['bank_card'])) { |
| | | throw new BaseException(['msg' => '请补全提现信息']); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 数据验证 |
| | | */ |
| | | private function saveAccount($user_id, $formData, $ymsSetting) |
| | | { |
| | | if ($formData['pay_type'] == 20) { |
| | | $data = [ |
| | | 'alipay_name' => $formData['alipay_name'], |
| | | 'alipay_account' => $formData['alipay_account'], |
| | | ]; |
| | | } elseif ($formData['pay_type'] == 30 && $ymsSetting['is_open'] == '0') { |
| | | $data = [ |
| | | 'bank_name' => $formData['bank_name'], |
| | | 'bank_account' => $formData['bank_account'], |
| | | 'bank_card' => $formData['bank_card'], |
| | | ]; |
| | | } else { |
| | | return false; |
| | | } |
| | | $user = UserModel::detail($user_id); |
| | | $user->save($data); |
| | | } |
| | | |
| | | private function createCashNo() |
| | | { |
| | | return date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\service\order\OrderService; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\common\library\helper; |
| | | |
| | | /** |
| | | * 分销商订单模型 |
| | | */ |
| | | class Order extends OrderModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'update_time', |
| | | ]; |
| | | |
| | | /** |
| | | * 获取分销商订单列表 |
| | | */ |
| | | public function getList($user_id, $is_settled = -1) |
| | | { |
| | | $model = $this; |
| | | $is_settled > -1 && $model = $model->where('is_settled', '=', !!$is_settled); |
| | | $data = $model->with(['user']) |
| | | ->where('first_user_id|second_user_id|subsidy_user_id', '=', $user_id) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate(15); |
| | | if ($data->isEmpty()) { |
| | | return $data; |
| | | } |
| | | // 整理订单信息 |
| | | $with = ['product' => ['image', 'refund'], 'address', 'user']; |
| | | return OrderService::getOrderList($data, 'order_master', $with); |
| | | } |
| | | |
| | | /** |
| | | * 分红订单 |
| | | */ |
| | | public static function createBonusOrder($order) |
| | | { |
| | | // 验证是否设置 |
| | | $config = Setting::getItem('basic', $order['app_id']); |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | |
| | | // 每买一个指定商品就生成一个分红订单 |
| | | foreach ($order['product'] as $product) { |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | // 为每个商品生成分红订单 |
| | | for ($i = 0; $i < $quantity; $i++) { |
| | | // 创建单个商品的订单数据 |
| | | $singleProductOrder = $order; |
| | | $singleProductOrder['product_id'] = $product['product_id']; |
| | | // 创建分红订单 |
| | | OrderModel::createOrder($singleProductOrder); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Referee as RefereeModel; |
| | | |
| | | /** |
| | | * 分销商推荐关系模型 |
| | | */ |
| | | class Referee extends RefereeModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = []; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 是否已存在推荐关系 |
| | | */ |
| | | private static function isExistReferee($user_id) |
| | | { |
| | | return !!(new static())->where(['user_id' => $user_id])->find(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Setting as SettingModel; |
| | | |
| | | /** |
| | | * 分销商设置模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'update_time', |
| | | ]; |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | |
| | | /** |
| | | * 分销商用户模型 |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'create_time', |
| | | 'update_time', |
| | | ]; |
| | | |
| | | /** |
| | | * 资金冻结 |
| | | */ |
| | | public function freezeMoney($money) |
| | | { |
| | | return $this->save([ |
| | | 'money' => $this['money'] - $money, |
| | | 'freeze_money' => $this['freeze_money'] + $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 累计分销商成员数量 |
| | | */ |
| | | public static function setMemberInc($agent_id, $level) |
| | | { |
| | | $fields = [1 => 'first_num', 2 => 'second_num', 3 => 'third_num']; |
| | | $model = static::detail($agent_id); |
| | | return $model->where('user_id', '=', $agent_id)->inc($fields[$level])->update(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Performance as PerformanceModel; |
| | | |
| | | /** |
| | | * 分销商资金明细模型 |
| | | */ |
| | | class Performance extends PerformanceModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'create_time', |
| | | 'update_time', |
| | | ]; |
| | | |
| | | } |
| | |
| | | { |
| | | $model = $this; |
| | | if ($shop_supplier_id != -1) { |
| | | $model = $model->where('shop_supplier_id', '=', $shop_supplier_id); |
| | | $model = $model->where('shop_supplier_id', 'in', [0,$shop_supplier_id]); |
| | | } |
| | | if ($coupon_type == 'duihuan') { |
| | | $model = $model->where('coupon_type', '=', 30); |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\api\model\plus\vip\User as VipUserModel; |
| | | use app\common\model\plus\vip\Apply as ApplyModel; |
| | | use app\common\exception\BaseException; |
| | | |
| | | |
| | | /** |
| | | * VIP专区申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 隐藏属性 |
| | | * @var array |
| | | */ |
| | | protected $hidden = [ |
| | | 'app_id', |
| | | 'update_time' |
| | | ]; |
| | | |
| | | /** |
| | | * 提交申请 |
| | | * @param $user |
| | | * @param $data |
| | | * @return bool|false |
| | | * @throws BaseException |
| | | */ |
| | | public function submit($user, $data) |
| | | { |
| | | // 是否已提交申请 |
| | | if ($this->checkExist($user['user_id'])) { |
| | | throw new BaseException(['msg' => '该用户已提交过申请,请勿重复提交']); |
| | | } |
| | | |
| | | // 表单数据 |
| | | $data['user_id'] = $user['user_id']; |
| | | $data['apply_status'] = 10; |
| | | $data['app_id'] = $user['app_id']; |
| | | |
| | | // 开启事务 |
| | | $this->startTrans(); |
| | | try { |
| | | // 保存申请信息 |
| | | $this->save($data); |
| | | |
| | | // 新增VIP专区用户 |
| | | VipUserModel::add($user['user_id'], [ |
| | | 'real_name' => $data['real_name'], |
| | | 'mobile' => $data['mobile'], |
| | | 'referee_id' => $user['referee_id'] ?? 0, |
| | | ]); |
| | | |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->rollback(); |
| | | throw new BaseException(['msg' => $e->getMessage()]); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查是否已提交申请 |
| | | * @param $user_id |
| | | * @return bool |
| | | */ |
| | | private function checkExist($user_id) |
| | | { |
| | | return (new self)->where('user_id', '=', $user_id) |
| | | ->where('apply_status', '<>', 30) |
| | | ->count() > 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请列表 |
| | | * @param $user_id |
| | | * @param int $status |
| | | * @param array $query |
| | | * @return \think\Paginator |
| | | * @throws \think\exception\DbException |
| | | */ |
| | | public function getList($user_id, $status = -1, $query = []) |
| | | { |
| | | $model = $this->where('user_id', '=', $user_id); |
| | | |
| | | if ($status > -1) { |
| | | $model = $model->where('apply_status', '=', $status); |
| | | } |
| | | |
| | | return $model->with(['user']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($query, false, [ |
| | | 'query' => \request()->request() |
| | | ]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Capital as CapitalModel; |
| | | |
| | | /** |
| | | * VIP专区资金明细模型 |
| | | */ |
| | | class Capital extends CapitalModel |
| | | { |
| | | /** |
| | | * 隐藏字段 |
| | | */ |
| | | protected $hidden = [ |
| | | 'create_time', |
| | | 'update_time', |
| | | ]; |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Cash as CashModel; |
| | | use app\common\exception\BaseException; |
| | | |
| | | |
| | | /** |
| | | * VIP专区提现API模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 隐藏属性 |
| | | * @var array |
| | | */ |
| | | protected $hidden = [ |
| | | 'app_id', |
| | | 'update_time' |
| | | ]; |
| | | |
| | | /** |
| | | * 提交提现申请 |
| | | * @param $vipUser |
| | | * @param $data |
| | | * @return bool |
| | | * @throws BaseException |
| | | */ |
| | | public function submit($vipUser, $data) |
| | | { |
| | | // 设置验证 |
| | | $setting = \app\common\model\plus\vip\Setting::getItem('settlement', $vipUser['app_id']); |
| | | |
| | | // 验证最低提现金额 |
| | | if ($data['money'] <= 0) { |
| | | $this->error = '提现金额必须大于0'; |
| | | return false; |
| | | } |
| | | |
| | | if ($data['money'] < $setting['min_money']) { |
| | | $this->error = '最低提现金额为' . $setting['min_money'] . '元'; |
| | | return false; |
| | | } |
| | | |
| | | if ($data['money'] > $vipUser['money']) { |
| | | $this->error = '提现金额不能超过可提现佣金'; |
| | | return false; |
| | | } |
| | | // 生成提现单号 |
| | | $data['cash_no'] = 'V' . date('YmdHis') . mt_rand(1000, 9999); |
| | | $data['user_id'] = $vipUser['user_id']; |
| | | $data['apply_status'] = 10; |
| | | $data['app_id'] = $vipUser['app_id']; |
| | | |
| | | // 计算手续费 |
| | | $fee_rate = $setting['fee_rate'] ?? 0; |
| | | $data['fee_rate'] = $fee_rate; |
| | | $data['fee_money'] = $data['money'] * ($fee_rate * 0.01); |
| | | $data['real_money'] = $data['money'] - $data['fee_money']; |
| | | |
| | | // 开启事务 |
| | | $this->startTrans(); |
| | | try { |
| | | // 保存提现申请 |
| | | $this->save($data); |
| | | |
| | | // 冻结VIP用户资金 |
| | | User::freezeMoney($vipUser['user_id'], $data['money']); |
| | | |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->rollback(); |
| | | $this->error = $e->getMessage(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取提现明细列表 |
| | | * @param $user_id |
| | | * @param int $status |
| | | * @param array $query |
| | | * @return \think\Paginator |
| | | * @throws \think\exception\DbException |
| | | */ |
| | | public function getList($user_id, $status = -1, $query = []) |
| | | { |
| | | $model = $this->where('user_id', '=', $user_id); |
| | | |
| | | if ($status > -1) { |
| | | $model = $model->where('apply_status', '=', $status); |
| | | } |
| | | |
| | | return $model->with(['user']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($query, false, [ |
| | | 'query' => \request()->request() |
| | | ]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * VIP专区订单API模型 |
| | | */ |
| | | class Order extends VipOrderModel |
| | | { |
| | | /** |
| | | * 隐藏属性 |
| | | * @var array |
| | | */ |
| | | protected $hidden = [ |
| | | 'app_id', |
| | | 'update_time' |
| | | ]; |
| | | |
| | | /** |
| | | * 获取订单列表 |
| | | * @param $vip_user_id |
| | | * @param int $type |
| | | * @param array $query |
| | | * @return \think\Paginator |
| | | * @throws \think\exception\DbException |
| | | */ |
| | | public function getList($vip_user_id, $type = -1, $query = []) |
| | | { |
| | | $model = $this->where('vip_area_user_id', '=', $vip_user_id); |
| | | |
| | | if ($type > -1) { |
| | | $model = $model->where('vip_area_type', '=', $type); |
| | | } |
| | | if (isset($query['is_settled']) && $query['is_settled']>=0) { |
| | | $model = $model->where('is_settled', '=', $query['is_settled']); |
| | | } |
| | | |
| | | return $model->with(['user', 'vipUser', 'referee','orderMaster'=>['product'=>['image']]]) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($query); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单统计数据 |
| | | * @param $vip_user_id |
| | | * @return array |
| | | */ |
| | | public static function getStatistics($vip_user_id) |
| | | { |
| | | // 总订单数 |
| | | $totalCount = self::where('vip_area_user_id', '=', $vip_user_id)->count(); |
| | | |
| | | // 推广订单数 |
| | | $promoteCount = self::where('vip_area_user_id', '=', $vip_user_id) |
| | | ->where('vip_area_type', '=', 10) |
| | | ->count(); |
| | | |
| | | // 推广复购订单数 |
| | | $reorderCount = self::where('vip_area_user_id', '=', $vip_user_id) |
| | | ->where('vip_area_type', '=', 20) |
| | | ->count(); |
| | | |
| | | // 已结算佣金 |
| | | $settledMoney = self::where('vip_area_user_id', '=', $vip_user_id) |
| | | ->where('is_settled', '=', 1) |
| | | ->sum('vip_area_money'); |
| | | |
| | | // 待结算佣金 |
| | | $unsettledMoney = self::where('vip_area_user_id', '=', $vip_user_id) |
| | | ->where('is_settled', '=', 0) |
| | | ->sum('vip_area_money'); |
| | | |
| | | return [ |
| | | 'total_count' => $totalCount, |
| | | 'promote_count' => $promoteCount, |
| | | 'reorder_count' => $reorderCount, |
| | | 'settled_money' => $settledMoney, |
| | | 'unsettled_money' => $unsettledMoney, |
| | | ]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Setting as SettingModel; |
| | | |
| | | /** |
| | | * VIP专区设置API模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | /** |
| | | * 获取前端设置 |
| | | * @param $app_id |
| | | * @return array |
| | | */ |
| | | public static function getFrontSetting($app_id = null) |
| | | { |
| | | $settings = parent::getAll($app_id); |
| | | |
| | | return [ |
| | | 'basic' => $settings['basic']['values'] ?? [], |
| | | 'settlement' => $settings['settlement']['values'] ?? [], |
| | | 'words' => $settings['words']['values'] ?? [], |
| | | 'background' => $settings['background']['values'] ?? [], |
| | | ]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\User as VipUserModel; |
| | | |
| | | use app\common\model\plus\vip\Capital as VipCapitalModel; |
| | | use app\common\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * VIP专区用户API模型 |
| | | */ |
| | | class User extends VipUserModel |
| | | { |
| | | /** |
| | | * 隐藏属性 |
| | | * @var array |
| | | */ |
| | | protected $hidden = [ |
| | | 'app_id', |
| | | 'update_time' |
| | | ]; |
| | | |
| | | /** |
| | | * 获取VIP专区用户信息 |
| | | * @param $user_id |
| | | * @return array|null|static |
| | | * @throws \think\db\exception\DataNotFoundException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | * @throws \think\exception\DbException |
| | | */ |
| | | public static function getDetail($user_id) |
| | | { |
| | | return self::detail($user_id, ['user', 'referee', 'grade']); |
| | | } |
| | | |
| | | /** |
| | | * 获取VIP专区统计数据 |
| | | * @param $user_id |
| | | * @return array |
| | | */ |
| | | public static function getStatistics($user_id) |
| | | { |
| | | // VIP专区用户信息 |
| | | $vipUser = self::detail($user_id); |
| | | if (!$vipUser) { |
| | | return []; |
| | | } |
| | | |
| | | // 获取推荐人数 |
| | | $inviteCount = self::where('referee_id', '=', $user_id)->count(); |
| | | |
| | | // 获取未结算订单数 |
| | | $unsettledCount = VipOrderModel::where('vip_area_user_id', '=', $user_id) |
| | | ->where('is_settled', '=', 0) |
| | | ->count(); |
| | | |
| | | // 获取已结算佣金 |
| | | $settledMoney = VipCapitalModel::where('user_id', '=', $user_id) |
| | | ->where('flow_type', '=', 10) |
| | | ->sum('money'); |
| | | |
| | | return [ |
| | | 'user' => $vipUser, |
| | | 'invite_count' => $inviteCount, |
| | | 'unsettled_count' => $unsettledCount, |
| | | 'settled_money' => $settledMoney, |
| | | ]; |
| | | } |
| | | } |
| | |
| | | return false; |
| | | } |
| | | $data['user_id'] = $user['user_id']; |
| | | $data['referee_id'] = $user['referee_id']; |
| | | $isApply = $this->isApply($data['user_id']); |
| | | if ($isApply > 0) { |
| | | $this->error = '已经申请开店'; |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\supplier; |
| | | use app\api\model\plus\agent\Setting; |
| | | use app\api\model\user\UserAuth; |
| | | use app\common\exception\BaseException; |
| | | use app\common\model\supplier\Cash as CashModel; |
| | | /** |
| | | * 供应商提现模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 提交申请 |
| | | */ |
| | | public function submit($supplier, $data) |
| | | { |
| | | // 数据验证 |
| | | $this->validation($supplier, $data); |
| | | // 新增申请记录 |
| | | $this->save(array_merge($data, [ |
| | | 'shop_supplier_id' => $supplier['shop_supplier_id'], |
| | | 'app_id' => self::$app_id, |
| | | ])); |
| | | // 冻结用户资金 |
| | | $supplier->freezeMoney($data['money']); |
| | | return true; |
| | | } |
| | | /** |
| | | * 数据验证 |
| | | */ |
| | | private function validation($supplier, $data) |
| | | { |
| | | // 结算设置 |
| | | $settlement = Setting::getItem('settlement'); |
| | | // 最低提现佣金 |
| | | if ($data['money'] <= 0) { |
| | | throw new BaseException(['msg' => '提现金额不正确']); |
| | | } |
| | | if ($supplier['money'] <= 0) { |
| | | throw new BaseException(['msg' => '当前用户没有可提现佣金']); |
| | | } |
| | | if ($data['money'] > $supplier['money']) { |
| | | throw new BaseException(['msg' => '提现金额不能大于可提现佣金']); |
| | | } |
| | | if ($data['money'] < $settlement['min_money']) { |
| | | throw new BaseException(['msg' => '最低提现金额为' . $settlement['min_money']]); |
| | | } |
| | | if (!in_array($data['pay_type'], $settlement['pay_type'])) { |
| | | throw new BaseException(['msg' => '提现方式不正确']); |
| | | } |
| | | if ($data['pay_type'] == '20') { |
| | | if (empty($data['alipay_name']) || empty($data['alipay_account'])) { |
| | | throw new BaseException(['msg' => '请补全提现信息']); |
| | | } |
| | | } elseif ($data['pay_type'] == '30') { |
| | | if (empty($data['bank_name']) || empty($data['bank_account']) || empty($data['bank_card'])) { |
| | | throw new BaseException(['msg' => '请补全提现信息']); |
| | | } |
| | | } elseif ($data['pay_type'] == '10') { |
| | | //微信支付需要实名认证 |
| | | $auth = UserAuth::detail($supplier['user_id']); |
| | | if(empty($auth)){ |
| | | throw new BaseException(['msg' => '请先到个人中心->设置->实名认证']); |
| | | }elseif(!empty($auth) && $auth["auth_status"] != 1){ |
| | | throw new BaseException(['msg' => '您的实名认证还未审核通过']); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取分销商提现明细 |
| | | */ |
| | | public function getList($shop_supplier_id, $apply_status = -1,$limit=15) |
| | | { |
| | | $model = $this; |
| | | $apply_status > -1 && $model = $model->where('apply_status', '=', $apply_status); |
| | | return $model->where('shop_supplier_id', '=', $shop_supplier_id)->order(['create_time' => 'desc']) |
| | | ->paginate($limit); |
| | | } |
| | | } |
| | |
| | | $data = [ |
| | | 'order_no' => $this->orderNo(), |
| | | 'user_id' => $user['user_id'], |
| | | 'pay_source' => 'wx', |
| | | 'pay_price' => $price, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\supplier; |
| | | use app\common\model\supplier\DepositRefund as DepositRefundModel; |
| | | use app\api\model\supplier\Supplier as SupplierModel; |
| | | /** |
| | | * 押金退款模型 |
| | | */ |
| | | class DepositRefund extends DepositRefundModel |
| | | { |
| | | public function add($data) |
| | | { |
| | | return $this->transaction(function () use ($data) { |
| | | $data['app_id'] = self::$app_id; |
| | | SupplierModel::where('shop_supplier_id',$data['shop_supplier_id']) |
| | | ->update(['status'=>10]); |
| | | $this->save($data); |
| | | return true; |
| | | }); |
| | | |
| | | } |
| | | } |
| | |
| | | ->with(['logo', 'category']) |
| | | ->find(); |
| | | if ($detail) { |
| | | $detail['logos'] = $detail['logo']['file_path']; |
| | | $detail['logos'] = $detail['logo']?$detail['logo']['file_path']:''; |
| | | $detail['category_name'] = $detail['category']['name']; |
| | | unset($detail['logo']); |
| | | unset($detail['category']); |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\supplier\member; |
| | | use app\common\model\supplier\member\Member as MemberModel; |
| | | /** |
| | | * 供应商年卡 |
| | | */ |
| | | class Member extends MemberModel |
| | | { |
| | | |
| | | public static function supplierDetail( $array) |
| | | { |
| | | return (new static())->where($array)->order('price', 'desc')->find(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | namespace app\api\model\supplier\member; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | /** |
| | | * 供应商年卡订单模型 |
| | | */ |
| | | class Order extends MemberOrderModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\model\supplier\member; |
| | | use app\common\model\supplier\member\Plan as MemberPlanModel; |
| | | /** |
| | | * 供应商年卡套餐模型 |
| | | */ |
| | | class Plan extends MemberPlanModel |
| | | { |
| | | |
| | | } |
| | |
| | | |
| | | namespace app\api\service\order\paysuccess\source; |
| | | |
| | | use app\api\model\plus\bonus\Apply as BonusApplyModel; |
| | | use app\api\model\plus\bonus\Order as BonusOrderModel; |
| | | use app\api\model\plus\vip\Apply as VipApplyModel; |
| | | use app\common\enum\settings\DeliveryTypeEnum; |
| | | use app\common\library\helper; |
| | | use app\api\model\plus\agent\Apply as AgentApplyModel; |
| | |
| | | $this->becomeAgentUser($order); |
| | | // 消费达到金额成为分销商 |
| | | $this->becomeAgentByOrder($order); |
| | | // 购买指定商品成为分红用户 |
| | | $this->becomeBonusUser($order); |
| | | // 购买指定商品成为VIP用户 |
| | | $this->becomeVipUser($order); |
| | | // 分红订单 by lyzflash 2023.03.17 复购分红商品也产生奖励 |
| | | BonusOrderModel::createBonusOrder($order); |
| | | // 如果是虚拟商品,则标记为已完成,无需发货 |
| | | if($order['delivery_type']['value'] == DeliveryTypeEnum::NO_EXPRESS && $order['virtual_auto'] == 1){ |
| | | $order->save([ |
| | |
| | | $model = new AgentApplyModel; |
| | | return $model->becomeAgentByOrder($order['user_id'], $order['pay_price'], $order['app_id']); |
| | | } |
| | | /** |
| | | * 购买指定商品成为分红用户 |
| | | */ |
| | | private function becomeBonusUser($order) |
| | | { |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | $model = new BonusApplyModel; |
| | | return $model->becomeBonusUser($order['user_id'], $productIds, $order['app_id'], $order); |
| | | } |
| | | |
| | | /** |
| | | * 购买指定商品成为VIP用户 |
| | | */ |
| | | private function becomeVipUser($order) |
| | | { |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | $model = new VipApplyModel; |
| | | return $model->becomeVipUser($order['user_id'], $productIds, $order['app_id'], $order); |
| | | } |
| | | |
| | | } |
| | |
| | | use app\common\model\order\OrderVerify as OrderVerifyModel; |
| | | use app\api\model\settings\Setting as SettingModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | | use app\common\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * 订单支付成功服务类 |
| | |
| | | } |
| | | // 记录分红订单 by yj |
| | | TeamOrderModel::createOrder($detail); |
| | | // 记录VIP专区订单 |
| | | VipOrderModel::createOrder($detail); |
| | | |
| | | event('PaySuccess', $detail); |
| | | } |
| | | } |
| | |
| | | case OrderTypeEnum::BUSINESS_CARD; |
| | | return new BusinessCardPaySuccessService($out_trade_no); |
| | | break; |
| | | case OrderTypeEnum::SUPPLIER_MEMBER: |
| | | // 供应商年卡支付成功回调服务 |
| | | return new SupplierMemberPaySuccessService($out_trade_no); |
| | | break; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\api\service\order\paysuccess\type; |
| | | |
| | | use app\common\enum\order\OrderPayTypeEnum; |
| | | use app\common\service\BaseService; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | use app\common\service\supplier\MemberService; |
| | | |
| | | /** |
| | | * 供应商年卡支付成功回调服务 |
| | | */ |
| | | class SupplierMemberPaySuccessService extends BaseService |
| | | { |
| | | // 订单模型 |
| | | public $model; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | */ |
| | | public function __construct($orderNo) |
| | | { |
| | | // 实例化订单模型 |
| | | $this->model = MemberOrderModel::getPayDetail($orderNo); |
| | | } |
| | | |
| | | /** |
| | | * 返回app_id,大于0则存在订单信息 |
| | | */ |
| | | public function isExist() |
| | | { |
| | | if ($this->model) { |
| | | return $this->model['app_id']; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 订单支付成功业务处理 |
| | | */ |
| | | public function onPaySuccess($payType, $payData = []) |
| | | { |
| | | // 更新订单状态 |
| | | $status = $this->updateOrderInfo($payType, $payData); |
| | | if (!$status) { |
| | | return false; |
| | | } |
| | | |
| | | // 激活年卡 |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->activateMember($this->model['order_id']); |
| | | |
| | | if (!$result) { |
| | | $this->error = '激活年卡失败'; |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 更新订单记录 |
| | | */ |
| | | private function updateOrderInfo($payType, $payData) |
| | | { |
| | | // 更新订单状态 |
| | | $order = [ |
| | | 'pay_status' => 20, |
| | | 'pay_type' => $payType, |
| | | 'pay_time' => time(), |
| | | ]; |
| | | |
| | | if ($payType == OrderPayTypeEnum::WECHAT || $payType == OrderPayTypeEnum::ALIPAY) { |
| | | $order['transaction_id'] = $payData['transaction_id']; |
| | | } |
| | | |
| | | return $this->model->save($order); |
| | | } |
| | | } |
| | |
| | | $data = $this->postData(); |
| | | $data['branch_id'] = $this->getBranchId(); |
| | | $model = new UserModel(); |
| | | $num = $model->getUserName(['is_delete'=>0,'user_name' => $data['user_name']]); |
| | | $num = $model->getUserName(['is_delete' => 0,'user_name' => $data['user_name']]); |
| | | if ($num > 0) { |
| | | return $this->renderError('用户名已存在'); |
| | | } |
| | |
| | | { |
| | | $model = new MemberModel; |
| | | $postData = $this->postData(); |
| | | $branch = $this->branch['user']; |
| | | $postData['branch_id'] = $branch['branch_id']; |
| | | $list = $model->getList($postData); |
| | | |
| | | return $this->renderSuccess('', compact('list')); |
| | |
| | | return $this->renderSuccess('', compact('positionList', 'areaList')); |
| | | } |
| | | $model = new MemberModel; |
| | | $postData = $this->postData(); |
| | | $branch = $this->branch['user']; |
| | | $postData['branch_id'] = $branch['branch_id']; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | if ($model->add($postData)) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '添加失败'); |
| | |
| | | $this->startTrans(); |
| | | try { |
| | | // 用户是否已绑定 |
| | | $user = null; |
| | | if($data['user_id'] > 0){ |
| | | $user = UserModel::detail($data['user_id']); |
| | | if($user['user_type'] != 1){ |
| | | $this->error = '该用户已绑定,或绑定的商户正在审核'; |
| | | return false; |
| | | } |
| | | } |
| | | // $user = null; |
| | | // if($data['user_id'] > 0){ |
| | | // $user = UserModel::detail($data['user_id']); |
| | | // if($user['user_type'] != 1){ |
| | | // $this->error = '该用户已绑定或正在审核'; |
| | | // return false; |
| | | // } |
| | | // } |
| | | $arr = [ |
| | | 'user_name' => trim($data['user_name']), |
| | | 'password' => salt_hash($data['password']), |
| | |
| | | } |
| | | $model->saveAll($add_arr); |
| | | // 后台添加的直接算审核通过 |
| | | if($user){ |
| | | $user->save([ |
| | | 'user_type' => 2 |
| | | ]); |
| | | } |
| | | // if($user){ |
| | | // $user->save([ |
| | | // 'user_type' => 2 |
| | | // ]); |
| | | // } |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | |
| | | $old_user_id = $this['user']['user_id']; |
| | | } |
| | | $userChange = false; |
| | | if($this['user'] && $data['user_id'] > 0 && $data['user_id'] != $this['user']['user_id']){ |
| | | $user = UserModel::detail($data['user_id']); |
| | | if($user['user_type'] != 1){ |
| | | $this->error = '该用户已绑定,或绑定的商户正在审核'; |
| | | return false; |
| | | } |
| | | $userChange = true; |
| | | } |
| | | // if($this['user'] && $data['user_id'] > 0 && $data['user_id'] != $this['user']['user_id']){ |
| | | // $user = UserModel::detail($data['user_id']); |
| | | // if($user['user_type'] != 1){ |
| | | // $this->error = '该用户已绑定,或绑定的商户正在审核'; |
| | | // return false; |
| | | // } |
| | | // $userChange = true; |
| | | // } |
| | | |
| | | $arr = [ |
| | | 'user_name' => $data['user_name'], |
| | | 'user_id' => $data['user_id'], |
| | | // 'user_id' => $data['user_id'], |
| | | 'real_name' => $data['real_name'], |
| | | ]; |
| | | if (!empty($data['password'])) { |
| | |
| | | } |
| | | $model->saveAll($add_arr); |
| | | // 后台添加的直接算审核通过 |
| | | if($userChange){ |
| | | $user->save([ |
| | | 'user_type' => 2 |
| | | ]); |
| | | //取消原来的 |
| | | if ($old_user_id > 0){ |
| | | (new UserModel())->where('user_id', '=', $old_user_id)->update([ |
| | | 'user_type' => 1 |
| | | ]); |
| | | } |
| | | } |
| | | // if($userChange){ |
| | | // $user->save([ |
| | | // 'user_type' => 2 |
| | | // ]); |
| | | // //取消原来的 |
| | | // if ($old_user_id > 0){ |
| | | // (new UserModel())->where('user_id', '=', $old_user_id)->update([ |
| | | // 'user_type' => 1 |
| | | // ]); |
| | | // } |
| | | // } |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | |
| | | */ |
| | | public function getMemberList($branch_id, $params) |
| | | { |
| | | $model = $this->with('A') |
| | | $model = $this->alias('A') |
| | | ->join('user B', 'B.user_id=A.user_id', 'left') |
| | | ->field(['A.user_id,B.avatarUrl,B.nickName,B.real_name,B.mobile,B.create_time']); |
| | | ->field(['A.user_id,A.branch_id,B.avatarUrl,B.nickName,B.real_name,B.mobile,B.create_time']); |
| | | if (isset($params['search']) && $params['search'] != '') { |
| | | $model = $model->where('B.nickName|B.mobile,B.real_name', 'like', '%' . trim($params['search']) . '%'); |
| | | } |
| | |
| | | const BRANCHACTIVITY = 90; |
| | | // 名片购买订单 |
| | | const BUSINESS_CARD = 100; |
| | | // 供应商年卡订单 |
| | | const SUPPLIER_MEMBER = 110; |
| | | |
| | | /** |
| | | * 获取订单类型值 |
| | | */ |
| | |
| | | 'name' => '名片购买订单', |
| | | 'value' => self::BUSINESS_CARD, |
| | | ], |
| | | self::SUPPLIER_MEMBER => [ |
| | | 'name' => '供应商年卡订单', |
| | | 'value' => self::SUPPLIER_MEMBER, |
| | | ], |
| | | ]; |
| | | } |
| | | |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\enum\plus\vip; |
| | | /** |
| | | * VIP专区订单类型 |
| | | */ |
| | | class VipAreaTypeEnum |
| | | { |
| | | const NORMAL = 10; // 推广 |
| | | const REFERRAL = 20; // 推广复购 |
| | | const VIP_SUBSIDY = 30; // 下级收益补贴 |
| | | const DIRECT_REFEREE = 40; // 平台直推佣金 |
| | | |
| | | /** |
| | | * 获取VIP专区订单类型名称 |
| | | * @return array |
| | | */ |
| | | public static function getTypeName() |
| | | { |
| | | return [ |
| | | self::NORMAL => '推广', |
| | | self::REFERRAL => '推广复购', |
| | | self::VIP_SUBSIDY => '下级收益补贴', |
| | | self::DIRECT_REFEREE => '平台直推佣金', |
| | | ]; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\enum\supplier; |
| | | |
| | | /** |
| | | * 供应商年卡订单状态枚举 |
| | | */ |
| | | class MemberOrderStatusEnum |
| | | { |
| | | // 待支付 |
| | | const PENDING = 10; |
| | | |
| | | // 已支付 |
| | | const SUCCESS = 20; |
| | | |
| | | /** |
| | | * 获取订单状态列表 |
| | | * @return array |
| | | */ |
| | | public static function data() |
| | | { |
| | | return [ |
| | | self::PENDING => '待支付', |
| | | self::SUCCESS => '已支付', |
| | | ]; |
| | | } |
| | | |
| | | /** |
| | | * 获取订单状态名称 |
| | | * @param int $status 状态值 |
| | | * @return string |
| | | */ |
| | | public static function getName($status) |
| | | { |
| | | $data = self::data(); |
| | | return isset($data[$status]) ? $data[$status] : '未知状态'; |
| | | } |
| | | } |
| | |
| | | 'value' => self::POINTS, |
| | | 'describe' => '积分转换余额', |
| | | ], |
| | | self::CASH => [ |
| | | 'name' => '余额提现', |
| | | 'value' => self::CASH, |
| | | 'describe' => '余额提现:%s', |
| | | ], |
| | | ]; |
| | | } |
| | | |
| | |
| | | } |
| | | $this['advance']->save(['order_status' => 20]); |
| | | } |
| | | // 减少用户购买商品次数 |
| | | UserModel::decreasePurchaseCount($this['user_id'], $this['product'], $this['app_id']); |
| | | // 更新订单状态 |
| | | return $this->save(['order_status' => 20,'is_refund' => 1,'refund_money' => $this['pay_price'], 'cancel_remark' => $data['cancel_remark']]); |
| | | }); |
| | |
| | | $this['advance']->save(['order_status' => 20]); |
| | | } |
| | | } |
| | | // 减少用户购买商品次数 |
| | | UserModel::decreasePurchaseCount($this['user_id'], $this['product'], $this['app_id']); |
| | | // 更新订单状态 |
| | | //return $this->save(['order_status' => $data['is_cancel'] ? 20 : 10]); |
| | | return $this->save([ |
| | |
| | | return $count; |
| | | } |
| | | |
| | | |
| | | public function sendWxExpress($express_id, $express_no) |
| | | { |
| | | //判断后台是否设置了微信发货 by yj 2024.4.10 |
| | |
| | | { |
| | | // 验证是否设置 |
| | | $config = Setting::getItem('condition', $appId); |
| | | if ($config['become__buy_product'] != '1' || empty($config['become__buy_product_ids'])) { |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | //单次消费 |
| | | if ($config['become'] == '30' && $order_price < $config['once_money']) { |
| | | return false; |
| | | } |
| | | //累计消费 |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\agent\User as agentUser; |
| | | use app\common\model\plus\agent\Referee as agentReferee; |
| | | //use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\model\plus\bonus\Order as BonusOrderModel; |
| | | use app\common\model\user\User as UserModel; |
| | | /** |
| | | * 队长申请模型 |
| | | */ |
| | | class Apply extends BaseModel |
| | | { |
| | | protected $name = 'bonus_apply'; |
| | | protected $pk = 'apply_id'; |
| | | |
| | | /** |
| | | * 申请状态 |
| | | * @var array |
| | | */ |
| | | public $applyStatus = [ |
| | | 10 => '待审核', |
| | | 20 => '审核通过', |
| | | 30 => '驳回', |
| | | ]; |
| | | |
| | | /** |
| | | * 申请时间 |
| | | * @param $value |
| | | * @return false|string |
| | | */ |
| | | public function getApplyTimeAttr($value) |
| | | { |
| | | return date('Y-m-d H:i:s', $value); |
| | | } |
| | | |
| | | /** |
| | | * 审核时间 |
| | | * @param $value |
| | | * @return false|int|string |
| | | */ |
| | | public function getAuditTimeAttr($value) |
| | | { |
| | | return $value > 0 ? date('Y-m-d H:i:s', $value) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 关联推荐人表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function referee() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'referee_id') |
| | | ->field(['user_id', 'nickName']); |
| | | } |
| | | |
| | | /** |
| | | * 销商申请记录详情 |
| | | * @param $where |
| | | * @return array|\think\Model|null |
| | | * @throws \think\db\exception\DataNotFoundException |
| | | * @throws \think\db\exception\DbException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | */ |
| | | public static function detail($where) |
| | | { |
| | | $filter = is_array($where) ? $where : ['apply_id' => $where]; |
| | | return (new static())->where($filter)->find(); |
| | | } |
| | | |
| | | /** |
| | | * 购买指定商品成为分红用户 |
| | | * @param $userId |
| | | * @param $productIds |
| | | * @param $appId |
| | | * @return bool |
| | | */ |
| | | public function becomeBonusUser($userId, $productIds, $appId, $order) |
| | | { |
| | | // 验证是否设置 |
| | | $config = Setting::getItem('basic', $appId); |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | $purchase_count=0; |
| | | // 每买一个指定商品就生成一个分红订单 |
| | | foreach ($order['product'] as $product) { |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | $purchase_count+=$quantity; |
| | | // 为每个商品生成分红订单 |
| | | for ($i = 0; $i < $quantity; $i++) { |
| | | UserModel::setRepurchaseFrequency($userId); |
| | | } |
| | | } |
| | | } |
| | | if(User::isBonusUser($userId)) { |
| | | return false; |
| | | } |
| | | if ($config['purchase_count']>0){ |
| | | if($purchase_count<$config['purchase_count']){ |
| | | return false; |
| | | } |
| | | } |
| | | //同时成为分销商 |
| | | $referee_id = agentReferee::getRefereeUserId($userId, 1); |
| | | if ($config['become_agent']) { |
| | | agentUser::add($userId, [ |
| | | 'referee_id' => $referee_id, |
| | | 'app_id' => $appId, |
| | | ]); |
| | | } |
| | | // 新增分红用户 |
| | | User::add($userId, [ |
| | | 'referee_id' => $referee_id, |
| | | 'app_id' => $appId, |
| | | ]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 审核状态 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getApplyStatusAttr($value) |
| | | { |
| | | $method = [10 => '待审核', 20 => '审核通过', '30' => '驳回']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 审核方式 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getApplyTypeAttr($value) |
| | | { |
| | | $method = [10 => '后台审核', 20 => '无需审核']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 队长资金明细模型 |
| | | */ |
| | | class Capital extends BaseModel |
| | | { |
| | | protected $name = 'bonus_capital'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 队长资金明细 |
| | | * @param $data |
| | | */ |
| | | public static function add($data) |
| | | { |
| | | $model = new static; |
| | | $app_id = isset($data['app_id']) ? $data['app_id'] : $model::$app_id; |
| | | $model->save(array_merge([ |
| | | 'app_id' => $app_id |
| | | ], $data)); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 队长提现明细模型 |
| | | */ |
| | | class Cash extends BaseModel |
| | | { |
| | | protected $name = 'bonus_cash'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 打款方式 |
| | | * @var array |
| | | */ |
| | | public $payType = [ |
| | | 10 => '微信', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡', |
| | | 40 => '余额', |
| | | ]; |
| | | |
| | | /** |
| | | * 申请状态 |
| | | * @var array |
| | | */ |
| | | public $applyStatus = [ |
| | | 10 => '待审核', |
| | | 20 => '审核通过', |
| | | 30 => '驳回', |
| | | 40 => '已打款', |
| | | 50 => '打款中', |
| | | ]; |
| | | |
| | | /** |
| | | * 关联队长用户表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('User'); |
| | | } |
| | | |
| | | /** |
| | | * 审核状态 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getApplyStatusAttr($value) |
| | | { |
| | | $method = [10 => '待审核', 20 => '审核通过', 30 => '驳回', 40 => '已打款', 50 => '打款中']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 提现详情 |
| | | * @param $id |
| | | * @return array|\think\Model|null |
| | | * @throws \think\db\exception\DataNotFoundException |
| | | * @throws \think\db\exception\DbException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | */ |
| | | public static function detail($id, $with = ['user']) |
| | | { |
| | | return (new static())->with($with)->find($id); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 用户等级模型 |
| | | */ |
| | | class Grade extends BaseModel |
| | | { |
| | | protected $pk = 'grade_id'; |
| | | protected $name = 'bonus_user_grade'; |
| | | |
| | | /** |
| | | * 用户等级模型初始化 |
| | | */ |
| | | public static function init() |
| | | { |
| | | parent::init(); |
| | | } |
| | | |
| | | /** |
| | | * 获取详情 |
| | | */ |
| | | public static function detail($grade_id) |
| | | { |
| | | return (new static())->find($grade_id); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getLists() |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->field('grade_id,name') |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取可用的会员等级列表 |
| | | */ |
| | | public static function getUsableList($appId = null) |
| | | { |
| | | $model = new static; |
| | | $appId = $appId ? $appId : $model::$app_id; |
| | | return $model->where('is_delete', '=', '0') |
| | | ->where('app_id', '=', $appId) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取默认等级id |
| | | */ |
| | | public static function getDefaultGradeId(){ |
| | | $grade = (new static())->where('is_default', '=', 1)->find(); |
| | | if (empty($grade)){ |
| | | self::create([ |
| | | 'app_id' => static::$app_id, |
| | | 'name' => '默认等级', |
| | | 'is_default' => 1, |
| | | 'weight' => 100, |
| | | ]); |
| | | $grade = (new static())->where('is_default', '=', 1)->find(); |
| | | } |
| | | return $grade['grade_id']; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 用户会员等级变更记录模型 |
| | | */ |
| | | class GradeLog extends BaseModel |
| | | { |
| | | protected $name = 'bonus_user_grade_log'; |
| | | protected $pk = 'log_id'; |
| | | protected $updateTime = false; |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | /** |
| | | * 队长订单模型 |
| | | */ |
| | | class Order extends BaseModel |
| | | { |
| | | protected $name = 'bonus_order'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 获取用户订单数 |
| | | * @param $user_id |
| | | * @return int |
| | | */ |
| | | public static function getUserOrderCounti($user_id) |
| | | { |
| | | return (new static()) |
| | | ->where('is_invalid', '=', 0) |
| | | ->where('user_id', '=', $user_id) |
| | | ->count()+1; |
| | | } |
| | | |
| | | /** |
| | | * 订单所属用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User'); |
| | | } |
| | | |
| | | /** |
| | | * 一级队长用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function bonusFirst() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'first_user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 二级队长用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function bonusSecond() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'second_user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 三级队长用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function bonusThird() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'third_user_id'); |
| | | } |
| | | /** |
| | | * 收益补贴用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function subsidy() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'subsidy_user_id'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单类型 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getOrderTypeAttr($value) |
| | | { |
| | | $types = OrderTypeEnum::getTypeName(); |
| | | return ['text' => $types[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 订单详情 |
| | | */ |
| | | public static function getDetailByOrderId($orderId, $orderType) |
| | | { |
| | | return (new static())->where('order_id', '=', $orderId) |
| | | ->where('order_type', '=', $orderType) |
| | | ->find(); |
| | | } |
| | | /** |
| | | * 获取订单所有同样订单id详情 |
| | | */ |
| | | public static function getDetailByOrderIdAll($orderId, $orderType) |
| | | { |
| | | return (new static())->where('order_id', '=', $orderId) |
| | | ->where('order_type', '=', $orderType) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 发放分销订单佣金 |
| | | * @param $order |
| | | * @param int $orderType |
| | | * @return bool |
| | | * @throws \think\db\exception\DataNotFoundException |
| | | * @throws \think\db\exception\DbException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | */ |
| | | public static function grantMoney($order, $orderType = OrderTypeEnum::MASTER) |
| | | { |
| | | // 订单是否已完成 |
| | | if ($order['order_status']['value'] != 30) { |
| | | return false; |
| | | } |
| | | |
| | | // 分销订单详情 |
| | | $models = self::getDetailByOrderIdAll($order['order_id'], $orderType); |
| | | foreach ($models as $model) { |
| | | if (!$model || $model['is_settled'] == 1) { |
| | | return false; |
| | | } |
| | | // 重新计算分红 |
| | | $capital = $model->getCapitalByOrder($order,$model); |
| | | // 发放直推分红 |
| | | $model['first_user_id'] > 0 && User::grantMoney($model['first_user_id'], $capital['first_money'], 10); |
| | | // 发放业绩分红 |
| | | $model['second_user_id'] > 0 && User::grantMoney($model['second_user_id'], $capital['second_money'], 20,$model['purchase_count']); |
| | | // 发放补贴分红 |
| | | $model['subsidy_user_id'] > 0 && User::grantMoney($model['subsidy_user_id'], $capital['subsidy_money'], 30); |
| | | // 更新分销订单记录 |
| | | $model->save([ |
| | | 'order_price' => $capital['orderPrice'], |
| | | 'first_money' => $model['first_user_id'] > 0? $capital['first_money']:0, |
| | | 'second_money' => $model['second_user_id'] > 0? $capital['second_money']:0, |
| | | 'is_settled' => 1, |
| | | 'settle_time' => time() |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 计算订单分销佣金 |
| | | * @param $order |
| | | * @return array |
| | | */ |
| | | protected function getCapitalByOrder($order,$teamOrder) |
| | | { |
| | | $capital=[ |
| | | 'orderPrice'=>$teamOrder['order_price'], |
| | | 'first_money'=>$teamOrder['first_money'], |
| | | 'second_money'=>$teamOrder['second_money'], |
| | | 'subsidy_money'=>$teamOrder['subsidy_money'] |
| | | ]; |
| | | return $capital; |
| | | } |
| | | |
| | | /** |
| | | * 计算商品实际佣金 |
| | | * @param $setting |
| | | * @param $product |
| | | * @param $productPrice |
| | | * @return float[]|int[] |
| | | */ |
| | | private function calculateProductCapital($setting, $product, $productPrice) |
| | | { |
| | | |
| | | // 分红佣金类型:百分比 |
| | | return [ |
| | | 'first_money' => $productPrice, |
| | | 'second_money' => $productPrice |
| | | ]; |
| | | } |
| | | |
| | | /** |
| | | * 验证商品是否存在售后 |
| | | * @param $product |
| | | * @return bool |
| | | */ |
| | | private function checkProductRefund($product) |
| | | { |
| | | return !empty($product['refund']) |
| | | && $product['refund']['type']['value'] != 20 |
| | | && $product['refund']['is_agree']['value'] != 20; |
| | | } |
| | | |
| | | public static function getUserOrderCount($user_id) |
| | | { |
| | | return (new static())->where('second_user_id', '=', $user_id) |
| | | ->count(); |
| | | } |
| | | |
| | | /** |
| | | * 创建分红订单记录 |
| | | */ |
| | | public static function createOrder($order, $order_type = OrderTypeEnum::MASTER) |
| | | { |
| | | // 分销订单模型 |
| | | $model = new self; |
| | | // 分销商基本设置 |
| | | $setting = Setting::getItem('basic', $order['app_id']); |
| | | // 是否开启分红功能 |
| | | if (!$setting['is_open']) { |
| | | return false; |
| | | } |
| | | // 获取当前买家的直推奖用户id和业绩奖用户id |
| | | $agentUser = $model->getAgentUserId($order, $setting['begin_num']); |
| | | // 无分红用户 |
| | | if (!$agentUser['first_user_id'] && !$agentUser['second_user_id']) { |
| | | return false; |
| | | } |
| | | $purchase_count=self::getUserOrderCount($order['user_id']); |
| | | /*$user=User::detail($order['user_id']); |
| | | if ($user['purchase_count']<=$purchase_count&&$user['purchase_count']!=11){ |
| | | return false; |
| | | }*/ |
| | | // 检查商品是否设置独立分红 |
| | | $one_money = $setting['one_money']; |
| | | $two_money = $setting['two_money']; |
| | | if ($order['product'][0]['is_ind_bonus']) { |
| | | $one_money = $order['product'][0]['one_money']; |
| | | $two_money = $order['product'][0]['two_money']; |
| | | |
| | | } |
| | | $subsidy_money=0; |
| | | if ($agentUser['subsidy_user_id']>0){ |
| | | $subsidy_money = bcmul(bcadd($one_money,$two_money,2),bcdiv($setting['operating_subsidy'],100,2),2); |
| | | } |
| | | // 保存分红订单记录 |
| | | return $model->save([ |
| | | 'user_id' => $order['user_id'], |
| | | 'order_id' => $order['order_id'], |
| | | 'order_type' => $order_type, |
| | | 'order_price' => bcsub($order['pay_price'], $order['express_price'], 2), |
| | | 'first_money' => $agentUser['first_user_id'] > 0 ? $one_money : 0, |
| | | 'second_money' => $two_money, |
| | | 'first_user_id' => $one_money > 0 ?$agentUser['first_user_id']:0, |
| | | 'second_user_id' => $agentUser['second_user_id'], |
| | | 'subsidy_user_id'=>$agentUser['subsidy_user_id'], |
| | | 'subsidy_money'=>$subsidy_money, |
| | | 'purchase_count'=>$purchase_count, |
| | | 'is_settled' => 0, |
| | | 'app_id' => $order['app_id'] |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前买家的所有上级分销商用户id |
| | | */ |
| | | private function getAgentUserId($order, $begin_num) |
| | | { |
| | | $user = UserModel::detail($order['user_id']); |
| | | if (empty($user['parent_id'])) { |
| | | $second_user_id = 0; |
| | | } else { |
| | | $second_user_id = UserModel::getSecondUserId($user['user_id'], $begin_num, $order); |
| | | } |
| | | if ($second_user_id==0){ |
| | | $subsidy_user_id = 0; |
| | | }else{ |
| | | $subsidy_user_id = UserModel::getSubsidyUserId($second_user_id); //补贴用户 |
| | | } |
| | | $agentUser = [ |
| | | 'first_user_id' => UserModel::getFirstUserId($order['user_id']), //直推用户 |
| | | 'second_user_id' => $second_user_id, //业绩奖用户 |
| | | 'subsidy_user_id'=>$subsidy_user_id, //补贴用户 |
| | | ]; |
| | | return $agentUser; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | |
| | | /** |
| | | * 业绩统计模型 |
| | | */ |
| | | class Performance extends BaseModel |
| | | { |
| | | protected $name = 'bonus_performance'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 业绩所属用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User'); |
| | | } |
| | | |
| | | /** |
| | | * 业绩明细 |
| | | * @param $data |
| | | */ |
| | | public static function add($data) |
| | | { |
| | | $model = new static; |
| | | return $model->save($data); |
| | | } |
| | | |
| | | public static function getPerformanceCount($user_id, $is_own = false) |
| | | { |
| | | $where = ['performance_id' => $user_id]; |
| | | if ($is_own) { |
| | | $where['is_own'] = 1; |
| | | } |
| | | return (new static())->where($where)->count(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\agent\Referee as agentRefereeModel; |
| | | use app\common\model\user\User as UserModel; |
| | | /** |
| | | * 队长推荐关系模型 |
| | | */ |
| | | class Referee extends BaseModel |
| | | { |
| | | protected $name = 'bonus_referee'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 关联用户表 |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User'); |
| | | } |
| | | |
| | | /** |
| | | * 关联队长用户表 |
| | | */ |
| | | public function bonus() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\bonus\\User')->where('is_delete', '=', 0); |
| | | } |
| | | |
| | | /** |
| | | * 关联队长用户表 |
| | | */ |
| | | public function bonus1() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\bonus\\User', 'bonus_id')->where('is_delete', '=', 0); |
| | | } |
| | | |
| | | /** |
| | | * 获取上级用户id |
| | | */ |
| | | public static function getRefereeUserId($user_id, $level, $is_team = false) |
| | | { |
| | | $bonus_id = (new self)->where(compact('user_id', 'level')) |
| | | ->value('bonus_id'); |
| | | if (!$bonus_id) return 0; |
| | | return $is_team ? (User::isBonusUser($bonus_id) ? $bonus_id : 0) : $bonus_id; |
| | | } |
| | | |
| | | /** |
| | | * 获取我的团队列表 |
| | | */ |
| | | public function getList($user_id, $level = -1) |
| | | { |
| | | $userIds=$this->getBonusUserIds($user_id); |
| | | $model = new UserModel(); |
| | | |
| | | $ids = implode(",", $userIds); |
| | | return $model->where('is_delete', '=', 0) |
| | | ->where('user_id', 'in', $userIds) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate(15); |
| | | } |
| | | /** |
| | | * 获取队长的所有队员 |
| | | */ |
| | | public function getBonusUserIds($user_id) |
| | | { |
| | | |
| | | $agentRefereeModel=new agentRefereeModel(); |
| | | //获取下级团队成员ID集 |
| | | $user_ids=$agentRefereeModel->getBonusUserIds($user_id, 1); |
| | | |
| | | $teamUserIds=array(); |
| | | $cengji=0; |
| | | while ($cengji<=10) { |
| | | $cengji++; |
| | | if(!empty($user_ids)){ |
| | | $old=$user_ids; |
| | | $new=array(); |
| | | foreach($old as $key=>$value){ |
| | | $teamUserIds[]=$value; |
| | | $user_ids=$agentRefereeModel->getBonusUserIds($value, 1); |
| | | $new=array_merge($new,$user_ids); |
| | | } |
| | | $user_ids=$new; |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return $teamUserIds; |
| | | } |
| | | |
| | | /** |
| | | * 创建分红层级关系 |
| | | */ |
| | | public static function createRelation($user_id, $referee_id) |
| | | { |
| | | $user = UserModel::detail($user_id); |
| | | // 分红基本设置 |
| | | $setting = Setting::getItem('basic', $user['app_id']); |
| | | // 是否开启分红功能 |
| | | if (!$setting['is_open']) { |
| | | return false; |
| | | } |
| | | // 自分享 |
| | | // if ($user_id == $referee_id) { |
| | | // return false; |
| | | // } |
| | | // # 记录一级推荐关系 |
| | | // 判断当前用户是否已存在推荐关系 |
| | | // if (self::isExistReferee($user_id)) { |
| | | // return false; |
| | | // } |
| | | // 判断推荐人是否为分销商 |
| | | // if (!User::isBonusUser($referee_id)) { |
| | | // return false; |
| | | // } |
| | | // 新增关系记录 |
| | | $model = new self; |
| | | $model->add($referee_id, $user_id, 1); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 新增关系记录 |
| | | */ |
| | | private function add($bonus_id, $user_id, $level = 1) |
| | | { |
| | | $user = UserModel::detail($user_id); |
| | | // 新增推荐关系 |
| | | $app_id = $user['app_id']; |
| | | $create_time = time(); |
| | | $this->insert(compact('bonus_id', 'user_id', 'level', 'app_id', 'create_time')); |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use think\facade\Cache; |
| | | |
| | | /** |
| | | * 分红用户设置模型 |
| | | */ |
| | | class Setting extends BaseModel |
| | | { |
| | | protected $name = 'bonus_setting'; |
| | | protected $createTime = false; |
| | | |
| | | /** |
| | | * 转义数组格式 |
| | | * @param $value |
| | | * @return mixed |
| | | */ |
| | | public function getValuesAttr($value) |
| | | { |
| | | return json_decode($value, true); |
| | | } |
| | | |
| | | /** |
| | | * 转义成json格式 |
| | | * @param $value |
| | | * @return false|string |
| | | */ |
| | | public function setValuesAttr($value) |
| | | { |
| | | return json_encode($value); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定项设置 |
| | | * @param $key |
| | | * @param null $app_id |
| | | * @return array|mixed |
| | | */ |
| | | public static function getItem($key, $app_id = null) |
| | | { |
| | | $data = static::getAll($app_id); |
| | | return isset($data[$key]) ? $data[$key]['values'] : []; |
| | | } |
| | | |
| | | /** |
| | | * 获取分红用户设置 |
| | | */ |
| | | public static function getAll($app_id = null) |
| | | { |
| | | $self = new static; |
| | | is_null($app_id) && $app_id = $self::$app_id; |
| | | if (!$data = Cache::get('bonus_setting_' . $app_id)) { |
| | | $data = array_column($self->select()->toArray(), null, 'key'); |
| | | Cache::tag('cache')->set('bonus_setting_' . $app_id, $data); |
| | | } |
| | | return array_merge_multiple($self->defaultData(), $data); |
| | | } |
| | | |
| | | /** |
| | | * 获取设置项信息 |
| | | */ |
| | | public static function detail($key) |
| | | { |
| | | return (new static())->find(compact('key')); |
| | | } |
| | | |
| | | /** |
| | | * 是否开启分红功能 |
| | | */ |
| | | public static function isOpen($app_id = null) |
| | | { |
| | | return static::getItem('basic', $app_id)['is_open']; |
| | | } |
| | | |
| | | /** |
| | | * 是否开启限制购买 |
| | | */ |
| | | public static function isLimitBuy($app_id = null) |
| | | { |
| | | return static::getItem('basic', $app_id)['limit_buy']; |
| | | } |
| | | |
| | | /** |
| | | * 是否开启同时成为分销商 |
| | | */ |
| | | public static function isBecomeAgent($app_id = null) |
| | | { |
| | | return static::getItem('basic', $app_id)['become_agent']; |
| | | } |
| | | |
| | | /** |
| | | * 分销中心页面名称 |
| | | */ |
| | | public static function getbonusTitle($app_id = null) |
| | | { |
| | | return static::getItem('words', $app_id)['index']['title']['value']; |
| | | } |
| | | |
| | | /** |
| | | * 默认配置 |
| | | */ |
| | | public function defaultData() |
| | | { |
| | | return [ |
| | | 'basic' => [ |
| | | 'key' => 'basic', |
| | | 'describe' => '基础设置', |
| | | 'values' => [ |
| | | // 是否开启分销功能 |
| | | 'is_open' => '0', // 参数值:1开启 0关闭 |
| | | // 购买指定商品的id集 |
| | | 'become__buy_product_ids' => [], |
| | | // 购买VIP专区商品次数 |
| | | 'purchase_count' => '0', |
| | | // 限制购物,用户需要成为分红用户后才能在商城购物 |
| | | 'limit_buy' => '1', // 参数值:1开启 0关闭 |
| | | 'limit_word' => '您需要成为分红用户后才能下单购买商品。', |
| | | // 同步成为分销商,用户成为分红用户后同时成为分销商,不受分销插件条件影响 |
| | | 'become_agent' => '1', // 参数值:1开启 0关闭 |
| | | 'begin_num' => 15, // 业绩全拿计数起点 |
| | | 'expire_day' => '0', // 排位有效期,0位永久有效 |
| | | 'keep_assets' => '0', // 更换排位用户是否保留资产 1保留 0不保留 |
| | | // 收益补贴 |
| | | 'operating_subsidy' => '0', |
| | | ], |
| | | ], |
| | | 'condition' => [ |
| | | 'key' => 'condition', |
| | | 'describe' => '分红用户条件', |
| | | 'values' => [ |
| | | // 成为分红用户条件 |
| | | 'become' => '10', // 参数值:10填写申请信息(需后台审核) 20填写申请信息(无需审核) |
| | | // 购买指定商品成为分红用户 0关闭 1开启 |
| | | 'become__buy_product' => '0', |
| | | // 购买指定商品的id集 |
| | | 'become__buy_product_ids' => [], |
| | | // 成为下线条件 |
| | | 'downline' => '10', // 参数值:10首次点击分享链接 20首次下单 30首次付款 |
| | | ] |
| | | ], |
| | | 'commission' => [ |
| | | 'key' => 'commission', |
| | | 'describe' => '分红设置', |
| | | 'values' => [ |
| | | // 一级分红 |
| | | 'first_money' => '0', |
| | | // 一级分红 |
| | | 'second_money' => '0', |
| | | // 一级分红 |
| | | 'third_money' => '0', |
| | | ] |
| | | ], |
| | | 'settlement' => [ |
| | | 'key' => 'settlement', |
| | | 'describe' => '结算', |
| | | 'values' => [ |
| | | // 提现方式 |
| | | 'pay_type' => [], // 参数值:10微信支付 20支付宝支付 30银行卡支付 |
| | | // 微信支付自动打款 |
| | | 'wechat_pay_auto' => '0', // 微信支付自动打款:1开启 0关闭 |
| | | 'fee_rate'=>0, |
| | | // 最低提现额度 |
| | | 'min_money' => '10.00', |
| | | // 分红结算天数 |
| | | 'settle_days' => '0', |
| | | 'explain' => '' |
| | | ] |
| | | ], |
| | | 'words' => [ |
| | | 'key' => 'words', |
| | | 'describe' => '自定义文字', |
| | | 'values' => [ |
| | | 'index' => [ |
| | | 'title' => [ |
| | | 'default' => '分红中心', |
| | | 'value' => '分红中心' |
| | | ], |
| | | 'words' => [ |
| | | 'not_bonus' => [ |
| | | 'default' => '您还不是分红用户,请先提交申请', |
| | | 'value' => '您还不是分红用户,请先提交申请' |
| | | ], |
| | | 'apply_now' => [ |
| | | 'default' => '立即加入', |
| | | 'value' => '立即加入' |
| | | ], |
| | | 'referee' => [ |
| | | 'default' => '推荐人', |
| | | 'value' => '推荐人' |
| | | ], |
| | | 'money' => [ |
| | | 'default' => '可提现分红', |
| | | 'value' => '可提现' |
| | | ], |
| | | 'freeze_money' => [ |
| | | 'default' => '待提现分红', |
| | | 'value' => '待提现' |
| | | ], |
| | | 'total_money' => [ |
| | | 'default' => '已提现金额', |
| | | 'value' => '已提现金额' |
| | | ], |
| | | 'cash' => [ |
| | | 'default' => '去提现', |
| | | 'value' => '去提现' |
| | | ], |
| | | 'freeze_money_second' => [ |
| | | 'default' => '已冻结金额', |
| | | 'value' => '已冻结金额' |
| | | ], |
| | | 'expire' => [ |
| | | 'default' => '如果排位不在有效期内,您的业绩奖将被冻结;您可以通过推荐新用户获得有效期。', |
| | | 'value' => '如果排位不在有效期内,您的业绩奖将被冻结;您可以通过推荐新用户获得有效期。' |
| | | ], |
| | | |
| | | ] |
| | | ], |
| | | 'apply' => [ |
| | | 'title' => [ |
| | | 'default' => '申请成为分红用户', |
| | | 'value' => '申请成为分红用户' |
| | | ], |
| | | 'words' => [ |
| | | 'title' => [ |
| | | 'default' => '请填写申请信息', |
| | | 'value' => '请填写申请信息' |
| | | ], |
| | | 'license' => [ |
| | | 'default' => '申请协议', |
| | | 'value' => '申请协议' |
| | | ], |
| | | 'submit' => [ |
| | | 'default' => '申请成为分红用户', |
| | | 'value' => '申请成为分红用户' |
| | | ], |
| | | 'wait_audit' => [ |
| | | 'default' => '您的申请已受理,正在进行信息核验,请耐心等待。', |
| | | 'value' => '您的申请已受理,正在进行信息核验,请耐心等待。' |
| | | ], |
| | | 'goto_mall' => [ |
| | | 'default' => '去商城逛逛', |
| | | 'value' => '去商城逛逛' |
| | | ], |
| | | ] |
| | | ], |
| | | 'order' => [ |
| | | 'title' => [ |
| | | 'default' => '分红订单', |
| | | 'value' => '分红订单' |
| | | ], |
| | | 'words' => [ |
| | | 'all' => [ |
| | | 'default' => '全部', |
| | | 'value' => '全部' |
| | | ], |
| | | 'unsettled' => [ |
| | | 'default' => '未结算', |
| | | 'value' => '未结算' |
| | | ], |
| | | 'settled' => [ |
| | | 'default' => '已结算', |
| | | 'value' => '已结算' |
| | | ], |
| | | ] |
| | | ], |
| | | // 'bonus' => [ |
| | | // 'title' => [ |
| | | // 'default' => '我的团队', |
| | | // 'value' => '我的团队' |
| | | // ], |
| | | // 'words' => [ |
| | | // 'total_bonus' => [ |
| | | // 'default' => '团队总人数', |
| | | // 'value' => '团队总人数' |
| | | // ], |
| | | // 'first' => [ |
| | | // 'default' => '一级团队', |
| | | // 'value' => '一级团队' |
| | | // ], |
| | | // 'second' => [ |
| | | // 'default' => '二级团队', |
| | | // 'value' => '二级团队' |
| | | // ], |
| | | // 'third' => [ |
| | | // 'default' => '三级团队', |
| | | // 'value' => '三级团队' |
| | | // ], |
| | | // ] |
| | | // ], |
| | | 'cash_list' => [ |
| | | 'title' => [ |
| | | 'default' => '提现明细', |
| | | 'value' => '提现明细' |
| | | ], |
| | | 'words' => [ |
| | | 'all' => [ |
| | | 'default' => '全部', |
| | | 'value' => '全部' |
| | | ], |
| | | 'apply_10' => [ |
| | | 'default' => '审核中', |
| | | 'value' => '审核中' |
| | | ], |
| | | 'apply_20' => [ |
| | | 'default' => '审核通过', |
| | | 'value' => '审核通过' |
| | | ], |
| | | 'apply_40' => [ |
| | | 'default' => '已打款', |
| | | 'value' => '已打款' |
| | | ], |
| | | 'apply_30' => [ |
| | | 'default' => '驳回', |
| | | 'value' => '驳回' |
| | | ], |
| | | ] |
| | | ], |
| | | 'cash_apply' => [ |
| | | 'title' => [ |
| | | 'default' => '申请提现', |
| | | 'value' => '申请提现' |
| | | ], |
| | | 'words' => [ |
| | | 'capital' => [ |
| | | 'default' => '可提现分红', |
| | | 'value' => '可提现分红' |
| | | ], |
| | | 'money' => [ |
| | | 'default' => '提现金额', |
| | | 'value' => '提现金额' |
| | | ], |
| | | 'money_placeholder' => [ |
| | | 'default' => '请输入要提取的金额', |
| | | 'value' => '请输入要提取的金额' |
| | | ], |
| | | 'min_money' => [ |
| | | 'default' => '最低提现分红', |
| | | 'value' => '最低提现分红' |
| | | ], |
| | | 'submit' => [ |
| | | 'default' => '提交申请', |
| | | 'value' => '提交申请' |
| | | ], |
| | | ] |
| | | ], |
| | | 'qrcode' => [ |
| | | 'title' => [ |
| | | 'default' => '推广二维码', |
| | | 'value' => '推广二维码' |
| | | ] |
| | | ], |
| | | ] |
| | | ], |
| | | 'license' => [ |
| | | 'key' => 'license', |
| | | 'describe' => '申请协议', |
| | | 'values' => [ |
| | | 'license' => '' |
| | | ] |
| | | ], |
| | | 'background' => [ |
| | | 'key' => 'background', |
| | | 'describe' => '页面背景图', |
| | | 'values' => [ |
| | | // 分销中心首页 |
| | | 'index' => self::$base_url . 'image/bonus/bonus-bg.jpg', |
| | | // 申请成为分红用户页 |
| | | 'apply' => self::$base_url . 'image/bonus/bonus-bg.jpg', |
| | | // 申请提现页 |
| | | 'cash_apply' => self::$base_url . 'image/bonus/bonus-bg.jpg', |
| | | // 申请成为分红用户页底部 |
| | | 'apply_bottom' => self::$base_url . 'image/bonus/apply-bottom.jpg', |
| | | ], |
| | | ], |
| | | 'template_msg' => [ |
| | | 'key' => 'template_msg', |
| | | 'describe' => '模板消息', |
| | | 'values' => [ |
| | | 'apply_tpl' => '', // 分红用户审核通知 |
| | | 'cash_tpl' => '', // 提现状态通知 |
| | | ] |
| | | ], |
| | | 'qrcode' => [ |
| | | 'key' => 'template_msg', |
| | | 'describe' => '分红推广海报', |
| | | 'values' => [ |
| | | 'backdrop' => [ |
| | | 'src' => self::$base_url . 'image/bonus/backdrop.jpg', |
| | | ], |
| | | 'nickName' => [ |
| | | 'fontSize' => 14, |
| | | 'color' => '#000000', |
| | | 'left' => 150, |
| | | 'top' => 99 |
| | | ], |
| | | 'avatar' => [ |
| | | 'width' => 70, |
| | | 'style' => 'circle', |
| | | 'left' => 150, |
| | | 'top' => 18 |
| | | ], |
| | | 'qrcode' => [ |
| | | 'width' => 100, |
| | | 'style' => 'circle', |
| | | 'left' => 136, |
| | | 'top' => 128 |
| | | ] |
| | | ], |
| | | ] |
| | | ]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\bonus; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\user\Grade as GradeModel; |
| | | use app\common\model\user\User as UserModel; |
| | | //use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\model\plus\bonus\Performance as PerformanceModel; |
| | | use app\common\model\plus\agent\Referee as agentRefereeModel; |
| | | use app\common\model\plus\agent\User as agentUserModel; |
| | | |
| | | /** |
| | | * 队长用户模型 |
| | | */ |
| | | class User extends BaseModel |
| | | { |
| | | protected $name = 'bonus_user'; |
| | | protected $pk = 'user_id'; |
| | | |
| | | /** |
| | | * 关联会员等级表 |
| | | */ |
| | | public function grade() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\bonus\\Grade', 'grade_id', 'grade_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联会员记录表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User'); |
| | | } |
| | | |
| | | /** |
| | | * 关联推荐人表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function referee() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User', 'referee_id', 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联排位上级 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function parent() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User', 'parent_id', 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 推荐的人员 |
| | | * @return \think\model\relation\HasMany |
| | | */ |
| | | public function agentuser() |
| | | { |
| | | return $this->hasMany('app\\common\\model\\plus\\agent\\User', 'referee_id', 'user_id') |
| | | ->order(['create_time' => 'desc']) |
| | | ->withlimit(1); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | public static function detail($user_id, $with = ['user', 'referee']) |
| | | { |
| | | return (new static())->with($with)->find($user_id); |
| | | } |
| | | |
| | | /** |
| | | * 是否为队长 |
| | | */ |
| | | public static function isBonusUser($user_id) |
| | | { |
| | | $team = self::detail($user_id); |
| | | return !!$team && !$team['is_delete']; |
| | | } |
| | | |
| | | /** |
| | | * 新增分红用户记录 |
| | | * @param $user_id |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public static function add($user_id, $data) |
| | | { |
| | | /* |
| | | 排位规则: |
| | | 1、直推的第一第二个人都往自己这条线下排 |
| | | 2、直推的第三个人起从总线开始,从上往下,从左往右找空位进行排位。 |
| | | */ |
| | | |
| | | //如果是第一个分红用户,生成预留排位 |
| | | if(!(new static())->count()) { |
| | | return self::addTheFirst($user_id, $data); |
| | | } |
| | | $model = static::detail($user_id); |
| | | //如果是新增 |
| | | if(!$model) { |
| | | $model = new static; |
| | | //获取直推上级 |
| | | $referee_id = agentRefereeModel::getRefereeUserId($user_id, 1); |
| | | //获取直推上级推荐的人数 |
| | | $direct_child_num = $referee_id ? self::getDirectNum($referee_id) : 0; |
| | | /*if ($referee_id && $direct_child_num < 2) { |
| | | $parent = static::detail($referee_id); |
| | | //如果自己名下已经被排满,继续往下找 |
| | | if ($parent['child_num'] == 3) { |
| | | //获取起始横向排位 |
| | | $level_num_first = ($parent['level_num'] - 1) * 3 + 1; |
| | | $parent = self::checkUserChild($level_num_first, 3, $parent['tree_level'] + 1); |
| | | } |
| | | } else {*/ |
| | | //规则2:查找有空缺的三叉树 |
| | | $parent = (new static())->where('child_num', '<', 3) |
| | | /*->where('user_id', "<>", $referee_id)*/ |
| | | ->order(['tree_level' => 'asc', 'level_num' => 'asc'])->find(); |
| | | //} |
| | | $data['parent_id'] = $parent['user_id']; |
| | | $data['order_num'] = $parent['child_num'] + 1; //三叉树内的位置 |
| | | $data['tree_level'] = $parent['tree_level'] + 1; //竖向层级 |
| | | $data['level_num'] = ($parent['level_num'] - 1) * 3 + $data['order_num']; //所在层的横向排序位置 |
| | | $parent->save([ |
| | | 'user_id' => $parent['user_id'], |
| | | 'grade_id' => Grade::getDefaultGradeId(), |
| | | 'child_num' => $parent['child_num'] + 1 |
| | | ]); |
| | | } |
| | | $user=UserModel::detail($user_id); |
| | | if ($model->save(array_merge([ |
| | | 'user_id' => $user_id, |
| | | 'is_delete' => 0, |
| | | 'purchase_count' => $user['purchase_count'], |
| | | 'grade_id' => Grade::getDefaultGradeId(), |
| | | 'app_id' => $data['app_id'] |
| | | ], $data))) { |
| | | //记录分红层级关系 |
| | | RefereeModel::createRelation($user_id, $data['parent_id']); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 添加第一个分红用户 |
| | | */ |
| | | private static function addTheFirst($user_id, $data) |
| | | { |
| | | $model = new static; |
| | | $data['parent_id'] = 0; |
| | | $data['order_num'] = 1; //三叉树内的位置 |
| | | $data['tree_level'] = 1; //竖向层级 |
| | | $data['level_num'] = 1; //所在层的横向排序位置 |
| | | $data['child_num'] = 3; //直属排位 |
| | | $model->save(array_merge([ |
| | | 'user_id' => $user_id, |
| | | 'is_delete' => 0, |
| | | 'app_id' => $data['app_id'] |
| | | ], $data)); |
| | | //记录分红层级关系 |
| | | RefereeModel::createRelation($user_id, $data['parent_id']); |
| | | //生成12个预留排位 |
| | | for ($i=1; $i <= 3; $i++) { |
| | | $user = UserModel::create([ |
| | | 'open_id' => $i, |
| | | 'reg_source' => 'sys', |
| | | 'nickName' => '预留' . $i, |
| | | 'app_id' => $data['app_id'] |
| | | ]); |
| | | $new_user_id = $user->user_id; |
| | | $model->create([ |
| | | 'user_id' => $new_user_id, |
| | | 'is_delete' => 0, |
| | | 'app_id' => $data['app_id'], |
| | | 'parent_id' => $user_id, |
| | | 'order_num' => $i, |
| | | 'tree_level' => 2, |
| | | 'level_num' => $i |
| | | ]); |
| | | //记录分红层级关系 |
| | | RefereeModel::createRelation($new_user_id, $user_id); |
| | | for ($j=1; $j <= 3; $j++) { |
| | | $user = UserModel::create([ |
| | | 'open_id' => $i . '_' . $j, |
| | | 'reg_source' => 'sys', |
| | | 'nickName' => '预留' . $i . '_' . $j, |
| | | 'app_id' => $data['app_id'] |
| | | ]); |
| | | $child_user_id = $user->user_id; |
| | | $model->create([ |
| | | 'user_id' => $child_user_id, |
| | | 'is_delete' => 0, |
| | | 'app_id' => $data['app_id'], |
| | | 'parent_id' => $new_user_id, |
| | | 'order_num' => $j, |
| | | 'tree_level' => 3, |
| | | 'level_num' => ($i - 1) * 3 + $j |
| | | ]); |
| | | $model->save([ |
| | | 'user_id' => $new_user_id, |
| | | 'child_num' => $j |
| | | ]); |
| | | RefereeModel::createRelation($child_user_id, $new_user_id); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | public function addTheFirst4() |
| | | { |
| | | $model = new self; |
| | | $grade_id=GradeModel::getDefaultGradeId(); |
| | | if ($model->where('tree_level',4)->count()){ |
| | | return true; |
| | | } |
| | | //记录分红层级关系 |
| | | $i=4; |
| | | $userList=$model->where('tree_level',3)->select(); |
| | | $k=0; |
| | | foreach ($userList as $tree){ |
| | | $new_user_id=$tree['user_id']; |
| | | for ($j=1; $j <= 3; $j++) { |
| | | $k++; |
| | | $user = UserModel::create([ |
| | | 'open_id' => $i . '_' .$k, |
| | | 'reg_source' => 'sys', |
| | | 'nickName' => '预留' . $i . '_' . $k, |
| | | 'grade_id'=>$grade_id, |
| | | 'app_id' => 10142 |
| | | ]); |
| | | $child_user_id = $user->user_id; |
| | | $model->create([ |
| | | 'user_id' => $child_user_id, |
| | | 'is_delete' => 0, |
| | | 'app_id' => 10142, |
| | | 'parent_id' => $new_user_id, |
| | | 'order_num' => $j, |
| | | 'tree_level' => 4, |
| | | 'level_num' => $k |
| | | ]); |
| | | $model->where('user_id',$new_user_id)->save([ |
| | | 'user_id' => $new_user_id, |
| | | 'child_num' => $j |
| | | ]); |
| | | RefereeModel::createRelation($child_user_id, $new_user_id); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查找横向位置内符合条件的用户 |
| | | * @param $level_num_first 查找的横向起始位置 |
| | | * @param $search_num 查找的数量,用于计算横向结束位置 |
| | | */ |
| | | private static function checkUserChild($level_num_first, $search_num, $tree_level) |
| | | { |
| | | //结束位置的序号 |
| | | // log_write('level_num_first:'.$level_num_first); |
| | | $level_num_end = $level_num_first + ($search_num - 1); |
| | | //log_write($level_num_end); |
| | | $user = (new static())->where('child_num', '<', 3) |
| | | ->where('level_num', '>=', $level_num_first) |
| | | ->where('level_num', '<=', $level_num_end) |
| | | ->where('tree_level', '=', $tree_level) |
| | | ->order(['level_num' => 'asc'])->find(); |
| | | if($user) { |
| | | //log_write($user); |
| | | return $user; |
| | | } else { |
| | | $new_level_num_first = ($level_num_first - 1) * 3 + 1; |
| | | $new_search_num = $search_num * 3; |
| | | $new_tree_level = $tree_level + 1; |
| | | return self::checkUserChild($new_level_num_first, $new_search_num, $new_tree_level); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发放队长佣金 |
| | | * @param $user_id |
| | | * @param $money |
| | | * @return bool |
| | | */ |
| | | public static function grantMoney($user_id, $money, $money_type,$purchase_count = 0) |
| | | { |
| | | $money_type_arr = ['10' => '直推奖', '20' => '业绩奖', '30' => '直推收益补贴']; |
| | | $is_expire = User::isExpire($user_id); |
| | | // 队长详情 |
| | | $model = static::detail($user_id); |
| | | if (!$model || $model['is_delete']) { |
| | | return false; |
| | | } |
| | | if ($money_type == 20){ |
| | | if ($model['purchase_count']<$purchase_count){ |
| | | $model->where('user_id', '=', $user_id)->inc('freeze_money_second', $money)->update(); |
| | | }else{ |
| | | $model->where('user_id', '=', $user_id)->inc('money', $money)->update(); |
| | | } |
| | | }else{ |
| | | $model->where('user_id', '=', $user_id)->inc('money', $money)->update(); |
| | | } |
| | | //直推人数 |
| | | /*$direct_num = self::getDirectNum($user_id); |
| | | //如果是业绩奖并且用户没有直推下级,则冻结其业绩奖 |
| | | if ($money_type == 20) { |
| | | //前三个直推每推一个解冻一个,直推>=3并且符合不冻结条件时解冻全部 |
| | | if (($direct_num > 0 && $direct_num <= 3 && PerformanceModel::getPerformanceCount($user_id, true) <= $direct_num) || self::isBackFreezeAll($user_id)) { |
| | | // 如果排位过期,也冻结 by lyzflash 2013.01.14 |
| | | if ($is_expire) { |
| | | $model->where('user_id', '=', $user_id)->inc('freeze_money_second', $money)->update(); |
| | | } else { |
| | | // 累积队长可提现分红 |
| | | $model->where('user_id', '=', $user_id)->inc('money', $money)->update(); |
| | | } |
| | | } else { |
| | | // 冻结 |
| | | $model->where('user_id', '=', $user_id)->inc('freeze_money_second', $money)->update(); |
| | | } |
| | | // 排位不过期才能解冻业绩分红 by lyzflash 2023.01.26 |
| | | if ($direct_num > 3 && $model['freeze_money_second'] > 0 && !$is_expire) { |
| | | self::backFreezeMoneySecond($user_id, $direct_num); |
| | | } |
| | | } else { |
| | | // 累积队长可提现分红(直推奖) |
| | | $model->where('user_id', '=', $user_id)->inc('money', $money)->update(); |
| | | } |
| | | //直推奖时,判断要不要解冻业绩分红 |
| | | // 排位不过期才能解冻业绩分红 by lyzflash 2023.01.26 |
| | | if ($money_type == 10 && !$is_expire) { |
| | | self::backFreezeMoneySecond($user_id, $direct_num); |
| | | }*/ |
| | | // 记录队长资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $user_id, |
| | | 'flow_type' => 10, |
| | | 'money' => $money, |
| | | 'money_type' => $money_type, |
| | | 'describe' => '订单分红结算-' . $money_type_arr[$money_type], |
| | | 'app_id' => $model['app_id'], |
| | | ]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取直推用户id |
| | | */ |
| | | public static function getFirstUserId($user_id) |
| | | { |
| | | $model = static::detail($user_id); |
| | | return !empty($model['referee_id']) ? (self::isBonusUser($model['referee_id']) ? $model['referee_id'] : 0) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取业绩奖用户id |
| | | */ |
| | | public static function getSecondUserId($user_id, $begin_num, $order) |
| | | { |
| | | /// 复购情况:根据复购次数逐级向上查找 |
| | | $user = static::detail($user_id); |
| | | |
| | | // 如果没有上级,则自己获得业绩奖 |
| | | if (empty($user['parent_id'])) { |
| | | return 0; |
| | | } |
| | | // 根据复购次数确定向上查找的层级 |
| | | // 复购1次:向上1级 |
| | | // 复购2次:向上2级 |
| | | // 复购n次:向上n级(最多不超过存在的层级) |
| | | $targetUserId = $user_id; |
| | | $levelsToGoUp = (new OrderModel)::getUserOrderCounti($user_id); |
| | | // 逐级向上查找 |
| | | for ($i = 0; $i < $levelsToGoUp; $i++) { |
| | | $currentUser = static::detail($targetUserId); |
| | | if (!empty($currentUser['parent_id'])) { |
| | | $targetUserId = $currentUser['parent_id']; |
| | | } else { |
| | | return false; |
| | | // 如果已经到顶级,停止向上查找 |
| | | break; |
| | | } |
| | | } |
| | | // 记录业绩分配 |
| | | if ($targetUserId != $user_id) { |
| | | // 上级获得业绩奖 |
| | | self::addPerformance($targetUserId, $order, 1); |
| | | } else { |
| | | $targetUserId=0; |
| | | // 自己获得业绩奖 |
| | | self::addPerformance($user_id, $order, 1); |
| | | } |
| | | return $targetUserId; |
| | | } |
| | | |
| | | /** |
| | | * 获取 $order_count / 2 位置的用户 |
| | | */ |
| | | public static function getMulParentUserId($user_id, $multiple) |
| | | { |
| | | $parent_id = (new self)->where(compact('user_id'))->value('parent_id'); |
| | | if (empty($parent_id)) { |
| | | return $user_id; |
| | | } |
| | | if ($multiple <= 1) { |
| | | return $parent_id; |
| | | } |
| | | $multiple--; |
| | | return self::getMulParentUserId($parent_id, $multiple); |
| | | } |
| | | |
| | | /** |
| | | * 获取我的三叉树用户 |
| | | */ |
| | | public static function getTreeUser($user_id) |
| | | { |
| | | $model = new static; |
| | | return $model->where('parent_id', '=', $user_id)->order(['order_num' => 'asc'])->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户直推人数 |
| | | */ |
| | | public static function getDirectNum($user_id) |
| | | { |
| | | return (new static())->where('referee_id', '=', $user_id)->count(); |
| | | } |
| | | |
| | | /** |
| | | * 排位是否失效 |
| | | */ |
| | | public static function isExpire($user_id) |
| | | { |
| | | $team = self::detail($user_id); |
| | | $setting = Setting::getItem('basic', $team['app_id']); |
| | | return !!$team && $team['is_expire'] && $team['is_permanent'] == 0 && $setting['expire_day'] > 0; |
| | | } |
| | | |
| | | /** |
| | | * 排位是否失效 |
| | | */ |
| | | public static function getExpireTime($user_id) |
| | | { |
| | | $user = self::detail($user_id); |
| | | if (!$user) { |
| | | return 0; |
| | | } |
| | | $setting = Setting::getItem('basic', $user['app_id']); |
| | | if ($user['tree_level'] <= 3 || $user['is_permanent']) { |
| | | $remain_time = '永久'; |
| | | } else { |
| | | $time = $user['agent_time'] ? $user['agent_time'] : strtotime($user['create_time']); |
| | | $remain_time = abs(intval((($time + 86400 * $setting['expire_day']) - time()) / 86400)); |
| | | } |
| | | return $remain_time; |
| | | } |
| | | |
| | | /** |
| | | * 更新队长直推人的最新时间 |
| | | */ |
| | | public static function updateAgentTime($user_id) |
| | | { |
| | | $user = self::detail($user_id); |
| | | if ($user) { |
| | | return $user->save([ |
| | | 'agent_time' => time(), |
| | | 'is_expire' => 0 // 取消过期 |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 添加业绩轮询计数 |
| | | */ |
| | | private static function addPerformance($user_id, $order, $is_own) |
| | | { |
| | | return PerformanceModel::add([ |
| | | 'user_id' => $order['user_id'], |
| | | 'order_id' => $order['order_id'], |
| | | 'performance_id' => $user_id, |
| | | 'is_own' => $is_own, |
| | | 'app_id' => $order['app_id'] |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 解冻业绩分红 |
| | | * $direct_num 直推人数 |
| | | */ |
| | | private static function backFreezeMoneySecond($user_id, $direct_num) |
| | | { |
| | | $model = static::detail($user_id); |
| | | if($model['freeze_money_second'] <= 0) { |
| | | return true; |
| | | } |
| | | //符合解冻全部业绩条件时 |
| | | if (self::isBackFreezeAll($user_id)) { |
| | | $money = $model['freeze_money_second']; |
| | | } else { |
| | | if ($direct_num > 3) { |
| | | return true; |
| | | } |
| | | $money = $model['freeze_money_second'] >= 2000 ? 2000 : $model['freeze_money_second']; |
| | | } |
| | | return $model->save([ |
| | | 'money' => $model['money'] + $money, |
| | | 'freeze_money_second' => $model['freeze_money_second'] - $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 是否能全部解冻 |
| | | * 条件:最开始直推的3人全部完成3个直推 |
| | | * 2022.09新条件:直推的任意3人全部完成3个直推 |
| | | */ |
| | | private static function isBackFreezeAll($user_id) { |
| | | $total = (new agentUserModel)->where('referee_id', '=', $user_id) |
| | | ->where('first_num', '>=', 3) |
| | | ->where('is_delete', '=', 0) |
| | | ->count(); |
| | | if ($total < 3) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 提现打款成功:累积提现佣金 |
| | | */ |
| | | public static function totalMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | 'total_money' => $model['total_money'] + $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 提现驳回:解冻队长资金 |
| | | */ |
| | | public static function backFreezeMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'money' => $model['money'] + $money, |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | ]); |
| | | } |
| | | /** |
| | | * 获取补贴用户id |
| | | */ |
| | | public static function getSubsidyUserId($user_id) |
| | | { |
| | | $bonusUser = self::detail($user_id); |
| | | if (!empty($bonusUser['referee_id'])){ |
| | | return $bonusUser['referee_id']; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | |
| | | !empty($paramr['province_id']) && $where['province_id'] = $paramr['province_id']; |
| | | !empty($paramr['city_id']) && $where['city_id'] = $paramr['city_id']; |
| | | !empty($paramr['region_id']) && $where['region_id'] = $paramr['region_id']; |
| | | // 检查置顶时间是否过期,如果过期则设置为非置顶 |
| | | $this->checkTopExpire(); |
| | | if (!empty($paramr['sort'])) { |
| | | $order = ['is_top' => 'desc', 'top_time' => 'desc']; |
| | | if ($paramr['sort'] == 'name') { |
| | |
| | | $order['unit'] = "asc"; |
| | | } |
| | | } else { |
| | | // 检查置顶时间是否过期,如果过期则设置为非置顶 |
| | | $this->checkTopExpire(); |
| | | |
| | | // 按置顶状态和创建时间排序 |
| | | $order = ['is_top' => 'desc', 'top_time' => 'desc', 'create_time' => 'desc']; |
| | | } |
| | |
| | | * @param int $appId 应用ID |
| | | * @return bool |
| | | */ |
| | | public function sendMessage($conversationId, $senderId, $content, $messageType = 0) |
| | | public function sendMessage($conversationId, $senderId, $content, $messageType = 0, $appId = null) |
| | | { |
| | | $data = [ |
| | | 'conversation_id' => $conversationId, |
| | | 'sender_id' => $senderId, |
| | | 'content' => $content, |
| | | 'message_type' => $messageType, |
| | | 'app_id' => self::$app_id, |
| | | 'is_read' => 0, |
| | | 'read_time' => 0, |
| | | 'app_id' => $appId?$appId:self::$app_id, |
| | | 'send_time' => time(), |
| | | ]; |
| | | |
| | | return $this->save($data); |
| | |
| | | */ |
| | | public function markAsRead($chatId, $readerId) |
| | | { |
| | | $message = $this->find($chatId); |
| | | $message = $this->where('chat_id',$chatId)->find(); |
| | | if ($message && $message->sender_id != $readerId) { |
| | | $message->is_read = 1; |
| | | $message->read_time = time(); |
| | | $message->update_time = time(); |
| | | return $message->save(); |
| | | $data=[ |
| | | 'is_read'=>1, |
| | | 'read_time'=>time() |
| | | ]; |
| | | return $message->save($data); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public function createConversation($businessCardId, $participants = []) |
| | | { |
| | | $appId = self::$app_id; |
| | | // 检查是否已存在相同名片的会话 |
| | | $existing = $this->where('business_card_id', $businessCardId)->find(); |
| | | if ($existing) { |
| | |
| | | |
| | | $data = [ |
| | | 'business_card_id' => $businessCardId, |
| | | 'app_id' => $appId |
| | | ]; |
| | | try { |
| | | $this->save($data); |
| | | $conversationId = $this->conversation_id; |
| | | // 添加参与者 |
| | | foreach ($participants as $userId) { |
| | | (new Participant())->addParticipant($conversationId, $userId, $appId); |
| | | (new Participant())->addParticipant($conversationId, $userId); |
| | | } |
| | | return $conversationId; |
| | | } catch (\Exception $e) { |
| | |
| | | */ |
| | | public function getUserConversations($param = []) |
| | | { |
| | | return $this->with(['businessCard', 'participants.user', 'messages']) |
| | | return $this->with(['businessCard', 'participants.user']) |
| | | ->order('update_time', 'desc') |
| | | ->paginate($param); |
| | | } |
| | |
| | | * @param int $appId 应用ID |
| | | * @return bool |
| | | */ |
| | | public function addParticipant($conversationId, $userId, $appId = 10001) |
| | | public function addParticipant($conversationId, $userId) |
| | | { |
| | | // 检查是否已存在 |
| | | $existing = $this->where('conversation_id', $conversationId) |
| | |
| | | $data = [ |
| | | 'conversation_id' => $conversationId, |
| | | 'user_id' => $userId, |
| | | 'app_id' => $appId, |
| | | 'app_id' => self::$app_id, |
| | | 'is_read' => 0, |
| | | 'join_time' => time(), |
| | | 'last_read_time' => time(), |
| | |
| | | ->find(); |
| | | |
| | | if ($participant) { |
| | | $participant->last_read_time = time(); |
| | | $participant->update_time = time(); |
| | | return $participant->save(); |
| | | $data=['last_read_time'=>time()]; |
| | | return $participant->save($data); |
| | | } |
| | | |
| | | return false; |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\agent\Referee as agentReferee; |
| | | use app\common\model\plus\agent\User as agentUser; |
| | | use app\common\model\user\User as UserModel; |
| | | use app\common\model\plus\agent\Referee as AgentRefereeModel; |
| | | |
| | | /** |
| | | * VIP专区申请模型 |
| | | */ |
| | | class Apply extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_apply'; |
| | | protected $pk = 'apply_id'; |
| | | |
| | | /** |
| | | * 打款方式 |
| | | * @var array |
| | | */ |
| | | public $payType = [ |
| | | 10 => '微信', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡', |
| | | ]; |
| | | |
| | | /** |
| | | * 申请状态 |
| | | * @var array |
| | | */ |
| | | public $applyStatus = [ |
| | | 10 => '待审核', |
| | | 20 => '审核通过', |
| | | 30 => '驳回', |
| | | ]; |
| | | |
| | | /** |
| | | * 关联用户表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User'); |
| | | } |
| | | |
| | | /** |
| | | * 关联VIP专区用户表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function vipUser() |
| | | { |
| | | return $this->belongsTo('User'); |
| | | } |
| | | |
| | | /** |
| | | * 获取详情 |
| | | */ |
| | | public static function detail($apply_id) |
| | | { |
| | | return (new static())->find($apply_id); |
| | | } |
| | | |
| | | /** |
| | | * 购买指定商品成为VIP用户 |
| | | * @param $userId |
| | | * @param $productIds |
| | | * @param $appId |
| | | * @param $order |
| | | * @return bool |
| | | */ |
| | | public function becomeVipUser($userId, $productIds, $appId, $order) |
| | | { |
| | | // 验证是否设置 |
| | | $config = Setting::getItem('basic', $appId); |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | |
| | | // 检查用户是否已经是VIP用户 |
| | | if(User::isVipUser($userId)) { |
| | | return false; |
| | | } |
| | | //同时成为分销商 |
| | | $referee_id = agentReferee::getRefereeUserId($userId, 1); |
| | | |
| | | agentUser::add($userId, [ |
| | | 'referee_id' => $referee_id, |
| | | 'app_id' => $appId, |
| | | ]); |
| | | // 新增VIP用户 |
| | | User::add($userId, [ |
| | | 'referee_id' => AgentRefereeModel::getRefereeUserId($userId, 1), |
| | | 'app_id' => $appId, |
| | | ]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 审核状态 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getApplyStatusAttr($value) |
| | | { |
| | | $method = [10 => '待审核', 20 => '审核通过', 30 => '驳回']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 打款方式 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | $method = [10 => '微信', 20 => '支付宝', 30 => '银行卡']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请列表 |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->with(['user', 'vipUser']) |
| | | ->order(['create_time' => 'desc']); |
| | | |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | if (isset($search['apply_status']) && $search['apply_status'] > -1) { |
| | | $model = $model->where('apply_status', '=', $search['apply_status']); |
| | | } |
| | | |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * VIP专区资金明细模型 |
| | | */ |
| | | class Capital extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_capital'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * VIP专区资金明细 |
| | | * @param $data |
| | | */ |
| | | public static function add($data) |
| | | { |
| | | $model = new static; |
| | | $model->save(array_merge([ |
| | | 'app_id' => $model::$app_id |
| | | ], $data)); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * VIP专区提现明细模型 |
| | | */ |
| | | class Cash extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_cash'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 打款方式 |
| | | * @var array |
| | | */ |
| | | public $payType = [ |
| | | 10 => '微信', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡', |
| | | ]; |
| | | |
| | | /** |
| | | * 申请状态 |
| | | * @var array |
| | | */ |
| | | public $applyStatus = [ |
| | | 10 => '待审核', |
| | | 20 => '审核通过', |
| | | 30 => '驳回', |
| | | 40 => '已打款', |
| | | ]; |
| | | |
| | | /** |
| | | * 关联VIP专区用户表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 提现详情 |
| | | */ |
| | | public static function detail($id) |
| | | { |
| | | return (new static())->find($id); |
| | | } |
| | | |
| | | /** |
| | | * 审核状态 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getApplyStatusAttr($value) |
| | | { |
| | | $method = [10 => '待审核', 20 => '审核通过', 30 => '驳回', 40 => '已打款']; |
| | | return ['text' => $method[$value], 'value' => $value]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * VIP专区等级模型 |
| | | */ |
| | | class Grade extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_grade'; |
| | | protected $pk = 'grade_id'; |
| | | |
| | | /** |
| | | * 获取详情 |
| | | */ |
| | | public static function detail($grade_id) |
| | | { |
| | | return (new static())->find($grade_id); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getLists() |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->field('grade_id,name') |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取可用的会员等级列表 |
| | | */ |
| | | public static function getUsableList($appId = null) |
| | | { |
| | | $model = new static; |
| | | $appId = $appId ? $appId : $model::$app_id; |
| | | return $model->where('is_delete', '=', '0') |
| | | ->where('app_id', '=', $appId) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取默认等级id |
| | | */ |
| | | public static function getDefaultGradeId(){ |
| | | $model = new static(); |
| | | $grade = $model->where('is_default', '=', 1)->find(); |
| | | if(!$grade){ |
| | | $model->save([ |
| | | 'name' => '默认等级', |
| | | 'is_default' => 1, |
| | | 'agent_money' => 100, |
| | | 'weight' => 1, |
| | | 'app_id' => self::$app_id |
| | | ]); |
| | | $grade_id = $model['grade_id']; |
| | | }else{ |
| | | $grade_id = $grade['grade_id']; |
| | | } |
| | | return $grade_id; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * VIP专区用户等级变更记录模型 |
| | | */ |
| | | class GradeLog extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_grade_log'; |
| | | protected $pk = 'log_id'; |
| | | protected $updateTime = false; |
| | | |
| | | /** |
| | | * 关联VIP用户记录表 |
| | | */ |
| | | public function vipUser() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\vip\\User', 'user_id', 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联旧等级记录表 |
| | | */ |
| | | public function oldGrade() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\vip\\Grade', 'old_grade_id', 'grade_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联新等级记录表 |
| | | */ |
| | | public function grade() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\vip\\Grade', 'new_grade_id', 'grade_id'); |
| | | } |
| | | |
| | | public function getList($params) |
| | | { |
| | | return $this->with(['vipUser', 'oldGrade', 'grade']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($params); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\common\enum\plus\vip\VipAreaTypeEnum; |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\user\User as UserModel; |
| | | use app\common\model\plus\vip\User as VipUserModel; |
| | | |
| | | /** |
| | | * VIP专区订单模型 |
| | | */ |
| | | class Order extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_order'; |
| | | protected $pk = 'id'; |
| | | public $append=['vip_area_type_text']; |
| | | /** |
| | | * VIP专区订单类型 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getVipAreaTypeTextAttr($value, $data) |
| | | { |
| | | $types = VipAreaTypeEnum::getTypeName(); |
| | | return $types[$data['vip_area_type']]; |
| | | } |
| | | |
| | | /** |
| | | * 订单所属用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User'); |
| | | } |
| | | |
| | | /** |
| | | * VIP专区用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function vipUser() |
| | | { |
| | | return $this->belongsTo('app\common\model\plus\vip\User', 'vip_area_user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联订单主表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function orderMaster() |
| | | { |
| | | return $this->belongsTo('app\common\model\order\Order', 'order_id'); |
| | | } |
| | | |
| | | /** |
| | | * 推荐人用户 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function referee() |
| | | { |
| | | return $this->belongsTo('app\common\model\user\User', 'referee_id'); |
| | | } |
| | | |
| | | /** |
| | | * 订单类型 |
| | | * @param $value |
| | | * @return array |
| | | */ |
| | | public function getOrderTypeAttr($value) |
| | | { |
| | | $types = OrderTypeEnum::getTypeName(); |
| | | return ['text' => $types[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 订单详情 - 获取单个订单 |
| | | */ |
| | | public static function getDetailByOrderId($orderId, $orderType) |
| | | { |
| | | return (new static())->where('order_id', '=', $orderId) |
| | | ->where('order_type', '=', $orderType) |
| | | ->find(); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单的所有VIP专区订单记录 |
| | | */ |
| | | public static function getAllDetailsByOrderId($orderId, $orderType) |
| | | { |
| | | return (new static())->where('order_id', '=', $orderId) |
| | | ->where('order_type', '=', $orderType) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 发放VIP专区订单佣金 |
| | | * @param $order |
| | | * @param int $orderType |
| | | * @return bool |
| | | * @throws \think\db\exception\DataNotFoundException |
| | | * @throws \think\db\exception\DbException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | */ |
| | | public static function grantMoney($order, $orderType = OrderTypeEnum::MASTER) |
| | | { |
| | | // 订单是否已完成 |
| | | if ($order['order_status']['value'] != 30) { |
| | | return false; |
| | | } |
| | | |
| | | // 获取该订单的所有VIP专区订单记录 |
| | | $models = self::getAllDetailsByOrderId($order['order_id'], $orderType); |
| | | if ($models->isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | | // 佣金结算天数 |
| | | $settleDays = Setting::getItem('settlement', $order['app_id'])['settle_days']; |
| | | $success = false; |
| | | |
| | | // 处理每个VIP专区订单 |
| | | foreach ($models as $model) { |
| | | // 跳过已结算的订单 |
| | | if ($model['is_settled'] == 1) { |
| | | continue; |
| | | } |
| | | |
| | | // 写入结算时间 |
| | | $deadlineTime = $model['settle_time'] ?: 0; |
| | | if($deadlineTime == 0){ |
| | | $deadlineTime = $order['receipt_time'] + $settleDays * 86400; |
| | | $model->save([ |
| | | 'settle_time' => $deadlineTime |
| | | ]); |
| | | } |
| | | |
| | | // 未到结算时间,跳过 |
| | | if ($deadlineTime > time()) { |
| | | continue; |
| | | } |
| | | |
| | | // 发放推广佣金(首次购买VIP商品) |
| | | if ($model['vip_area_type'] == 10) { |
| | | $model['vip_area_user_id'] > 0 && User::grantMoney($model['vip_area_user_id'], $model['vip_area_money'], '推广佣金'); |
| | | } |
| | | |
| | | // 发放推广复购佣金(非首次购买VIP商品) |
| | | if ($model['vip_area_type'] == 20) { |
| | | $model['vip_area_user_id'] > 0 && User::grantMoney($model['vip_area_user_id'], $model['vip_area_money'], '推广复购佣金'); |
| | | } |
| | | |
| | | // 发放VIP专区补贴给下级用户(当下级获得推广佣金或复购佣金时) |
| | | if ($model['vip_area_type'] == 10 || $model['vip_area_type'] == 20) { |
| | | // 获取下级用户的推荐人(即上级用户) |
| | | $superiorUser = UserModel::detail($model['vip_area_user_id']); |
| | | if ($superiorUser && $superiorUser['referee_id']) { |
| | | $vipUser = VipUserModel::detail($superiorUser['vip_area_user_id']); |
| | | if ($vipUser['grade']['operating_subsidy']>0){ |
| | | // 获取补贴比例设置 |
| | | $subsidyRate = $vipUser['grade']['operating_subsidy']; |
| | | |
| | | // 计算VIP专区补贴 |
| | | $subsidyAmount = bcmul($model['vip_area_money'], bcdiv((string)$subsidyRate, '100', 4), 2); |
| | | User::grantMoney($superiorUser['referee_id'], $subsidyAmount, 'VIP专区补贴'); |
| | | |
| | | // 记录分销订单 |
| | | self::createDistributionOrder($order, $superiorUser['referee_id'], $subsidyAmount, 'vip_subsidy',$model['vip_area_money']); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | // 发放平台直推佣金(满足直推条件后) |
| | | //self::grantPlatformCommission($order, $model); |
| | | |
| | | // 更新VIP订单记录 |
| | | $model->save([ |
| | | 'is_settled' => 1, |
| | | 'settle_time' => time() |
| | | ]); |
| | | |
| | | $success = true; |
| | | } |
| | | |
| | | return $success; |
| | | } |
| | | |
| | | /** |
| | | * 发放平台直推佣金(已弃用) |
| | | * @param $order |
| | | * @param $model |
| | | * @return void |
| | | */ |
| | | protected static function grantPlatformCommission($order, $model) |
| | | { |
| | | // 获取平台直推佣金设置 |
| | | $setting = Setting::getItem('basic', $order['app_id']); |
| | | $requiredReferralCount = $setting['referee_buy_count'] ?? 0; |
| | | |
| | | // 如果设置了直推条件且用户有推荐人 |
| | | if ($requiredReferralCount > 0 && $model['vip_area_user_id'] > 0) { |
| | | // 检查推荐人是否满足直推条件(直推用户数量) |
| | | $directReferralsCount = UserModel::where('referee_id', '=', $model['vip_area_user_id'])->count(); |
| | | |
| | | if ($directReferralsCount >= $requiredReferralCount) { |
| | | // 计算平台直推佣金 |
| | | $platformCommissionRate = $setting['platform_commission_rate'] ?? 5; |
| | | $platformCommissionAmount = bcmul($model['order_price'], bcdiv((string)$platformCommissionRate, '100', 4), 2); |
| | | |
| | | // 发放平台直推佣金 |
| | | User::grantMoney($model['vip_area_user_id'], $platformCommissionAmount, '平台直推佣金'); |
| | | |
| | | // 记录分销订单 |
| | | self::createDistributionOrder($order, $model['vip_area_user_id'], $platformCommissionAmount, 'platform_commission',$model['vip_area_money']); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建分销订单记录 |
| | | * @param $order |
| | | * @param $userId |
| | | * @param $amount |
| | | * @param $type |
| | | * @return bool |
| | | */ |
| | | protected static function createDistributionOrder($order, $userId, $amount, $type,$subordinate_money) |
| | | { |
| | | // 创建分销订单记录以跟踪各种类型的佣金 |
| | | $distributionOrder = new self(); |
| | | $vip_area_type = 0; |
| | | switch($type) { |
| | | case 'vip_subsidy': |
| | | $vip_area_type = 30; // VIP专区补贴 |
| | | break; |
| | | case 'platform_commission': |
| | | $vip_area_type = 40; // 平台直推佣金 |
| | | break; |
| | | } |
| | | |
| | | return $distributionOrder->save([ |
| | | 'user_id' => $userId, |
| | | 'order_id' => $order['order_id'], |
| | | 'order_type' => OrderTypeEnum::MASTER, |
| | | 'order_price' => $order['pay_price'], |
| | | 'vip_area_user_id' => $userId, |
| | | 'referee_id' => $order['user_id'], // 被推荐人 |
| | | 'vip_area_money' => $amount, |
| | | 'subordinate_money' => $subordinate_money, |
| | | 'team_revenue' => 0, |
| | | 'vip_area_type' => $vip_area_type, |
| | | 'is_settled' => 1, |
| | | 'settle_time' => time(), |
| | | 'app_id' => $order['app_id'] |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 创建VIP专区订单记录 |
| | | */ |
| | | public static function createOrder($order, $order_type = OrderTypeEnum::MASTER) |
| | | { |
| | | try { |
| | | // VIP专区订单模型 |
| | | $model = new self; |
| | | // VIP专区基本设置 |
| | | $setting = Setting::getItem('basic', $order['app_id']); |
| | | // 是否开启VIP专区功能 |
| | | if (!$setting['is_open']) { |
| | | return false; |
| | | } |
| | | |
| | | // 获取当前买家的推荐人信息 |
| | | $userModel = UserModel::detail($order['user_id']); |
| | | if (!$userModel || !$userModel['referee_id']) { |
| | | return false; |
| | | } |
| | | |
| | | // 检查推荐人是否为VIP专区用户 |
| | | $vipUser = User::detail($userModel['referee_id']); |
| | | if (!$vipUser) { |
| | | return false; |
| | | } |
| | | |
| | | // 获取VIP等级设置 |
| | | $vipGrade = Grade::detail($vipUser['grade_id']); |
| | | if (!$vipGrade) { |
| | | return false; |
| | | } |
| | | // 验证是否设置 |
| | | $config = Setting::getItem('basic', $order['app_id']); |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | $data = [ |
| | | 'user_id' => $order['user_id'], |
| | | 'order_id' => $order['order_id'], |
| | | 'order_type' => $order_type, |
| | | 'order_price' => $order['pay_price'], |
| | | 'vip_area_user_id' => $vipUser['user_id'], |
| | | 'referee_id' => $userModel['referee_id'], |
| | | 'vip_area_money' => 0, |
| | | 'vip_area_type' => 0, |
| | | 'is_settled' => 0, |
| | | 'settle_time' => 0, |
| | | 'app_id' => $order['app_id'] |
| | | ]; |
| | | $list=[]; |
| | | // 计算佣金金额 |
| | | $orderPrice = bcsub($order['pay_price'], $order['express_price'], 2); |
| | | $purchase_count=(new self())->getPurchaseCount($order['user_id']); |
| | | foreach ($order['product'] as $product){ |
| | | if (in_array($product['product_id'], $config['become__buy_product_ids'])) { |
| | | // 获取商品数量 |
| | | $quantity = $product['total_num']; |
| | | // 为每个商品生成分红订单 |
| | | for ($i = 0; $i < $quantity; $i++) { |
| | | if ($purchase_count==1){ |
| | | $list[]=array_merge($data,['vip_area_type'=>10,'vip_area_money'=>$vipGrade['agent_money'],'is_vip'=>1,'purchase_count'=>$purchase_count]); |
| | | $purchase_count++; |
| | | }else{ |
| | | if ($vipGrade['repurchase_money']>0){ |
| | | $list[]=array_merge($data,['vip_area_type'=>20,'vip_area_money'=>$vipGrade['repurchase_money'],'is_vip'=>1,'purchase_count'=>$purchase_count]); |
| | | $purchase_count++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | $directReferralsCount=0; |
| | | $user=UserModel::detail($order['user_id']); |
| | | if (!empty($user['referee_id'])){ |
| | | // 检查推荐人是否满足直推条件(直推用户数量) |
| | | $directReferralsCount = UserModel::where('referee_id', '=', $user['referee_id'])->count(); |
| | | } |
| | | $requiredReferralCount = $setting['referee_buy_count'] ?? 0; |
| | | if ($vipGrade['commission']>0 && $directReferralsCount >= $requiredReferralCount){ |
| | | // 计算佣金金额 |
| | | $commissionAmount = bcmul($orderPrice, bcdiv($vipGrade['commission'], '100', 4), 2); |
| | | $list[]=array_merge($data,['vip_area_type'=>40,'vip_area_money'=>$commissionAmount]); |
| | | } |
| | | if (empty($list)){ |
| | | return true; |
| | | } |
| | | // 保存VIP专区订单记录 |
| | | return $model->saveAll($list); |
| | | }catch (\Exception $e){ |
| | | log_write('创建VIP专区订单失败:'.$e->getMessage()); |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | public function getPurchaseCount($user_id) |
| | | { |
| | | return self::where(['user_id'=>$user_id,'is_vip'=>1])->count()+1; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\user\User as UserModel; |
| | | |
| | | /** |
| | | * VIP专区推荐关系模型(基于用户表推荐关系) |
| | | */ |
| | | class Referee extends BaseModel |
| | | { |
| | | /** |
| | | * 获取我的团队列表 |
| | | */ |
| | | public function getList($vip_user_id) |
| | | { |
| | | return UserModel::where('referee_id', '=', $vip_user_id) |
| | | ->where('is_delete', '=', 0) |
| | | ->with(['vipAreaUser', 'vipAreaUser.grade']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate(15); |
| | | } |
| | | |
| | | /** |
| | | * 创建推荐关系(用户注册时自动处理) |
| | | * VIP专区直接使用用户表的referee_id字段,不需要独立的推荐关系表 |
| | | */ |
| | | public static function createRelation($user_id, $referee_id) |
| | | { |
| | | // VIP专区基本设置 |
| | | $setting = Setting::getItem('basic'); |
| | | // 是否开启VIP专区功能 |
| | | if (!$setting['is_open']) { |
| | | return false; |
| | | } |
| | | // 自分享 |
| | | if ($user_id == $referee_id) { |
| | | return false; |
| | | } |
| | | // 判断推荐人是否为VIP用户 |
| | | if (!User::isVipUser($referee_id)) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取团队统计 |
| | | */ |
| | | public static function getStatistics($vip_user_id) |
| | | { |
| | | $team_list = UserModel::where('referee_id', '=', $vip_user_id) |
| | | ->where('is_delete', '=', 0) |
| | | ->select(); |
| | | |
| | | return [ |
| | | 'total_count' => count($team_list), |
| | | 'vip_count' => 0, // 是VIP的成员数 |
| | | 'today_count' => UserModel::where('referee_id', '=', $vip_user_id) |
| | | ->where('create_time', '>=', strtotime(date('Y-m-d'))) |
| | | ->count(), |
| | | ]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use think\facade\Cache; |
| | | |
| | | /** |
| | | * VIP专区设置模型 |
| | | */ |
| | | class Setting extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_setting'; |
| | | protected $createTime = false; |
| | | |
| | | /** |
| | | * 设置项描述 |
| | | * @var array |
| | | */ |
| | | private $describe = [ |
| | | 'basic' => '基础设置', |
| | | 'settlement' => '结算', |
| | | 'words' => '自定义文字', |
| | | 'background' => '页面背景图', |
| | | ]; |
| | | |
| | | /** |
| | | * 转义数组格式 |
| | | * @param $value |
| | | * @return mixed |
| | | */ |
| | | public function getValuesAttr($value) |
| | | { |
| | | return json_decode($value, true); |
| | | } |
| | | |
| | | /** |
| | | * 转义成json格式 |
| | | * @param $value |
| | | * @return false|string |
| | | */ |
| | | public function setValuesAttr($value) |
| | | { |
| | | return json_encode($value); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定项设置 |
| | | * @param $key |
| | | * @param null $app_id |
| | | * @return array|mixed |
| | | */ |
| | | public static function getItem($key, $app_id = null) |
| | | { |
| | | $data = static::getAll($app_id); |
| | | return isset($data[$key]) ? $data[$key]['values'] : []; |
| | | } |
| | | |
| | | /** |
| | | * 获取VIP专区设置 |
| | | */ |
| | | public static function getAll($app_id = null) |
| | | { |
| | | $self = new static; |
| | | is_null($app_id) && $app_id = $self::$app_id; |
| | | if (!$data = Cache::get('vip_setting_' . $app_id)) { |
| | | $data = array_column($self->select()->toArray(), null, 'key'); |
| | | Cache::tag('cache')->set('vip_setting_' . $app_id, $data); |
| | | } |
| | | return array_merge_multiple($self->defaultData(), $data); |
| | | } |
| | | |
| | | /** |
| | | * 获取设置项信息 |
| | | */ |
| | | public static function detail($key) |
| | | { |
| | | return (new static())->find(compact('key')); |
| | | } |
| | | |
| | | /** |
| | | * 是否开启VIP专区功能 |
| | | */ |
| | | public static function isOpen($app_id = null) |
| | | { |
| | | return static::getItem('basic', $app_id)['is_open']; |
| | | } |
| | | |
| | | /** |
| | | * 更新系统设置 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | foreach ($data as $key => $values) |
| | | $this->saveValues($key, $values); |
| | | $this->commit(); |
| | | // 删除系统设置缓存 |
| | | Cache::delete('vip_setting_' . self::$app_id); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存设置项 |
| | | */ |
| | | private function saveValues($key, $values) |
| | | { |
| | | $where['key'] = $key; |
| | | $res = $this->where($where)->select()->count(); |
| | | $data = [ |
| | | 'describe' => $this->describe[$key], |
| | | 'values' => $values, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($res == 1) { |
| | | return self::update($data, $where); |
| | | } |
| | | if ($res == 0) { |
| | | $data['key'] = $key; |
| | | return self::create($data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 默认配置 |
| | | * @return array[] |
| | | */ |
| | | public function defaultData() |
| | | { |
| | | return [ |
| | | 'basic' => [ |
| | | 'key' => 'basic', |
| | | 'describe' => '基础设置', |
| | | 'values' => [ |
| | | // 是否开启VIP专区功能 |
| | | 'is_open' => '0', // 参数值:1开启 0关闭 |
| | | // 成为VIP需要购买的商品ID |
| | | 'become__buy_product_ids' => [], |
| | | //直推多少用户享受平台佣金 |
| | | 'referee_buy_count' => '0', |
| | | // VIP专区补贴比例 |
| | | 'subsidy_rate' => '10', |
| | | // 平台直推佣金比例 |
| | | 'platform_commission_rate' => '5', |
| | | ], |
| | | ], |
| | | 'settlement' => [ |
| | | 'key' => 'settlement', |
| | | 'describe' => '结算', |
| | | 'values' => [ |
| | | // 提现方式 |
| | | 'pay_type' => [], // 参数值:10微信支付 20支付宝支付 30银行卡支付 |
| | | // 微信支付自动打款 |
| | | 'wechat_pay_auto' => '0', // 微信支付自动打款:1开启 0关闭 |
| | | // 最低提现额度 |
| | | 'min_money' => '10.00', |
| | | // 佣金结算天数 |
| | | 'settle_days' => '10', |
| | | 'fee_rate' => '0', |
| | | 'explain' => '' |
| | | ] |
| | | ], |
| | | 'words' => [ |
| | | 'key' => 'words', |
| | | 'describe' => '自定义文字', |
| | | 'values' => [ |
| | | 'index' => [ |
| | | 'title' => [ |
| | | 'default' => 'VIP专区', |
| | | 'value' => 'VIP专区' |
| | | ], |
| | | 'words' => [ |
| | | 'vip_user' => [ |
| | | 'default' => 'VIP用户', |
| | | 'value' => 'VIP用户' |
| | | ], |
| | | 'not_vip' => [ |
| | | 'default' => '您还不是VIP用户', |
| | | 'value' => '您还不是VIP用户' |
| | | ], |
| | | 'apply_now' => [ |
| | | 'default' => '立即加入', |
| | | 'value' => '立即加入' |
| | | ], |
| | | 'referee' => [ |
| | | 'default' => '推荐人', |
| | | 'value' => '推荐人' |
| | | ], |
| | | 'money' => [ |
| | | 'default' => '可提现佣金', |
| | | 'value' => '可提现' |
| | | ], |
| | | 'freeze_money' => [ |
| | | 'default' => '待提现佣金', |
| | | 'value' => '待提现' |
| | | ], |
| | | 'total_money' => [ |
| | | 'default' => '已提现金额', |
| | | 'value' => '已提现金额' |
| | | ], |
| | | 'cash' => [ |
| | | 'default' => '去提现', |
| | | 'value' => '去提现' |
| | | ], |
| | | ] |
| | | ], |
| | | 'order' => [ |
| | | 'title' => [ |
| | | 'default' => 'vip专区订单', |
| | | 'value' => 'vip专区订单' |
| | | ], |
| | | 'words' => [ |
| | | 'all' => [ |
| | | 'default' => '全部', |
| | | 'value' => '全部' |
| | | ], |
| | | 'unsettled' => [ |
| | | 'default' => '未结算', |
| | | 'value' => '未结算' |
| | | ], |
| | | 'settled' => [ |
| | | 'default' => '已结算', |
| | | 'value' => '已结算' |
| | | ], |
| | | ] |
| | | ], |
| | | 'apply' => [ |
| | | 'title' => [ |
| | | 'default' => '申请成为vip专区用户', |
| | | 'value' => '申请成为vip专区用户' |
| | | ], |
| | | 'words' => [ |
| | | 'title' => [ |
| | | 'default' => '请填写申请信息', |
| | | 'value' => '请填写申请信息' |
| | | ], |
| | | 'license' => [ |
| | | 'default' => 'vip专区用户申请协议', |
| | | 'value' => 'vip专区用户申请协议' |
| | | ], |
| | | 'submit' => [ |
| | | 'default' => '申请成为vip专区用户', |
| | | 'value' => '申请成为vip专区用户' |
| | | ], |
| | | 'wait_audit' => [ |
| | | 'default' => '您的申请已受理,正在进行信息核验,请耐心等待。', |
| | | 'value' => '您的申请已受理,正在进行信息核验,请耐心等待。' |
| | | ], |
| | | 'goto_mall' => [ |
| | | 'default' => '去商城逛逛', |
| | | 'value' => '去商城逛逛' |
| | | ], |
| | | ] |
| | | ], |
| | | 'team' => [ |
| | | 'title' => [ |
| | | 'default' => '我的团队', |
| | | 'value' => '我的团队' |
| | | ], |
| | | 'words' => [ |
| | | 'total_team' => [ |
| | | 'default' => '团队总人数', |
| | | 'value' => '团队总人数' |
| | | ], |
| | | 'first' => [ |
| | | 'default' => '一级团队', |
| | | 'value' => '一级团队' |
| | | ], |
| | | 'second' => [ |
| | | 'default' => '二级团队', |
| | | 'value' => '二级团队' |
| | | ], |
| | | 'third' => [ |
| | | 'default' => '三级团队', |
| | | 'value' => '三级团队' |
| | | ], |
| | | ] |
| | | ], |
| | | 'qrcode' => [ |
| | | 'title' => [ |
| | | 'default' => '推广二维码', |
| | | 'value' => '推广二维码' |
| | | ] |
| | | ], |
| | | 'cash_list' => [ |
| | | 'title' => [ |
| | | 'default' => '提现明细', |
| | | 'value' => '提现明细' |
| | | ], |
| | | 'words' => [ |
| | | 'all' => [ |
| | | 'default' => '全部', |
| | | 'value' => '全部' |
| | | ], |
| | | 'apply_10' => [ |
| | | 'default' => '审核中', |
| | | 'value' => '审核中' |
| | | ], |
| | | 'apply_20' => [ |
| | | 'default' => '审核通过', |
| | | 'value' => '审核通过' |
| | | ], |
| | | 'apply_40' => [ |
| | | 'default' => '已打款', |
| | | 'value' => '已打款' |
| | | ], |
| | | 'apply_30' => [ |
| | | 'default' => '驳回', |
| | | 'value' => '驳回' |
| | | ], |
| | | ] |
| | | ], |
| | | 'cash_apply' => [ |
| | | 'title' => [ |
| | | 'default' => '申请提现', |
| | | 'value' => '申请提现' |
| | | ], |
| | | 'words' => [ |
| | | 'capital' => [ |
| | | 'default' => '可提现佣金', |
| | | 'value' => '可提现佣金' |
| | | ], |
| | | 'money' => [ |
| | | 'default' => '提现金额', |
| | | 'value' => '提现金额' |
| | | ], |
| | | 'money_placeholder' => [ |
| | | 'default' => '请输入要提取的金额', |
| | | 'value' => '请输入要提取的金额' |
| | | ], |
| | | 'min_money' => [ |
| | | 'default' => '最低提现佣金', |
| | | 'value' => '最低提现佣金' |
| | | ], |
| | | 'submit' => [ |
| | | 'default' => '提交申请', |
| | | 'value' => '提交申请' |
| | | ], |
| | | ] |
| | | ], |
| | | ] |
| | | ], |
| | | 'background' => [ |
| | | 'key' => 'background', |
| | | 'describe' => '页面背景图', |
| | | 'values' => [ |
| | | // VIP专区首页 |
| | | 'index' => self::$base_url . 'image/vip/vip-bg.jpg', |
| | | // 申请提现页 |
| | | 'cash_apply' => self::$base_url . 'image/vip/vip-bg.jpg', |
| | | ], |
| | | ], |
| | | ]; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\plus\vip; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\vip\GradeLog as GradeLogModel; |
| | | use app\common\enum\user\grade\ChangeTypeEnum; |
| | | |
| | | /** |
| | | * VIP专区用户模型 |
| | | */ |
| | | class User extends BaseModel |
| | | { |
| | | protected $name = 'vip_area_user'; |
| | | protected $pk = 'user_id'; |
| | | |
| | | /** |
| | | * 关联会员记录表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function user() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User'); |
| | | } |
| | | |
| | | /** |
| | | * 关联推荐人表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function referee() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\user\\User', 'referee_id', 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联VIP等级记录表 |
| | | * @return \think\model\relation\BelongsTo |
| | | */ |
| | | public function grade() |
| | | { |
| | | return $this->belongsTo('app\\common\\model\\plus\\vip\\Grade','grade_id', 'grade_id'); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | public static function detail($user_id, $with = ['user', 'referee', 'grade']) |
| | | { |
| | | return (new static())->with($with)->find($user_id); |
| | | } |
| | | |
| | | /** |
| | | * 是否为VIP专区用户 |
| | | */ |
| | | public static function isVipUser($user_id) |
| | | { |
| | | $vip = self::detail($user_id); |
| | | return !!$vip && !$vip['is_delete']; |
| | | } |
| | | |
| | | /** |
| | | * 新增VIP专区用户记录 |
| | | * @param $user_id |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public static function add($user_id, $data) |
| | | { |
| | | $model = static::detail($user_id) ?: new static; |
| | | $user=(new \app\common\model\user\User())->detail($user_id); |
| | | $model->save(array_merge([ |
| | | 'user_id' => $user_id, |
| | | 'real_name' => $user['real_name']?: $user['nickName'], |
| | | 'mobile' => $user['mobile'], |
| | | 'is_delete' => 0, |
| | | 'app_id' => $model::$app_id, |
| | | 'grade_id' => Grade::getDefaultGradeId() |
| | | ], $data)); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 发放VIP专区佣金 |
| | | * @param $user_id |
| | | * @param $money |
| | | * @param string $description 佣金描述 |
| | | * @return bool |
| | | */ |
| | | public static function grantMoney($user_id, $money, $description = '订单佣金结算') |
| | | { |
| | | // VIP专区用户详情 |
| | | $model = static::detail($user_id); |
| | | if (!$model || $model['is_delete']) { |
| | | return false; |
| | | } |
| | | // 累加VIP专区用户可提现佣金 |
| | | $model->where('user_id', '=', $user_id)->inc('money', $money)->update(); |
| | | // 记录VIP专区资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $user_id, |
| | | 'flow_type' => 10, |
| | | 'money' => $money, |
| | | 'describe' => $description, |
| | | 'app_id' => $model['app_id'], |
| | | ]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 批量设置会员等级 |
| | | */ |
| | | public function upgradeGrade($user, $upgradeGrade) |
| | | { |
| | | // 更新会员等级的数据 |
| | | $this->where('user_id', '=', $user['user_id']) |
| | | ->update([ |
| | | 'grade_id' => $upgradeGrade['grade_id'] |
| | | ]); |
| | | (new GradeLogModel)->save([ |
| | | 'old_grade_id' => $user['grade_id'], |
| | | 'new_grade_id' => $upgradeGrade['grade_id'], |
| | | 'change_type' => ChangeTypeEnum::AUTO_UPGRADE, |
| | | 'user_id' => $user['user_id'], |
| | | 'app_id' => $user['app_id'] |
| | | ]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 提现打款成功:累积提现佣金 |
| | | */ |
| | | public static function totalMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | 'total_money' => $model['total_money'] + $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 提现驳回:解冻VIP专区资金 |
| | | */ |
| | | public static function backFreezeMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'money' => $model['money'] + $money, |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 冻结VIP专区资金 |
| | | */ |
| | | public static function freezeMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | if ($model['money'] < $money) { |
| | | return false; |
| | | } |
| | | return $model->save([ |
| | | 'money' => $model['money'] - $money, |
| | | 'freeze_money' => $model['freeze_money'] + $money, |
| | | ]); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | $status = [10 => '支付宝', 20 => '银行卡','30'=>'微信']; |
| | | $status = [30 => '支付宝', 20 => '银行卡','10'=>'微信']; |
| | | return ['text' => $status[$value], 'value' => $value]; |
| | | } |
| | | /** |
| | |
| | | namespace app\common\model\supplier; |
| | | |
| | | use app\common\model\BaseModel; |
| | | use app\shop\model\auth\User as AuthUserModel; |
| | | use app\shop\model\auth\UserRole as UserRoleModel; |
| | | use app\common\model\shop\Role as RoleModel; |
| | | use app\common\model\supplier\member\Member as MemberModel; |
| | | use app\common\model\supplier\PointsLog as PointsLogModel; |
| | | use app\shop\model\auth\UserRole as UserRoleModel; |
| | | |
| | | /** |
| | | * 商家供应商模型 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取供应商当前有效的年卡 |
| | | */ |
| | | public function getCurrentMember() |
| | | { |
| | | return MemberModel::getCurrentMember($this['shop_supplier_id'], $this['app_id']); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色管理的区域 |
| | | */ |
| | | public static function getAreaIdsByUser($user) |
| | |
| | | ->find(); |
| | | return empty($data['is_independent']) ? 0 : $data['is_independent']; |
| | | } |
| | | |
| | | /** |
| | | * 冻结用户资金 |
| | | */ |
| | | public function freezeMoney($money) |
| | | { |
| | | $this->save(['money' => $this['money'] - $money,'freeze_money'=>$this['freeze_money']+$money]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\supplier\member; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 供应商会员模型 |
| | | * 记录供应商拥有的年卡信息 |
| | | */ |
| | | class Member extends BaseModel |
| | | { |
| | | // 表名 |
| | | protected $name = 'supplier_member'; |
| | | protected $pk = 'member_id'; |
| | | protected $append=['expire_time_text']; |
| | | /** |
| | | * 过期时间文本 |
| | | */ |
| | | public function getExpireTimeTextAttr($value, $data) |
| | | { |
| | | return $data['expire_time'] > 0 ? date('Y-m-d H:i:s', $data['expire_time']) : '长期有效'; |
| | | } |
| | | |
| | | /** |
| | | * 关联供应商表 |
| | | */ |
| | | public function supplier() |
| | | { |
| | | return $this->belongsTo('app\common\model\supplier\Supplier', 'shop_supplier_id', 'shop_supplier_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联年卡计划表 |
| | | */ |
| | | public function plan() |
| | | { |
| | | return $this->belongsTo('app\common\model\supplier\member\Plan', 'plan_id', 'plan_id'); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否过期 |
| | | */ |
| | | public function isExpired() |
| | | { |
| | | return $this->expire_time < time(); |
| | | } |
| | | |
| | | /** |
| | | * 获取供应商当前有效的年卡 |
| | | */ |
| | | public static function getCurrentMember($supplierId, $appId) |
| | | { |
| | | return self::where([ |
| | | 'shop_supplier_id' => $supplierId, |
| | | 'app_id' => $appId, |
| | | 'is_expire' => 0 |
| | | ])->where('expire_time', '>', time())->find(); |
| | | } |
| | | |
| | | /** |
| | | * 获取详情 |
| | | */ |
| | | public static function detail($memberId) |
| | | { |
| | | return (new static())->where('member_id', '=', $memberId)->where('is_expire', '=', 0)->find(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\supplier\member; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 供应商年卡订单模型 |
| | | * 记录供应商购买年卡的订单信息 |
| | | */ |
| | | class Order extends BaseModel |
| | | { |
| | | // 表名 |
| | | protected $name = 'supplier_member_order'; |
| | | |
| | | protected $pk = 'order_id'; |
| | | |
| | | /** |
| | | * 关联供应商表 |
| | | */ |
| | | public function supplier() |
| | | { |
| | | return $this->belongsTo('app\common\model\supplier\Supplier', 'shop_supplier_id', 'shop_supplier_id'); |
| | | } |
| | | |
| | | /** |
| | | * 关联年卡计划表 |
| | | */ |
| | | public function plan() |
| | | { |
| | | return $this->belongsTo('app\common\model\supplier\member\Plan', 'plan_id', 'plan_id'); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if (!empty($data['order_no'])) { |
| | | $model = $model->where('order_no', '=', $data['order_no']); |
| | | } |
| | | if (isset($data['pay_status']) && $data['pay_status'] >= 0) { |
| | | $model = $model->where('pay_status', '=', $data['pay_status']); |
| | | } |
| | | return $model->where('app_id', '=', $data['app_id']) |
| | | ->with(['supplier']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | */ |
| | | public static function detail($orderId) |
| | | { |
| | | return (new static())->where('order_id', '=', $orderId)->find(); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单支付详情 |
| | | */ |
| | | public static function getPayDetail($orderNo) |
| | | { |
| | | return (new static())->where(['order_no' => $orderNo])->find(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\supplier\member; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 供应商年卡模型 |
| | | * 用于管理供应商年卡类型及其权益 |
| | | */ |
| | | class Plan extends BaseModel |
| | | { |
| | | // 表名 |
| | | protected $name = 'supplier_member_plan'; |
| | | protected $pk = 'plan_id'; |
| | | |
| | | /** |
| | | * 关联年卡权限 |
| | | */ |
| | | public function planAccess() |
| | | { |
| | | return $this->hasMany('app\common\model\supplier\member\PlanAccess', 'plan_id', 'plan_id'); |
| | | } |
| | | /** |
| | | * 获取启用的年卡列表 |
| | | */ |
| | | public function getEnabledPlans() |
| | | { |
| | | return $this->where(['status' => 1, 'is_default' =>0]) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取详情 |
| | | */ |
| | | public static function detail($planId) |
| | | { |
| | | return (new static())->with(['plan_access'])->where('plan_id', '=', $planId)->find(); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if (!empty($data['name'])) { |
| | | $model = $model->where('name', 'like', '%' . $data['name'] . '%'); |
| | | } |
| | | if (isset($data['status']) && $data['status'] >= 0) { |
| | | $model = $model->where('status', '=', $data['status']); |
| | | } |
| | | return $model->where('app_id', '=', $data['app_id']) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->paginate($data); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\model\supplier\member; |
| | | |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | | * 供应商年卡权限模型 |
| | | * 用于管理年卡套餐对应的权限 |
| | | */ |
| | | class PlanAccess extends BaseModel |
| | | { |
| | | // 表名 |
| | | protected $name = 'supplier_member_plan_access'; |
| | | protected $pk = 'id'; |
| | | |
| | | /** |
| | | * 获取年卡套餐的所有权限ID |
| | | */ |
| | | public static function getAccessIdsByPlanId($planId) |
| | | { |
| | | $accessData = self::where(['plan_id' => $planId])->select(); |
| | | $accessIds = []; |
| | | foreach ($accessData as $item) { |
| | | $accessIds[] = $item['access_id']; |
| | | } |
| | | return $accessIds; |
| | | } |
| | | |
| | | /** |
| | | * 设置年卡套餐的权限 |
| | | */ |
| | | public static function setPlanAccess($planId, $accessIds) |
| | | { |
| | | // 先删除原有权限 |
| | | self::where(['plan_id' => $planId])->delete(); |
| | | |
| | | // 添加新权限 |
| | | $data = []; |
| | | foreach ($accessIds as $accessId) { |
| | | $data[] = [ |
| | | 'plan_id' => $planId, |
| | | 'access_id' => $accessId, |
| | | 'create_time' => time() |
| | | ]; |
| | | } |
| | | |
| | | if (!empty($data)) { |
| | | return (new self())->saveAll($data); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } |
| | |
| | | { |
| | | return (new static())->find($grade_id); |
| | | } |
| | | /** |
| | | * 优惠券数组转换 |
| | | * @param $value |
| | | * @param $data |
| | | * @return string |
| | | */ |
| | | public function setOpenCouponsAttr($value) |
| | | { |
| | | return $value ? json_encode($value) : ''; |
| | | } |
| | | |
| | | /** |
| | | * 数组转换 |
| | | * @param $value |
| | | * @param $data |
| | | * @return string |
| | | */ |
| | | public function getOpenCouponsAttr($value) |
| | | { |
| | | return $value ? json_decode($value, 1) : []; |
| | | } |
| | | |
| | | /** |
| | | * 券商品数组转换 |
| | | * @param $value |
| | | * @param $data |
| | | * @return string |
| | | */ |
| | | public function setOpenProductsAttr($value) |
| | | { |
| | | return $value ? json_encode($value) : ''; |
| | | } |
| | | |
| | | /** |
| | | * 数组转换 |
| | | * @param $value |
| | | * @param $data |
| | | * @return string |
| | | */ |
| | | public function getOpenProductsAttr($value) |
| | | { |
| | | return $value ? json_decode($value, 1) : []; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表记录 |
| | |
| | | |
| | | namespace app\common\model\user; |
| | | |
| | | use app\common\library\helper; |
| | | use app\common\model\BaseModel; |
| | | use app\common\model\plus\bonus\Setting as bonusSettingModel; |
| | | use app\common\model\user\Grade as GradeModel; |
| | | use app\common\model\user\PointsLog as PointsLogModel; |
| | | use app\common\model\supplier\User as SupplierUserModel; |
| | | use app\common\model\store\Clerk as StoreClerkModel; |
| | | use app\common\model\user\User as UserModel; |
| | | use think\facade\Db; // by lyzflash |
| | | |
| | | use app\common\model\plus\bonus\User as BonusUserModel; |
| | | /** |
| | | * 用户模型 |
| | | */ |
| | |
| | | } |
| | | return $model->where('user_id', 'in', $ids)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 购买商品成功:累积购买商品次数 |
| | | */ |
| | | public static function setRepurchaseFrequency($user_id) |
| | | { |
| | | $user= self::detail($user_id); |
| | | $purchase_count=$user['purchase_count']+1; |
| | | if ($purchase_count>11){ |
| | | return false; |
| | | } |
| | | self::where('user_id',$user_id)->update([ |
| | | 'purchase_count'=>$purchase_count |
| | | ]); |
| | | // 用户等级 |
| | | event('UserGrade', $user_id); |
| | | $bonusUser=BonusUserModel::detail($user_id); |
| | | if ($bonusUser){ |
| | | return BonusUserModel::detail($user_id)->save([ |
| | | 'purchase_count'=>$purchase_count |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | /** |
| | | * 取消订单:减少累积购买商品次数 |
| | | */ |
| | | public static function decreasePurchaseCount($user_id,$product,$app_id) |
| | | { |
| | | // 验证是否设置 |
| | | $config = bonusSettingModel::getItem('basic', $app_id); |
| | | if (empty($config['become__buy_product_ids'])) { |
| | | return false; |
| | | } |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($product, 'product_id'); |
| | | // 判断商品是否在设置范围内 |
| | | $intersect = array_intersect($productIds, $config['become__buy_product_ids']); |
| | | if (empty($intersect)) { |
| | | return false; |
| | | } |
| | | $quantity=0; |
| | | foreach ($product as $item){ |
| | | // 检查商品是否是指定的分红商品 |
| | | if (in_array($item['product_id'], $config['become__buy_product_ids'])) { |
| | | // 获取商品数量 |
| | | $quantity+= $item['total_num']; |
| | | } |
| | | } |
| | | $user= self::detail($user_id); |
| | | $purchase_count=$user['purchase_count']-$quantity; |
| | | if ($purchase_count<0){ |
| | | $purchase_count=0; |
| | | } |
| | | $grade=(new GradeModel())->where('purchase_count','<=',$purchase_count)->order('purchase_count','desc')->find(); |
| | | self::where('user_id',$user_id)->update([ |
| | | 'purchase_count'=>$purchase_count, |
| | | 'grade_id'=>$grade['grade_id'] |
| | | ]); |
| | | // 用户等级 |
| | | event('UserGrade', $user_id); |
| | | $bonusUser=BonusUserModel::detail($user_id); |
| | | if ($bonusUser){ |
| | | return BonusUserModel::detail($user_id)->save([ |
| | | 'purchase_count'=>$purchase_count |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | namespace app\common\service\order; |
| | | |
| | | use app\common\library\helper; |
| | | use app\common\model\plus\bonus\Order as BonusOrderModel; |
| | | use app\common\model\settings\Setting; |
| | | use app\common\model\supplier\Capital as SupplierCapitalModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | |
| | | use app\common\model\plus\shareholder\Apply as ShareholderApplyModel; |
| | | use app\common\model\plus\shareholder\Setting as ShareholderSettingModel; |
| | | use app\common\model\plus\shareholder\Bonus as ShareholderBonusModel; |
| | | use app\common\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * 已完成订单结算服务类 |
| | |
| | | AgentOrderModel::grantMoney($order, $this->orderType); |
| | | // 发放团队分红 by yj |
| | | TeamOrderModel::grantMoney($order, $this->orderType); |
| | | // 发放会员分红 |
| | | VipOrderModel::grantMoney($order); |
| | | //发放分红 |
| | | BonusOrderModel::grantMoney($order, $this->orderType); |
| | | // 生成区域代理订单 by yj |
| | | RegionOrderModel::createOrder($order); |
| | | // 生成股东分红订单 by yj |
| | | ShareholderOrderModel::createOrder($order); |
| | | // 更新队长等级 by yj |
| | | event('TeamUserGrade', $order['user_id']); |
| | | event('VipUserGrade', $order['user_id']); |
| | | if (ShareholderSettingModel::getItem('basic')['self_buy_money']) { |
| | | // 更新股东等级 by lyzflash |
| | | $shareholderModel = new ShareholderApplyModel; |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\common\service\supplier; |
| | | |
| | | use app\common\enum\supplier\MemberOrderStatusEnum; |
| | | use app\common\model\supplier\member\Member as MemberModel; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | use app\common\model\supplier\member\Plan as MemberPlanModel; |
| | | use app\common\model\supplier\Supplier as SupplierModel; |
| | | use app\common\model\user\User as UserModel; |
| | | /** |
| | | * 供应商年卡服务类 |
| | | * 用于处理年卡购买、权限分配等业务逻辑 |
| | | */ |
| | | class MemberService |
| | | { |
| | | /** |
| | | * 创建年卡订单 |
| | | * @param int $supplierId 供应商ID |
| | | * @param int $planId 年卡套餐ID |
| | | * @return array 订单信息 |
| | | */ |
| | | public function createOrder($supplierId, $planId, $user) |
| | | { |
| | | // 获取供应商信息 |
| | | $supplier = SupplierModel::detail($supplierId); |
| | | if (!$supplier) { |
| | | return ['status' => false, 'msg' => '供应商不存在']; |
| | | } |
| | | |
| | | // 获取年卡套餐信息 |
| | | $plan = MemberPlanModel::where(['plan_id' => $planId, 'status' => 1])->find(); |
| | | if (!$plan) { |
| | | return ['status' => false, 'msg' => '年卡套餐不存在或已禁用']; |
| | | } |
| | | |
| | | // 生成订单号 |
| | | $orderNo = date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); |
| | | |
| | | // 创建订单 |
| | | $orderData = [ |
| | | 'order_no' => $orderNo, |
| | | 'shop_supplier_id' => $supplierId, |
| | | 'plan_id' => $planId, |
| | | 'plan_name' => $plan['name'], |
| | | 'price' => $plan['price'], |
| | | 'user_id' => $user['user_id'], |
| | | 'pay_status' => MemberOrderStatusEnum::PENDING, |
| | | 'app_id' => $supplier['app_id'], |
| | | 'pay_source' => 'wx', // 默认来源 |
| | | ]; |
| | | |
| | | $order = MemberOrderModel::create($orderData); |
| | | if (!$order) { |
| | | return ['status' => false, 'msg' => '创建订单失败']; |
| | | } |
| | | |
| | | return ['status' => true, 'data' => $order]; |
| | | } |
| | | |
| | | /** |
| | | * 支付成功后处理年卡激活 |
| | | * @param int $orderId 订单ID |
| | | * @return bool 是否处理成功 |
| | | */ |
| | | public function activateMember($orderId) |
| | | { |
| | | // 获取订单信息 |
| | | $order = MemberOrderModel::where(['order_id' => $orderId, 'pay_status' => MemberOrderStatusEnum::PENDING])->find(); |
| | | if (!$order) { |
| | | return false; |
| | | } |
| | | |
| | | // 获取供应商和套餐信息 |
| | | $supplier = SupplierModel::detail($order['shop_supplier_id']); |
| | | $user = UserModel::detail($order['user_id']); |
| | | $plan = MemberPlanModel::where(['plan_id' => $order['plan_id'], 'status' => 1])->find(); |
| | | if (!$supplier || !$plan) { |
| | | return false; |
| | | } |
| | | |
| | | // 更新订单状态 |
| | | $order->save([ |
| | | 'pay_status' => MemberOrderStatusEnum::SUCCESS, |
| | | 'pay_time' => time(), |
| | | 'update_time' => time() |
| | | ]); |
| | | |
| | | // 计算过期时间 |
| | | $expireTime = time() + ($plan['duration'] * 24 * 60 * 60); |
| | | |
| | | // 创建或更新年卡记录 |
| | | $memberData = [ |
| | | 'shop_supplier_id' => $supplier['shop_supplier_id'], |
| | | 'plan_id' => $plan['plan_id'], |
| | | 'plan_name' => $plan['name'], |
| | | 'price' => $plan['price'], |
| | | 'expire_time' => $expireTime, |
| | | 'bonus_points' => $plan['bonus_points'], |
| | | 'is_expire' => 0, |
| | | 'app_id' => $supplier['app_id'], |
| | | ]; |
| | | |
| | | $member = MemberModel::where([ |
| | | 'shop_supplier_id' => $supplier['shop_supplier_id'], |
| | | 'is_expire' => 0 |
| | | ])->where('expire_time', '>', time())->find(); |
| | | if ($member) { |
| | | $expireTime = $member['expire_time'] + ($plan['duration'] * 24 * 60 * 60); |
| | | // 续费,延长过期时间 |
| | | $member->save([ |
| | | 'expire_time' => $expireTime, |
| | | ]); |
| | | } else { |
| | | // 新购买 |
| | | MemberModel::create($memberData); |
| | | } |
| | | |
| | | // 赠送积分 |
| | | if ($plan['bonus_points'] > 0) { |
| | | $user->setIncPoints($plan['bonus_points'], '购买年卡赠送积分:'.$order['order_no']); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 检查供应商是否有指定权限 |
| | | * @param int $supplierId 供应商ID |
| | | * @param string $permission 权限标识 |
| | | * @return bool 是否有权限 |
| | | */ |
| | | public function checkPermission($supplierId, $permission) |
| | | { |
| | | // 获取供应商当前年卡 |
| | | $supplier = SupplierModel::detail($supplierId); |
| | | $member = $supplier->getCurrentMember(); |
| | | |
| | | if (!$member) { |
| | | return false; // 没有有效年卡 |
| | | } |
| | | |
| | | // 获取年卡套餐信息 |
| | | $plan = MemberPlanModel::where(['plan_id' => $member['plan_id'], 'status' => 1])->find(); |
| | | if (!$plan || empty($plan['permissions'])) { |
| | | return false; |
| | | } |
| | | |
| | | // 解析权限 |
| | | $permissions = json_decode($plan['permissions'], true); |
| | | if (!$permissions) { |
| | | return false; |
| | | } |
| | | |
| | | // 检查是否有指定权限 |
| | | return isset($permissions[$permission]) && $permissions[$permission] == 1; |
| | | } |
| | | |
| | | /** |
| | | * 获取供应商所有权限 |
| | | * @param int $supplierId 供应商ID |
| | | * @return array 权限列表 |
| | | */ |
| | | public function getPermissions($supplierId) |
| | | { |
| | | // 获取供应商当前年卡 |
| | | $supplier = SupplierModel::detail($supplierId); |
| | | $member = $supplier->getCurrentMember(); |
| | | |
| | | if (!$member) { |
| | | return []; // 没有有效年卡 |
| | | } |
| | | |
| | | // 获取年卡套餐信息 |
| | | $plan = MemberPlanModel::where(['plan_id' => $member['plan_id'], 'status' => 1])->find(); |
| | | if (!$plan || empty($plan['permissions'])) { |
| | | return []; |
| | | } |
| | | |
| | | // 解析权限 |
| | | $permissions = json_decode($plan['permissions'], true); |
| | | return $permissions ?: []; |
| | | } |
| | | } |
| | |
| | | 'Branch' => [ |
| | | \app\job\event\Branch::class |
| | | ], |
| | | /*vip订单*/ |
| | | 'VipOrder' => [ |
| | | \app\job\event\VipOrder::class |
| | | ], |
| | | /*vip用户*/ |
| | | 'VipUser' => [ |
| | | \app\job\event\VipUser::class |
| | | ], |
| | | /*vip用户等级*/ |
| | | 'VipUserGrade' => [ |
| | | \app\job\event\VipUserGrade::class |
| | | ], |
| | | ], |
| | | |
| | | 'subscribe' => [ |
| | |
| | | |
| | | use \GatewayWorker\Lib\Gateway; |
| | | use app\api\model\plus\business\chat\Chat as BusinessChatModel; |
| | | use app\api\model\plus\business\chat\Participant as BusinessParticipantModel; |
| | | use Workerman\Lib\Timer; |
| | | use Workerman\Worker; |
| | | use think\worker\Application; |
| | |
| | | { |
| | | // 向当前client_id发送数据 |
| | | $data['client_id'] = $client_id; |
| | | $data['type'] = 'init'; |
| | | $data['type'] = 'init';//心跳 |
| | | Gateway::sendToClient($client_id, json_encode($data)); |
| | | } |
| | | |
| | |
| | | public static function onMessage($client_id, $message) |
| | | { |
| | | $data = json_decode($message, 1); |
| | | $to = 'user_' . $data['to_user_id']; |
| | | $to = !empty($data['to_user_id']) ? 'user_' . $data['to_user_id'] : 0; |
| | | $from_id = 'user_' . $data['user_id']; |
| | | |
| | | if ($data['type'] !== 'ping' && $data['type'] !== 'close') {//正常发送消息 |
| | | if (Gateway::isUidOnline($to)) { |
| | | $data['time'] = date('Y-m-d H:i:s'); |
| | | Gateway::sendToUid($to, json_encode($data)); |
| | | } |
| | | |
| | | // 保存消息到数据库 |
| | | $Chat = new BusinessChatModel; |
| | | $Chat->addBusinessMessage($data, ['user_id' => $data['user_id']]); |
| | | if ($data['type'] == 'bind') { |
| | | // 绑定client_id和user_id |
| | | Gateway::bindUid($client_id, $from_id); |
| | | |
| | | } else if ($data['type'] == 'ping') { |
| | | //心跳 |
| | | $data['Online'] = $to && Gateway::isUidOnline($to) ? 'on' : 'off'; |
| | | $data['Online'] = $to && Gateway::isUidOnline($to) ? 'off' : 'on'; |
| | | Gateway::sendToUid($from_id, json_encode($data)); |
| | | } else if ($data['type'] == 'close') { |
| | | //断开链接 |
| | | Gateway::unbindUid($client_id, $from_id); |
| | | } else if ($data['type'] == 'read') { |
| | | // 消息已读处理 |
| | | $chatModel = new BusinessChatModel(); |
| | | $chatModel->markAsRead($data['chat_id'], $data['user_id']); |
| | | |
| | | // 更新参与者最后阅读时间 |
| | | $participantModel = new BusinessParticipantModel(); |
| | | $participantModel->updateLastReadTime($data['conversation_id'], $data['user_id']); |
| | | if ($to && Gateway::isUidOnline($to)) { |
| | | Gateway::sendToUid($to, json_encode($data)); |
| | | } |
| | | } else if ($data['type'] !== 'ping' && $data['type'] !== 'close') {//正常发送消息 |
| | | // 绑定client_id和user_id |
| | | Gateway::bindUid($client_id, $from_id); |
| | | // 保存消息到数据库 |
| | | $Chat = new BusinessChatModel; |
| | | $Chat->sendMessage($data['conversation_id'], $data['user_id'], $data['content'], 0, $data['app_id']); |
| | | // 检查接收方是否在线 |
| | | if ($to && Gateway::isUidOnline($to)) { |
| | | $data['send_time'] = time(); |
| | | $data['chat_id']=$Chat->chat_id; |
| | | Gateway::sendToUid($to, json_encode($data)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | if($upgradeGrade){ |
| | | if($user['grade_id'] == $upgradeGrade['grade_id']){ |
| | | return true; |
| | | } |
| | | $this->dologs('setAgentUserGrade', [ |
| | | 'user_id' => $user['user_id'], |
| | | 'grade_id' => $upgradeGrade['grade_id'], |
| | |
| | | if($grade['open_agent_user'] == 1 && UserModel::agentCount($user['user_id']) >= $grade['agent_user']){ |
| | | $agent_user = true; |
| | | } |
| | | // 按购买指定商品次数升级 |
| | | $purchase_count = false; |
| | | if($grade['is_purchase_count'] == 1 && $user['user']['purchase_count'] >= $grade['purchase_count']){ |
| | | $purchase_count = true; |
| | | } |
| | | if($grade['condition_type'] == 'and'){ |
| | | return $agent_money && $agent_user; |
| | | $grade['open_agent_user']!=1 && $agent_user=true; |
| | | $grade['open_agent_money']!=1 && $agent_money=true; |
| | | $grade['is_purchase_count']!=1 && $purchase_count=true; |
| | | return $agent_money && $agent_user && $purchase_count; |
| | | }else{ |
| | | return $agent_money || $agent_user; |
| | | return $agent_money || $agent_user || $purchase_count; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\event; |
| | | |
| | | use think\facade\Cache; |
| | | use app\job\model\plus\bonus\User as BonusUserModel; |
| | | use app\common\library\helper; |
| | | |
| | | /** |
| | | * 超级分红事件管理 |
| | | */ |
| | | class BonusUser |
| | | { |
| | | // 模型 |
| | | private $model; |
| | | |
| | | // 应用id |
| | | private $appId; |
| | | |
| | | /** |
| | | * 执行函数 |
| | | */ |
| | | public function handle($app_id) |
| | | { |
| | | try { |
| | | $this->appId = $app_id; |
| | | $this->model = new BonusUserModel(); |
| | | // 设置队长排位过期状态 |
| | | $this->setExpired(); |
| | | // 解冻业绩 |
| | | $this->backFreezeMoneySecond(); |
| | | } catch (\Throwable $e) { |
| | | echo 'ERROR BonusUser: ' . $e->getMessage() . PHP_EOL; |
| | | log_write('BonusUser TASK : ' . '__ ' . $e->getMessage(), 'task'); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 设置队长过期状态 |
| | | */ |
| | | private function setExpired() |
| | | { |
| | | $cacheKey = "task_space_BonusUser__{$this->appId}"; |
| | | if (Cache::has($cacheKey)) return true; |
| | | // 获取已过期的队长ID集 |
| | | $userIds = $this->model->getExpiredUserIds($this->appId); |
| | | // 记录日志 |
| | | $this->dologs('setExpired', [ |
| | | 'userIds' => json_encode($userIds), |
| | | ]); |
| | | // 更新已过期状态 |
| | | $this->model->setIsExpire($userIds); |
| | | Cache::set($cacheKey, time(), 3600); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取可解冻业绩的队长列表 |
| | | */ |
| | | private function backFreezeMoneySecond() |
| | | { |
| | | $cacheKey = "task_space_BonusUser_back__{$this->appId}"; |
| | | if (Cache::has($cacheKey)) return true; |
| | | // 获得可解冻的队长 |
| | | $userList = $this->model->getBackUserList($this->appId); |
| | | $userIds = helper::getArrayColumn($userList, 'user_id'); |
| | | // 记录日志 |
| | | $this->dologs('setBackFreezeMoneySecond', [ |
| | | 'userIds' => json_encode($userIds), |
| | | ]); |
| | | // 解冻 |
| | | $this->model->setBackFreezeMoneySecond($userList); |
| | | Cache::set($cacheKey, time(), 3600 * 6); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 记录日志 |
| | | */ |
| | | private function dologs($method, $params = []) |
| | | { |
| | | $value = 'BonusUser --' . $method; |
| | | foreach ($params as $key => $val) |
| | | $value .= ' --' . $key . ' ' . $val; |
| | | return log_write($value, 'task'); |
| | | } |
| | | |
| | | } |
| | |
| | | event('Order', $app['app_id']); |
| | | // 预售订单 |
| | | event('AdvanceOrder', $app['app_id']); |
| | | // 分红队长排位有效期 |
| | | event('BonusUser', $app['app_id']); |
| | | } |
| | | // 拼团任务 |
| | | event('AssembleBill'); |
| | |
| | | event('UserCoupon'); |
| | | // 分销商订单 |
| | | event('AgentOrder'); |
| | | // VIP专区订单 |
| | | event('VipOrder'); |
| | | // 直播间管理 |
| | | event('LiveRoom'); |
| | | // 分会 |
| | |
| | | } |
| | | |
| | | if(!empty($upgradeGrade)){ |
| | | |
| | | if($user['grade_id'] == $upgradeGrade['grade_id'] || $user['weight'] >= $upgradeGrade['weight']){ |
| | | return true; |
| | | } |
| | | $this->dologs('setUserGrade', [ |
| | | 'user_id' => $user['user_id'], |
| | | 'grade_id' => $upgradeGrade['grade_id'], |
| | |
| | | if($grade['open_invite'] == 1 && $user['total_invite'] >= $grade['upgrade_invite']){ |
| | | return true; |
| | | } |
| | | // 按购买指定商品次数升级 |
| | | if($grade['is_purchase_count'] == 1 && $user['purchase_count'] >= $grade['purchase_count']){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\event; |
| | | |
| | | use think\facade\Cache; |
| | | use app\job\model\plus\vip\Cash as VipCashModel; |
| | | |
| | | /** |
| | | * VIP提现事件管理 |
| | | */ |
| | | class VipCash |
| | | { |
| | | // 模型 |
| | | private $model; |
| | | |
| | | /** |
| | | * 执行函数 |
| | | */ |
| | | public function handle() |
| | | { |
| | | try { |
| | | $this->model = new VipCashModel(); |
| | | $cacheKey = "task_space_VipCash"; |
| | | if (!Cache::has($cacheKey)) { |
| | | // 处理提现申请逻辑 |
| | | $this->processCashApplications(); |
| | | |
| | | // 处理打款逻辑 |
| | | $this->processPayments(); |
| | | |
| | | Cache::set($cacheKey, time(), 60); |
| | | } |
| | | } catch (\Throwable $e) { |
| | | echo 'ERROR VipCash: ' . $e->getMessage() . PHP_EOL; |
| | | log_write('VipCash TASK : ' . '__ ' . $e->getMessage(), 'task'); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 处理提现申请 |
| | | */ |
| | | private function processCashApplications() |
| | | { |
| | | // 获取待处理的提现申请列表 |
| | | $list = $this->model->getPendingList(); |
| | | if ($list->isEmpty()) return false; |
| | | |
| | | // 处理逻辑... |
| | | $processedIds = []; |
| | | foreach ($list as $item) { |
| | | // 具体处理逻辑 |
| | | $processedIds[] = $item['id']; |
| | | } |
| | | |
| | | // 标记已处理 |
| | | if (!empty($processedIds)) { |
| | | $this->model->setProcessed($processedIds); |
| | | } |
| | | |
| | | // 记录日志 |
| | | $this->dologs('processCashApplications', ['Count' => count($processedIds)]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 处理打款 |
| | | */ |
| | | private function processPayments() |
| | | { |
| | | // 获取已批准但未打款的申请列表 |
| | | $list = $this->model->getApprovedList(); |
| | | if ($list->isEmpty()) return false; |
| | | |
| | | // 处理逻辑... |
| | | $processedIds = []; |
| | | foreach ($list as $item) { |
| | | // 具体处理逻辑 |
| | | $processedIds[] = $item['id']; |
| | | } |
| | | |
| | | // 标记已处理 |
| | | if (!empty($processedIds)) { |
| | | $this->model->setProcessed($processedIds); |
| | | } |
| | | |
| | | // 记录日志 |
| | | $this->dologs('processPayments', ['Count' => count($processedIds)]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 记录日志 |
| | | */ |
| | | private function dologs($method, $params = []) |
| | | { |
| | | $value = 'behavior VipCash --' . $method; |
| | | foreach ($params as $key => $val) { |
| | | $value .= ' --' . $key . ' ' . (is_array($val) ? json_encode($val) : $val); |
| | | } |
| | | return log_write($value, 'task'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\event; |
| | | |
| | | use think\facade\Cache; |
| | | use app\job\model\plus\vip\Order as VipOrderModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | |
| | | /** |
| | | * VIP专区订单事件管理 |
| | | */ |
| | | class VipOrder |
| | | { |
| | | // 模型 |
| | | private $model; |
| | | |
| | | /** |
| | | * 执行函数 |
| | | */ |
| | | public function handle() |
| | | { |
| | | try { |
| | | $this->model = new VipOrderModel(); |
| | | $cacheKey = "task_space_VipOrder"; |
| | | //if (!Cache::has($cacheKey)) { |
| | | $this->model->startTrans(); |
| | | try { |
| | | // 发放VIP订单佣金 |
| | | $this->grantMoney(); |
| | | $this->model->commit(); |
| | | } catch (\Exception $e) { |
| | | log_write('VipOrder TASK : ' . '__ ' . $e->getMessage()); |
| | | $this->model->rollback(); |
| | | } |
| | | Cache::set($cacheKey, time(), 60); |
| | | //} |
| | | } catch (\Throwable $e) { |
| | | echo 'ERROR VipOrder: ' . $e->getMessage() . PHP_EOL; |
| | | log_write('VipOrder TASK : ' . '__ ' . $e->getMessage(), 'task'); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 发放VIP订单佣金 |
| | | */ |
| | | private function grantMoney() |
| | | { |
| | | // 获取未结算佣金的订单列表 |
| | | $list = $this->model->getUnSettledList(); |
| | | if ($list->isEmpty()) return false; |
| | | // 整理id集 |
| | | $invalidIds = []; |
| | | $grantIds = []; |
| | | // 发放VIP订单佣金 |
| | | foreach ($list as $item) { |
| | | // 已失效的订单 |
| | | if ($item['orderMaster']['order_status']['value'] == 20) { |
| | | $invalidIds[] = $item['id']; |
| | | } |
| | | // 已完成的订单 |
| | | if ($item['orderMaster']['order_status']['value'] == 30) { |
| | | $grantIds[] = $item['id']; |
| | | VipOrderModel::grantMoney($item['orderMaster'], OrderTypeEnum::MASTER); |
| | | } |
| | | } |
| | | |
| | | // 标记已失效的订单 |
| | | $this->model->setInvalid($invalidIds); |
| | | |
| | | // 记录日志 |
| | | $this->dologs('invalidIds', ['Ids' => $invalidIds]); |
| | | $this->dologs('grantMoney', ['Ids' => $grantIds]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 记录日志 |
| | | */ |
| | | private function dologs($method, $params = []) |
| | | { |
| | | $value = 'behavior VipOrder --' . $method; |
| | | foreach ($params as $key => $val) { |
| | | $value .= ' --' . $key . ' ' . (is_array($val) ? json_encode($val) : $val); |
| | | } |
| | | return log_write($value, 'task'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\event; |
| | | |
| | | use think\facade\Cache; |
| | | use app\job\model\plus\vip\User as VipUserModel; |
| | | |
| | | /** |
| | | * VIP用户事件管理 |
| | | */ |
| | | class VipUser |
| | | { |
| | | // 模型 |
| | | private $model; |
| | | |
| | | /** |
| | | * 执行函数 |
| | | */ |
| | | public function handle() |
| | | { |
| | | try { |
| | | $this->model = new VipUserModel(); |
| | | $cacheKey = "task_space_VipUser"; |
| | | if (!Cache::has($cacheKey)) { |
| | | // 处理用户升级逻辑 |
| | | $this->processUserUpgrades(); |
| | | |
| | | // 处理用户降级逻辑 |
| | | $this->processUserDowngrades(); |
| | | |
| | | Cache::set($cacheKey, time(), 60); |
| | | } |
| | | } catch (\Throwable $e) { |
| | | echo 'ERROR VipUser: ' . $e->getMessage() . PHP_EOL; |
| | | log_write('VipUser TASK : ' . '__ ' . $e->getMessage(), 'task'); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 处理用户升级 |
| | | */ |
| | | private function processUserUpgrades() |
| | | { |
| | | // 获取需要升级的用户列表 |
| | | $list = $this->model->getUpgradeList(); |
| | | if ($list->isEmpty()) return false; |
| | | |
| | | // 处理逻辑... |
| | | $processedIds = []; |
| | | foreach ($list as $item) { |
| | | // 具体处理逻辑 |
| | | $processedIds[] = $item['user_id']; |
| | | } |
| | | |
| | | // 标记已处理 |
| | | if (!empty($processedIds)) { |
| | | $this->model->processGradeChange($processedIds, true); |
| | | } |
| | | |
| | | // 记录日志 |
| | | $this->dologs('processUserUpgrades', ['Count' => count($processedIds)]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 处理用户降级 |
| | | */ |
| | | private function processUserDowngrades() |
| | | { |
| | | // 获取需要降级的用户列表 |
| | | $list = $this->model->getDowngradeList(); |
| | | if ($list->isEmpty()) return false; |
| | | |
| | | // 处理逻辑... |
| | | $processedIds = []; |
| | | foreach ($list as $item) { |
| | | // 具体处理逻辑 |
| | | $processedIds[] = $item['user_id']; |
| | | } |
| | | |
| | | // 标记已处理 |
| | | if (!empty($processedIds)) { |
| | | $this->model->processGradeChange($processedIds, false); |
| | | } |
| | | |
| | | // 记录日志 |
| | | $this->dologs('processUserDowngrades', ['Count' => count($processedIds)]); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 记录日志 |
| | | */ |
| | | private function dologs($method, $params = []) |
| | | { |
| | | $value = 'behavior VipUser --' . $method; |
| | | foreach ($params as $key => $val) { |
| | | $value .= ' --' . $key . ' ' . (is_array($val) ? json_encode($val) : $val); |
| | | } |
| | | return log_write($value, 'task'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\event; |
| | | |
| | | use app\common\model\plus\vip\Grade as GradeModel; |
| | | use app\common\model\plus\vip\User as UserModel; |
| | | use app\common\model\plus\vip\Order as OrderModel; |
| | | |
| | | /** |
| | | * VIP用户等级事件管理 |
| | | */ |
| | | class VipUserGrade |
| | | { |
| | | /** |
| | | * 执行函数 |
| | | */ |
| | | public function handle($userId) |
| | | { |
| | | // 设置用户的会员等级 |
| | | $this->setGrade($userId); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 设置等级 |
| | | */ |
| | | private function setGrade($userId) |
| | | { |
| | | if (empty($userId)) { |
| | | return false; |
| | | } |
| | | log_write('VIP用户升级$user_id='.$userId); |
| | | // 用户模型 |
| | | $user = UserModel::detail($userId); |
| | | // 获取所有等级 |
| | | $list = GradeModel::getUsableList($user['app_id']); |
| | | if ($list->isEmpty()) { |
| | | return false; |
| | | } |
| | | // 遍历等级,根据升级条件 查询满足消费金额的用户列表,并且他的等级小于该等级 |
| | | $upgradeGrade = null; |
| | | foreach ($list as $grade) { |
| | | if($grade['is_default'] == 1){ |
| | | continue; |
| | | } |
| | | // 不自动升级 |
| | | if($grade['auto_upgrade'] == 0){ |
| | | continue; |
| | | } |
| | | $is_upgrade = $this->checkCanUpdate($user, $grade); |
| | | if($is_upgrade){ |
| | | $upgradeGrade = $grade; |
| | | continue; |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | if($upgradeGrade){ |
| | | if($user['grade_id'] == $upgradeGrade['grade_id']){ |
| | | return true; |
| | | } |
| | | $this->dologs('setVipUserGrade', [ |
| | | 'user_id' => $user['user_id'], |
| | | 'grade_id' => $upgradeGrade['grade_id'], |
| | | ]); |
| | | // 修改会员的等级 |
| | | (new UserModel())->upgradeGrade($user, $upgradeGrade); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询满足会员等级升级条件的用户列表 |
| | | */ |
| | | public function checkCanUpdate($user, $grade) |
| | | { |
| | | // 按购买指定商品次数升级 |
| | | $purchase_count = false; |
| | | if($grade['is_purchase_count'] == 1 && $user['user']['purchase_count'] >= $grade['purchase_count']){ |
| | | $purchase_count = true; |
| | | } |
| | | if($grade['condition_type'] == 'and'){ |
| | | $grade['is_purchase_count']!=1 && $purchase_count=true; |
| | | return $purchase_count; |
| | | }else{ |
| | | return $purchase_count; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 记录日志 |
| | | */ |
| | | private function dologs($method, $params = []) |
| | | { |
| | | $value = 'VipUserGrade --' . $method; |
| | | foreach ($params as $key => $val) |
| | | $value .= ' --' . $key . ' ' . $val; |
| | | return log_write($value, 'task'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | use app\common\model\plus\bonus\Setting; |
| | | use app\common\library\helper; |
| | | |
| | | /** |
| | | * 用户优惠券模型 |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取排位已过期的队长ID集 |
| | | */ |
| | | // public function getExpiredUserIds($app_id) |
| | | // { |
| | | // $setting = Setting::getItem('basic', $app_id); |
| | | // // log_write($setting); |
| | | // if (empty($setting['expire_day'])) { |
| | | // return ''; |
| | | // } |
| | | // $time = time() - 86400 * $setting['expire_day']; |
| | | // // log_write($time); |
| | | // return $this->where('is_expire', '=', 0) |
| | | // ->where('is_delete', '=', 0) |
| | | // ->where('tree_level', '>', 3) |
| | | // ->where('agent_time', '<', $time)->column('user_id'); |
| | | // } |
| | | |
| | | /** |
| | | * 获取排位已过期的队长ID集(直推超过3个的不设置过期) |
| | | */ |
| | | public function getExpiredUserIds($app_id) |
| | | { |
| | | $setting = Setting::getItem('basic', $app_id); |
| | | // log_write($setting); |
| | | if (empty($setting['expire_day'])) { |
| | | return ''; |
| | | } |
| | | $time = time() - 86400 * $setting['expire_day']; |
| | | $list = $this->alias('bonus')->where('bonus.is_expire', '=', 0) |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->where('bonus.tree_level', '>', 3) |
| | | ->where('bonus.is_permanent', '=', 0) |
| | | ->where('bonus.agent_time', '<', $time) |
| | | ->field('bonus.user_id,count(agent.user_id) as num') |
| | | ->leftJoin('agent_user agent', 'agent.referee_id=bonus.user_id') |
| | | ->having('num<3') |
| | | ->group('bonus.user_id') |
| | | ->select()->toArray(); |
| | | log_write($list); |
| | | return helper::getArrayColumn($list, 'user_id'); |
| | | } |
| | | |
| | | /** |
| | | * 设置队长排位过期状态 |
| | | */ |
| | | public function setIsExpire($UserIds) |
| | | { |
| | | if (empty($UserIds)) { |
| | | return false; |
| | | } |
| | | return $this->where('user_id', 'in', $UserIds)->save(['is_expire' => 1]); |
| | | } |
| | | |
| | | /** |
| | | * 获取可解冻业绩奖的队长列表 |
| | | */ |
| | | public function getBackUserList($app_id) |
| | | { |
| | | $setting = Setting::getItem('basic', $app_id); |
| | | $model = $this->alias('bonus'); |
| | | if (!empty($setting['expire_day'])) { |
| | | $model = $model->where('bonus.is_expire', '=', 0); |
| | | } |
| | | return $model->where('bonus.is_delete', '=', 0) |
| | | ->where('freeze_money_second', '>', 0) |
| | | ->join('agent_user agent', 'agent.referee_id=bonus.user_id and agent.first_num>=3') |
| | | ->field('bonus.user_id,bonus.money,bonus.freeze_money_second,count(agent.user_id) as num') |
| | | ->having('num>=3') |
| | | ->group('bonus.user_id') |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 执行解冻业绩 |
| | | */ |
| | | public function setBackFreezeMoneySecond($list) |
| | | { |
| | | $data = []; |
| | | foreach ($list as $item) { |
| | | $data[] = [ |
| | | 'user_id' => $item['user_id'], |
| | | 'money' => $item['money'] + $item['freeze_money_second'], |
| | | 'freeze_money_second' => 0 |
| | | ]; |
| | | } |
| | | $data && $this->saveAll($data); |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Cash as CashModel; |
| | | |
| | | /** |
| | | * VIP提现模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取待处理的提现申请 |
| | | */ |
| | | public function getPendingList() |
| | | { |
| | | return $this->where('apply_status', '=', 10) |
| | | ->where('is_delete', '=', 0) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取已批准但未打款的提现申请 |
| | | */ |
| | | public function getApprovedList() |
| | | { |
| | | return $this->where('apply_status', '=', 20) |
| | | ->where('is_delete', '=', 0) |
| | | ->where('pay_status', '=', 10) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 批量标记提现申请为已处理 |
| | | */ |
| | | public function setProcessed($ids) |
| | | { |
| | | return $this->where('id', 'in', $ids) |
| | | ->save(['apply_status' => 30, 'pay_status' => 20]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Order as VipOrderModel; |
| | | use app\common\model\order\Order as OrderModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | |
| | | /** |
| | | * VIP专区订单模型(Job专用) |
| | | */ |
| | | class Order extends VipOrderModel |
| | | { |
| | | /** |
| | | * 获取未结算佣金的订单列表 |
| | | */ |
| | | public function getUnSettledList() |
| | | { |
| | | return $this->with(['orderMaster']) |
| | | ->where('is_settled', '=', 0) |
| | | ->where('is_invalid', '=', 0) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 标记订单为已失效 |
| | | */ |
| | | public function setInvalid($orderIds) |
| | | { |
| | | if (empty($orderIds)) return; |
| | | return $this->whereIn('id', $orderIds) |
| | | ->save(['is_invalid' => 1]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\job\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\User as UserModel; |
| | | |
| | | /** |
| | | * VIP用户模型 |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取需要升级的用户列表 |
| | | */ |
| | | public function getUpgradeList() |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->where('is_upgrade', '=', 1) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取需要降级的用户列表 |
| | | */ |
| | | public function getDowngradeList() |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->where('is_downgrade', '=', 1) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 批量处理用户等级变更 |
| | | */ |
| | | public function processGradeChange($ids, $is_upgrade = true) |
| | | { |
| | | $field = $is_upgrade ? 'is_upgrade' : 'is_downgrade'; |
| | | return $this->where('user_id', 'in', $ids) |
| | | ->save([$field => 0]); |
| | | } |
| | | } |
| | |
| | | |
| | | namespace app\job\model\user; |
| | | |
| | | use app\api\model\plus\coupon\UserCoupon as UserCouponModel; |
| | | use app\common\model\user\User as UserModel; |
| | | use app\job\model\user\GradeLog as GradeLogModel; |
| | | use app\common\enum\user\grade\ChangeTypeEnum; |
| | |
| | | */ |
| | | public function upgradeGrade($user, $upgradeGrade) |
| | | { |
| | | if($user['business_card_time']>time()){ |
| | | $business_card_time=strtotime('+'.$upgradeGrade['business_card_time'].' month',$user['business_card_time']); |
| | | }else{ |
| | | $business_card_time=strtotime('+'.$upgradeGrade['business_card_time'].' month'); |
| | | } |
| | | //赠送优惠券 |
| | | if ($upgradeGrade['open_coupon'] && $upgradeGrade['open_coupons']) { |
| | | (new UserCouponModel)->addUserCardCoupon($upgradeGrade['open_coupons'], $user,0); |
| | | } |
| | | // 更新会员等级的数据 |
| | | $this->where('user_id', '=', $user['user_id']) |
| | | ->update([ |
| | | 'grade_id' => $upgradeGrade['grade_id'] |
| | | 'grade_id' => $upgradeGrade['grade_id'], |
| | | 'business_card_time' => $business_card_time |
| | | ]); |
| | | |
| | | (new GradeLogModel)->save([ |
| | | 'old_grade_id' => $user['grade_id'], |
| | | 'new_grade_id' => $upgradeGrade['grade_id'], |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\Apply as ApplyModel; |
| | | |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 队长申请列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new ApplyModel; |
| | | $apply_list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('apply_list')); |
| | | } |
| | | |
| | | /** |
| | | * 审核队长 |
| | | */ |
| | | public function editApplyStatus($apply_id) |
| | | { |
| | | $model = ApplyModel::detail($apply_id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError('修改失败'); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\Cash as CashModel; |
| | | |
| | | /** |
| | | * 提现申请制器 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | /** |
| | | * 提现记录列表 |
| | | */ |
| | | public function index($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel; |
| | | $list = $model->getList($user_id, $apply_status, $pay_type, $search, $this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function submit($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 确认打款 |
| | | */ |
| | | public function money($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | |
| | | if ($model->money()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 队长提现:微信支付企业付款 |
| | | */ |
| | | public function wechat_pay($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->wechatPay()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function export($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel(); |
| | | return $model->exportList($user_id, $apply_status, $pay_type, $search, $this->postData()); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\Grade as GradeModel; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | class Grade extends Controller |
| | | { |
| | | /** |
| | | * 会员等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new GradeModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new GradeModel; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员等级 |
| | | */ |
| | | public function edit($grade_id) |
| | | { |
| | | $model = GradeModel::detail($grade_id); |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员等级 |
| | | */ |
| | | public function delete($grade_id) |
| | | { |
| | | // 会员等级详情 |
| | | $model = GradeModel::detail($grade_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('已存在用户,删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\Order as OrderModel; |
| | | |
| | | /** |
| | | * 分销订单 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 分销订单列表 |
| | | */ |
| | | public function index($user_id = null, $is_settled = -1) |
| | | { |
| | | $model = new OrderModel; |
| | | $list = $model->getList($user_id, $is_settled); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\Setting as bonusSettingModel; |
| | | use app\shop\model\product\Product as ProductModel; |
| | | |
| | | /** |
| | | * 分销设置控制器 |
| | | */ |
| | | class Setting extends Controller |
| | | { |
| | | |
| | | public $pay_type = [ |
| | | ['id' => '10', 'name' => '微信支付'], |
| | | ['id' => '20', 'name' => '支付宝'], |
| | | ['id' => '30', 'name' => '银行卡'], |
| | | ['id' => '40', 'name' => '余额'] |
| | | ]; |
| | | |
| | | public $pay_type1 = [ |
| | | 10 => '微信支付', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡', |
| | | 40 => '余额' |
| | | ]; |
| | | |
| | | /** |
| | | * 分销设置 |
| | | */ |
| | | public function index() |
| | | { |
| | | $pay_type = $this->pay_type; |
| | | $data = bonusSettingModel::getAll(); |
| | | // 购买指定商品成为队长:商品列表 |
| | | $product_ids = $data['basic']['values']['become__buy_product_ids']; |
| | | $productList = []; |
| | | if(count($product_ids) > 0){ |
| | | $productList = (new ProductModel)->getListByIds($product_ids); |
| | | } |
| | | return $this->renderSuccess('', compact('data', 'productList', 'pay_type')); |
| | | } |
| | | |
| | | /** |
| | | * 基础信息设置 |
| | | */ |
| | | public function basic() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['basic'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 队长条件设置 |
| | | */ |
| | | public function condition() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['condition'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 佣金设置 |
| | | */ |
| | | public function commission() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['commission'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 结算设置 |
| | | */ |
| | | public function settlement() |
| | | { |
| | | $param = $this->postData('form'); |
| | | $data['settlement'] = [ |
| | | 'fee_rate' => $param['fee_rate'], |
| | | 'min_money' => $param['min_money'], |
| | | 'settle_days' => $param['settle_days'], |
| | | 'pay_type' => $param['pay_type'], |
| | | 'explain' => $param['explain'], |
| | | ]; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 自定义文字设置 |
| | | */ |
| | | public function words() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['words'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 申请协议设置 |
| | | */ |
| | | public function license() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['license'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 页面背景设置 |
| | | */ |
| | | public function background() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['background'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $model = new bonusSettingModel; |
| | | if ($model->edit($data)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分销海报 |
| | | */ |
| | | public function qrcode() |
| | | { |
| | | if (!$this->request->post()) { |
| | | $data = bonusSettingModel::getItem('qrcode'); |
| | | return $this->renderSuccess('', ['data' => $data]); |
| | | } |
| | | $model = new bonusSettingModel; |
| | | if ($model->edit(['qrcode' => $this->postData('form')])) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\bonus; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\bonus\User as UserModel; |
| | | use app\shop\model\plus\bonus\Setting as SettingModel; |
| | | use app\shop\model\plus\bonus\Referee as RefereeModel; |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | /** |
| | | * 队长列表 |
| | | */ |
| | | public function index($keyword = '', $search_type = 'user_id') |
| | | { |
| | | $model = new UserModel; |
| | | $list = $model->getList($keyword, $search_type, $this->postData()); |
| | | |
| | | foreach ($list as $key => $val) { |
| | | $list[$key]['cash_total'] = sprintf('%.2f', $val['moeny'] + $val['freeze_money'] + $val['total_money']); |
| | | } |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | $total_money_wait = (new UserModel)->getTotalMoney('money'); |
| | | $total_money_freeze = (new UserModel)->getTotalMoney('freeze_money_second'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting', 'total_money_wait', 'total_money_freeze')); |
| | | } |
| | | |
| | | /** |
| | | * 编辑队长 |
| | | */ |
| | | public function edit() |
| | | { |
| | | if ($this->request->isGet()) { |
| | | return $this->renderSuccess(''); |
| | | } |
| | | //判断是否更换用户并且是不是分红用户 |
| | | $new_user_id = $this->postData('new_user_id'); |
| | | if($new_user_id) { |
| | | $model = UserModel::detail($new_user_id); |
| | | if($model) { |
| | | return $this->renderError($model->getError() ?: '更换的会员已经是分红用户,请重新选择'); |
| | | } |
| | | } |
| | | $user_id = $this->postData('user_id'); |
| | | $model = UserModel::detail($user_id); |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 队长用户列表 |
| | | */ |
| | | public function fans($user_id, $level = -1) |
| | | { |
| | | $model = new RefereeModel; |
| | | $list = $model->getList($user_id, $level); |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting')); |
| | | } |
| | | |
| | | /** |
| | | * 软删除队长用户 |
| | | */ |
| | | public function delete($user_id) |
| | | { |
| | | $model = UserModel::detail($user_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | public function architecture($keyword = '', $type = 0) |
| | | { |
| | | $model = new UserModel; |
| | | $list = $model->getArchitecture($keyword, $type); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 分红用户导出 |
| | | */ |
| | | public function export($keyword = '', $search_type = 'user_id') |
| | | { |
| | | $model = new UserModel; |
| | | return $model->exportList($keyword, $search_type, $this->postData()); |
| | | } |
| | | |
| | | } |
| | |
| | | $model = new BusinessTemplate(); |
| | | if (request()->isGet()) { |
| | | $data = ["backdrop" => [ |
| | | "src" => $model::$base_url."/image/agent/agent-bg.jpg", |
| | | "src" => $model::$base_url."/image/team/business.png", |
| | | 'type' => 'backdrop' |
| | | ], |
| | | "is_business" => 0, |
| | | "name" => [ |
| | | "fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 232, |
| | | "top" => 13, |
| | | "left" => 170, |
| | | "top" => 70, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text' |
| | | ], |
| | |
| | | "mobile" => [ |
| | | "fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 192, |
| | | "top" => 43, |
| | | "left" => 170, |
| | | "top" => 180, |
| | | "fontWeight" => 400 |
| | | ], |
| | | "address" => [ |
| | | ["fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 133, |
| | | "top" => 206, |
| | | "left" => 170, |
| | | "top" => 380, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text'] |
| | | ], |
| | | "unit" => [ |
| | | ["fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 133, |
| | | "top" => 167, |
| | | "left" => 367, |
| | | "top" => 120, |
| | | "fontWeight" => 100, |
| | | 'type' => 'text'] |
| | | ], |
| | | "duties" => [ |
| | | ["fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 260, |
| | | "top" => 167, |
| | | "left" => 170, |
| | | "top" => 120, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text'] |
| | | ], |
| | |
| | | "wechat" => [ |
| | | "fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 205, |
| | | "top" => 65, |
| | | "left" => 170, |
| | | "top" => 230, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text' |
| | | ], |
| | | "mailbox" => [ |
| | | "fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 205, |
| | | "top" => 104, |
| | | "left" => 170, |
| | | "top" => 330, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text' |
| | | ], |
| | | "phone" => [ |
| | | "fontSize" => 14, |
| | | "color" => "#000000", |
| | | "left" => 205, |
| | | "top" => 84, |
| | | "left" => 170, |
| | | "top" => 280, |
| | | "fontWeight" => 400, |
| | | 'type' => 'text' |
| | | ], |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\Apply as VipApplyModel; |
| | | use app\common\model\plus\vip\User as VipUserModel; |
| | | |
| | | /** |
| | | * VIP专区申请管理 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | /** |
| | | * 申请列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new VipApplyModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 申请审核 |
| | | */ |
| | | public function audit() |
| | | { |
| | | $data = $this->postData(); |
| | | $model = new VipApplyModel; |
| | | $detail = $model::detail($data['id']); |
| | | |
| | | if (!$detail) { |
| | | return $this->renderError('申请记录不存在'); |
| | | } |
| | | |
| | | if ($detail['apply_status'] != 10) { |
| | | return $this->renderError('该申请已处理'); |
| | | } |
| | | |
| | | // 更新审核状态 |
| | | $updateData = [ |
| | | 'apply_status' => $data['apply_status'], |
| | | 'audit_time' => time() |
| | | ]; |
| | | |
| | | if ($data['apply_status'] == 30) { |
| | | // 驳回,需要填写驳回原因 |
| | | if (empty($data['reject_reason'])) { |
| | | return $this->renderError('请填写驳回原因'); |
| | | } |
| | | $updateData['reject_reason'] = $data['reject_reason']; |
| | | } |
| | | |
| | | if ($model->where('id', $data['id'])->update($updateData)) { |
| | | return $this->renderSuccess('审核成功'); |
| | | } |
| | | return $this->renderError('审核失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\Cash as VipCashModel; |
| | | use app\common\model\plus\vip\User as VipUserModel; |
| | | |
| | | /** |
| | | * VIP专区提现管理 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | /** |
| | | * 提现列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new VipCashModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function audit() |
| | | { |
| | | $id = $this->request->param('id'); |
| | | $model = VipCashModel::detail($id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | /** |
| | | * 确认打款 |
| | | */ |
| | | public function money($id) |
| | | { |
| | | $model = VipCashModel::detail($id); |
| | | |
| | | if ($model->money()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\Grade as VipGradeModel; |
| | | use app\common\model\plus\vip\GradeLog as GradeLogModel; |
| | | /** |
| | | * VIP专区等级管理 |
| | | */ |
| | | class Grade extends Controller |
| | | { |
| | | /** |
| | | * 等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new VipGradeModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new VipGradeModel; |
| | | $data = $this->postData(); |
| | | |
| | | if ($model->add($data)) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑等级 |
| | | */ |
| | | public function edit($grade_id) |
| | | { |
| | | $model = new VipGradeModel; |
| | | $detail = $model::detail($grade_id); |
| | | |
| | | if (!$detail) { |
| | | return $this->renderError('等级不存在'); |
| | | } |
| | | |
| | | if ($this->request->isPost()) { |
| | | $data = $this->postData(); |
| | | |
| | | if ($detail->edit($data)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError('更新失败'); |
| | | } |
| | | |
| | | return $this->renderSuccess('', compact('detail')); |
| | | } |
| | | |
| | | /** |
| | | * 删除等级 |
| | | */ |
| | | public function delete($grade_id) |
| | | { |
| | | $model = new VipGradeModel; |
| | | |
| | | // 不能删除默认等级 |
| | | $detail = $model::detail($grade_id); |
| | | if ($detail['is_default']) { |
| | | return $this->renderError('不能删除默认等级'); |
| | | } |
| | | |
| | | if ($model->where('grade_id', $grade_id)->update(['is_delete' => 1])) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | |
| | | public function log() |
| | | { |
| | | $model = new GradeLogModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\Order as VipOrderModel; |
| | | |
| | | /** |
| | | * VIP专区订单管理 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | /** |
| | | * VIP专区订单列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new VipOrderModel; |
| | | $list = $model->getList($this->postData()); |
| | | event('VipOrder'); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\Setting as VipSettingModel; |
| | | |
| | | /** |
| | | * VIP专区设置控制器 |
| | | */ |
| | | class Setting extends Controller |
| | | { |
| | | public $pay_type = [ |
| | | ['id' => '10', 'name' => '微信支付'], |
| | | ['id' => '20', 'name' => '支付宝'], |
| | | ['id' => '30', 'name' => '银行卡'] |
| | | ]; |
| | | |
| | | /** |
| | | * VIP专区设置 |
| | | */ |
| | | public function index() |
| | | { |
| | | $pay_type = $this->pay_type; |
| | | $data = VipSettingModel::getAll(); |
| | | return $this->renderSuccess('', compact('data', 'pay_type')); |
| | | } |
| | | |
| | | /** |
| | | * 基础信息设置 |
| | | */ |
| | | public function basic() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['basic'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 结算设置 |
| | | */ |
| | | public function settlement() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['settlement'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 文字设置 |
| | | */ |
| | | public function words() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['words'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 背景图设置 |
| | | */ |
| | | public function background() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['background'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $model = new VipSettingModel; |
| | | if ($model->edit($data)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\plus\vip; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\plus\vip\User as VipUserModel; |
| | | |
| | | /** |
| | | * VIP专区用户管理 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | /** |
| | | * VIP专区用户列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new VipUserModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 删除VIP用户 |
| | | */ |
| | | public function delete($user_id) |
| | | { |
| | | $model = new VipUserModel; |
| | | if ($model->where('user_id', $user_id)->update(['is_delete' => 1])) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | public function edit($user_id) |
| | | { |
| | | $model = new VipUserModel; |
| | | $data = $model->where('user_id', $user_id)->find(); |
| | | if ($this->request->get()){ |
| | | return $this->renderSuccess('', compact('data')); |
| | | } |
| | | $param = $this->postData(); |
| | | if ($data->save($param)){ |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError('更新失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\supplier; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\supplier\Access as AccessModel; |
| | | |
| | | /** |
| | | * 供应商权限管理 |
| | | */ |
| | | class Access extends Controller |
| | | { |
| | | /** |
| | | * 权限列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new AccessModel; |
| | | $list = $model->getList(); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\supplier\member; |
| | | |
| | | use app\common\service\supplier\MemberService; |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\supplier\Order as MemberOrderModel; |
| | | |
| | | /** |
| | | * 供应商年卡订单管理 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | /** |
| | | * 年卡订单列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new MemberOrderModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 激活年卡 |
| | | */ |
| | | public function activate() |
| | | { |
| | | $orderId = $this->request->post('order_id'); |
| | | |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->activateMember($orderId); |
| | | |
| | | if (!$result) { |
| | | return $this->renderError('激活年卡失败'); |
| | | } |
| | | |
| | | return $this->renderSuccess('年卡激活成功'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\controller\supplier\member; |
| | | |
| | | use app\shop\controller\Controller; |
| | | use app\shop\model\supplier\Access as AccessModel; |
| | | use app\shop\model\supplier\Plan as MemberPlanModel; |
| | | |
| | | /** |
| | | * 供应商年卡套餐管理 |
| | | */ |
| | | class Plan extends Controller |
| | | { |
| | | /** |
| | | * 年卡套餐列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new MemberPlanModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加年卡套餐 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new MemberPlanModel; |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑年卡套餐 |
| | | */ |
| | | public function edit($plan_id) |
| | | { |
| | | $model = MemberPlanModel::detail($plan_id); |
| | | $select_menu = array_column($model->toArray()['plan_access'], 'access_id'); |
| | | if (request()->isGet()) { |
| | | $accessModel = new AccessModel; |
| | | $list = $accessModel->getList(); |
| | | return $this->renderSuccess('', compact('model', 'select_menu', 'list')); |
| | | } |
| | | if (!$model) { |
| | | return $this->renderError('套餐不存在'); |
| | | } |
| | | |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('编辑成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '编辑失败'); |
| | | } |
| | | |
| | | /** |
| | | * 删除年卡套餐 |
| | | */ |
| | | public function delete($plan_id) |
| | | { |
| | | $model = MemberPlanModel::detail($plan_id); |
| | | if (!$model) { |
| | | return $this->renderError('套餐不存在'); |
| | | } |
| | | |
| | | if ($model->setDelete()) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '删除失败'); |
| | | } |
| | | } |
| | |
| | | public function edit($grade_id) |
| | | { |
| | | $model = GradeModel::detail($grade_id); |
| | | if (request()->isGet()) { |
| | | return $this->renderSuccess('', compact('model')); |
| | | } |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | |
| | | use app\shop\model\user\User as UserModel; |
| | | use app\shop\model\user\Grade; |
| | | use app\shop\service\order\ExportService; |
| | | |
| | | use app\common\model\plus\bonus\User as BonusUserModel; |
| | | /** |
| | | * 用户管理 |
| | | */ |
| | |
| | | $list = UserModel::getList($nickName, $grade_id, $reg_date, $gender = -1, $this->postData()); |
| | | $GradeModel = new Grade(); |
| | | $grade = $GradeModel->getLists(); |
| | | //(new BonusUserModel())->addTheFirst4(); |
| | | // 所有标签 |
| | | $allTag = TagModel::getAll(); |
| | | return $this->renderSuccess('', compact('list', 'grade', 'allTag')); |
| | |
| | | // 修改登录用户 |
| | | $user_model = $this['superUser']; |
| | | $user_data = [ |
| | | // 'user_id' => $branch['user_id'], |
| | | 'user_id' => $branch['user_id'], |
| | | 'user_name' => $branch['user_name'] |
| | | ]; |
| | | if (isset($branch['password']) && !empty($branch['password'])) { |
| | |
| | | } |
| | | $remark .= "直推分销商满{$data['agent_user']}"; |
| | | } |
| | | if($data['is_purchase_count'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "购买VIP专区商品次数满{$data['purchase_count']}次"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\api\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\plus\bonus\Apply as ApplyModel; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\model\plus\bonus\Grade as GradeModel; |
| | | |
| | | /** |
| | | * 队长入驻申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 获取队长申请列表 |
| | | * @noinspection PhpUndefinedMethodInspection |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->alias('apply') |
| | | ->field('apply.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee']) |
| | | ->join('user', 'user.user_id = apply.user_id') |
| | | ->order(['apply.create_time' => 'desc']); |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName|apply.real_name|apply.mobile', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | // 获取列表数据 |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | |
| | | /** |
| | | * 队长入驻审核 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function submit($data) |
| | | { |
| | | if ($data['apply_status'] == '30' && empty($data['reject_reason'])) { |
| | | $this->error = '请填写驳回原因'; |
| | | return false; |
| | | } |
| | | $this->startTrans(); |
| | | if ($data['apply_status'] == '20') { |
| | | $grade_id=GradeModel::getDefaultGradeId(); |
| | | // 新增队长用户 |
| | | User::add($data['user_id'], [ |
| | | 'real_name' => $data['real_name'], |
| | | 'mobile' => $data['mobile'], |
| | | 'referee_id' => $data['referee_id'], |
| | | 'grade_id'=>$grade_id |
| | | ]); |
| | | } |
| | | $save_data = [ |
| | | 'audit_time' => time(), |
| | | 'apply_status' => $data['apply_status'], |
| | | 'reject_reason' => $data['reject_reason'], |
| | | ]; |
| | | $this->save($save_data); |
| | | // 记录推荐人关系 |
| | | if ($data['referee_id'] > 0) { |
| | | RefereeModel::createRelation($data['user_id'], $data['referee_id']); |
| | | } |
| | | // 发送模板消息 |
| | | (new MessageService)->team($this); |
| | | $this->commit(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请中的数量 |
| | | */ |
| | | public static function getApplyCount(){ |
| | | return (new static())->where('apply_status', '=', 10)->count(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Capital as CapitalModel; |
| | | |
| | | /** |
| | | * 队长资金明细模型 |
| | | */ |
| | | class Capital extends CapitalModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\library\easywechat\AppWx; |
| | | use app\common\library\easywechat\AppMp; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\service\order\OrderService; |
| | | use app\common\library\easywechat\WxPay; |
| | | use app\common\model\plus\bonus\Cash as CashModel; |
| | | use app\shop\model\user\User as UserModel; |
| | | use app\shop\service\order\ExportService; |
| | | /** |
| | | * 队长提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取器:申请时间 |
| | | */ |
| | | public function getAuditTimeAttr($value) |
| | | { |
| | | return $value > 0 ? date('Y-m-d H:i:s', $value) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取器:打款方式 |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | return ['text' => $this->payType[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 获取队长提现列表 |
| | | */ |
| | | public function getList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '', $params = []) |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, bonus.real_name, bonus.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('bonus_user bonus', 'bonus.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($search)) { |
| | | if ($params['search_type'] == 'user_id') { |
| | | $model = $model->where('cash.user_id', '=', $search); |
| | | } else if ($params['search_type'] == 'nickName') { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search . '%'); |
| | | } else { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | //搜索时间段 |
| | | if (isset($params['create_time']) && $params['create_time'] != '') { |
| | | $model = $model->where('cash.create_time', 'between', [strtotime($params['create_time'][0]), strtotime($params['create_time'][1]) + 86399]); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->paginate($params); |
| | | } |
| | | |
| | | /** |
| | | * 队长提现审核 |
| | | */ |
| | | public function submit($param) |
| | | { |
| | | $data = ['apply_status' => $param['apply_status']]; |
| | | if ($param['apply_status'] == 30) { |
| | | $data['reject_reason'] = $param['reject_reason']; |
| | | } |
| | | // 更新申请记录 |
| | | $data['audit_time'] = time(); |
| | | self::update($data, ['id' => $param['id']]); |
| | | // 提现驳回:解冻队长资金 |
| | | if ($param['apply_status'] == 30) { |
| | | User::backFreezeMoney($param['user_id'], $param['money']); |
| | | } |
| | | |
| | | // 发送模板消息 |
| | | (new MessageService)->cash($this); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 确认已打款 |
| | | */ |
| | | public function money() |
| | | { |
| | | // 如果是完税系统打款 by lyzflash |
| | | if ($this['is_yms']) { |
| | | return $this->ymsMoney(); |
| | | } |
| | | $this->startTrans(); |
| | | try { |
| | | // 更新申请状态 |
| | | $data = ['apply_status' => 40, 'audit_time' => time()]; |
| | | self::update($data, ['id' => $this['id']]); |
| | | |
| | | // 如果是打款到余额 |
| | | if ($this['pay_type']['value'] == 40) { |
| | | UserModel::cashToBalance($this['user_id'], $this['money'], '分红提现到余额-cash_id:' . $this['id']); |
| | | } |
| | | |
| | | // 更新队长累积提现佣金 |
| | | User::totalMoney($this['user_id'], $this['money']); |
| | | |
| | | // 记录队长资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $this['user_id'], |
| | | 'flow_type' => 20, |
| | | 'money' => -$this['money'], |
| | | 'describe' => '申请提现', |
| | | ]); |
| | | // 发送模板消息 |
| | | //(new Message)->withdraw($this); |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 完税系统打款 by lyzflash |
| | | */ |
| | | public function ymsMoney() |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | $result = (new YmsModel($this['app_id']))->batchPay([$this]); |
| | | if ($result && $result['code'] != '0') { |
| | | $this->error = $result['msg']; |
| | | return false; |
| | | } |
| | | $resData = $result['data']; |
| | | // 统一记录付款信息 |
| | | $ymsData = []; |
| | | $errorArr = []; |
| | | foreach ($resData['payItemList'] as $item) { |
| | | if ($item['status'] == '0') { |
| | | (new CashModel)->where('cash_no', '=', $item['merchantOrderId'])->save([ |
| | | 'merBatchId' => $resData['merchantBatchId'], // 商户批次号 |
| | | 'payItemId' => $item['orderNo'], // 订单流水号 |
| | | 'apply_status' => 50, // 付款中 |
| | | ]); |
| | | $ymsData[] = [ |
| | | 'user_id' => $this['user_id'], |
| | | 'merOrderId' => $item['merchantOrderId'], // 商户订单号(cash_no) |
| | | 'payItemId' => $item['orderNo'], // 完税系统返回的订单流水号 |
| | | 'merBatchId' => $resData['merchantBatchId'], // 商户批次号 |
| | | 'orderBatchNo' => $resData['orderBatchNo'], // 订单批次号 |
| | | 'cash_type' => CashTypeEnum::BONUS, // 提现来源标识 |
| | | 'money' => $item['amt'] / 100, |
| | | 'app_id' => $this['app_id'], |
| | | ]; |
| | | } else { |
| | | $this->error = $item['errorMsg']; |
| | | return false; |
| | | } |
| | | } |
| | | if ($ymsData) { |
| | | (new YmsSettlementModel)->saveAll($ymsData); |
| | | } |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 队长提现:微信支付企业付款 |
| | | */ |
| | | public function wechatPay() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '队长提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app = []; |
| | | if($user['reg_source'] == 'mp'){ |
| | | $app = AppMp::getWxPayApp($user['app_id']); |
| | | $open_id = $user['mpopen_id']; |
| | | }else if($user['reg_source'] == 'wx'){ |
| | | $app = AppWx::getWxPayApp($user['app_id']); |
| | | $open_id = $user['open_id']; |
| | | } |
| | | |
| | | if($open_id == ''){ |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $WxPay = new WxPay($app); |
| | | //打款金额 |
| | | $money = floatval($this['money']) - floatval($this['fee_money']); |
| | | // 请求付款api |
| | | if ($WxPay->transfers($orderNO, $open_id, $money, $desc)) { |
| | | // 确认已打款 |
| | | $this->money(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /* |
| | | *统计提现总数量 |
| | | */ |
| | | public function getteamOrderTotal() |
| | | { |
| | | return $this->count('id'); |
| | | } |
| | | |
| | | /* |
| | | * 统计提现待审核总数量 |
| | | */ |
| | | public function getteamApplyTotal($apply_status) |
| | | { |
| | | return $this->where('apply_status', '=', $apply_status)->count(); |
| | | } |
| | | |
| | | /* |
| | | * 统计提现待审核金额 |
| | | */ |
| | | public function getteamApplyMoney() |
| | | { |
| | | return $this->where('apply_status', '=', 10)->sum('real_money'); |
| | | } |
| | | |
| | | /* |
| | | *获取提现待打款总数量 by lyzflash 2023.02.08 |
| | | */ |
| | | public function getCashPayNum() |
| | | { |
| | | return $this->where('apply_status', '=', 20)->count(); |
| | | } |
| | | |
| | | /* |
| | | *统计待打款的金额 by lyzflash 2023.02.08 |
| | | */ |
| | | public function getCashPayMoney() |
| | | { |
| | | return $this->where('apply_status', '=', 20)->sum('real_money'); |
| | | } |
| | | |
| | | /** |
| | | * 导出分红提现 |
| | | */ |
| | | public function exportList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '', $params = []) |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, agent.real_name, agent.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('agent_user agent', 'agent.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($search)) { |
| | | if ($params['search_type'] == 'user_id') { |
| | | $model = $model->where('cash.user_id', '=', $search); |
| | | } else if ($params['search_type'] == 'nickName') { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search . '%'); |
| | | } else { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | //搜索时间段 |
| | | if (isset($params['create_time']) && $params['create_time'] != '') { |
| | | $model = $model->where('cash.create_time', 'between', [strtotime($params['create_time'][0]), strtotime($params['create_time'][1]) + 86399]); |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | // 导出excel文件 |
| | | (new Exportservice)->bonusCashList($list); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Grade as GradeModel; |
| | | use app\shop\model\plus\bonus\User as UserModel; |
| | | |
| | | /** |
| | | * 用户会员等级模型 |
| | | */ |
| | | class Grade extends GradeModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | /** |
| | | * 获取可用的分红等级列表 |
| | | */ |
| | | public static function getUsableList($appId = null) |
| | | { |
| | | $model = new static; |
| | | $appId = $appId ? $appId : $model::$app_id; |
| | | return $model->where('is_delete', '=', '0') |
| | | ->where('app_id', '=', $appId) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['is_default'] = 0; |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | if($this['is_default'] == 0){ |
| | | |
| | | $data['remark'] = $this->setRemark($data); |
| | | } |
| | | return $this->save($data); |
| | | } |
| | | |
| | | private function setRemark($data){ |
| | | $remark = ''; |
| | | if($data['open_money'] == 1){ |
| | | $money = sprintf('%.2f',$data['upgrade_money']); |
| | | $remark .= "会员消费满{$money}元可升级到此等级"; |
| | | } |
| | | if($data['open_points'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员积分满{$data['upgrade_points']}可升级到此等级"; |
| | | } |
| | | if($data['open_invite'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员邀请人数满{$data['upgrade_invite']}可升级到此等级"; |
| | | } |
| | | if($data['open_agent1'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员直推分销商人数满{$data['upgrade_agent1']}可升级到此等级"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | // 判断该等级下是否存在会员 |
| | | if (UserModel::checkExistByGradeId($this['grade_id'])) { |
| | | return false; |
| | | } |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\GradeLog as GradeLogModel; |
| | | |
| | | /** |
| | | * 用户会员等级变更记录模型 |
| | | */ |
| | | class GradeLog extends GradeLogModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\service\order\OrderService; |
| | | /** |
| | | * 队长订单模型 |
| | | */ |
| | | class Order extends OrderModel |
| | | { |
| | | /** |
| | | * 获取队长订单列表 |
| | | */ |
| | | public function getList($user_id = null, $is_settled = -1) |
| | | { |
| | | $model = $this; |
| | | // 检索查询条件 |
| | | if ($user_id > 1) { |
| | | $model = $model->where('first_user_id|second_user_id', '=', $user_id); |
| | | } |
| | | if ($is_settled > -1) { |
| | | $model = $model->where('is_settled', '=', $is_settled); |
| | | } |
| | | // 获取队长订单列表 |
| | | $data = $model->with([ |
| | | 'bonus_first', |
| | | 'bonus_second', |
| | | 'subsidy' |
| | | ]) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate(15); |
| | | if ($data->isEmpty()) { |
| | | return $data; |
| | | } |
| | | // 获取订单的主信息 |
| | | $with = ['product' => ['image', 'refund'], 'address', 'user']; |
| | | return OrderService::getOrderList($data, 'order_master', $with); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Referee as RefereeModel; |
| | | |
| | | /** |
| | | * 队长用户模型 |
| | | */ |
| | | class Referee extends RefereeModel |
| | | { |
| | | /** |
| | | * 获取下级团队成员ID集 |
| | | */ |
| | | public function getBonusUserIds($teamId, $level = -1) |
| | | { |
| | | $level > -1 && $this->where('m.level', '=', $level); |
| | | return $this->alias('m') |
| | | ->join('user', 'user.user_id = m.user_id') |
| | | ->where('m.bonus_id', '=', $teamId) |
| | | ->where('user.is_delete', '=', 0) |
| | | ->column('m.user_id'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定用户的推荐人列表 |
| | | */ |
| | | public static function getRefereeList($userId) |
| | | { |
| | | return (new static)->with(['team1'])->where('user_id', '=', $userId)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 清空下级成员推荐关系 |
| | | */ |
| | | public function onClearBonus($bonus_id, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1){ |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('bonus_id', '=', $bonus_id)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空上级推荐关系 |
| | | */ |
| | | public function onClearReferee($userId, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1) { |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('user_id', '=', $userId)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空2-3级推荐人的关系记录 |
| | | */ |
| | | public function onClearTop($teamIds) |
| | | { |
| | | return $this->where('user_id', 'in', $teamIds) |
| | | ->where('level', 'in', [2, 3]) |
| | | ->delete(); |
| | | } |
| | | |
| | | public static function updateReferee($user_id, $new_user_id) |
| | | { |
| | | (new static)->where('user_id', '=', $user_id) |
| | | ->save(['user_id' => $new_user_id]); |
| | | (new static)->where('bonus_id', '=', $user_id) |
| | | ->save(['bonus_id' => $new_user_id]); |
| | | return true; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use think\facade\Cache; |
| | | use app\common\model\plus\bonus\Setting as SettingModel; |
| | | |
| | | /** |
| | | * 队长设置模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | /** |
| | | * 设置项描述 |
| | | * @var array |
| | | */ |
| | | private $describe = [ |
| | | 'basic' => '基础设置', |
| | | 'condition' => '加入条件', |
| | | 'commission' => '分红设置', |
| | | 'settlement' => '结算', |
| | | 'words' => '自定义文字', |
| | | 'license' => '申请协议', |
| | | 'background' => '页面背景图', |
| | | 'template_msg' => '模板消息', |
| | | 'qrcode' => '分红海报', |
| | | ]; |
| | | |
| | | /** |
| | | * 更新系统设置 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | foreach ($data as $key => $values) |
| | | $this->saveValues($key, $values); |
| | | $this->commit(); |
| | | // 删除系统设置缓存 |
| | | Cache::delete('bonus_setting_' . self::$app_id); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存设置项 |
| | | */ |
| | | private function saveValues($key, $values) |
| | | { |
| | | |
| | | $where['key'] = $key; |
| | | $res = $this->where($where)->select()->count(); |
| | | $data = [ |
| | | 'describe' => $this->describe[$key], |
| | | 'values' => $values, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($res == 1) { |
| | | return self::update($data, $where); |
| | | } |
| | | if ($res == 0) { |
| | | $data['key'] = $key; |
| | | return self::create($data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证结算方式 |
| | | */ |
| | | private function validSettlement($values) |
| | | { |
| | | if (!isset($values['pay_type']) || empty($values['pay_type'])) { |
| | | $this->error = '请设置 结算-提现方式'; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\bonus; |
| | | |
| | | use app\shop\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | use app\common\model\user\User as UserModel1; |
| | | use app\common\model\plus\agent\User as agentUser; |
| | | use app\common\model\plus\agent\Referee as agentReferee; |
| | | use app\common\library\helper; |
| | | use app\shop\service\order\ExportService; |
| | | |
| | | /** |
| | | * 队长用户模型 |
| | | * Class User |
| | | * @package app\shop\model\plus\bonus |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取队长用户列表 |
| | | */ |
| | | public function getList($keyword, $search_type = 'user_id', $params = []) |
| | | { |
| | | // 构建查询规则 |
| | | $model = $this->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent','agentuser']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['bonus.tree_level' => 'asc', 'level_num' => 'asc', 'agent_time' => '']); |
| | | // 查询条件 |
| | | if (!empty($keyword)) { |
| | | if ($search_type == 'user_id') { |
| | | $model = $model->where('bonus.user_id', '=', $keyword); |
| | | } else { |
| | | if ($search_type == 'nickName') { |
| | | $search_field = 'user.' . $search_type; |
| | | } else { |
| | | $search_field = 'bonus.' . $search_type; |
| | | } |
| | | $model = $model->where($search_field, 'like', '%' . $keyword . '%'); |
| | | } |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->paginate($params); |
| | | $setting = Setting::getItem('basic'); |
| | | $userData = []; |
| | | foreach ($list as &$user){ |
| | | $user['total_money'] = sprintf('%.2f', $user['money'] + $user['freeze_money'] + $user['total_money']); |
| | | // 排位有效期 |
| | | $user['remain_time'] = UserModel::getExpireTime($user['user_id']); |
| | | // $user['is_expire'] = UserModel::isExpire($user['user_id']); |
| | | |
| | | // 初始化最新推荐人推荐时间 |
| | | // $agentuser = $user['agentuser']->toArray(); |
| | | // if($agentuser) { |
| | | // $agent_time = strtotime($agentuser[0]['create_time']); |
| | | // } else { |
| | | // $agent_time = strtotime($user['create_time']); |
| | | // } |
| | | // $userData[] = [ |
| | | // 'user_id' => $user['user_id'], |
| | | // 'agent_time' => $agent_time |
| | | // ]; |
| | | } |
| | | unset($user); |
| | | // $this->saveAll($userData); |
| | | return $list; |
| | | } |
| | | /** |
| | | * 编辑队长用户 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | //如果更换用户 |
| | | $new_user_id = $data['new_user_id']; |
| | | unset($data['new_user_id']); |
| | | if($new_user_id) { |
| | | $new_data = $data; |
| | | $new_user = UserModel1::detail($new_user_id); |
| | | $new_data['user_id'] = $new_user_id; |
| | | $new_data['referee_id'] = $new_user['referee_id']; |
| | | $setting = Setting::getItem('basic', $new_user['app_id']); |
| | | // 如果不保留资产 by lyzflash |
| | | if ($setting['keep_assets'] == 0) { |
| | | $new_data['money'] = 0; |
| | | $new_data['freeze_money'] = 0; |
| | | $new_data['freeze_money_second'] = 0; |
| | | $new_data['total_money'] = 0; |
| | | } |
| | | if ($this->where(['user_id' => $data['user_id']])->save($new_data)) { |
| | | //将原用户下级改为新用户下级 |
| | | $this->updateParentId($data['user_id'], $new_user_id); |
| | | //更新关系表 |
| | | RefereeModel::updateReferee($data['user_id'], $new_user_id); |
| | | //同时成为分销商 |
| | | $config = Setting::getItem('basic', $new_user['app_id']); |
| | | if ($config['become_agent']) { |
| | | agentUser::add($new_user_id, [ |
| | | 'referee_id' => agentReferee::getRefereeUserId($new_user_id, 1), |
| | | 'app_id' => $new_user['app_id'], |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return $this->save($data) !== false; |
| | | } |
| | | |
| | | /** |
| | | * 删除队长用户 |
| | | * @return mixed |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | return $this->transaction(function () { |
| | | // 获取一级团队成员ID集 |
| | | $RefereeModel = new RefereeModel; |
| | | $bonus1Ids = $RefereeModel->getBonusUserIds($this['user_id'], 1); |
| | | if (!empty($bonus1Ids)) { |
| | | // 一级团队成员归属到平台 |
| | | $this->setFromplatform($bonus1Ids); |
| | | // 一级推荐人ID |
| | | $referee1Id = RefereeModel::getRefereeUserId($this['user_id'], 1, true); |
| | | if ($referee1Id > 0) { |
| | | // 一级推荐人的成员数量(二级) |
| | | $this->setDecBonusNum($referee1Id, 2, count($bonus1Ids)); |
| | | // 一级推荐人的成员数量(三级) |
| | | $bonus2Ids = $RefereeModel->getBonusUserIds($this['user_id'], 2); |
| | | !empty($bonus2Ids) && $this->setDecBonusNum($referee1Id, 3, count($bonus2Ids)); |
| | | // 二级推荐人的成员数量(三级) |
| | | $referee2Id = RefereeModel::getRefereeUserId($this['user_id'], 2, true); |
| | | $referee2Id > 0 && $this->setDecBonusNum($referee2Id, 3, count($bonus1Ids)); |
| | | // 清空队长下级成员与上级推荐人的关系记录 |
| | | $RefereeModel->onClearTop(array_merge($bonus1Ids, $bonus2Ids)); |
| | | } |
| | | } |
| | | // 清空下级推荐记录 |
| | | $RefereeModel->onClearBonus($this['user_id']); |
| | | // 标记当前队长记录为已删除 |
| | | return $this->save([ |
| | | 'is_delete' => 1 |
| | | ]); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 更改用户的parent_id |
| | | * @param $user_id |
| | | * @param $new_user_id |
| | | * @return false|int |
| | | */ |
| | | private function updateParentId($user_id, $new_user_id) |
| | | { |
| | | return $this->where('parent_id', '=', $user_id) |
| | | ->save(['parent_id' => $new_user_id]); |
| | | } |
| | | |
| | | /** |
| | | * 一级团队成员归属到平台 |
| | | * @param $userIds |
| | | * @return false|int |
| | | */ |
| | | private function setFromplatform($userIds) |
| | | { |
| | | return $this->where('user_id', 'in', $userIds) |
| | | ->where('is_delete', '=', 0) |
| | | ->save(['referee_id' => 0]); |
| | | } |
| | | |
| | | /** |
| | | * 递减队长成员数量 |
| | | */ |
| | | private function setDecBonusNum($bonus_id, $level, $number) |
| | | { |
| | | $field = [1 => 'first_num', 2 => 'second_num', 3 => 'third_num']; |
| | | return $this->where('user_id', '=', $bonus_id) |
| | | ->where('is_delete', '=', 0) |
| | | ->dec($field[$level], $number); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户的上级推荐关系 |
| | | * @param $userId |
| | | * @return bool |
| | | * @throws \think\Exception |
| | | */ |
| | | public function onDeleteReferee($userId) |
| | | { |
| | | // 获取推荐人列表 |
| | | $list = RefereeModel::getRefereeList($userId); |
| | | if (!$list->isEmpty()) { |
| | | // 递减推荐人的下级成员数量 |
| | | foreach ($list as $item) { |
| | | $item['bonus1'] && $this->setDecBonusNum($item['bonus_id'], $item['level'], 1); |
| | | } |
| | | // 清空上级推荐关系 |
| | | (new RefereeModel)->onClearReferee($userId); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取平台的总销售额 |
| | | */ |
| | | public function getTotalMoney($type = 'all_money') |
| | | { |
| | | $model = $this; |
| | | if($type == 'money'){ |
| | | return $model->sum('money'); |
| | | } else if($type == 'freeze_money'){ |
| | | return $model->sum('freeze_money'); |
| | | } else if($type == 'freeze_money_second'){ |
| | | return $model->sum('freeze_money_second'); |
| | | } else if($type == 'total_money'){ |
| | | return $model->sum('total_money'); |
| | | } else if($type == 'all_money'){ |
| | | return $model->sum('total_money') + $model->sum('freeze_money') + $model->sum('money'); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public function getArchitecture($search = '', $type = 0) |
| | | { |
| | | $model = new UserModel(); |
| | | $model = $model->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0); |
| | | if (!empty($search)) { |
| | | if ($type) { |
| | | if (intval($search)) { |
| | | $model = $model->where('bonus.user_id', '=', $search); |
| | | } else { |
| | | $model = $model->where('user.nickName|bonus.real_name|bonus.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } else { |
| | | $model = $model->where('bonus.user_id', '=', $search); |
| | | } |
| | | } else { |
| | | $model = $model->where('bonus.tree_level', '=', 1); |
| | | } |
| | | $firstUser = $model->find(); |
| | | if (!$firstUser) { |
| | | return false; |
| | | } |
| | | $secondUser = $this->getArchitectureSubUser($firstUser); |
| | | $thirdUser = []; |
| | | foreach ($secondUser as &$user) { |
| | | $thirdUser = array_merge($thirdUser, $this->getArchitectureSubUser($user)); |
| | | } |
| | | unset($user); |
| | | return ['firstUser' => $firstUser, 'secondUser' => $secondUser, 'thirdUser' => $thirdUser]; |
| | | } |
| | | |
| | | private function getArchitectureSubUser($user) |
| | | { |
| | | if ($user) { |
| | | $model = new UserModel(); |
| | | $subUser = $model->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('parent_id', '=', $user['user_id']) |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['level_num' => 'asc']) |
| | | ->select()->toArray(); |
| | | } else { |
| | | $subUser = []; |
| | | } |
| | | // 补全3个位置 |
| | | if (count($subUser) < 3) { |
| | | $emptyArr = []; |
| | | for ($i = 0; $i < 3 - count($subUser); $i++) { |
| | | $emptyArr[] = []; |
| | | } |
| | | $subUser = array_merge($subUser, $emptyArr); |
| | | } |
| | | return $subUser; |
| | | } |
| | | |
| | | /** |
| | | * 获取队长用户列表 |
| | | */ |
| | | public function exportList($keyword, $search_type = 'user_id', $params = []) |
| | | { |
| | | // 构建查询规则 |
| | | $model = $this->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent','agentuser']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['bonus.tree_level' => 'asc', 'level_num' => 'asc', 'agent_time' => '']); |
| | | // 查询条件 |
| | | if (!empty($keyword)) { |
| | | if ($search_type == 'user_id') { |
| | | $model = $model->where('bonus.user_id', '=', $keyword); |
| | | } else { |
| | | if ($search_type == 'nickName') { |
| | | $search_field = 'user.' . $search_type; |
| | | } else { |
| | | $search_field = 'bonus.' . $search_type; |
| | | } |
| | | $model = $model->where($search_field, 'like', '%' . $keyword . '%'); |
| | | } |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | foreach ($list as &$user){ |
| | | $user['total_money'] = sprintf('%.2f', $user['money'] + $user['freeze_money'] + $user['total_money']); |
| | | // 排位有效期 |
| | | $user['remain_time'] = UserModel::getExpireTime($user['user_id']); |
| | | } |
| | | unset($user); |
| | | // 导出excel文件 |
| | | (new Exportservice)->bonusUserList($list); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Apply as ApplyModel; |
| | | |
| | | /** |
| | | * VIP专区申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->with(['user', 'vipUser']) |
| | | ->order(['create_time' => 'desc']); |
| | | |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | if (isset($search['apply_status']) && $search['apply_status'] > -1) { |
| | | $model = $model->where('apply_status', '=', $search['apply_status']); |
| | | } |
| | | |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Capital; |
| | | use app\common\model\plus\vip\Cash as CashModel; |
| | | use app\common\service\message\MessageService; |
| | | |
| | | /** |
| | | * VIP专区提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->with(['user']) |
| | | ->order(['create_time' => 'desc']); |
| | | |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | if (isset($search['apply_status']) && $search['apply_status'] > -1) { |
| | | $model = $model->where('apply_status', '=', $search['apply_status']); |
| | | } |
| | | |
| | | return $model->paginate($search); |
| | | } |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function submit($param) |
| | | { |
| | | $data = ['apply_status' => $param['apply_status']]; |
| | | if ($param['apply_status'] == 30) { |
| | | $data['reject_reason'] = $param['reject_reason']; |
| | | } |
| | | // 更新申请记录 |
| | | $data['audit_time'] = time(); |
| | | self::update($data, ['id' => $param['id']]); |
| | | // 提现驳回:解冻分销商资金 |
| | | if ($param['apply_status'] == 30) { |
| | | User::backFreezeMoney($param['user_id'], $param['money']); |
| | | } |
| | | |
| | | // 发送模板消息 |
| | | (new MessageService)->cash($this); |
| | | return true; |
| | | } |
| | | /** |
| | | * 确认已打款 |
| | | */ |
| | | public function money() |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | // 更新申请状态 |
| | | $data = ['apply_status' => 40, 'audit_time' => time()]; |
| | | self::update($data, ['id' => $this['id']]); |
| | | |
| | | // 更新分销商累积提现佣金 |
| | | User::totalMoney($this['user_id'], $this['money']); |
| | | |
| | | // 记录分销商资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $this['user_id'], |
| | | 'flow_type' => 20, |
| | | 'money' => -$this['money'], |
| | | 'describe' => '申请提现', |
| | | ]); |
| | | // 发送模板消息 |
| | | //(new Message)->withdraw($this); |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Grade as GradeModel; |
| | | use app\shop\model\plus\vip\User as VipUserModel; |
| | | /** |
| | | * VIP专区等级模型 |
| | | */ |
| | | class Grade extends GradeModel |
| | | { |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | |
| | | $list = $this->selectList(); |
| | | // 如果为空,则插入默认等级 |
| | | if(count($list) == 0){ |
| | | $grade_id=Grade::getDefaultGradeId(); |
| | | $where['app_id'] = self::$app_id; |
| | | $where['grade_id'] = 0; |
| | | // 更新之前的默认为0的id为此等级id |
| | | (new VipUserModel())->where($where)->update([ |
| | | 'grade_id' => $grade_id |
| | | ]); |
| | | $list = $this->selectList(); |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | /** |
| | | * 获取等级列表 |
| | | */ |
| | | public function selectList() |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['is_default'] = 0; |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | public function edit( $data) |
| | | { |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | private function setRemark($data) |
| | | { |
| | | $remark = ''; |
| | | if($data['is_purchase_count'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "购买VIP专区商品次数满{$data['purchase_count']}次"; |
| | | } |
| | | return $remark; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Order as OrderModel; |
| | | |
| | | /** |
| | | * VIP专区订单模型 |
| | | */ |
| | | class Order extends OrderModel |
| | | { |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | public function getList($param=[],$user_id = null, $is_settled = -1) |
| | | { |
| | | $model = $this->with(['user', 'vipUser'=>['user'], 'referee','orderMaster'=>['product'=>['image']]]); |
| | | // 筛选用户 |
| | | $user_id > 0 && $model = $model->where('user_id', '=', $user_id); |
| | | // 筛选结算状态 |
| | | $is_settled > -1 && $model = $model->where('is_settled', '=', $is_settled); |
| | | // 获取列表数据 |
| | | return $model->order(['create_time' => 'desc']) |
| | | ->paginate($param); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\Setting as SettingModel; |
| | | |
| | | /** |
| | | * VIP专区设置模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\plus\vip; |
| | | |
| | | use app\common\model\plus\vip\User as UserModel; |
| | | |
| | | /** |
| | | * VIP专区用户模型 |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取VIP用户列表 |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->with(['user', 'referee', 'grade']) |
| | | ->order(['create_time' => 'desc']); |
| | | |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\supplier; |
| | | use app\common\model\supplier\Access as AccessModel; |
| | | /** |
| | | * 供应商权限模型 |
| | | */ |
| | | class Access extends AccessModel |
| | | { |
| | | /** |
| | | * 获取权限列表 |
| | | */ |
| | | public function getList() |
| | | { |
| | | $all = static::getAll(); |
| | | $res = $this->recursiveMenuArray($all, 0); |
| | | return array_values($this->foo($res)); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 递归获取获取分类 |
| | | */ |
| | | public function recursiveMenuArray($data, $pid) |
| | | { |
| | | $re_data = []; |
| | | foreach ($data as $key => $value) { |
| | | if ($value['parent_id'] == $pid) { |
| | | $re_data[$value['access_id']] = $value; |
| | | $re_data[$value['access_id']]['children'] = $this->recursiveMenuArray($data, $value['access_id']); |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | return $re_data; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 格式化递归数组下标 |
| | | */ |
| | | public function foo(&$ar) |
| | | { |
| | | if (!is_array($ar)) return; |
| | | foreach ($ar as $k => &$v) { |
| | | if (is_array($v)) $this->foo($v); |
| | | if ($k == 'children') $v = array_values($v); |
| | | } |
| | | return $ar; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\supplier; |
| | | |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | |
| | | /** |
| | | * 供应商年卡订单模型 |
| | | */ |
| | | class Order extends MemberOrderModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if (!empty($data['order_no'])) { |
| | | $model = $model->where('order_no', '=', $data['order_no']); |
| | | } |
| | | if ($data['pay_status'] >= 0) { |
| | | $model = $model->where('pay_status', '=', $data['pay_status']); |
| | | } |
| | | $list = $model->where('app_id', '=', self::$app_id) |
| | | ->with(['supplier']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($data); |
| | | return $list; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\shop\model\supplier; |
| | | |
| | | use app\common\model\supplier\member\Plan as MemberPlanModel; |
| | | |
| | | /** |
| | | * 供应商年卡套餐模型 |
| | | */ |
| | | class Plan extends MemberPlanModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if (!empty($data['name'])) { |
| | | $model = $model->where('name', 'like', '%' . $data['name'] . '%'); |
| | | } |
| | | if ($data['status'] >= 0) { |
| | | $model = $model->where('status', '=', $data['status']); |
| | | } |
| | | $list = $model->with('plan_access') |
| | | ->where(['is_delete'=>0]) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->paginate($data); |
| | | if (empty($list)) { |
| | | $addDate=[ |
| | | 'name' => '默认套餐', |
| | | 'price' => 0, |
| | | 'sort' => 0, |
| | | 'status' => 1, |
| | | 'is_default' => 1, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | $this->save($addDate); |
| | | $list = $model->with('plan_access') |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $this->transaction(function () use ($data) { |
| | | $this->save($data); |
| | | $this->addPlanAccess($data['access_ids']); |
| | | }); |
| | | return $this; |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $this->transaction(function () use ($data) { |
| | | $this->save($data); |
| | | $this->addPlanAccess($data['access_ids']); |
| | | }); |
| | | return $this; |
| | | } |
| | | private function addPlanAccess($list) |
| | | { |
| | | $this->planAccess()->where('plan_id', $this->plan_id)->delete(); |
| | | $list = json_decode($list); |
| | | $data=array_map(function($item){ |
| | | return [ |
| | | 'access_id' => $item, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | },$list); |
| | | return $this->planAccess()->saveAll($data); |
| | | } |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | } |
| | |
| | | } |
| | | $remark .= "会员邀请人数满{$data['upgrade_invite']}可升级到此等级"; |
| | | } |
| | | if($data['is_purchase_count'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员购买VIP专区商品次数满{$data['purchase_count']}可升级到此等级"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| | |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 提现到余额 by lyzflash |
| | | */ |
| | | public static function cashToBalance($user_id, $money, $describe) |
| | | { |
| | | $describe = !is_array($describe) ? [$describe] : $describe; |
| | | $model = parent::detail($user_id); |
| | | $model->where('user_id', '=', $user_id)->inc('balance', $money)->update(); |
| | | // 记录余额明细 |
| | | BalanceLogModel::add(SceneEnum::CASH, [ |
| | | 'user_id' => $user_id, |
| | | 'money' => $money, |
| | | 'app_id' => $model['app_id'], |
| | | ], $describe); |
| | | // 添加到可提现的余额 |
| | | // parent::addCashMoney($user_id, $money); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前用户总数 |
| | | */ |
| | | public function getUserTotal($day = null) |
| | |
| | | use app\supplier\model\auth\User as UserModel; |
| | | use app\supplier\model\auth\Role; |
| | | use app\supplier\model\auth\User as AuthUserModel; |
| | | use app\supplier\model\supplier\member\Member; |
| | | |
| | | /** |
| | | * 管理员 |
| | |
| | | |
| | | if ($user_info['is_super'] == 1) { |
| | | $model = new AccessModel(); |
| | | $menus = $model->getList(); |
| | | if($user['supplier_user_id']==1){ |
| | | $menus = $model->getList(); |
| | | }else{ |
| | | $menus = $model->getMemberAccess($user['supplier_user_id']); |
| | | } |
| | | } else { |
| | | $model = new AccessModel(); |
| | | $menus = $model->getListByUser($user['supplier_user_id']); |
| | | |
| | | foreach ($menus as $key => $val) { |
| | | if ($val['redirect_name'] != $val['children'][0]['path']) { |
| | | $menus[$key]['redirect_name'] = $menus[$key]['children'][0]['path']; |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Apply as ApplyModel; |
| | | |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 分销商申请列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new ApplyModel; |
| | | $apply_list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('apply_list')); |
| | | } |
| | | |
| | | /** |
| | | * 审核分销商 |
| | | */ |
| | | public function editApplyStatus($apply_id) |
| | | { |
| | | $model = ApplyModel::detail($apply_id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError('修改失败'); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Cash as CashModel; |
| | | use app\supplier\model\user\UserAuth; |
| | | |
| | | /** |
| | | * 提现申请制器 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | /** |
| | | * 提现记录列表 |
| | | */ |
| | | public function index($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel; |
| | | $list = $model->getList($user_id, $apply_status, $pay_type, $search); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function submit($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 确认打款 |
| | | */ |
| | | public function money($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | |
| | | if ($model->money()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:微信支付企业付款 |
| | | */ |
| | | public function wechat_pay($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->wechatPay()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:分账功能 by yj |
| | | */ |
| | | public function fb_pay($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->fbPay()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function export($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel(); |
| | | return $model->exportList($user_id, $apply_status, $pay_type, $search); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\common\model\supplier\member\Setting as AgentSetting; |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Grade as AgentGradeModel; |
| | | use app\common\model\plus\agent\GradeLog as GradeLogModel; |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | class Grade extends Controller |
| | | { |
| | | /** |
| | | * 会员等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new AgentGradeModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | if($this->request->isGet()){ |
| | | // 平台分销规则 |
| | | $basicSetting = AgentSetting::getItem('basic'); |
| | | return $this->renderSuccess('', compact( 'basicSetting')); |
| | | } |
| | | $model = new AgentGradeModel; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员等级 |
| | | */ |
| | | public function edit() |
| | | { |
| | | if($this->request->isGet()){ |
| | | // 平台分销规则 |
| | | $basicSetting = AgentSetting::getItem('basic'); |
| | | return $this->renderSuccess('', compact( 'basicSetting')); |
| | | } |
| | | $grade_id = $this->postData('grade_id'); |
| | | $model = AgentGradeModel::detail($grade_id); |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员等级 |
| | | */ |
| | | public function delete($grade_id) |
| | | { |
| | | // 会员等级详情 |
| | | $model = AgentGradeModel::detail($grade_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('已存在用户,删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | /** |
| | | * 分销商申请列表 |
| | | */ |
| | | public function log() |
| | | { |
| | | $model = new GradeLogModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\common\library\helper; |
| | | use app\supplier\model\plus\agent\User as AgentUserModel; |
| | | |
| | | /** |
| | | * 概况 |
| | | */ |
| | | class Index extends Controller |
| | | { |
| | | /** |
| | | * 首页概况 |
| | | */ |
| | | public function index() |
| | | { |
| | | // 分销商统计数据 |
| | | $agent_data = [ |
| | | 'total_num' => (new AgentUserModel())->where('is_delete', '=', 0)->count(), |
| | | 'store_money' => (new AgentUserModel())->getTotalMoney('store_money'), |
| | | 'freeze_money' => (new AgentUserModel())->getTotalMoney('freeze_money'), |
| | | 'total_money' => (new AgentUserModel())->getTotalMoney('total_money'), |
| | | ]; |
| | | // 平台统计数据 |
| | | $tj_data = [ |
| | | 'total_money' => helper::number2((new OrderModel())->getTotalMoney('all')), |
| | | 'supplier_money' => helper::number2((new OrderModel())->getTotalMoney('supplier')), |
| | | 'sys_money' => helper::number2((new OrderModel())->getTotalMoney('sys')), |
| | | ]; |
| | | // 供应商统计数据 |
| | | $supplier_data = [ |
| | | 'total_money' => helper::number2((new SupplierModel())->getTotalMoney('total_money')), |
| | | 'money' => helper::number2((new SupplierModel())->getTotalMoney('money')), |
| | | 'nosettled_money' => helper::number2((new OrderModel())->getTotalMoney('supplier', 0)), |
| | | 'freeze_money' => helper::number2((new SupplierModel())->getTotalMoney('freeze_money')), |
| | | 'cash_money' => helper::number2((new SupplierModel())->getTotalMoney('cash_money')), |
| | | 'deposit_money' => helper::number2((new SupplierModel())->getTotalMoney('deposit_money')), |
| | | ]; |
| | | |
| | | return $this->renderSuccess('', compact( 'tj_data', 'supplier_data', 'agent_data')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Order as OrderModel; |
| | | |
| | | /** |
| | | * 分销订单 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 分销订单列表 |
| | | */ |
| | | public function index($user_id = null, $is_settled = -1,$list_rows = 15) |
| | | { |
| | | $model = new OrderModel; |
| | | $list = $model->getList($user_id, $is_settled,$list_rows); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function export($user_id = null, $is_settled = -1) |
| | | { |
| | | $model = new OrderModel(); |
| | | return $model->exportList($user_id, $is_settled); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\common\library\helper; |
| | | use app\common\model\supplier\member\Setting as AgentSetting; |
| | | use app\common\model\supplier\member\Setting as AgentSettingModel; |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Grade as AgentGradeModel; |
| | | use app\supplier\model\product\Product as ProductModel; |
| | | use app\supplier\service\ProductService; |
| | | use app\supplier\model\plus\agent\Product as AgentProductModel; |
| | | use app\supplier\model\product\Category as CategoryModel; |
| | | |
| | | /** |
| | | * 商品运营控制器 |
| | | */ |
| | | class Product extends Controller |
| | | { |
| | | /** |
| | | * 商品列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new ProductModel; |
| | | $list = $model->getList(array_merge(['status' => -1], $this->postData())); |
| | | // 商品分类 |
| | | $category = CategoryModel::getCacheTree(); |
| | | return $this->renderSuccess('', compact('list', 'category')); |
| | | } |
| | | |
| | | /** |
| | | * 编辑分销商 |
| | | */ |
| | | public function edit($product_id) |
| | | { |
| | | $model = new AgentProductModel(); |
| | | if ($this->request->isGet()) { |
| | | // 平台分销规则 |
| | | $basicSetting = AgentSetting::getItem('basic'); |
| | | $agent_product = AgentProductModel::detail($product_id); |
| | | return $this->renderSuccess('', compact('agent_product', 'basicSetting')); |
| | | } |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 设置状态 |
| | | */ |
| | | public function setAgent($productIds, $is_agent) |
| | | { |
| | | $model = new AgentProductModel(); |
| | | if ($model->setAgent($productIds, $is_agent)) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\Setting as AgentSettingModel; |
| | | use app\supplier\model\product\Product as ProductModel; |
| | | |
| | | /** |
| | | * 分销设置控制器 |
| | | */ |
| | | class Setting extends Controller |
| | | { |
| | | |
| | | public $pay_type = [ |
| | | ['id' => '10', 'name' => '微信支付'], |
| | | ['id' => '20', 'name' => '支付宝'], |
| | | ['id' => '30', 'name' => '银行卡'] |
| | | ]; |
| | | |
| | | public $pay_type1 = [ |
| | | 10 => '微信支付', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡' |
| | | ]; |
| | | |
| | | /** |
| | | * 分销设置 |
| | | */ |
| | | public function index() |
| | | { |
| | | $pay_type = $this->pay_type; |
| | | $data = AgentSettingModel::getAll(); |
| | | // 购买指定商品成为分销商:商品列表 |
| | | $product_ids = $data['condition']['values']['become__buy_product_ids']; |
| | | $productList = []; |
| | | if(count($product_ids) > 0){ |
| | | $productList = (new ProductModel)->getListByIds($product_ids); |
| | | } |
| | | //商城设置 |
| | | $operate_type = SettingModel::getItem('store')['operate_type']; |
| | | return $this->renderSuccess('', compact('data', 'productList', 'pay_type', 'operate_type')); |
| | | } |
| | | |
| | | /** |
| | | * 基础信息设置 |
| | | */ |
| | | public function basic() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['basic'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 分销商条件设置 |
| | | */ |
| | | public function condition() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['condition'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 佣金设置 |
| | | */ |
| | | public function commission() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['commission'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 结算设置 |
| | | */ |
| | | public function settlement() |
| | | { |
| | | $param = $this->postData('form'); |
| | | $data['settlement'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 自定义文字设置 |
| | | */ |
| | | public function words() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['words'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 申请协议设置 |
| | | */ |
| | | public function license() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['license'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 页面背景设置 |
| | | */ |
| | | public function background() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['background'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $model = new AgentSettingModel; |
| | | if ($model->edit($data)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分销海报 |
| | | */ |
| | | public function qrcode() |
| | | { |
| | | if (!$this->request->post()) { |
| | | $data = AgentSettingModel::getItem('qrcode'); |
| | | return $this->renderSuccess('', ['data' => $data]); |
| | | } |
| | | $model = new AgentSettingModel; |
| | | if ($model->edit(['qrcode' => $this->postData('form')])) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\agent; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\agent\User as UserModel; |
| | | use app\supplier\model\plus\agent\Setting as SettingModel; |
| | | use app\supplier\model\plus\agent\Referee as RefereeModel; |
| | | use app\supplier\model\plus\agent\Grade as GradeModel; |
| | | |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | /** |
| | | * 分销商申请列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new UserModel; |
| | | $list = $model->getList($this->postData()); |
| | | |
| | | foreach ($list as $key => $val) { |
| | | $list[$key]['cash_total'] = sprintf('%.2f', $val['moeny'] + $val['freeze_money'] + $val['total_money']); |
| | | } |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting')); |
| | | } |
| | | |
| | | /** |
| | | * 编辑分销商 |
| | | */ |
| | | public function edit() |
| | | { |
| | | $user_id = $this->postData('user_id'); |
| | | $model = UserModel::detail($user_id); |
| | | if ($this->request->isGet()) { |
| | | $gradeList = GradeModel::getUsableList(); |
| | | return $this->renderSuccess('', compact('gradeList', 'model')); |
| | | } |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 分销商用户列表 |
| | | */ |
| | | public function fans($user_id, $level = -1) |
| | | { |
| | | $model = new RefereeModel; |
| | | $list = $model->getList($user_id, $level); |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting')); |
| | | } |
| | | |
| | | /** |
| | | * 软删除分销商用户 |
| | | */ |
| | | public function delete($user_id) |
| | | { |
| | | $model = UserModel::detail($user_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\Apply as ApplyModel; |
| | | |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class Apply extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 队长申请列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new ApplyModel; |
| | | $apply_list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('apply_list')); |
| | | } |
| | | |
| | | /** |
| | | * 审核队长 |
| | | */ |
| | | public function editApplyStatus($apply_id) |
| | | { |
| | | $model = ApplyModel::detail($apply_id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError('修改失败'); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\Cash as CashModel; |
| | | |
| | | /** |
| | | * 提现申请制器 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | /** |
| | | * 提现记录列表 |
| | | */ |
| | | public function index($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel; |
| | | $list = $model->getList($user_id, $apply_status, $pay_type, $search, $this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function submit($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 确认打款 |
| | | */ |
| | | public function money($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | |
| | | if ($model->money()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 队长提现:微信支付企业付款 |
| | | */ |
| | | public function wechat_pay($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->wechatPay()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function export($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel(); |
| | | return $model->exportList($user_id, $apply_status, $pay_type, $search, $this->postData()); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\Grade as GradeModel; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | class Grade extends Controller |
| | | { |
| | | /** |
| | | * 会员等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new GradeModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new GradeModel; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员等级 |
| | | */ |
| | | public function edit($grade_id) |
| | | { |
| | | $model = GradeModel::detail($grade_id); |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员等级 |
| | | */ |
| | | public function delete($grade_id) |
| | | { |
| | | // 会员等级详情 |
| | | $model = GradeModel::detail($grade_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('已存在用户,删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\Order as OrderModel; |
| | | |
| | | /** |
| | | * 分销订单 |
| | | */ |
| | | class Order extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 分销订单列表 |
| | | */ |
| | | public function index($user_id = null, $is_settled = -1) |
| | | { |
| | | $model = new OrderModel; |
| | | $list = $model->getList($user_id, $is_settled); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\Setting as bonusSettingModel; |
| | | use app\supplier\model\product\Product as ProductModel; |
| | | |
| | | /** |
| | | * 分销设置控制器 |
| | | */ |
| | | class Setting extends Controller |
| | | { |
| | | |
| | | public $pay_type = [ |
| | | ['id' => '10', 'name' => '微信支付'], |
| | | ['id' => '20', 'name' => '支付宝'], |
| | | ['id' => '30', 'name' => '银行卡'], |
| | | ['id' => '40', 'name' => '余额'] |
| | | ]; |
| | | |
| | | public $pay_type1 = [ |
| | | 10 => '微信支付', |
| | | 20 => '支付宝', |
| | | 30 => '银行卡', |
| | | 40 => '余额' |
| | | ]; |
| | | |
| | | /** |
| | | * 分销设置 |
| | | */ |
| | | public function index() |
| | | { |
| | | $pay_type = $this->pay_type; |
| | | $data = bonusSettingModel::getAll(); |
| | | // 购买指定商品成为队长:商品列表 |
| | | $product_ids = $data['basic']['values']['become__buy_product_ids']; |
| | | $productList = []; |
| | | if(count($product_ids) > 0){ |
| | | $productList = (new ProductModel)->getListByIds($product_ids); |
| | | } |
| | | return $this->renderSuccess('', compact('data', 'productList', 'pay_type')); |
| | | } |
| | | |
| | | /** |
| | | * 基础信息设置 |
| | | */ |
| | | public function basic() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['basic'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 队长条件设置 |
| | | */ |
| | | public function condition() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['condition'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 佣金设置 |
| | | */ |
| | | public function commission() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['commission'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 结算设置 |
| | | */ |
| | | public function settlement() |
| | | { |
| | | $param = $this->postData('form'); |
| | | $data['settlement'] = [ |
| | | 'fee_rate' => $param['fee_rate'], |
| | | 'min_money' => $param['min_money'], |
| | | 'settle_days' => $param['settle_days'], |
| | | 'pay_type' => $param['pay_type'], |
| | | 'explain' => $param['explain'], |
| | | ]; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 自定义文字设置 |
| | | */ |
| | | public function words() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['words'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 申请协议设置 |
| | | */ |
| | | public function license() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['license'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 页面背景设置 |
| | | */ |
| | | public function background() |
| | | { |
| | | $param = $this->postData(); |
| | | $data['background'] = $param; |
| | | return $this->edit($data); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $model = new bonusSettingModel; |
| | | if ($model->edit($data)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分销海报 |
| | | */ |
| | | public function qrcode() |
| | | { |
| | | if (!$this->request->post()) { |
| | | $data = bonusSettingModel::getItem('qrcode'); |
| | | return $this->renderSuccess('', ['data' => $data]); |
| | | } |
| | | $model = new bonusSettingModel; |
| | | if ($model->edit(['qrcode' => $this->postData('form')])) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\plus\bonus; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\plus\bonus\User as UserModel; |
| | | use app\supplier\model\plus\bonus\Setting as SettingModel; |
| | | use app\supplier\model\plus\bonus\Referee as RefereeModel; |
| | | /** |
| | | * 分销控制器 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | /** |
| | | * 队长列表 |
| | | */ |
| | | public function index($keyword = '', $search_type = 'user_id') |
| | | { |
| | | $model = new UserModel; |
| | | $list = $model->getList($keyword, $search_type, $this->postData()); |
| | | |
| | | foreach ($list as $key => $val) { |
| | | $list[$key]['cash_total'] = sprintf('%.2f', $val['moeny'] + $val['freeze_money'] + $val['total_money']); |
| | | } |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | $total_money_wait = (new UserModel)->getTotalMoney('money'); |
| | | $total_money_freeze = (new UserModel)->getTotalMoney('freeze_money_second'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting', 'total_money_wait', 'total_money_freeze')); |
| | | } |
| | | |
| | | /** |
| | | * 编辑队长 |
| | | */ |
| | | public function edit() |
| | | { |
| | | if ($this->request->isGet()) { |
| | | return $this->renderSuccess(''); |
| | | } |
| | | //判断是否更换用户并且是不是分红用户 |
| | | $new_user_id = $this->postData('new_user_id'); |
| | | if($new_user_id) { |
| | | $model = UserModel::detail($new_user_id); |
| | | if($model) { |
| | | return $this->renderError($model->getError() ?: '更换的会员已经是分红用户,请重新选择'); |
| | | } |
| | | } |
| | | $user_id = $this->postData('user_id'); |
| | | $model = UserModel::detail($user_id); |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 队长用户列表 |
| | | */ |
| | | public function fans($user_id, $level = -1) |
| | | { |
| | | $model = new RefereeModel; |
| | | $list = $model->getList($user_id, $level); |
| | | $basicSetting = SettingModel::getItem('basic'); |
| | | return $this->renderSuccess('', compact('list', 'basicSetting')); |
| | | } |
| | | |
| | | /** |
| | | * 软删除队长用户 |
| | | */ |
| | | public function delete($user_id) |
| | | { |
| | | $model = UserModel::detail($user_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | public function architecture($keyword = '', $type = 0) |
| | | { |
| | | $model = new UserModel; |
| | | $list = $model->getArchitecture($keyword, $type); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 分红用户导出 |
| | | */ |
| | | public function export($keyword = '', $search_type = 'user_id') |
| | | { |
| | | $model = new UserModel; |
| | | return $model->exportList($keyword, $search_type, $this->postData()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\common\enum\settings\SettingEnum; |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\settings\Setting as SettingModel; |
| | | use app\supplier\model\user\BalanceLog as BalanceLogModel; |
| | | |
| | | /** |
| | | * 余额明细 |
| | | */ |
| | | class Balance extends Controller |
| | | { |
| | | /** |
| | | * 余额明细 |
| | | */ |
| | | public function log() |
| | | { |
| | | $model = new BalanceLogModel; |
| | | return $this->renderSuccess('', [ |
| | | // 充值记录列表 |
| | | 'list' => $model->getList($this->postData('Params')), |
| | | // 属性集 |
| | | 'attributes' => $model::getAttributes(), |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 充值设置 |
| | | */ |
| | | public function setting() |
| | | { |
| | | if ($this->request->isGet()) { |
| | | $values = SettingModel::getItem(SettingEnum::BALANCE); |
| | | return $this->renderSuccess('', compact('values')); |
| | | } |
| | | $model = new SettingModel; |
| | | if ($model->edit(SettingEnum::BALANCE, $this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\user\Card as CardModel; |
| | | use app\supplier\model\user\CardRecord as CardRecordModel; |
| | | use app\supplier\model\plus\coupon\Coupon as CouponModel; |
| | | |
| | | /** |
| | | * 会员卡 |
| | | */ |
| | | class Card extends Controller |
| | | { |
| | | /** |
| | | * 会员卡列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new CardModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 领取会员卡记录 |
| | | */ |
| | | public function record() |
| | | { |
| | | $model = new CardRecordModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 会员卡删除记录 |
| | | */ |
| | | public function deleterecord() |
| | | { |
| | | $model = new CardModel; |
| | | $list = $model->getDeleteList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 发卡 |
| | | */ |
| | | public function put() |
| | | { |
| | | $model = new CardModel; |
| | | if ($model->put($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 撤销 |
| | | */ |
| | | public function cancel() |
| | | { |
| | | $model = new CardModel; |
| | | if ($model->cancel($this->postData())) { |
| | | return $this->renderSuccess('撤销成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '撤销失败'); |
| | | } |
| | | |
| | | /** |
| | | * 延期 |
| | | */ |
| | | public function delay($order_id) |
| | | { |
| | | $model = CardRecordModel::detail($order_id); |
| | | if ($model->delay($this->postData())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 添加会员卡 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new CardModel; |
| | | // get请求 |
| | | if ($this->request->isGet()) { |
| | | //优惠券 |
| | | $couponList = []; |
| | | //卡片样式 |
| | | $image = $model::getImage(); |
| | | return $this->renderSuccess('', compact('couponList', 'image')); |
| | | } |
| | | // 新增记录 |
| | | if ($model->add($this->postData()['params'])) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员卡 |
| | | */ |
| | | public function edit($card_id) |
| | | { |
| | | $model = CardModel::detail($card_id); |
| | | // get请求 |
| | | if ($this->request->isGet()) { |
| | | //优惠券 |
| | | $couponList = []; |
| | | //卡片样式 |
| | | $image = $model::getImage(); |
| | | return $this->renderSuccess('', compact('couponList', 'model', 'image')); |
| | | } |
| | | // 修改记录 |
| | | if ($model->edit($this->postData()['params'])) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员卡 |
| | | */ |
| | | public function delete($card_id) |
| | | { |
| | | // 会员卡详情 |
| | | $model = CardModel::detail($card_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError($model->getError() ?: '已存在用户,删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\settings\Setting as SettingModel; |
| | | use app\supplier\model\user\Cash as CashModel; |
| | | |
| | | /** |
| | | * 提现 |
| | | */ |
| | | class Cash extends Controller |
| | | { |
| | | /** |
| | | * 提现记录列表 |
| | | */ |
| | | public function index($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel; |
| | | $list = $model->getList($user_id, $apply_status, $pay_type, $search); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function audit($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->submit($this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 确认打款 |
| | | */ |
| | | public function money($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | |
| | | if ($model->money()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 余额提现:微信支付企业付款 |
| | | */ |
| | | public function wxpay($id) |
| | | { |
| | | $model = CashModel::detail($id); |
| | | if ($model->wechatPay()) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function export($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = new CashModel(); |
| | | return $model->exportList($user_id, $apply_status, $pay_type, $search); |
| | | } |
| | | |
| | | /** |
| | | * 提现设置 |
| | | */ |
| | | public function setting() |
| | | { |
| | | if ($this->request->isGet()) { |
| | | $values = SettingModel::getItem('balance_cash'); |
| | | return $this->renderSuccess('', compact('values')); |
| | | } |
| | | $model = new SettingModel; |
| | | if ($model->edit('balance_cash', $this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\user\Clerk as ClerkModel; |
| | | use app\supplier\model\user\User as UserModel; |
| | | |
| | | /** |
| | | * 店员控制器 |
| | | */ |
| | | class Clerk extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 店员列表 |
| | | */ |
| | | public function index($search = '') |
| | | { |
| | | // 店员列表 |
| | | $model = new ClerkModel; |
| | | $list = $model->getList(-1, $search, $this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加店员 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new ClerkModel; |
| | | //传过来的信息 |
| | | $data = $this->postData(); |
| | | |
| | | $list = $model->getAll()->toArray(); |
| | | $list_user_id = array_column($list, 'user_id'); |
| | | if (in_array($data['user_id'], $list_user_id)) { |
| | | return $this->renderError('', '该用户已经是店员,无需重复添加'); |
| | | } |
| | | // 新增记录 |
| | | if ($model->add($data)) { |
| | | return $this->renderSuccess('', '添加成功'); |
| | | } |
| | | return $this->renderError('', $model->getError() ?: '添加失败'); |
| | | } |
| | | |
| | | public function detail($clerk_id) |
| | | { |
| | | $detail = ClerkModel::detail($clerk_id); |
| | | return $this->renderSuccess('', compact('detail')); |
| | | } |
| | | |
| | | /** |
| | | * 编辑店员 |
| | | */ |
| | | public function edit($clerk_id) |
| | | { |
| | | if($this->request->isGet()){ |
| | | return $this->detail($clerk_id); |
| | | } |
| | | $model = ClerkModel::detail($clerk_id); |
| | | //编辑店员的数据 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('', '更新成功'); |
| | | } |
| | | return $this->renderError('', $model->getError() ?: '更新失败'); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除店员 |
| | | */ |
| | | public function delete($clerk_id) |
| | | { |
| | | // 店员详情 |
| | | $model = ClerkModel::detail($clerk_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('', '删除失败'); |
| | | } |
| | | return $this->renderSuccess('', $model->getError() ?: '删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\user\Grade as GradeModel; |
| | | use app\common\model\user\GradeLog as GradeLogModel; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | class Grade extends Controller |
| | | { |
| | | /** |
| | | * 会员等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new GradeModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new GradeModel; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员等级 |
| | | */ |
| | | public function edit($grade_id) |
| | | { |
| | | $model = GradeModel::detail($grade_id); |
| | | if (request()->isGet()) { |
| | | return $this->renderSuccess('', compact('model')); |
| | | } |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员等级 |
| | | */ |
| | | public function delete($grade_id) |
| | | { |
| | | // 会员等级详情 |
| | | $model = GradeModel::detail($grade_id); |
| | | if (!$model->setDelete()) { |
| | | return $this->renderError('已存在用户,删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | /** |
| | | * 会员等级日志 |
| | | */ |
| | | public function log() |
| | | { |
| | | $model = new GradeLogModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\user\BalancePlan as PlanModel; |
| | | use app\supplier\model\user\BalanceOrder as BalanceOrderModel; |
| | | |
| | | /** |
| | | * 充值控制器 |
| | | */ |
| | | class Plan extends Controller |
| | | { |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new PlanModel(); |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new PlanModel(); |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 更新 |
| | | */ |
| | | public function edit($plan_id) |
| | | { |
| | | $detail = PlanModel::detail($plan_id); |
| | | if($this->request->isGet()){ |
| | | return $this->renderSuccess('', compact('detail')); |
| | | } |
| | | if ($detail->edit($this->postData())) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError('更新失败'); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | public function delete($plan_id) |
| | | { |
| | | // 详情 |
| | | $model = new PlanModel; |
| | | // 更新记录 |
| | | if ($model->setDelete(['plan_id' => $plan_id])) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | |
| | | /** |
| | | * 充值记录 |
| | | */ |
| | | public function log() |
| | | { |
| | | $model = new BalanceOrderModel(); |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\settings\Setting as SettingModel; |
| | | use app\supplier\model\user\PointsLog as PointsLogModel; |
| | | |
| | | /** |
| | | * 积分控制器 |
| | | */ |
| | | class Points extends Controller |
| | | { |
| | | /** |
| | | * 积分设置 |
| | | */ |
| | | public function setting() |
| | | { |
| | | if ($this->request->isGet()) { |
| | | $values = SettingModel::getItem('points'); |
| | | return $this->renderSuccess('', compact('values')); |
| | | } |
| | | $model = new SettingModel; |
| | | if ($model->edit('points', $this->postData())) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 积分明细 |
| | | */ |
| | | public function log() |
| | | { |
| | | // 积分明细列表 |
| | | $model = new PointsLogModel; |
| | | $list = $model->getList($this->request->param()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\supplier\controller\Controller; |
| | | use app\supplier\model\user\Tag as TagModel; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | class Tag extends Controller |
| | | { |
| | | /** |
| | | * 会员等级列表 |
| | | */ |
| | | public function index() |
| | | { |
| | | $model = new TagModel; |
| | | $list = $model->getList($this->postData()); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | /** |
| | | * 添加等级 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new TagModel; |
| | | // 新增记录 |
| | | if ($model->add($this->postData())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError('添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 编辑会员等级 |
| | | */ |
| | | public function edit($tag_id) |
| | | { |
| | | $model = TagModel::detail($tag_id); |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess(); |
| | | } |
| | | return $this->renderError(); |
| | | } |
| | | |
| | | /** |
| | | * 删除会员等级 |
| | | */ |
| | | public function delete($tag_id) |
| | | { |
| | | // 会员等级详情 |
| | | $model = TagModel::detail($tag_id); |
| | | if (!$model->deleteTag()) { |
| | | return $this->renderError('删除失败'); |
| | | } |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\controller\user; |
| | | |
| | | use app\common\library\helper; |
| | | use app\common\model\user\Tag as TagModel; |
| | | use app\common\model\user\UserTag as UserTagModel; |
| | | use app\shop\controller\Controller; |
| | | use app\supplier\model\user\User as UserModel; |
| | | use app\supplier\model\user\Grade; |
| | | use app\supplier\service\order\ExportService; |
| | | use app\common\model\plus\bonus\User as BonusUserModel; |
| | | /** |
| | | * 用户管理 |
| | | */ |
| | | class User extends Controller |
| | | { |
| | | /** |
| | | * 商户列表 |
| | | */ |
| | | public function index($nickName = '', $gender = null, $reg_date = '', $grade_id = null) |
| | | { |
| | | $list = UserModel::getList($nickName, $grade_id, $reg_date, $gender = -1, $this->postData()); |
| | | $GradeModel = new Grade(); |
| | | $grade = $GradeModel->getLists(); |
| | | //(new BonusUserModel())->addTheFirst4(); |
| | | // 所有标签 |
| | | $allTag = TagModel::getAll(); |
| | | return $this->renderSuccess('', compact('list', 'grade', 'allTag')); |
| | | } |
| | | |
| | | /** |
| | | * 其他用户详情 |
| | | */ |
| | | public function getDetail($user_id = '') |
| | | { |
| | | $detail = UserModel::detail($user_id); |
| | | return $this->renderSuccess('', compact('detail')); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | public function delete($user_id) |
| | | { |
| | | // 用户详情 |
| | | $model = UserModel::detail($user_id); |
| | | if ($model && $model->setDelete()) { |
| | | return $this->renderSuccess('删除成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '删除失败'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加用户 |
| | | */ |
| | | public function add() |
| | | { |
| | | $model = new UserModel; |
| | | // 新增记录 |
| | | if ($model->add($this->request->param())) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '添加失败'); |
| | | } |
| | | |
| | | /** |
| | | * 用户充值 |
| | | */ |
| | | public function recharge($user_id, $source) |
| | | { |
| | | // 用户详情 |
| | | $model = UserModel::detail($user_id); |
| | | |
| | | if ($model->recharge($this->store['user']['user_name'], $source, $this->postData('params'))) { |
| | | return $this->renderSuccess('操作成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '操作失败'); |
| | | } |
| | | |
| | | /** |
| | | * 等级改用户 |
| | | */ |
| | | public function edit($user_id) |
| | | { |
| | | // 用户详情 |
| | | $model = UserModel::detail($user_id); |
| | | if ($this->request->isGet()) { |
| | | return $this->renderSuccess('', compact('model')); |
| | | } |
| | | // 修改记录 |
| | | if ($model->edit($this->postData())) { |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '修改失败'); |
| | | } |
| | | |
| | | public function tag($user_id){ |
| | | if($this->request->isGet()){ |
| | | // 用户详情 |
| | | $user = UserModel::detail($user_id); |
| | | // 标签 |
| | | $userTag = UserTagModel::getListByUser($user_id); |
| | | $userTag = helper::getArrayColumn($userTag, 'tag_id'); |
| | | // 所有标签 |
| | | $allTag = TagModel::getAll(); |
| | | return $this->renderSuccess('', compact('user', 'userTag' , 'allTag')); |
| | | } |
| | | $model = UserModel::detail($user_id); |
| | | if($model->editTag($this->postData())){ |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '修改失败'); |
| | | } |
| | | |
| | | /** |
| | | * 等级改用户 |
| | | */ |
| | | public function grade($user_id) |
| | | { |
| | | // 用户详情 |
| | | $model = UserModel::detail($user_id); |
| | | // 修改记录 |
| | | if ($model->updateGrade($this->postData())) { |
| | | return $this->renderSuccess('修改成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '修改失败'); |
| | | } |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | | public function export() |
| | | { |
| | | ini_set('memory_limit','-1'); |
| | | set_time_limit(0); |
| | | $postData = $this->postData(); |
| | | $data = UserModel::getList($postData["nick_name"], $postData["grade_id"], $postData["reg_date"], $gender = -1, $this->postData(),false); |
| | | $list = $data->toArray(); |
| | | return (new Exportservice)->userList($list); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\supplier\model\plus\agent\Referee as RefereeModel; |
| | | use app\common\model\plus\agent\Apply as ApplyModel; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\model\plus\agent\Grade as AgentGradeModel; |
| | | /** |
| | | * 分销商入驻申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 获取分销商申请列表 |
| | | * @noinspection PhpUndefinedMethodInspection |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->alias('apply') |
| | | ->field('apply.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee']) |
| | | ->join('user', 'user.user_id = apply.user_id') |
| | | ->order(['apply.create_time' => 'desc']); |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName|apply.real_name|apply.mobile', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | // 获取列表数据 |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | |
| | | /** |
| | | * 分销商入驻审核 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function submit($data) |
| | | { |
| | | if ($data['apply_status'] == '30' && empty($data['reject_reason'])) { |
| | | $this->error = '请填写驳回原因'; |
| | | return false; |
| | | } |
| | | $this->startTrans(); |
| | | if ($data['apply_status'] == '20') { |
| | | // 新增分销商用户 |
| | | User::add($data['user_id'], [ |
| | | 'real_name' => $data['real_name'], |
| | | 'mobile' => $data['mobile'], |
| | | 'referee_id' => $data['referee_id'], |
| | | 'grade_id' => (new Grade())->getDefaultGradeId() |
| | | ]); |
| | | } |
| | | $save_data = [ |
| | | 'audit_time' => time(), |
| | | 'apply_status' => $data['apply_status'], |
| | | 'reject_reason' => $data['reject_reason'], |
| | | ]; |
| | | $this->save($save_data); |
| | | // 记录推荐人关系 |
| | | if ($data['referee_id'] > 0) { |
| | | RefereeModel::createRelation($data['user_id'], $data['referee_id']); |
| | | } |
| | | // 发送模板消息 |
| | | (new MessageService)->agent($this); |
| | | $this->commit(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请中的数量 |
| | | */ |
| | | public static function getApplyCount() |
| | | { |
| | | return (new static())->where('apply_status', '=', 10)->count(); |
| | | } |
| | | /** |
| | | * 编辑分销商用户 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | return $this->save($data) !== false; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\agent\Capital as CapitalModel; |
| | | |
| | | /** |
| | | * 分销商资金明细模型 |
| | | */ |
| | | class Capital extends CapitalModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\library\easywechat\AppWx; |
| | | use app\common\library\easywechat\AppMp; |
| | | use app\common\model\app\AppMp as AppMpModel; |
| | | use app\common\model\app\AppOpen as AppOpenModel; |
| | | use app\common\model\app\AppWx as AppWxModel; |
| | | use app\common\model\plus\agent\Setting; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\service\order\OrderService; |
| | | use app\common\library\easywechat\WxPay; |
| | | use app\common\model\plus\agent\Cash as CashModel; |
| | | use app\shop\model\user\User as UserModel; |
| | | use app\shop\service\order\ExportService; |
| | | use app\common\library\fbpay\FbPay; |
| | | use app\supplier\model\user\UserAuth; |
| | | use app\common\model\shop\FbCashApply; |
| | | |
| | | /** |
| | | * 分销商提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取器:申请时间 |
| | | */ |
| | | public function getAuditTimeAttr($value) |
| | | { |
| | | return $value > 0 ? date('Y-m-d H:i:s', $value) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取器:打款方式 |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | return ['text' => $this->payType[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 获取分销商提现列表 |
| | | */ |
| | | public function getList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, agent.real_name, agent.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('agent_user agent', 'agent.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if ($user_id > 0) { |
| | | $model = $model->where('cash.user_id', '=', $user_id); |
| | | } |
| | | if (!empty($search)) { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->paginate(15); |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现审核 |
| | | */ |
| | | public function submit($param) |
| | | { |
| | | $data = ['apply_status' => $param['apply_status']]; |
| | | if ($param['apply_status'] == 30) { |
| | | $data['reject_reason'] = $param['reject_reason']; |
| | | } |
| | | // 更新申请记录 |
| | | $data['audit_time'] = time(); |
| | | self::update($data, ['id' => $param['id']]); |
| | | // 提现驳回:解冻分销商资金 |
| | | if ($param['apply_status'] == 30) { |
| | | User::backFreezeMoney($param['user_id'], $param['money']); |
| | | } |
| | | |
| | | // 发送模板消息 |
| | | (new MessageService)->cash($this); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 确认已打款 |
| | | */ |
| | | public function money() |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | // 更新申请状态 |
| | | $data = ['apply_status' => 40, 'audit_time' => time()]; |
| | | self::update($data, ['id' => $this['id']]); |
| | | |
| | | // 更新分销商累积提现佣金 |
| | | User::totalMoney($this['user_id'], $this['money']); |
| | | |
| | | // 记录分销商资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $this['user_id'], |
| | | 'flow_type' => 20, |
| | | 'money' => -$this['money'], |
| | | 'describe' => '申请提现', |
| | | ]); |
| | | // 发送模板消息 |
| | | //(new Message)->withdraw($this); |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:微信支付企业付款 |
| | | */ |
| | | public function wechatPay() |
| | | { |
| | | $settlement = Setting::getItem('settlement'); |
| | | if($settlement['wechat_type'] == 0){ |
| | | return $this->wechatPay0(); |
| | | }else { |
| | | return $this->wechatPay1(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:微信支付企业付款 |
| | | */ |
| | | public function wechatPay0() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '分销商提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app = []; |
| | | if($user['reg_source'] == 'mp'){ |
| | | $app = AppMp::getWxPayApp($user['app_id']); |
| | | $open_id = $user['mpopen_id']; |
| | | }else if($user['reg_source'] == 'wx'){ |
| | | $app = AppWx::getWxPayApp($user['app_id']); |
| | | $open_id = $user['open_id']; |
| | | } |
| | | |
| | | if($open_id == ''){ |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $WxPay = new WxPay($app); |
| | | // 请求付款api |
| | | if ($WxPay->transfers($orderNO, $open_id, $this['money'], $desc)) { |
| | | // 确认已打款 |
| | | $this->money(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 商家转账到零钱 |
| | | */ |
| | | public function wechatPay1() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '余额提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app_id = ''; |
| | | if ($user['reg_source'] == 'mp') { |
| | | $open_id = $user['mpopen_id']; |
| | | $wxConfig = AppMpModel::getAppMpCache($app_id); |
| | | $app_id = $wxConfig['mpapp_id']; |
| | | } else if ($user['reg_source'] == 'wx') { |
| | | $open_id = $user['open_id']; |
| | | $wxConfig = AppWxModel::getAppWxCache($app_id); |
| | | $app_id = $wxConfig['wxapp_id']; |
| | | } else if ($user['reg_source'] == 'app') { |
| | | $open_id = $user['appopen_id']; |
| | | $wxConfig = AppOpenModel::getAppOpenCache($app_id); |
| | | $app_id = $wxConfig['openapp_id']; |
| | | } |
| | | |
| | | if ($open_id == '') { |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $pars = []; |
| | | $pars['appid'] = $app_id;//直连商户的appid |
| | | $pars['out_batch_no'] = 'sjzz'.date('Ymd').mt_rand(1000, 9999);//商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一 |
| | | $pars['batch_name'] = $desc;//该笔批量转账的名称 |
| | | $pars['batch_remark'] = $desc;//转账说明,UTF8编码,最多允许32个字符 |
| | | $pars['total_amount'] = intval($this['money'] * 100);//转账总金额 单位为“分” |
| | | $pars['total_num'] = 1;//转账总笔数 |
| | | $pars['transfer_detail_list'][0] = [ |
| | | 'out_detail_no'=>'Dh'.$orderNO, |
| | | 'transfer_amount'=>$pars['total_amount'], |
| | | 'transfer_remark'=> $desc, |
| | | 'openid' => $open_id |
| | | ];//转账明细列表 |
| | | //获取token |
| | | $wxPay = new WxPay(null); |
| | | $res = $wxPay->wechatTrans($pars, $user['app_id']); |
| | | $resArr = json_decode($res,true); |
| | | if(isset($resArr['batch_id'])){ |
| | | $this->save([ |
| | | 'batch_id' => $resArr['batch_id'] |
| | | ]); |
| | | // 确认打款 |
| | | $this->money(); |
| | | return true; |
| | | }else{ |
| | | $this->error = $resArr['message']; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:分账功能 |
| | | */ |
| | | public function fbPay() |
| | | { |
| | | // 用户认证的信息 |
| | | $userAuth = UserAuth::detail($this['user_id']); |
| | | if(empty($userAuth)){ |
| | | $this->error = '该用户未实名认证'; |
| | | return false; |
| | | }elseif(!empty($userAuth) && empty($userAuth["account_id"])){ |
| | | $this->error = '该用户实名认证还未审核通过'; |
| | | return false; |
| | | } |
| | | //获取向付呗申请的记录 |
| | | $where["cash_id"] = $this['id']; |
| | | $apply = FbCashApply::detail($where); |
| | | if(empty($apply)){ |
| | | //只生成一次订单 否则造成多次打同一笔款 |
| | | $merchant_order_sn = OrderService::createOrderNo(); |
| | | // 更新订单号:用于回调 更新打款状态 |
| | | $save_data = [ |
| | | 'merchant_order_sn' => $merchant_order_sn, |
| | | 'cash_id' => $this['id'], |
| | | 'type' => 'agent', |
| | | 'user_id' => $this['user_id'], |
| | | ]; |
| | | $model =new FbCashApply(); |
| | | $model->save($save_data); |
| | | }else{ |
| | | $merchant_order_sn = $apply['merchant_order_sn']; |
| | | } |
| | | |
| | | // 分账接收方ID |
| | | $data["account_id"] = $userAuth["account_id"]; |
| | | // 生成付款订单号 |
| | | $data["merchant_order_sn"] = $merchant_order_sn; |
| | | //打款金额 |
| | | $data["amount"]=$this['real_money']; |
| | | |
| | | //如果是付呗接口,配置参数 by yj |
| | | $app = FbPay::getFbPayApp($userAuth["app_id"], 'wx'); |
| | | $FbPay = new FbPay($app); |
| | | // 请求分账api |
| | | if ($FbPay->withdraw($data)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /* |
| | | *统计提现总数量 |
| | | */ |
| | | public function getAgentOrderTotal() |
| | | { |
| | | return $this->count('id'); |
| | | } |
| | | |
| | | /* |
| | | * 统计提现待审核总数量 |
| | | */ |
| | | public function getAgentApplyTotal($apply_status) |
| | | { |
| | | return $this->where('apply_status', '=', $apply_status)->count(); |
| | | } |
| | | |
| | | /** |
| | | * 导出分销商提现 |
| | | */ |
| | | public function exportList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, agent.real_name, agent.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('agent_user agent', 'agent.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if ($user_id > 0) { |
| | | $model = $model->where('cash.user_id', '=', $user_id); |
| | | } |
| | | if (!empty($search)) { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | // 导出excel文件 |
| | | (new Exportservice)->cashList($list); |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\agent\Grade as AgentGradeModel; |
| | | use app\supplier\model\plus\agent\User as AgentUserModel; |
| | | |
| | | /** |
| | | * 用户会员等级模型 |
| | | */ |
| | | class Grade extends AgentGradeModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList() |
| | | { |
| | | $list = $this->selectList(); |
| | | // 如果为空,则插入默认等级 |
| | | if(count($list) == 0){ |
| | | $grade_id=Grade::getDefaultGradeId(); |
| | | $where['app_id'] = self::$app_id; |
| | | $where['grade_id'] = 0; |
| | | // 更新之前的默认为0的id为此等级id |
| | | (new AgentUserModel())->where($where)->update([ |
| | | 'grade_id' => $grade_id |
| | | ]); |
| | | $list = $this->selectList(); |
| | | } |
| | | return $list; |
| | | } |
| | | |
| | | |
| | | private function selectList(){ |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['is_default'] = 0; |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | if($this['is_default'] == 0){ |
| | | $data['remark'] = $this->setRemark($data); |
| | | } |
| | | return $this->save($data); |
| | | } |
| | | |
| | | private function setRemark($data){ |
| | | $remark = ''; |
| | | if($data['open_agent_money'] == 1){ |
| | | $money = sprintf('%.2f',$data['agent_money']); |
| | | $remark .= "推广金额满{$money}元"; |
| | | } |
| | | if($data['open_agent_user'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "直推分销商满{$data['agent_user']}"; |
| | | } |
| | | if($data['is_purchase_count'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "购买VIP专区商品次数满{$data['purchase_count']}次"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | // 判断该等级下是否存在会员 |
| | | if (AgentUserModel::checkExistByGradeId($this['grade_id'])) { |
| | | return false; |
| | | } |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\agent\Product as AgentProductModel; |
| | | use app\common\model\product\Product as ProductModel; |
| | | |
| | | /** |
| | | * 分销商用户模型 |
| | | */ |
| | | class Product extends AgentProductModel |
| | | { |
| | | public function getList($product_id) |
| | | { |
| | | return $this->where('product_id', '=', $product_id) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 保存 |
| | | */ |
| | | public function edit($params) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | (new ProductModel())->where('product_id', '=', $params['product_id']) |
| | | ->save([ |
| | | 'is_agent' => $params['is_agent'], |
| | | ]); |
| | | // 参与分销 |
| | | if ($params['is_agent'] == 1) { |
| | | // 先删除 |
| | | $model = self::detail($params['product_id']); |
| | | if(!$model){ |
| | | $model = new self(); |
| | | } |
| | | $model->save(array_merge($params, [ |
| | | 'app_id' => self::$app_id |
| | | ])); |
| | | } |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //设置状态 |
| | | public function setAgent($productIds, $is_agent) |
| | | { |
| | | $productIds = explode(",",$productIds); |
| | | if($is_agent == 1){ |
| | | // 先删除 |
| | | $model = $this; |
| | | $model->where('product_id', 'in', $productIds)->delete(); |
| | | foreach ($productIds as $val){ |
| | | $save_data=[ |
| | | 'is_ind_agent' => 0, |
| | | 'agent_money_type' => 10, |
| | | 'product_id' => $val, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | $this->create($save_data); |
| | | } |
| | | } |
| | | return (new ProductModel)->where('product_id', 'in', $productIds)->save(['is_agent' => $is_agent]); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\agent\Referee as RefereeModel; |
| | | |
| | | /** |
| | | * 分销商用户模型 |
| | | */ |
| | | class Referee extends RefereeModel |
| | | { |
| | | /** |
| | | * 获取下级团队成员ID集 |
| | | */ |
| | | public function getTeamUserIds($agentId, $level = -1) |
| | | { |
| | | $level > -1 && $this->where('m.level', '=', $level); |
| | | return $this->alias('m') |
| | | ->join('user', 'user.user_id = m.user_id') |
| | | ->where('m.agent_id', '=', $agentId) |
| | | ->where('user.is_delete', '=', 0) |
| | | ->column('m.user_id'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定用户的推荐人列表 |
| | | */ |
| | | public static function getRefereeList($userId) |
| | | { |
| | | return (new static)->with(['agent1'])->where('user_id', '=', $userId)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 清空下级成员推荐关系 |
| | | */ |
| | | public function onClearTeam($agent_id, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1){ |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('agent_id', '=', $agent_id)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空上级推荐关系 |
| | | */ |
| | | public function onClearReferee($userId, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1) { |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('user_id', '=', $userId)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空2-3级推荐人的关系记录 |
| | | */ |
| | | public function onClearTop($teamIds) |
| | | { |
| | | return $this->where('user_id', 'in', $teamIds) |
| | | ->where('level', 'in', [2, 3]) |
| | | ->delete(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\agent\Referee as RefereeModel; |
| | | use app\common\model\plus\agent\Relation as RelationModel; |
| | | use app\common\model\user\User as UserModel; |
| | | |
| | | /** |
| | | * 分销商用户模型 |
| | | */ |
| | | class Relation extends RelationModel |
| | | { |
| | | |
| | | /** |
| | | * 创建推荐关系 |
| | | */ |
| | | public static function updateRelation($user_id, $referee_id, $level = 1, $later = array()) |
| | | { |
| | | // 自分享 |
| | | if ($user_id == $referee_id) { |
| | | return false; |
| | | } |
| | | |
| | | if (!empty($later)) { |
| | | if (self::inArray($referee_id, $later)) { |
| | | return UserModel::detail($referee_id); |
| | | } |
| | | } else { |
| | | $later[] = $user_id; |
| | | } |
| | | |
| | | $later[] = $referee_id; |
| | | $level = max($level, 1); |
| | | $model = new self; |
| | | if ( $level == 1 ) { |
| | | $model->add($referee_id, $user_id, 1); |
| | | } |
| | | |
| | | $parent_id = RefereeModel::getRefereeUserId($referee_id, 1); |
| | | if (empty($parent_id )) { |
| | | return false; |
| | | } else { |
| | | if ($user_id == $parent_id) { |
| | | return UserModel::detail($user_id); |
| | | } |
| | | $model->add($parent_id, $user_id, ++$level); |
| | | return self::updateRelation($user_id, $parent_id, $level, $later); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 新增关系记录 |
| | | */ |
| | | private function add($agent_id, $user_id, $level = 1) |
| | | { |
| | | // 新增推荐关系 |
| | | $app_id = self::$app_id; |
| | | $create_time = time(); |
| | | $this->insert(compact('agent_id', 'user_id', 'level', 'app_id', 'create_time')); |
| | | return true; |
| | | } |
| | | |
| | | private static function inArray($item, $array) |
| | | { |
| | | $flipArray = array_flip($array); |
| | | return isset($flipArray[$item]); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定用户的推荐人列表 |
| | | */ |
| | | public static function getRelationList($userId) |
| | | { |
| | | return (new static)->with(['agent1'])->where('user_id', '=', $userId)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定用户的推荐和间推团队列表 |
| | | */ |
| | | public static function getTeamList($userId) |
| | | { |
| | | return (new static)->with(['agent1'])->where('agent_id', '=', $userId)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 清空所有层级推荐关系 |
| | | */ |
| | | public function onClearRelation($userId, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1) { |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('user_id', '=', $userId)->delete(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use think\facade\Cache; |
| | | use app\common\model\plus\agent\Setting as SettingModel; |
| | | |
| | | /** |
| | | * 分销商设置模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | /** |
| | | * 设置项描述 |
| | | * @var array |
| | | */ |
| | | private $describe = [ |
| | | 'basic' => '基础设置', |
| | | 'condition' => '分销商条件', |
| | | 'commission' => '佣金设置', |
| | | 'settlement' => '结算', |
| | | 'words' => '自定义文字', |
| | | 'license' => '申请协议', |
| | | 'background' => '页面背景图', |
| | | 'template_msg' => '模板消息', |
| | | 'qrcode' => '分销海报', |
| | | ]; |
| | | |
| | | /** |
| | | * 更新系统设置 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | foreach ($data as $key => $values) |
| | | $this->saveValues($key, $values); |
| | | $this->commit(); |
| | | // 删除系统设置缓存 |
| | | Cache::delete('agent_setting_' . self::$app_id); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存设置项 |
| | | */ |
| | | private function saveValues($key, $values) |
| | | { |
| | | |
| | | $where['key'] = $key; |
| | | $res = $this->where($where)->select()->count(); |
| | | $data = [ |
| | | 'describe' => $this->describe[$key], |
| | | 'values' => $values, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($res == 1) { |
| | | return self::update($data, $where); |
| | | } |
| | | if ($res == 0) { |
| | | $data['key'] = $key; |
| | | return self::create($data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证结算方式 |
| | | */ |
| | | private function validSettlement($values) |
| | | { |
| | | if (!isset($values['pay_type']) || empty($values['pay_type'])) { |
| | | $this->error = '请设置 结算-提现方式'; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\agent; |
| | | |
| | | use app\common\model\plus\team\Referee as TeamRefereeModel; |
| | | use app\supplier\model\plus\agent\Referee as RefereeModel; |
| | | use app\common\model\plus\agent\User as UserModel; |
| | | use app\common\model\user\User as RealUserModel; |
| | | use app\shop\model\plus\agent\Relation as RelationModel; |
| | | use app\common\model\plus\team\User as TeamUserModel; |
| | | |
| | | /** |
| | | * 分销商用户模型 |
| | | * Class User |
| | | * @package app\shop\model\plus\agent |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取分销商用户列表 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | // 构建查询规则 |
| | | $model = $this->alias('agent') |
| | | ->field('agent.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee', 'grade']) |
| | | ->join('user', 'user.user_id = agent.user_id') |
| | | ->where('agent.is_delete', '=', 0) |
| | | ->order(['agent.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($data['nick_name'])) { |
| | | $model = $model->where('user.nickName|agent.real_name|agent.mobile', 'like', '%' . $data['nick_name'] . '%'); |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->paginate($data); |
| | | foreach ($list as $user){ |
| | | $user['total_money'] = sprintf('%.2f', $user['money'] + $user['freeze_money'] + $user['total_money']); |
| | | } |
| | | return $list; |
| | | } |
| | | /** |
| | | * 编辑分销商用户 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | // 开启事务 |
| | | $this->startTrans(); |
| | | try { |
| | | if(isset($data['referee_id']) && $data['referee_id'] != $this['referee_id']){ |
| | | // 删除原推荐人关系 |
| | | $this->onDeleteReferee($this['user_id']); |
| | | //更新推荐人的数量 by yj |
| | | (new RealUserModel())->setOnInvite($this['user_id'],$data['referee_id']); |
| | | // 修改用户推荐人 |
| | | (new RealUserModel())->where('user_id', '=', $this['user_id'])->update([ |
| | | 'referee_id' => $data['referee_id'] |
| | | ]); |
| | | // 修改团队的推荐人 by yj |
| | | (new TeamUserModel())->where('user_id', '=', $this['user_id'])->update([ |
| | | 'referee_id' => $data['referee_id'] |
| | | ]); |
| | | |
| | | // 记录推荐人关系, |
| | | $data['referee_id'] > 0 && RefereeModel::updateRelation($this['user_id'], $data['referee_id']); |
| | | |
| | | //处理变动用户底下的团队推荐人信息 by yj |
| | | $this->onTeamReferee($this['user_id']); |
| | | |
| | | // 重建团队分红关系 by yj |
| | | $data['referee_id'] > 0 && TeamRefereeModel::createTeam($data['referee_id']); |
| | | } |
| | | $this->save($data); |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理变动用户底下的团队推荐人信息上级推荐关系 |
| | | */ |
| | | public function onTeamReferee($userId) |
| | | { |
| | | // 获取变动用户所有推荐和间推用户列表 |
| | | $list = RelationModel::getTeamList($userId); |
| | | if (!$list->isEmpty()) { |
| | | foreach ($list as $item) { |
| | | if($item['user_id']){ |
| | | $user_data=RealUserModel::detail($item['user_id']);//获取推荐人 |
| | | $referee_id=$user_data["referee_id"]; |
| | | $user_id =$item['user_id']; |
| | | // 删除原推荐人关系 |
| | | $this->onDeleteReferee($user_id); |
| | | // 重新记录推荐人关系, |
| | | $referee_id > 0 && RefereeModel::updateRelation($user_id, $referee_id); |
| | | // 重新记录关系表所有层级的推荐人关系, |
| | | $referee_id> 0 && RelationModel::updateRelation($user_id, $referee_id); |
| | | // 重建团队分红关系 |
| | | $referee_id > 0 && TeamRefereeModel::createTeam($referee_id); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 删除分销商用户 |
| | | * @return mixed |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | return $this->transaction(function () { |
| | | // 获取一级团队成员ID集 |
| | | $RefereeModel = new RefereeModel; |
| | | $team1Ids = $RefereeModel->getTeamUserIds($this['user_id'], 1); |
| | | if (!empty($team1Ids)) { |
| | | // 一级团队成员归属到平台 |
| | | $this->setFromplatform($team1Ids); |
| | | // 一级推荐人ID |
| | | $referee1Id = RefereeModel::getRefereeUserId($this['user_id'], 1, true); |
| | | if ($referee1Id > 0) { |
| | | // 一级推荐人的成员数量(二级) |
| | | $this->setDecTeamNum($referee1Id, 2, count($team1Ids)); |
| | | // 一级推荐人的成员数量(三级) |
| | | $team2Ids = $RefereeModel->getTeamUserIds($this['user_id'], 2); |
| | | !empty($team2Ids) && $this->setDecTeamNum($referee1Id, 3, count($team2Ids)); |
| | | // 二级推荐人的成员数量(三级) |
| | | $referee2Id = RefereeModel::getRefereeUserId($this['user_id'], 2, true); |
| | | $referee2Id > 0 && $this->setDecTeamNum($referee2Id, 3, count($team1Ids)); |
| | | // 清空分销商下级成员与上级推荐人的关系记录 |
| | | $RefereeModel->onClearTop(array_merge($team1Ids, $team2Ids)); |
| | | } |
| | | } |
| | | // 清空下级推荐记录 |
| | | $RefereeModel->onClearTeam($this['user_id']); |
| | | // 标记当前分销商记录为已删除 |
| | | return $this->save([ |
| | | 'is_delete' => 1 |
| | | ]); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 一级团队成员归属到平台 |
| | | * @param $userIds |
| | | * @return false|int |
| | | */ |
| | | private function setFromplatform($userIds) |
| | | { |
| | | return $this->where('user_id', 'in', $userIds) |
| | | ->where('is_delete', '=', 0) |
| | | ->save(['referee_id' => 0]); |
| | | } |
| | | |
| | | /** |
| | | * 递减分销商成员数量 |
| | | */ |
| | | private function setDecTeamNum($agent_id, $level, $number) |
| | | { |
| | | $field = [1 => 'first_num', 2 => 'second_num', 3 => 'third_num']; |
| | | return $this->where('user_id', '=', $agent_id) |
| | | ->where('is_delete', '=', 0) |
| | | ->dec($field[$level], $number) |
| | | ->update(); |
| | | } |
| | | /** |
| | | * 提现打款成功:累积提现佣金 |
| | | */ |
| | | public static function totalMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | 'total_money' => $model['total_money'] + $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 提现驳回:解冻分销商资金 |
| | | */ |
| | | public static function backFreezeMoney($user_id, $money) |
| | | { |
| | | $model = self::detail($user_id); |
| | | return $model->save([ |
| | | 'money' => $model['money'] + $money, |
| | | 'freeze_money' => $model['freeze_money'] - $money, |
| | | ]); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户的上级推荐关系 |
| | | */ |
| | | public function onDeleteReferee($userId) |
| | | { |
| | | // 获取推荐人列表 |
| | | $list = RefereeModel::getRefereeList($userId); |
| | | $agent_user = self::detail($userId); |
| | | if (!$list->isEmpty()) { |
| | | // 递减推荐人的下级成员数量(如果该会员不是分销员则不减少分销数量) |
| | | if($agent_user){ |
| | | foreach ($list as $item) { |
| | | $item['agent1'] && $this->setDecTeamNum($item['agent_id'], $item['level'], 1); |
| | | } |
| | | } |
| | | |
| | | // 清空上级推荐关系 |
| | | (new RefereeModel)->onClearReferee($userId); |
| | | } |
| | | return true; |
| | | } |
| | | /** |
| | | * 添加分销的推荐人的数量 |
| | | */ |
| | | public function addAgentRefereeNum($userId) |
| | | { |
| | | // 获取推荐人列表 |
| | | $list = RefereeModel::getRefereeList($userId); |
| | | if (!$list->isEmpty()) { |
| | | // 递增推荐人的下级成员数量 |
| | | foreach ($list as $item) { |
| | | $item['agent1'] && $this->setIncTeamNum($item['agent_id'], $item['level'], 1); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取平台的总销售额 |
| | | */ |
| | | public function getTotalMoney($type = 'all_money') |
| | | { |
| | | $model = $this; |
| | | if($type == 'money'){ |
| | | return $model->sum('money'); |
| | | } else if($type == 'freeze_money'){ |
| | | return $model->sum('freeze_money'); |
| | | } else if($type == 'total_money'){ |
| | | return $model->sum('total_money'); |
| | | } else if($type == 'all_money'){ |
| | | return $model->sum('total_money') + $model->sum('freeze_money') + $model->sum('money'); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 指定会员等级下是否存在用户 |
| | | */ |
| | | public static function checkExistByGradeId($gradeId) |
| | | { |
| | | $model = new static; |
| | | return !!$model->where('grade_id', '=', (int)$gradeId) |
| | | ->where('is_delete', '=', 0) |
| | | ->value('user_id'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\api\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\plus\bonus\Apply as ApplyModel; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\model\plus\bonus\Grade as GradeModel; |
| | | |
| | | /** |
| | | * 队长入驻申请模型 |
| | | */ |
| | | class Apply extends ApplyModel |
| | | { |
| | | /** |
| | | * 获取队长申请列表 |
| | | * @noinspection PhpUndefinedMethodInspection |
| | | */ |
| | | public function getList($search) |
| | | { |
| | | $model = $this->alias('apply') |
| | | ->field('apply.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee']) |
| | | ->join('user', 'user.user_id = apply.user_id') |
| | | ->order(['apply.create_time' => 'desc']); |
| | | if (!empty($search['nick_name'])) { |
| | | $model = $model->where('user.nickName|apply.real_name|apply.mobile', 'like', '%' . $search['nick_name'] . '%'); |
| | | } |
| | | |
| | | // 获取列表数据 |
| | | return $model->paginate($search['list_rows']); |
| | | } |
| | | |
| | | /** |
| | | * 队长入驻审核 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function submit($data) |
| | | { |
| | | if ($data['apply_status'] == '30' && empty($data['reject_reason'])) { |
| | | $this->error = '请填写驳回原因'; |
| | | return false; |
| | | } |
| | | $this->startTrans(); |
| | | if ($data['apply_status'] == '20') { |
| | | $grade_id=GradeModel::getDefaultGradeId(); |
| | | // 新增队长用户 |
| | | User::add($data['user_id'], [ |
| | | 'real_name' => $data['real_name'], |
| | | 'mobile' => $data['mobile'], |
| | | 'referee_id' => $data['referee_id'], |
| | | 'grade_id'=>$grade_id |
| | | ]); |
| | | } |
| | | $save_data = [ |
| | | 'audit_time' => time(), |
| | | 'apply_status' => $data['apply_status'], |
| | | 'reject_reason' => $data['reject_reason'], |
| | | ]; |
| | | $this->save($save_data); |
| | | // 记录推荐人关系 |
| | | if ($data['referee_id'] > 0) { |
| | | RefereeModel::createRelation($data['user_id'], $data['referee_id']); |
| | | } |
| | | // 发送模板消息 |
| | | (new MessageService)->team($this); |
| | | $this->commit(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取申请中的数量 |
| | | */ |
| | | public static function getApplyCount(){ |
| | | return (new static())->where('apply_status', '=', 10)->count(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Capital as CapitalModel; |
| | | |
| | | /** |
| | | * 队长资金明细模型 |
| | | */ |
| | | class Capital extends CapitalModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\library\easywechat\AppWx; |
| | | use app\common\library\easywechat\AppMp; |
| | | use app\common\service\message\MessageService; |
| | | use app\common\service\order\OrderService; |
| | | use app\common\library\easywechat\WxPay; |
| | | use app\common\model\plus\bonus\Cash as CashModel; |
| | | use app\supplier\model\user\User as UserModel; |
| | | use app\supplier\service\order\ExportService; |
| | | /** |
| | | * 队长提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取器:申请时间 |
| | | */ |
| | | public function getAuditTimeAttr($value) |
| | | { |
| | | return $value > 0 ? date('Y-m-d H:i:s', $value) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取器:打款方式 |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | return ['text' => $this->payType[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 获取队长提现列表 |
| | | */ |
| | | public function getList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '', $params = []) |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, bonus.real_name, bonus.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('bonus_user bonus', 'bonus.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($search)) { |
| | | if ($params['search_type'] == 'user_id') { |
| | | $model = $model->where('cash.user_id', '=', $search); |
| | | } else if ($params['search_type'] == 'nickName') { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search . '%'); |
| | | } else { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | //搜索时间段 |
| | | if (isset($params['create_time']) && $params['create_time'] != '') { |
| | | $model = $model->where('cash.create_time', 'between', [strtotime($params['create_time'][0]), strtotime($params['create_time'][1]) + 86399]); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->paginate($params); |
| | | } |
| | | |
| | | /** |
| | | * 队长提现审核 |
| | | */ |
| | | public function submit($param) |
| | | { |
| | | $data = ['apply_status' => $param['apply_status']]; |
| | | if ($param['apply_status'] == 30) { |
| | | $data['reject_reason'] = $param['reject_reason']; |
| | | } |
| | | // 更新申请记录 |
| | | $data['audit_time'] = time(); |
| | | self::update($data, ['id' => $param['id']]); |
| | | // 提现驳回:解冻队长资金 |
| | | if ($param['apply_status'] == 30) { |
| | | User::backFreezeMoney($param['user_id'], $param['money']); |
| | | } |
| | | |
| | | // 发送模板消息 |
| | | (new MessageService)->cash($this); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 确认已打款 |
| | | */ |
| | | public function money() |
| | | { |
| | | // 如果是完税系统打款 by lyzflash |
| | | if ($this['is_yms']) { |
| | | return $this->ymsMoney(); |
| | | } |
| | | $this->startTrans(); |
| | | try { |
| | | // 更新申请状态 |
| | | $data = ['apply_status' => 40, 'audit_time' => time()]; |
| | | self::update($data, ['id' => $this['id']]); |
| | | |
| | | // 如果是打款到余额 |
| | | if ($this['pay_type']['value'] == 40) { |
| | | UserModel::cashToBalance($this['user_id'], $this['money'], '分红提现到余额-cash_id:' . $this['id']); |
| | | } |
| | | |
| | | // 更新队长累积提现佣金 |
| | | User::totalMoney($this['user_id'], $this['money']); |
| | | |
| | | // 记录队长资金明细 |
| | | Capital::add([ |
| | | 'user_id' => $this['user_id'], |
| | | 'flow_type' => 20, |
| | | 'money' => -$this['money'], |
| | | 'describe' => '申请提现', |
| | | ]); |
| | | // 发送模板消息 |
| | | //(new Message)->withdraw($this); |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 完税系统打款 by lyzflash |
| | | */ |
| | | public function ymsMoney() |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | $result = (new YmsModel($this['app_id']))->batchPay([$this]); |
| | | if ($result && $result['code'] != '0') { |
| | | $this->error = $result['msg']; |
| | | return false; |
| | | } |
| | | $resData = $result['data']; |
| | | // 统一记录付款信息 |
| | | $ymsData = []; |
| | | $errorArr = []; |
| | | foreach ($resData['payItemList'] as $item) { |
| | | if ($item['status'] == '0') { |
| | | (new CashModel)->where('cash_no', '=', $item['merchantOrderId'])->save([ |
| | | 'merBatchId' => $resData['merchantBatchId'], // 商户批次号 |
| | | 'payItemId' => $item['orderNo'], // 订单流水号 |
| | | 'apply_status' => 50, // 付款中 |
| | | ]); |
| | | $ymsData[] = [ |
| | | 'user_id' => $this['user_id'], |
| | | 'merOrderId' => $item['merchantOrderId'], // 商户订单号(cash_no) |
| | | 'payItemId' => $item['orderNo'], // 完税系统返回的订单流水号 |
| | | 'merBatchId' => $resData['merchantBatchId'], // 商户批次号 |
| | | 'orderBatchNo' => $resData['orderBatchNo'], // 订单批次号 |
| | | 'cash_type' => CashTypeEnum::BONUS, // 提现来源标识 |
| | | 'money' => $item['amt'] / 100, |
| | | 'app_id' => $this['app_id'], |
| | | ]; |
| | | } else { |
| | | $this->error = $item['errorMsg']; |
| | | return false; |
| | | } |
| | | } |
| | | if ($ymsData) { |
| | | (new YmsSettlementModel)->saveAll($ymsData); |
| | | } |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 队长提现:微信支付企业付款 |
| | | */ |
| | | public function wechatPay() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '队长提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app = []; |
| | | if($user['reg_source'] == 'mp'){ |
| | | $app = AppMp::getWxPayApp($user['app_id']); |
| | | $open_id = $user['mpopen_id']; |
| | | }else if($user['reg_source'] == 'wx'){ |
| | | $app = AppWx::getWxPayApp($user['app_id']); |
| | | $open_id = $user['open_id']; |
| | | } |
| | | |
| | | if($open_id == ''){ |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $WxPay = new WxPay($app); |
| | | //打款金额 |
| | | $money = floatval($this['money']) - floatval($this['fee_money']); |
| | | // 请求付款api |
| | | if ($WxPay->transfers($orderNO, $open_id, $money, $desc)) { |
| | | // 确认已打款 |
| | | $this->money(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /* |
| | | *统计提现总数量 |
| | | */ |
| | | public function getteamOrderTotal() |
| | | { |
| | | return $this->count('id'); |
| | | } |
| | | |
| | | /* |
| | | * 统计提现待审核总数量 |
| | | */ |
| | | public function getteamApplyTotal($apply_status) |
| | | { |
| | | return $this->where('apply_status', '=', $apply_status)->count(); |
| | | } |
| | | |
| | | /* |
| | | * 统计提现待审核金额 |
| | | */ |
| | | public function getteamApplyMoney() |
| | | { |
| | | return $this->where('apply_status', '=', 10)->sum('real_money'); |
| | | } |
| | | |
| | | /* |
| | | *获取提现待打款总数量 by lyzflash 2023.02.08 |
| | | */ |
| | | public function getCashPayNum() |
| | | { |
| | | return $this->where('apply_status', '=', 20)->count(); |
| | | } |
| | | |
| | | /* |
| | | *统计待打款的金额 by lyzflash 2023.02.08 |
| | | */ |
| | | public function getCashPayMoney() |
| | | { |
| | | return $this->where('apply_status', '=', 20)->sum('real_money'); |
| | | } |
| | | |
| | | /** |
| | | * 导出分红提现 |
| | | */ |
| | | public function exportList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '', $params = []) |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, agent.real_name, agent.mobile, user.nickName, user.avatarUrl') |
| | | ->join('user', 'user.user_id = cash.user_id') |
| | | ->join('agent_user agent', 'agent.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if (!empty($search)) { |
| | | if ($params['search_type'] == 'user_id') { |
| | | $model = $model->where('cash.user_id', '=', $search); |
| | | } else if ($params['search_type'] == 'nickName') { |
| | | $model = $model->where('user.nickName', 'like', '%' . $search . '%'); |
| | | } else { |
| | | $model = $model->where('agent.real_name|agent.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | //搜索时间段 |
| | | if (isset($params['create_time']) && $params['create_time'] != '') { |
| | | $model = $model->where('cash.create_time', 'between', [strtotime($params['create_time'][0]), strtotime($params['create_time'][1]) + 86399]); |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | // 导出excel文件 |
| | | (new Exportservice)->bonusCashList($list); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Grade as GradeModel; |
| | | use app\supplier\model\plus\bonus\User as UserModel; |
| | | |
| | | /** |
| | | * 用户会员等级模型 |
| | | */ |
| | | class Grade extends GradeModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | /** |
| | | * 获取可用的分红等级列表 |
| | | */ |
| | | public static function getUsableList($appId = null) |
| | | { |
| | | $model = new static; |
| | | $appId = $appId ? $appId : $model::$app_id; |
| | | return $model->where('is_delete', '=', '0') |
| | | ->where('app_id', '=', $appId) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['is_default'] = 0; |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | if($this['is_default'] == 0){ |
| | | |
| | | $data['remark'] = $this->setRemark($data); |
| | | } |
| | | return $this->save($data); |
| | | } |
| | | |
| | | private function setRemark($data){ |
| | | $remark = ''; |
| | | if($data['open_money'] == 1){ |
| | | $money = sprintf('%.2f',$data['upgrade_money']); |
| | | $remark .= "会员消费满{$money}元可升级到此等级"; |
| | | } |
| | | if($data['open_points'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员积分满{$data['upgrade_points']}可升级到此等级"; |
| | | } |
| | | if($data['open_invite'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员邀请人数满{$data['upgrade_invite']}可升级到此等级"; |
| | | } |
| | | if($data['open_agent1'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员直推分销商人数满{$data['upgrade_agent1']}可升级到此等级"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | // 判断该等级下是否存在会员 |
| | | if (UserModel::checkExistByGradeId($this['grade_id'])) { |
| | | return false; |
| | | } |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\GradeLog as GradeLogModel; |
| | | |
| | | /** |
| | | * 用户会员等级变更记录模型 |
| | | */ |
| | | class GradeLog extends GradeLogModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Order as OrderModel; |
| | | use app\common\service\order\OrderService; |
| | | /** |
| | | * 队长订单模型 |
| | | */ |
| | | class Order extends OrderModel |
| | | { |
| | | /** |
| | | * 获取队长订单列表 |
| | | */ |
| | | public function getList($user_id = null, $is_settled = -1) |
| | | { |
| | | $model = $this; |
| | | // 检索查询条件 |
| | | if ($user_id > 1) { |
| | | $model = $model->where('first_user_id|second_user_id', '=', $user_id); |
| | | } |
| | | if ($is_settled > -1) { |
| | | $model = $model->where('is_settled', '=', $is_settled); |
| | | } |
| | | // 获取队长订单列表 |
| | | $data = $model->with([ |
| | | 'bonus_first', |
| | | 'bonus_second', |
| | | 'subsidy' |
| | | ]) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate(15); |
| | | if ($data->isEmpty()) { |
| | | return $data; |
| | | } |
| | | // 获取订单的主信息 |
| | | $with = ['product' => ['image', 'refund'], 'address', 'user']; |
| | | return OrderService::getOrderList($data, 'order_master', $with); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\common\model\plus\bonus\Referee as RefereeModel; |
| | | |
| | | /** |
| | | * 队长用户模型 |
| | | */ |
| | | class Referee extends RefereeModel |
| | | { |
| | | /** |
| | | * 获取下级团队成员ID集 |
| | | */ |
| | | public function getBonusUserIds($teamId, $level = -1) |
| | | { |
| | | $level > -1 && $this->where('m.level', '=', $level); |
| | | return $this->alias('m') |
| | | ->join('user', 'user.user_id = m.user_id') |
| | | ->where('m.bonus_id', '=', $teamId) |
| | | ->where('user.is_delete', '=', 0) |
| | | ->column('m.user_id'); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定用户的推荐人列表 |
| | | */ |
| | | public static function getRefereeList($userId) |
| | | { |
| | | return (new static)->with(['team1'])->where('user_id', '=', $userId)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 清空下级成员推荐关系 |
| | | */ |
| | | public function onClearBonus($bonus_id, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1){ |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('bonus_id', '=', $bonus_id)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空上级推荐关系 |
| | | */ |
| | | public function onClearReferee($userId, $level = -1) |
| | | { |
| | | $model = $this; |
| | | if($level > -1) { |
| | | $model = $model->where('level', '=', $level); |
| | | } |
| | | return $model->where('user_id', '=', $userId)->delete(); |
| | | } |
| | | |
| | | /** |
| | | * 清空2-3级推荐人的关系记录 |
| | | */ |
| | | public function onClearTop($teamIds) |
| | | { |
| | | return $this->where('user_id', 'in', $teamIds) |
| | | ->where('level', 'in', [2, 3]) |
| | | ->delete(); |
| | | } |
| | | |
| | | public static function updateReferee($user_id, $new_user_id) |
| | | { |
| | | (new static)->where('user_id', '=', $user_id) |
| | | ->save(['user_id' => $new_user_id]); |
| | | (new static)->where('bonus_id', '=', $user_id) |
| | | ->save(['bonus_id' => $new_user_id]); |
| | | return true; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use think\facade\Cache; |
| | | use app\common\model\plus\bonus\Setting as SettingModel; |
| | | |
| | | /** |
| | | * 队长设置模型 |
| | | */ |
| | | class Setting extends SettingModel |
| | | { |
| | | /** |
| | | * 设置项描述 |
| | | * @var array |
| | | */ |
| | | private $describe = [ |
| | | 'basic' => '基础设置', |
| | | 'condition' => '加入条件', |
| | | 'commission' => '分红设置', |
| | | 'settlement' => '结算', |
| | | 'words' => '自定义文字', |
| | | 'license' => '申请协议', |
| | | 'background' => '页面背景图', |
| | | 'template_msg' => '模板消息', |
| | | 'qrcode' => '分红海报', |
| | | ]; |
| | | |
| | | /** |
| | | * 更新系统设置 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | foreach ($data as $key => $values) |
| | | $this->saveValues($key, $values); |
| | | $this->commit(); |
| | | // 删除系统设置缓存 |
| | | Cache::delete('bonus_setting_' . self::$app_id); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存设置项 |
| | | */ |
| | | private function saveValues($key, $values) |
| | | { |
| | | |
| | | $where['key'] = $key; |
| | | $res = $this->where($where)->select()->count(); |
| | | $data = [ |
| | | 'describe' => $this->describe[$key], |
| | | 'values' => $values, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | if ($res == 1) { |
| | | return self::update($data, $where); |
| | | } |
| | | if ($res == 0) { |
| | | $data['key'] = $key; |
| | | return self::create($data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证结算方式 |
| | | */ |
| | | private function validSettlement($values) |
| | | { |
| | | if (!isset($values['pay_type']) || empty($values['pay_type'])) { |
| | | $this->error = '请设置 结算-提现方式'; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\bonus; |
| | | |
| | | use app\supplier\model\plus\bonus\Referee as RefereeModel; |
| | | use app\common\model\plus\bonus\User as UserModel; |
| | | use app\common\model\user\User as UserModel1; |
| | | use app\common\model\plus\agent\User as agentUser; |
| | | use app\common\model\plus\agent\Referee as agentReferee; |
| | | use app\common\library\helper; |
| | | use app\supplier\service\order\ExportService; |
| | | |
| | | /** |
| | | * 队长用户模型 |
| | | * Class User |
| | | * @package app\shop\model\plus\bonus |
| | | */ |
| | | class User extends UserModel |
| | | { |
| | | /** |
| | | * 获取队长用户列表 |
| | | */ |
| | | public function getList($keyword, $search_type = 'user_id', $params = []) |
| | | { |
| | | // 构建查询规则 |
| | | $model = $this->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent','agentuser']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['bonus.tree_level' => 'asc', 'level_num' => 'asc', 'agent_time' => '']); |
| | | // 查询条件 |
| | | if (!empty($keyword)) { |
| | | if ($search_type == 'user_id') { |
| | | $model = $model->where('bonus.user_id', '=', $keyword); |
| | | } else { |
| | | if ($search_type == 'nickName') { |
| | | $search_field = 'user.' . $search_type; |
| | | } else { |
| | | $search_field = 'bonus.' . $search_type; |
| | | } |
| | | $model = $model->where($search_field, 'like', '%' . $keyword . '%'); |
| | | } |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->paginate($params); |
| | | $setting = Setting::getItem('basic'); |
| | | $userData = []; |
| | | foreach ($list as &$user){ |
| | | $user['total_money'] = sprintf('%.2f', $user['money'] + $user['freeze_money'] + $user['total_money']); |
| | | // 排位有效期 |
| | | $user['remain_time'] = UserModel::getExpireTime($user['user_id']); |
| | | // $user['is_expire'] = UserModel::isExpire($user['user_id']); |
| | | |
| | | // 初始化最新推荐人推荐时间 |
| | | // $agentuser = $user['agentuser']->toArray(); |
| | | // if($agentuser) { |
| | | // $agent_time = strtotime($agentuser[0]['create_time']); |
| | | // } else { |
| | | // $agent_time = strtotime($user['create_time']); |
| | | // } |
| | | // $userData[] = [ |
| | | // 'user_id' => $user['user_id'], |
| | | // 'agent_time' => $agent_time |
| | | // ]; |
| | | } |
| | | unset($user); |
| | | // $this->saveAll($userData); |
| | | return $list; |
| | | } |
| | | /** |
| | | * 编辑队长用户 |
| | | * @param $data |
| | | * @return bool |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | //如果更换用户 |
| | | $new_user_id = $data['new_user_id']; |
| | | unset($data['new_user_id']); |
| | | if($new_user_id) { |
| | | $new_data = $data; |
| | | $new_user = UserModel1::detail($new_user_id); |
| | | $new_data['user_id'] = $new_user_id; |
| | | $new_data['referee_id'] = $new_user['referee_id']; |
| | | $setting = Setting::getItem('basic', $new_user['app_id']); |
| | | // 如果不保留资产 by lyzflash |
| | | if ($setting['keep_assets'] == 0) { |
| | | $new_data['money'] = 0; |
| | | $new_data['freeze_money'] = 0; |
| | | $new_data['freeze_money_second'] = 0; |
| | | $new_data['total_money'] = 0; |
| | | } |
| | | if ($this->where(['user_id' => $data['user_id']])->save($new_data)) { |
| | | //将原用户下级改为新用户下级 |
| | | $this->updateParentId($data['user_id'], $new_user_id); |
| | | //更新关系表 |
| | | RefereeModel::updateReferee($data['user_id'], $new_user_id); |
| | | //同时成为分销商 |
| | | $config = Setting::getItem('basic', $new_user['app_id']); |
| | | if ($config['become_agent']) { |
| | | agentUser::add($new_user_id, [ |
| | | 'referee_id' => agentReferee::getRefereeUserId($new_user_id, 1), |
| | | 'app_id' => $new_user['app_id'], |
| | | ]); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return $this->save($data) !== false; |
| | | } |
| | | |
| | | /** |
| | | * 删除队长用户 |
| | | * @return mixed |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | return $this->transaction(function () { |
| | | // 获取一级团队成员ID集 |
| | | $RefereeModel = new RefereeModel; |
| | | $bonus1Ids = $RefereeModel->getBonusUserIds($this['user_id'], 1); |
| | | if (!empty($bonus1Ids)) { |
| | | // 一级团队成员归属到平台 |
| | | $this->setFromplatform($bonus1Ids); |
| | | // 一级推荐人ID |
| | | $referee1Id = RefereeModel::getRefereeUserId($this['user_id'], 1, true); |
| | | if ($referee1Id > 0) { |
| | | // 一级推荐人的成员数量(二级) |
| | | $this->setDecBonusNum($referee1Id, 2, count($bonus1Ids)); |
| | | // 一级推荐人的成员数量(三级) |
| | | $bonus2Ids = $RefereeModel->getBonusUserIds($this['user_id'], 2); |
| | | !empty($bonus2Ids) && $this->setDecBonusNum($referee1Id, 3, count($bonus2Ids)); |
| | | // 二级推荐人的成员数量(三级) |
| | | $referee2Id = RefereeModel::getRefereeUserId($this['user_id'], 2, true); |
| | | $referee2Id > 0 && $this->setDecBonusNum($referee2Id, 3, count($bonus1Ids)); |
| | | // 清空队长下级成员与上级推荐人的关系记录 |
| | | $RefereeModel->onClearTop(array_merge($bonus1Ids, $bonus2Ids)); |
| | | } |
| | | } |
| | | // 清空下级推荐记录 |
| | | $RefereeModel->onClearBonus($this['user_id']); |
| | | // 标记当前队长记录为已删除 |
| | | return $this->save([ |
| | | 'is_delete' => 1 |
| | | ]); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 更改用户的parent_id |
| | | * @param $user_id |
| | | * @param $new_user_id |
| | | * @return false|int |
| | | */ |
| | | private function updateParentId($user_id, $new_user_id) |
| | | { |
| | | return $this->where('parent_id', '=', $user_id) |
| | | ->save(['parent_id' => $new_user_id]); |
| | | } |
| | | |
| | | /** |
| | | * 一级团队成员归属到平台 |
| | | * @param $userIds |
| | | * @return false|int |
| | | */ |
| | | private function setFromplatform($userIds) |
| | | { |
| | | return $this->where('user_id', 'in', $userIds) |
| | | ->where('is_delete', '=', 0) |
| | | ->save(['referee_id' => 0]); |
| | | } |
| | | |
| | | /** |
| | | * 递减队长成员数量 |
| | | */ |
| | | private function setDecBonusNum($bonus_id, $level, $number) |
| | | { |
| | | $field = [1 => 'first_num', 2 => 'second_num', 3 => 'third_num']; |
| | | return $this->where('user_id', '=', $bonus_id) |
| | | ->where('is_delete', '=', 0) |
| | | ->dec($field[$level], $number); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户的上级推荐关系 |
| | | * @param $userId |
| | | * @return bool |
| | | * @throws \think\Exception |
| | | */ |
| | | public function onDeleteReferee($userId) |
| | | { |
| | | // 获取推荐人列表 |
| | | $list = RefereeModel::getRefereeList($userId); |
| | | if (!$list->isEmpty()) { |
| | | // 递减推荐人的下级成员数量 |
| | | foreach ($list as $item) { |
| | | $item['bonus1'] && $this->setDecBonusNum($item['bonus_id'], $item['level'], 1); |
| | | } |
| | | // 清空上级推荐关系 |
| | | (new RefereeModel)->onClearReferee($userId); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 获取平台的总销售额 |
| | | */ |
| | | public function getTotalMoney($type = 'all_money') |
| | | { |
| | | $model = $this; |
| | | if($type == 'money'){ |
| | | return $model->sum('money'); |
| | | } else if($type == 'freeze_money'){ |
| | | return $model->sum('freeze_money'); |
| | | } else if($type == 'freeze_money_second'){ |
| | | return $model->sum('freeze_money_second'); |
| | | } else if($type == 'total_money'){ |
| | | return $model->sum('total_money'); |
| | | } else if($type == 'all_money'){ |
| | | return $model->sum('total_money') + $model->sum('freeze_money') + $model->sum('money'); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public function getArchitecture($search = '', $type = 0) |
| | | { |
| | | $model = new UserModel(); |
| | | $model = $model->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0); |
| | | if (!empty($search)) { |
| | | if ($type) { |
| | | if (intval($search)) { |
| | | $model = $model->where('bonus.user_id', '=', $search); |
| | | } else { |
| | | $model = $model->where('user.nickName|bonus.real_name|bonus.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | } else { |
| | | $model = $model->where('bonus.user_id', '=', $search); |
| | | } |
| | | } else { |
| | | $model = $model->where('bonus.tree_level', '=', 1); |
| | | } |
| | | $firstUser = $model->find(); |
| | | if (!$firstUser) { |
| | | return false; |
| | | } |
| | | $secondUser = $this->getArchitectureSubUser($firstUser); |
| | | $thirdUser = []; |
| | | foreach ($secondUser as &$user) { |
| | | $thirdUser = array_merge($thirdUser, $this->getArchitectureSubUser($user)); |
| | | } |
| | | unset($user); |
| | | return ['firstUser' => $firstUser, 'secondUser' => $secondUser, 'thirdUser' => $thirdUser]; |
| | | } |
| | | |
| | | private function getArchitectureSubUser($user) |
| | | { |
| | | if ($user) { |
| | | $model = new UserModel(); |
| | | $subUser = $model->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('parent_id', '=', $user['user_id']) |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['level_num' => 'asc']) |
| | | ->select()->toArray(); |
| | | } else { |
| | | $subUser = []; |
| | | } |
| | | // 补全3个位置 |
| | | if (count($subUser) < 3) { |
| | | $emptyArr = []; |
| | | for ($i = 0; $i < 3 - count($subUser); $i++) { |
| | | $emptyArr[] = []; |
| | | } |
| | | $subUser = array_merge($subUser, $emptyArr); |
| | | } |
| | | return $subUser; |
| | | } |
| | | |
| | | /** |
| | | * 获取队长用户列表 |
| | | */ |
| | | public function exportList($keyword, $search_type = 'user_id', $params = []) |
| | | { |
| | | // 构建查询规则 |
| | | $model = $this->alias('bonus') |
| | | ->field('bonus.*, user.nickName, user.avatarUrl') |
| | | ->with(['referee','grade','parent','agentuser']) |
| | | ->join('user', 'user.user_id = bonus.user_id') |
| | | ->where('bonus.is_delete', '=', 0) |
| | | ->order(['bonus.tree_level' => 'asc', 'level_num' => 'asc', 'agent_time' => '']); |
| | | // 查询条件 |
| | | if (!empty($keyword)) { |
| | | if ($search_type == 'user_id') { |
| | | $model = $model->where('bonus.user_id', '=', $keyword); |
| | | } else { |
| | | if ($search_type == 'nickName') { |
| | | $search_field = 'user.' . $search_type; |
| | | } else { |
| | | $search_field = 'bonus.' . $search_type; |
| | | } |
| | | $model = $model->where($search_field, 'like', '%' . $keyword . '%'); |
| | | } |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | foreach ($list as &$user){ |
| | | $user['total_money'] = sprintf('%.2f', $user['money'] + $user['freeze_money'] + $user['total_money']); |
| | | // 排位有效期 |
| | | $user['remain_time'] = UserModel::getExpireTime($user['user_id']); |
| | | } |
| | | unset($user); |
| | | // 导出excel文件 |
| | | (new Exportservice)->bonusUserList($list); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\coupon; |
| | | |
| | | use app\common\model\plus\coupon\Coupon as CouponModel; |
| | | |
| | | /** |
| | | * 优惠券模型 |
| | | */ |
| | | class Coupon extends CouponModel |
| | | { |
| | | /** |
| | | * 获取优惠券列表getList |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if (isset($data['shop_supplier_id'])) { |
| | | $model = $model->where('coupon.shop_supplier_id', '=', $data['shop_supplier_id']); |
| | | } |
| | | return $model->alias('coupon')->field(['coupon.*,supplier.name as supplier_name']) |
| | | ->join('supplier', 'coupon.shop_supplier_id = supplier.shop_supplier_id', 'left') |
| | | ->where('coupon.is_delete', '=', 0) |
| | | ->order(['coupon.sort' => 'asc', 'coupon.create_time' => 'desc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | /** |
| | | * 添加新记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['shop_supplier_id'] = 0; |
| | | if ($data['expire_type'] == '20') { |
| | | $data['start_time'] = strtotime($data['active_time'][0]); |
| | | $data['end_time'] = strtotime($data['active_time'][1]); |
| | | } |
| | | // 限制商品id |
| | | if($data['apply_range'] == 20){ |
| | | $data['product_ids'] = implode(',', $data['product_ids']); |
| | | } |
| | | $category_first_ids = []; |
| | | $category_second_ids = []; |
| | | if($data['apply_range'] == 30){ |
| | | if(isset($data['category_list']['first'])){ |
| | | foreach($data['category_list']['first'] as $item){ |
| | | array_push($category_first_ids, $item['category_id']); |
| | | } |
| | | } |
| | | if(isset($data['category_list']['second'])) { |
| | | foreach ($data['category_list']['second'] as $item) { |
| | | array_push($category_second_ids, $item['category_id']); |
| | | } |
| | | } |
| | | $data['category_ids'] = [ |
| | | 'first' => $category_first_ids, |
| | | 'second' => $category_second_ids |
| | | ]; |
| | | $data['category_ids'] = json_encode($data['category_ids']); |
| | | } |
| | | return self::create($data); |
| | | } |
| | | |
| | | /** |
| | | * 更新记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | if ($data['expire_type'] == '20') { |
| | | $data['start_time'] = strtotime($data['active_time'][0]); |
| | | $data['end_time'] = strtotime($data['active_time'][1]); |
| | | } |
| | | // 限制商品id |
| | | if($data['apply_range'] == 20){ |
| | | $data['product_ids'] = implode(',', $data['product_ids']); |
| | | } |
| | | $category_first_ids = []; |
| | | $category_second_ids = []; |
| | | if($data['apply_range'] == 30){ |
| | | if(isset($data['category_list']['first'])){ |
| | | foreach($data['category_list']['first'] as $item){ |
| | | array_push($category_first_ids, $item['category_id']); |
| | | } |
| | | } |
| | | if(isset($data['category_list']['second'])) { |
| | | foreach ($data['category_list']['second'] as $item) { |
| | | array_push($category_second_ids, $item['category_id']); |
| | | } |
| | | } |
| | | $data['category_ids'] = [ |
| | | 'first' => $category_first_ids, |
| | | 'second' => $category_second_ids |
| | | ]; |
| | | $data['category_ids'] = json_encode($data['category_ids']); |
| | | } |
| | | $where['coupon_id'] = $data['coupon_id']; |
| | | unset($data['coupon_id']); |
| | | return self::update($data, $where); |
| | | } |
| | | |
| | | /** |
| | | * 删除记录 (软删除) |
| | | */ |
| | | public function setDelete($where) |
| | | { |
| | | return self::update(['is_delete' => 1], $where); |
| | | } |
| | | |
| | | /** |
| | | * 查询指定优惠券 |
| | | * @param $value |
| | | */ |
| | | public function getCoupon($value) |
| | | { |
| | | return $this->where('coupon_id', 'in', $value)->select(); |
| | | } |
| | | |
| | | /** |
| | | * 查询指定优惠券 |
| | | * @param $value |
| | | */ |
| | | public function getCoupons($value) |
| | | { |
| | | $data = $this->where('coupon_id', 'in', $value)->select(); |
| | | $name = ''; |
| | | if (!empty($data)) { |
| | | foreach ($data as $val) { |
| | | $name .= $val['name'] . ','; |
| | | } |
| | | } |
| | | |
| | | return $name; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\plus\coupon; |
| | | |
| | | use app\common\exception\BaseException; |
| | | use app\supplier\model\user\User; |
| | | use app\common\model\plus\coupon\UserCoupon as UserCouponModel; |
| | | |
| | | /** |
| | | * 用户优惠券模型 |
| | | */ |
| | | class UserCoupon extends UserCouponModel |
| | | { |
| | | /** |
| | | * 获取优惠券列表 |
| | | */ |
| | | public function getList($limit = 20) |
| | | { |
| | | return $this->with(['user']) |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($limit); |
| | | } |
| | | |
| | | /** |
| | | * 发送优惠券 |
| | | * @param int $send_type 1给所有会员 2给指定等级的用户 3给指定用户发送 |
| | | * @param int $coupon_id |
| | | * @param int $user_level |
| | | * @param string $user_ids |
| | | */ |
| | | public function SendCoupon($data) |
| | | { |
| | | $send_type = $data['send_type']; |
| | | $coupon_id = $data['coupon_id']; |
| | | $user_level = $data['user_level']; |
| | | $user_ids = $data['user_ids']; |
| | | $user = new User(); |
| | | $coupon = Coupon::detail($coupon_id); |
| | | if (empty($coupon)) { |
| | | throw new BaseException(['msg' => '未找到优惠券信息']); |
| | | return false; |
| | | } |
| | | if ($send_type == 1) { |
| | | $user_arr = $user->getUsers(); |
| | | if (count($user_arr) == 0) { |
| | | throw new BaseException(['msg' => '没有符合条件的会员']); |
| | | return false; |
| | | } |
| | | $data = $this->setData($coupon, $user_arr); |
| | | } elseif ($send_type == 2) { |
| | | $user_arr = $user->getUsers(['grade_id' => $user_level]); |
| | | if (count($user_arr) == 0) { |
| | | throw new BaseException(['msg' => '没有符合条件的会员']); |
| | | return false; |
| | | } |
| | | $data = $this->setData($coupon, $user_arr); |
| | | } elseif ($send_type == 3) { |
| | | if ($user_ids == '') { |
| | | throw new BaseException(['msg' => '请选择用户']); |
| | | return false; |
| | | } |
| | | $user_ids = explode(',', $user_ids); |
| | | $user_arr = []; |
| | | foreach ($user_ids as $val) { |
| | | $user_arr[]['user_id'] = $val; |
| | | } |
| | | $data = $this->setData($coupon, $user_arr); |
| | | } |
| | | return $this->saveAll($data); |
| | | } |
| | | |
| | | /** |
| | | * 数组重组 |
| | | * @param $coupon |
| | | * @param $user_arr |
| | | */ |
| | | public function setData($coupon, $user_arr) |
| | | { |
| | | $data = []; |
| | | foreach ($user_arr as $k => $val) { |
| | | if ($coupon['expire_type'] == 10) { |
| | | $start_time = time(); |
| | | $end_time = $start_time + ($coupon['expire_day'] * 86400); |
| | | } else { |
| | | $start_time = $coupon['start_time']['value']; |
| | | $end_time = $coupon['end_time']['value']; |
| | | } |
| | | $data[$k]['coupon_id'] = $coupon['coupon_id']; |
| | | $data[$k]['name'] = $coupon['name']; |
| | | $data[$k]['color'] = $coupon['color']['value']; |
| | | $data[$k]['coupon_type'] = $coupon['coupon_type']['value']; |
| | | $data[$k]['reduce_price'] = $coupon['reduce_price']; |
| | | $data[$k]['discount'] = $coupon['discount'] * 10; |
| | | $data[$k]['min_price'] = $coupon['min_price']; |
| | | $data[$k]['expire_type'] = $coupon['expire_type']; |
| | | $data[$k]['expire_day'] = $coupon['expire_day']; |
| | | $data[$k]['start_time'] = $start_time; |
| | | $data[$k]['end_time'] = $end_time; |
| | | $data[$k]['apply_range'] = $coupon['apply_range']; |
| | | $data[$k]['app_id'] = self::$app_id; |
| | | $data[$k]['user_id'] = $val['user_id']; |
| | | $data[$k]['coupon_project'] = $coupon['coupon_project']; |
| | | $data[$k]['coupon_rule'] = $coupon['coupon_rule']; |
| | | $data[$k]['shop_supplier_id'] = $coupon['shop_supplier_id']; |
| | | $data[$k]['use_permission'] = empty($coupon['use_permission']) ? 0 : $coupon['use_permission']; |
| | | } |
| | | return $data; |
| | | } |
| | | } |
| | |
| | | use app\common\model\supplier\Access as AccessModel; |
| | | use app\supplier\model\auth\RoleAccess; |
| | | use app\supplier\model\auth\UserRole; |
| | | use app\supplier\model\supplier\member\Member; |
| | | use app\supplier\model\supplier\member\Plan; |
| | | use app\supplier\model\supplier\member\PlanAccess; |
| | | /** |
| | | * Class Access |
| | | * 商家用户权限模型 |
| | |
| | | // 格式化 |
| | | return $this->formatTreeData($menus_list, 0); |
| | | } |
| | | public function getMemberAccess($supplier_user_id) |
| | | { |
| | | |
| | | $member=(new Member())->detail($supplier_user_id); |
| | | if (empty($member)){ |
| | | $plan_id=(new Plan())->getDefaultPlanId(); |
| | | }else{ |
| | | $plan_id=$member['plan_id']; |
| | | } |
| | | // 获取当前年卡套餐的所有角色ID |
| | | $accessIds = PlanAccess::getRoleIds($plan_id); |
| | | // 获取当前角色所有权限链接 |
| | | $menus_list = AccessModel::getAccessList($accessIds); |
| | | // 格式化 |
| | | return $this->formatTreeData($menus_list, 0); |
| | | } |
| | | // 循环获取分类 |
| | | private function formatTreeData($all, $parent_id = 0) |
| | | { |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\supplier\member; |
| | | use app\common\model\supplier\member\Member as MemberModel; |
| | | /** |
| | | * 供应商年卡 |
| | | */ |
| | | class Member extends MemberModel |
| | | { |
| | | |
| | | public static function supplierDetail($array) |
| | | { |
| | | return (new static())->where($array)->order('price', 'desc')->find(); |
| | | } |
| | | public static function detail($shop_supplier_id) |
| | | { |
| | | return (new static())->where('shop_supplier_id', $shop_supplier_id)->where('expire_time', '>', time())->find(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | namespace app\supplier\model\supplier\member; |
| | | use app\common\model\supplier\member\Order as MemberOrderModel; |
| | | /** |
| | | * 供应商年卡订单模型 |
| | | */ |
| | | class Order extends MemberOrderModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\supplier\member; |
| | | use app\common\model\supplier\member\Plan as MemberPlanModel; |
| | | /** |
| | | * 供应商年卡套餐模型 |
| | | */ |
| | | class Plan extends MemberPlanModel |
| | | { |
| | | |
| | | public function getDefaultPlanId() |
| | | { |
| | | return $this->where('is_default', 1)->where(['is_delete'=>0])->value('plan_id'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\supplier\member; |
| | | |
| | | use app\common\model\supplier\member\PlanAccess as PlanAccessModel; |
| | | |
| | | /** |
| | | * 供应商年卡权限模型 |
| | | * 用于管理年卡套餐对应的权限 |
| | | */ |
| | | class PlanAccess extends PlanAccessModel |
| | | { |
| | | public static function getRoleIds($plan_id) |
| | | { |
| | | // 获取当前用户的角色集 |
| | | return (new self)->where('plan_id', '=', $plan_id)->column('access_id'); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | |
| | | /** |
| | | * 用户余额变动明细模型 |
| | | */ |
| | | class BalanceLog extends BalanceLogModel |
| | | { |
| | | /** |
| | | * 获取余额变动明细列表 |
| | | */ |
| | | public function getList($query = []) |
| | | { |
| | | // 设置默认的检索数据 |
| | | $params = [ |
| | | 'user_id' => 0, |
| | | 'search' => '', |
| | | 'scene' => -1, |
| | | 'start_time' => '', |
| | | 'end_time' => '', |
| | | ]; |
| | | // 合并查询条件 |
| | | $data = array_merge($params, $query); |
| | | $model = $this->alias('log')->field('log.*'); |
| | | // 用户昵称 |
| | | $data['search'] = trim($data['search']); |
| | | !empty($data['search']) && $model = $model->where('user.nickName', 'like', "%{$data['search']}%"); |
| | | //搜索时间段 |
| | | if (isset($data['value1']) && $data['value1'] != '') { |
| | | $sta_time = array_shift($data['value1']); |
| | | $end_time = array_pop($data['value1']); |
| | | $model = $model->whereBetweenTime('log.create_time', $sta_time, date('Y-m-d 23:59:59', strtotime($end_time))); |
| | | } |
| | | // 余额变动场景 |
| | | if (!empty($data['scene']) && $data['scene'] > -1) { |
| | | $model = $model->where('log.scene', '=', (int)$data['scene']); |
| | | } |
| | | // 用户ID |
| | | if (!empty($data['user_id']) && $data['user_id'] > 0) { |
| | | $model = $model->where('log.user_id', '=', (int)$data['user_id']); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->with(['user']) |
| | | ->join('user', 'user.user_id = log.user_id') |
| | | ->order(['log.create_time' => 'desc']) |
| | | ->paginate($query); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\BalanceOrder as BalanceOrderModel; |
| | | |
| | | /** |
| | | * 充值模型 |
| | | */ |
| | | class BalanceOrder extends BalanceOrderModel |
| | | { |
| | | /** |
| | | * 列表 |
| | | */ |
| | | public function getList($params) |
| | | { |
| | | $model = $this->alias('log'); |
| | | !empty($params['search']) && $model = $model->where('user.nickName', 'like', "%{$params['search']}%"); |
| | | //搜索时间段 |
| | | if (isset($params['value1']) && $params['value1'] != '') { |
| | | $sta_time = array_shift($params['value1']); |
| | | $end_time = array_pop($params['value1']); |
| | | $model = $model->whereBetweenTime('log.create_time', $sta_time, date('Y-m-d 23:59:59', strtotime($end_time))); |
| | | } |
| | | $list = $model->with(['user']) |
| | | ->join('user', 'user.user_id = log.user_id') |
| | | ->order(['log.create_time' => 'desc']) |
| | | ->field('log.*') |
| | | ->paginate($params); |
| | | foreach ($list as $key => &$value) { |
| | | $value['snapshot'] = json_decode($value['snapshot'],true); |
| | | } |
| | | return $list; |
| | | } |
| | | /** |
| | | * 获取充值金额 |
| | | */ |
| | | public function getTotalPayByDate($day,$user_ids=[],$in='true') |
| | | { |
| | | $start = strtotime($day); |
| | | $end = strtotime($day) + 86399; |
| | | $model = $this; |
| | | if(!empty($user_ids)){ |
| | | if($in){ |
| | | $model = $model->where('user_id', 'in', $user_ids); |
| | | }else{ |
| | | $model = $model->where('user_id', 'not in', $user_ids); |
| | | } |
| | | } |
| | | $money = $model->where('create_time', 'between', "$start,$end") |
| | | ->where('pay_status', '=', 20) |
| | | ->sum("pay_price"); |
| | | |
| | | return $money; |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\BalancePlan as BalancePlanModel; |
| | | |
| | | /** |
| | | * 充值模型 |
| | | */ |
| | | class BalancePlan extends BalancePlanModel |
| | | { |
| | | /** |
| | | * 列表 |
| | | */ |
| | | public function getList($params) |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->select(); |
| | | } |
| | | |
| | | /** |
| | | * 添加新记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 更新记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 删除记录 (软删除) |
| | | */ |
| | | public function setDelete($where) |
| | | { |
| | | return self::update(['is_delete' => 1], $where); |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\Card as CardModel; |
| | | use app\supplier\controller\plus\queue\Record; |
| | | use app\supplier\model\user\CardRecord as CardRecordModel; |
| | | use app\supplier\model\plus\coupon\UserCoupon as UserCouponModel; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | |
| | | /** |
| | | * 会员卡模型 |
| | | */ |
| | | class Card extends CardModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if ($data['card_name']) { |
| | | $model = $model->where('card_name', 'like', '%' . $data['card_name'] . '%'); |
| | | } |
| | | if ($data['status'] >= 0) { |
| | | $model = $model->where('status', '=', $data['status']); |
| | | } |
| | | $list = $model->where('is_delete', '=', 0) |
| | | ->order(['sort' => 'asc', 'create_time' => 'desc']) |
| | | ->paginate($data); |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getDeleteList($data) |
| | | { |
| | | $model = $this; |
| | | if ($data['card_name']) { |
| | | $model = $model->where('card_name', 'like', '%' . $data['card_name'] . '%'); |
| | | } |
| | | $list = $model->where('is_delete', '=', 1) |
| | | ->order(['sort' => 'asc', 'create_time' => 'asc']) |
| | | ->paginate($data); |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data = json_decode($data, 1); |
| | | $data['app_id'] = self::$app_id; |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 发卡 |
| | | */ |
| | | public function put($data) |
| | | { |
| | | $userId = $data['user_ids']; |
| | | if (empty($userId)) { |
| | | $this->error = "请选择会员"; |
| | | return false; |
| | | } |
| | | //是否存在会员卡 |
| | | $isExist = (new CardRecord())->checkExistByUserId($userId); |
| | | if ($isExist) { |
| | | $this->error = "该会员已存在会员卡,勿重复发放"; |
| | | return false; |
| | | } |
| | | $detail = self::detail($data['card_id']); |
| | | $this->startTrans(); |
| | | try { |
| | | //添加会员卡 |
| | | $record = [ |
| | | 'user_id' => $userId, |
| | | 'card_id' => $data['card_id'], |
| | | 'expire_time' => $detail['expire'] ? (time() + $detail['expire'] * 86400 * 30) : 0, |
| | | 'money' => $detail['money'], |
| | | 'discount' => $detail['is_discount'] ? $detail['discount'] : 0, |
| | | 'open_points' => $detail['open_points'], |
| | | 'open_points_num' => $detail['open_points_num'], |
| | | 'open_coupon' => $detail['open_coupon'], |
| | | 'open_coupons' => $detail['open_coupons'], |
| | | 'open_money' => $detail['open_money'], |
| | | 'open_money_num' => $detail['open_money_num'], |
| | | 'pay_status' => 20, |
| | | 'pay_type' => 30, |
| | | 'pay_time' => time(), |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | $CardRecordModel = new CardRecordModel; |
| | | $CardRecordModel->save($record); |
| | | $user = (new User)::detail($userId); |
| | | //赠送积分 |
| | | if ($detail['open_points'] && $detail['open_points_num']) { |
| | | $user->setIncPoints($detail['open_points_num'], '发会员卡获取积分'); |
| | | } |
| | | //赠送优惠券 |
| | | if ($detail['open_coupon'] && $detail['open_coupons']) { |
| | | (new UserCouponModel)->addUserCardCoupon($detail['open_coupons'], $user, $CardRecordModel['order_id']); |
| | | } |
| | | //赠送余额 |
| | | if ($detail['open_money'] && $detail['open_money_num']) { |
| | | (new User())->where('user_id', '=', $user['user_id']) |
| | | ->inc('balance', $detail['open_money_num']) |
| | | ->update(); |
| | | BalanceLogModel::add(BalanceLogSceneEnum::RECHARGE, [ |
| | | 'user_id' => $user['user_id'], |
| | | 'money' => $detail['open_money_num'], |
| | | ], ['order_no' => '后台发放会员卡赠送']); |
| | | } |
| | | $detail->save(['receive_num' => $detail['receive_num'] + 1]); |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 撤销 |
| | | */ |
| | | public function cancel($data) |
| | | { |
| | | $CardRecordModel = new CardRecordModel; |
| | | $detail = $CardRecordModel::detail($data['order_id']); |
| | | $cardDetail = self::detail($detail['card_id']); |
| | | if (!$detail || $detail['is_delete'] != 0) { |
| | | $this->error = "记录不存在"; |
| | | return false; |
| | | } |
| | | $this->startTrans(); |
| | | try { |
| | | $detail->save(['is_delete' => 1]); |
| | | $user = (new User)::detail($detail['user_id']); |
| | | //撤销积分 |
| | | if ($detail['open_points'] && $detail['open_points_num']) { |
| | | $user->setIncPoints(-$detail['open_points_num'], '撤销会员卡减少积分'); |
| | | } |
| | | //撤销优惠券 |
| | | if ($detail['open_coupon'] && $detail['open_coupons']) { |
| | | (new UserCouponModel)->cancelUserCardCoupon($detail['open_coupons'], $user, $detail['order_id']); |
| | | } |
| | | if ($detail['open_money'] && $detail['open_money_num']) { |
| | | (new User())->where('user_id', '=', $user['user_id']) |
| | | ->dec('balance', $detail['open_money_num']) |
| | | ->update(); |
| | | BalanceLogModel::add(BalanceLogSceneEnum::ADMIN, [ |
| | | 'user_id' => $user['user_id'], |
| | | 'money' => -$detail['open_money_num'], |
| | | ], ['order_no' => '撤销会员卡减少余额']); |
| | | } |
| | | $cardDetail->save(['receive_num' => $cardDetail['receive_num'] - 1]); |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | $data = json_decode($data, 1); |
| | | unset($data['create_time']); |
| | | unset($data['update_time']); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | // 判断该卡下是否存在会员 |
| | | if (CardRecordModel::checkExistByRecordId($this['card_id'])) { |
| | | return false; |
| | | } |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\CardRecord as CardRecordModel; |
| | | |
| | | /** |
| | | * 会员卡记录模型 |
| | | */ |
| | | class CardRecord extends CardRecordModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $model = $this; |
| | | if ($data['search']) { |
| | | $model = $model->where('card_name|nickName', 'like', '%' . $data['search'] . '%'); |
| | | } |
| | | if ($data['status'] >= 0) { |
| | | if ($data['status'] == 0) { |
| | | $model = $model->where('expire_time', '<', time()); |
| | | } else { |
| | | $model = $model->where('expire_time', '>=', time()); |
| | | } |
| | | |
| | | } |
| | | $list = $model->alias('r') |
| | | ->where('pay_status', '=', 20) |
| | | ->where('r.is_delete', '=', 0) |
| | | ->with(['card', 'user']) |
| | | ->join('user u', 'u.user_id=r.user_id') |
| | | ->join('user_card c', 'c.card_id=r.card_id') |
| | | ->field('r.*') |
| | | ->order(['r.create_time' => 'desc']) |
| | | ->paginate($data); |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 延期 |
| | | */ |
| | | public function delay($data) |
| | | { |
| | | $isExist = self::checkExistByUserId($this['user_id'], $data['order_id']); |
| | | if ($isExist) { |
| | | $this->error = "该会员已存在会员卡,请勿延期"; |
| | | return false; |
| | | } |
| | | $update['expire_time'] = strtotime($data['expire_time']); |
| | | if ($update['expire_time'] < $this['expire_time']) { |
| | | $this->error = "延期日期不能小于当前有效期"; |
| | | return false; |
| | | } |
| | | return $this->save($update); |
| | | } |
| | | |
| | | /** |
| | | * 获取微信购买卡的金额 |
| | | */ |
| | | public function getTotalPayByDate($day,$user_ids=[],$in='true') |
| | | { |
| | | $start = strtotime($day); |
| | | $end = strtotime($day) + 86399; |
| | | $model = $this; |
| | | if(!empty($user_ids)){ |
| | | if($in){ |
| | | $model = $model->where('user_id', 'in', $user_ids); |
| | | }else{ |
| | | $model = $model->where('user_id', 'not in', $user_ids); |
| | | } |
| | | } |
| | | $money = $model->where('create_time', 'between', "$start,$end") |
| | | ->where('pay_status', '=', 20) |
| | | ->where('pay_type', '=', 20) |
| | | ->sum("money"); |
| | | |
| | | return $money; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\user\model\supplier; |
| | | |
| | | use app\common\library\easywechat\AppWx; |
| | | use app\common\library\easywechat\AppMp; |
| | | use app\common\model\app\AppMp as AppMpModel; |
| | | use app\common\model\app\AppOpen as AppOpenModel; |
| | | use app\common\model\app\AppWx as AppWxModel; |
| | | use app\common\model\settings\Setting as SettingModel; |
| | | use app\common\service\order\OrderService; |
| | | use app\common\library\easywechat\WxPay; |
| | | use app\common\model\user\Cash as CashModel; |
| | | use app\supplier\model\user\User as UserModel; |
| | | use app\supplier\service\order\ExportService; |
| | | use app\common\model\user\BalanceLog as BalanceLogModel; |
| | | use app\common\enum\user\balanceLog\BalanceLogSceneEnum; |
| | | |
| | | /** |
| | | * 余额提现明细模型 |
| | | */ |
| | | class Cash extends CashModel |
| | | { |
| | | /** |
| | | * 获取器:申请时间 |
| | | */ |
| | | public function getAuditTimeAttr($value) |
| | | { |
| | | return $value > 0 ? date('Y-m-d H:i:s', $value) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取器:打款方式 |
| | | */ |
| | | public function getPayTypeAttr($value) |
| | | { |
| | | return ['text' => $this->payType[$value], 'value' => $value]; |
| | | } |
| | | |
| | | /** |
| | | * 获取提现列表 |
| | | */ |
| | | public function getList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, user.nickName, user.avatarUrl') |
| | | ->join('user user', 'user.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if ($user_id > 0) { |
| | | $model = $model->where('cash.user_id', '=', $user_id); |
| | | } |
| | | if (!empty($search)) { |
| | | $model = $model->where('user.nickName|user.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->paginate(15); |
| | | } |
| | | |
| | | /** |
| | | * 提现审核 |
| | | */ |
| | | public function submit($param) |
| | | { |
| | | $data = ['apply_status' => $param['apply_status']]; |
| | | if ($param['apply_status'] == 30) { |
| | | $data['reject_reason'] = $param['reject_reason']; |
| | | } |
| | | // 更新申请记录 |
| | | $data['audit_time'] = time(); |
| | | self::update($data, ['id' => $param['id']]); |
| | | // 提现驳回:解冻余额 |
| | | if ($param['apply_status'] == 30) { |
| | | User::backFreezeMoney($param['user_id'], $param['money']); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 确认已打款 |
| | | */ |
| | | public function money() |
| | | { |
| | | $this->startTrans(); |
| | | try { |
| | | // 更新申请状态 |
| | | $data = ['apply_status' => 40, 'audit_time' => time()]; |
| | | self::update($data, ['id' => $this['id']]); |
| | | |
| | | // 更新累积提现 |
| | | User::totalMoney($this['user_id'], $this['money']); |
| | | //添加余额记录 |
| | | BalanceLogModel::add(BalanceLogSceneEnum::CASH, [ |
| | | 'user_id' => $this['user_id'], |
| | | 'money' => -$this['money'], |
| | | 'app_id' => self::$app_id, |
| | | ], ''); |
| | | // 事务提交 |
| | | $this->commit(); |
| | | return true; |
| | | } catch (\Exception $e) { |
| | | $this->error = $e->getMessage(); |
| | | $this->rollback(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 商家转账到零钱 |
| | | */ |
| | | public function wechatPay() |
| | | { |
| | | $wechat_type = SettingModel::getItem('balance_cash')['wechat_type']; |
| | | if($wechat_type == '0'){ |
| | | return $this->wechatPay0(); |
| | | }else { |
| | | return $this->wechatPay1(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分销商提现:微信支付企业付款 |
| | | */ |
| | | public function wechatPay0() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '余额提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app = null; |
| | | if ($user['reg_source'] == 'mp') { |
| | | $app = AppMp::getWxPayApp($user['app_id']); |
| | | $open_id = $user['mpopen_id']; |
| | | } else if ($user['reg_source'] == 'wx') { |
| | | $app = AppWx::getWxPayApp($user['app_id']); |
| | | $open_id = $user['open_id']; |
| | | } |
| | | |
| | | if ($open_id == '') { |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $WxPay = new WxPay($app); |
| | | // 请求付款api |
| | | if ($WxPay->transfers($orderNO, $open_id, $this['real_money'], $desc)) { |
| | | // 确认已打款 |
| | | $this->money(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 商家转账到零钱 |
| | | */ |
| | | public function wechatPay1() |
| | | { |
| | | // 微信用户信息 |
| | | $user = UserModel::detail($this['user_id']); |
| | | // 生成付款订单号 |
| | | $orderNO = OrderService::createOrderNo(); |
| | | // 付款描述 |
| | | $desc = '余额提现付款'; |
| | | // 微信支付api:企业付款到零钱 |
| | | $open_id = ''; |
| | | $app_id = ''; |
| | | if ($user['reg_source'] == 'mp') { |
| | | $open_id = $user['mpopen_id']; |
| | | $wxConfig = AppMpModel::getAppMpCache($app_id); |
| | | $app_id = $wxConfig['mpapp_id']; |
| | | } else if ($user['reg_source'] == 'wx') { |
| | | $open_id = $user['open_id']; |
| | | $wxConfig = AppWxModel::getAppWxCache($app_id); |
| | | $app_id = $wxConfig['wxapp_id']; |
| | | } else if ($user['reg_source'] == 'app') { |
| | | $open_id = $user['appopen_id']; |
| | | $wxConfig = AppOpenModel::getAppOpenCache($app_id); |
| | | $app_id = $wxConfig['openapp_id']; |
| | | } |
| | | |
| | | if ($open_id == '') { |
| | | $this->error = '未找到用户open_id'; |
| | | return false; |
| | | } |
| | | |
| | | $url = 'https://api.mch.weixin.qq.com/v3/transfer/batches'; |
| | | $pars = []; |
| | | $pars['appid'] = $app_id;//直连商户的appid |
| | | $pars['out_batch_no'] = 'sjzz'.date('Ymd').mt_rand(1000, 9999);//商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一 |
| | | $pars['batch_name'] = $desc;//该笔批量转账的名称 |
| | | $pars['batch_remark'] = $desc;//转账说明,UTF8编码,最多允许32个字符 |
| | | $pars['total_amount'] = intval($this['real_money'] * 100);//转账总金额 单位为“分” |
| | | $pars['total_num'] = 1;//转账总笔数 |
| | | $pars['transfer_detail_list'][0] = [ |
| | | 'out_detail_no'=>'Dh'.$orderNO, |
| | | 'transfer_amount'=>$pars['total_amount'], |
| | | 'transfer_remark'=> $desc, |
| | | 'openid' => $open_id |
| | | ];//转账明细列表 |
| | | //获取token |
| | | $wxPay = new WxPay(null); |
| | | $res = $wxPay->wechatTrans($pars, $user['app_id']); |
| | | $resArr = json_decode($res,true); |
| | | if(isset($resArr['batch_id'])){ |
| | | $this->save([ |
| | | 'batch_id' => $resArr['batch_id'] |
| | | ]); |
| | | // 确认打款 |
| | | $this->money(); |
| | | return true; |
| | | }else{ |
| | | $this->error = $resArr['message']; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /* |
| | | *统计提现总数量 |
| | | */ |
| | | public function getUserCashTotal() |
| | | { |
| | | return $this->where('apply_status', '=', 10)->count(); |
| | | } |
| | | |
| | | /* |
| | | *统计提现总数量 |
| | | */ |
| | | public function getUserApplyTotal() |
| | | { |
| | | return $this->where('apply_status', '=', '10')->count(); |
| | | } |
| | | |
| | | /** |
| | | * 导出用户余额提现 |
| | | */ |
| | | public function exportList($user_id = null, $apply_status = -1, $pay_type = -1, $search = '') |
| | | { |
| | | $model = $this; |
| | | // 构建查询规则 |
| | | $model = $model->alias('cash') |
| | | ->with(['user']) |
| | | ->field('cash.*, user.nickName, user.avatarUrl,user.mobile') |
| | | ->join('user user', 'user.user_id = cash.user_id') |
| | | ->order(['cash.create_time' => 'desc']); |
| | | // 查询条件 |
| | | if ($user_id > 0) { |
| | | $model = $model->where('cash.user_id', '=', $user_id); |
| | | } |
| | | if (!empty($search)) { |
| | | $model = $model->where('user.nickName|user.mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | if ($apply_status > 0) { |
| | | $model = $model->where('cash.apply_status', '=', $apply_status); |
| | | } |
| | | if ($pay_type > 0) { |
| | | $model = $model->where('cash.pay_type', '=', $pay_type); |
| | | } |
| | | // 获取列表数据 |
| | | $list = $model->select(); |
| | | // 导出excel文件 |
| | | (new Exportservice)->userCashList($list); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\Clerk as ClerkModel; |
| | | |
| | | /** |
| | | * 店员模型 |
| | | */ |
| | | class Clerk extends ClerkModel |
| | | { |
| | | |
| | | const FORM_SCENE_ADD = 'add'; |
| | | const FORM_SCENE_EDIT = 'edit'; |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | */ |
| | | public function getList($status = -1, $search = '', $params) |
| | | { |
| | | $model = $this; |
| | | if ($status > -1) { |
| | | $model = $model->where('status', '=', (int)$status); |
| | | } |
| | | if (!empty($search)) { |
| | | $model = $model->where('real_name|mobile', 'like', '%' . $search . '%'); |
| | | } |
| | | // 查询列表数据 |
| | | return $model->with(['user']) |
| | | ->where('is_delete', '=', '0') |
| | | ->order(['create_time' => 'desc']) |
| | | ->paginate($params); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有列表数据 |
| | | */ |
| | | public function getAll() |
| | | { |
| | | $model = $this; |
| | | // 查询列表数据 |
| | | return $model->where('is_delete', '=', '0')->select(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | return self::create($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | // 表单验证 |
| | | if (!$this->validateForm($data, self::FORM_SCENE_EDIT)) { |
| | | return false; |
| | | } |
| | | |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | /** |
| | | * 表单验证 |
| | | */ |
| | | private function validateForm($data, $scene = self::FORM_SCENE_ADD) |
| | | { |
| | | if ($scene === self::FORM_SCENE_ADD) { |
| | | if (!isset($data['user_id']) || empty($data['user_id'])) { |
| | | $this->error = '请选择用户'; |
| | | return false; |
| | | } |
| | | if (self::detail(['user_id' => $data['user_id'], 'is_delete' => 0])) { |
| | | $this->error = '该用户已经是核销员,无需重复添加'; |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\Grade as GradeModel; |
| | | use app\supplier\model\user\User as UserModel; |
| | | |
| | | /** |
| | | * 用户会员等级模型 |
| | | */ |
| | | class Grade extends GradeModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | return $this->where('is_delete', '=', 0) |
| | | ->order(['weight' => 'asc', 'create_time' => 'asc']) |
| | | ->paginate($data); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | $data['is_default'] = 0; |
| | | $data['remark'] = $this->setRemark($data); |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | if($this['is_default'] == 0){ |
| | | |
| | | $data['remark'] = $this->setRemark($data); |
| | | } |
| | | return $this->save($data); |
| | | } |
| | | |
| | | private function setRemark($data){ |
| | | $remark = ''; |
| | | if($data['open_money'] == 1){ |
| | | $money = sprintf('%.2f',$data['upgrade_money']); |
| | | $remark .= "会员消费满{$money}元可升级到此等级"; |
| | | } |
| | | if($data['open_points'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员积分满{$data['upgrade_points']}可升级到此等级"; |
| | | } |
| | | if($data['open_invite'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员邀请人数满{$data['upgrade_invite']}可升级到此等级"; |
| | | } |
| | | if($data['is_purchase_count'] == 1){ |
| | | if(!empty($remark)){ |
| | | $remark .= '\r\n'; |
| | | } |
| | | $remark .= "会员购买VIP专区商品次数满{$data['purchase_count']}可升级到此等级"; |
| | | } |
| | | return $remark; |
| | | } |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function setDelete() |
| | | { |
| | | // 判断该等级下是否存在会员 |
| | | if (UserModel::checkExistByGradeId($this['grade_id'])) { |
| | | return false; |
| | | } |
| | | return $this->save(['is_delete' => 1]); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\GradeLog as GradeLogModel; |
| | | |
| | | /** |
| | | * 用户会员等级变更记录模型 |
| | | */ |
| | | class GradeLog extends GradeLogModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\PointsLog as PointsLogModel; |
| | | |
| | | /** |
| | | * 用户余额变动明细模型 |
| | | */ |
| | | class PointsLog extends PointsLogModel |
| | | { |
| | | /** |
| | | * 获取积分明细列表 |
| | | */ |
| | | public function getList($query = []) |
| | | { |
| | | $model = $this; |
| | | //搜索订单号 |
| | | if (isset($query['search']) && $query['search'] != '') { |
| | | $model = $model->where('user.nickName', 'like', '%' . trim($query['search']) . '%'); |
| | | } |
| | | //搜索时间段 |
| | | if (isset($query['value1']) && $query['value1'] != '') { |
| | | $sta_time = array_shift($query['value1']); |
| | | $end_time = array_pop($query['value1']); |
| | | $model = $model->whereBetweenTime('log.create_time', $sta_time, date('Y-m-d 23:59:59', strtotime($end_time))); |
| | | } |
| | | // 获取列表数据 |
| | | return $model->with(['user']) |
| | | ->alias('log') |
| | | ->field('log.*') |
| | | ->join('user', 'user.user_id = log.user_id') |
| | | ->order(['log.create_time' => 'desc']) |
| | | ->paginate($query); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\Tag as TagModel; |
| | | use app\common\model\user\UserTag as UserTagModel; |
| | | /** |
| | | * 用户会员等级模型 |
| | | */ |
| | | class Tag extends TagModel |
| | | { |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getList($data) |
| | | { |
| | | $list = $this->order([ 'create_time' => 'asc']) |
| | | ->paginate($data); |
| | | foreach ($list as $item){ |
| | | $item['user_count'] = UserTagModel::getCountByTag($item['tag_id']); |
| | | } |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表记录 |
| | | */ |
| | | public function getLists() |
| | | { |
| | | return $this->field('tag_id,tag_name') |
| | | ->order(['create_time' => 'asc']) |
| | | ->select(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增记录 |
| | | */ |
| | | public function add($data) |
| | | { |
| | | $data['app_id'] = self::$app_id; |
| | | return $this->save($data); |
| | | } |
| | | |
| | | /** |
| | | * 编辑记录 |
| | | */ |
| | | public function edit($data) |
| | | { |
| | | return $this->save($data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 软删除 |
| | | */ |
| | | public function deleteTag() |
| | | { |
| | | // 删除关联 |
| | | (new UserTagModel())->where('tag_id', '=', $this['tag_id'])->delete(); |
| | | return $this->delete(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\model\user; |
| | | |
| | | use app\common\model\user\UserAddress as UserAddressModel; |
| | | |
| | | /** |
| | | * 用户地址模型 |
| | | */ |
| | | class UserAddress extends UserAddressModel |
| | | { |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | |
| | | namespace app\supplier\service\order; |
| | | |
| | | use PhpOffice\PhpSpreadsheet\IOFactory; |
| | | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
| | | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
| | | |
| | | /** |
| | | * 订单导出服务类 |
| | | */ |
| | | class ExportService |
| | | { |
| | | /** |
| | | * 订单导出 |
| | | */ |
| | | public function orderList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //列宽 |
| | | $sheet->getColumnDimension('B')->setWidth(30); |
| | | $sheet->getColumnDimension('P')->setWidth(30); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('订单明细'); |
| | | |
| | | $sheet->setCellValue('A1', '订单号'); |
| | | $sheet->setCellValue('B1', '商品信息'); |
| | | $sheet->setCellValue('C1', '订单总额'); |
| | | $sheet->setCellValue('D1', '优惠券抵扣'); |
| | | $sheet->setCellValue('E1', '积分抵扣'); |
| | | $sheet->setCellValue('F1', '运费金额'); |
| | | $sheet->setCellValue('G1', '后台改价'); |
| | | $sheet->setCellValue('H1', '实付款金额'); |
| | | $sheet->setCellValue('I1', '支付方式'); |
| | | $sheet->setCellValue('J1', '下单时间'); |
| | | $sheet->setCellValue('K1', '买家'); |
| | | $sheet->setCellValue('L1', '买家留言'); |
| | | $sheet->setCellValue('M1', '配送方式'); |
| | | $sheet->setCellValue('N1', '自提门店名称'); |
| | | $sheet->setCellValue('O1', '自提联系人'); |
| | | $sheet->setCellValue('P1', '自提联系电话'); |
| | | $sheet->setCellValue('Q1', '收货人姓名'); |
| | | $sheet->setCellValue('R1', '联系电话'); |
| | | $sheet->setCellValue('S1', '收货人地址'); |
| | | $sheet->setCellValue('T1', '物流公司'); |
| | | $sheet->setCellValue('U1', '物流单号'); |
| | | $sheet->setCellValue('V1', '付款状态'); |
| | | $sheet->setCellValue('W1', '付款时间'); |
| | | $sheet->setCellValue('X1', '发货状态'); |
| | | $sheet->setCellValue('Y1', '发货时间'); |
| | | $sheet->setCellValue('Z1', '收货状态'); |
| | | $sheet->setCellValue('AA1', '收货时间'); |
| | | $sheet->setCellValue('AB1', '订单状态'); |
| | | $sheet->setCellValue('AC1', '微信支付交易号'); |
| | | $sheet->setCellValue('AD1', '是否已评价'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $order) { |
| | | $address = $order['address']; |
| | | $sheet->setCellValue('A' . ($index + 2), "\t" . $order['order_no'] . "\t"); |
| | | $sheet->setCellValue('B' . ($index + 2), $this->filterProductInfo($order)); |
| | | $sheet->setCellValue('C' . ($index + 2), $order['total_price']); |
| | | $sheet->setCellValue('D' . ($index + 2), $order['coupon_money']); |
| | | $sheet->setCellValue('E' . ($index + 2), $order['points_money']); |
| | | $sheet->setCellValue('F' . ($index + 2), $order['express_price']); |
| | | $sheet->setCellValue('G' . ($index + 2), "{$order['update_price']['symbol']}{$order['update_price']['value']}"); |
| | | $sheet->setCellValue('H' . ($index + 2), $order['order_source'] == 70 ? round($order['pay_price'] + $order['advance']['pay_price'], 2) : $order['pay_price']); |
| | | $sheet->setCellValue('I' . ($index + 2), $order['pay_type']['text']); |
| | | $sheet->setCellValue('J' . ($index + 2), $order['create_time']); |
| | | $sheet->setCellValue('K' . ($index + 2), $order['user']['nickName']); |
| | | $sheet->setCellValue('L' . ($index + 2), $order['buyer_remark']); |
| | | $sheet->setCellValue('M' . ($index + 2), $order['delivery_type']['text']); |
| | | $sheet->setCellValue('N' . ($index + 2), !empty($order['extract_store']) ? $order['extract_store']['shop_name'] : ''); |
| | | $sheet->setCellValue('O' . ($index + 2), !empty($order['extract']) ? $order['extract']['linkman'] : ''); |
| | | $sheet->setCellValue('P' . ($index + 2), !empty($order['extract']) ? $order['extract']['phone'] : ''); |
| | | $sheet->setCellValue('Q' . ($index + 2), !empty($order['address']) ? $order['address']['name']:''); |
| | | $sheet->setCellValue('R' . ($index + 2), !empty($order['address']) ? $order['address']['phone']: ''); |
| | | $sheet->setCellValue('S' . ($index + 2), $address ? $address->getFullAddress() : ''); |
| | | $sheet->setCellValue('T' . ($index + 2), !empty($order['express']) ? $order['express']['express_name']:''); |
| | | $sheet->setCellValue('U' . ($index + 2), $order['express_no']); |
| | | $sheet->setCellValue('V' . ($index + 2), $order['pay_status']['text']); |
| | | $sheet->setCellValue('W' . ($index + 2), $this->filterTime($order['pay_time'])); |
| | | $sheet->setCellValue('X' . ($index + 2), $order['delivery_status']['text']); |
| | | $sheet->setCellValue('Y' . ($index + 2), $this->filterTime($order['delivery_time'])); |
| | | $sheet->setCellValue('Z' . ($index + 2), $order['receipt_status']['text']); |
| | | $sheet->setCellValue('AA' . ($index + 2), $this->filterTime($order['receipt_time'])); |
| | | $sheet->setCellValue('AB' . ($index + 2), $order['order_status']['text']); |
| | | $sheet->setCellValue('AC' . ($index + 2), $order['transaction_id']); |
| | | $sheet->setCellValue('AD' . ($index + 2), $order['is_comment'] ? '是' : '否'); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $writer = new Xlsx($spreadsheet); |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '订单') . '-' . date('YmdHis') . '.xlsx'; |
| | | |
| | | |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 分销订单导出 |
| | | */ |
| | | public function agentOrderList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //列宽 |
| | | $sheet->getColumnDimension('B')->setWidth(30); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('分销订单明细'); |
| | | |
| | | $sheet->setCellValue('A1', '订单号'); |
| | | $sheet->setCellValue('B1', '商品信息'); |
| | | $sheet->setCellValue('C1', '订单总额'); |
| | | $sheet->setCellValue('D1', '实付款金额'); |
| | | $sheet->setCellValue('E1', '支付方式'); |
| | | $sheet->setCellValue('F1', '下单时间'); |
| | | $sheet->setCellValue('G1', '一级分销商'); |
| | | $sheet->setCellValue('H1', '一级分销佣金'); |
| | | $sheet->setCellValue('I1', '二级分销商'); |
| | | $sheet->setCellValue('J1', '二级分销佣金'); |
| | | $sheet->setCellValue('K1', '三级分销商'); |
| | | $sheet->setCellValue('L1', '三级分销佣金'); |
| | | $sheet->setCellValue('M1', '买家'); |
| | | $sheet->setCellValue('N1', '付款状态'); |
| | | $sheet->setCellValue('O1', '付款时间'); |
| | | $sheet->setCellValue('P1', '发货状态'); |
| | | $sheet->setCellValue('Q1', '发货时间'); |
| | | $sheet->setCellValue('R1', '收货状态'); |
| | | $sheet->setCellValue('S1', '收货时间'); |
| | | $sheet->setCellValue('T1', '订单状态'); |
| | | $sheet->setCellValue('U1', '佣金结算'); |
| | | $sheet->setCellValue('V1', '结算时间'); |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $agent) { |
| | | $order = $agent['order_master']; |
| | | $sheet->setCellValue('A' . ($index + 2), "\t" . $order['order_no'] . "\t"); |
| | | $sheet->setCellValue('B' . ($index + 2), $this->filterProductInfo($order)); |
| | | $sheet->setCellValue('C' . ($index + 2), $order['total_price']); |
| | | $sheet->setCellValue('D' . ($index + 2), $order['pay_price']); |
| | | $sheet->setCellValue('E' . ($index + 2), $order['pay_type']['text']); |
| | | $sheet->setCellValue('F' . ($index + 2), $order['create_time']); |
| | | $sheet->setCellValue('G' . ($index + 2), isset($agent['agent_first'])?$agent['agent_first']['nickName']:''); |
| | | $sheet->setCellValue('H' . ($index + 2), $agent['first_money']); |
| | | $sheet->setCellValue('I' . ($index + 2), isset($agent['agent_second'])?$agent['agent_second']['nickName']:''); |
| | | $sheet->setCellValue('J' . ($index + 2), $agent['second_money']); |
| | | $sheet->setCellValue('K' . ($index + 2), isset($agent['agent_third'])?$agent['agent_third']['nickName']:''); |
| | | $sheet->setCellValue('L' . ($index + 2), $agent['third_money']); |
| | | $sheet->setCellValue('M' . ($index + 2), $order['user']['nickName']); |
| | | $sheet->setCellValue('N' . ($index + 2), $order['pay_status']['text']); |
| | | $sheet->setCellValue('O' . ($index + 2), $this->filterTime($order['pay_time'])); |
| | | $sheet->setCellValue('P' . ($index + 2), $order['delivery_status']['text']); |
| | | $sheet->setCellValue('Q' . ($index + 2), $this->filterTime($order['delivery_time'])); |
| | | $sheet->setCellValue('R' . ($index + 2), $order['receipt_status']['text']); |
| | | $sheet->setCellValue('S' . ($index + 2), $this->filterTime($order['receipt_time'])); |
| | | $sheet->setCellValue('T' . ($index + 2), $order['order_status']['text']); |
| | | $sheet->setCellValue('U' . ($index + 2), $agent['is_settled'] == 1 ? '已结算' : '未结算'); |
| | | $sheet->setCellValue('V' . ($index + 2), $this->filterTime($agent['settle_time'])); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '分销订单') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 提现订单导出 |
| | | */ |
| | | public function cashList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //列宽 |
| | | $sheet->getColumnDimension('H')->setWidth(50); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('提现明细'); |
| | | |
| | | $sheet->setCellValue('A1', 'ID'); |
| | | $sheet->setCellValue('B1', '分销商id'); |
| | | $sheet->setCellValue('C1', '分销商姓名'); |
| | | $sheet->setCellValue('D1', '微信昵称'); |
| | | $sheet->setCellValue('E1', '手机号'); |
| | | $sheet->setCellValue('F1', '提现金额'); |
| | | $sheet->setCellValue('G1', '提现方式'); |
| | | $sheet->setCellValue('H1', '提现信息'); |
| | | $sheet->setCellValue('I1', '审核状态'); |
| | | $sheet->setCellValue('J1', '申请时间'); |
| | | $sheet->setCellValue('K1', '审核时间'); |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $cash) { |
| | | $sheet->setCellValue('A' . ($index + 2), $cash['id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $cash['user_id']); |
| | | $sheet->setCellValue('C' . ($index + 2), $cash['real_name']); |
| | | $sheet->setCellValue('D' . ($index + 2), $cash['nickName']); |
| | | $sheet->setCellValue('E' . ($index + 2), "\t" . $cash['mobile'] . "\t"); |
| | | $sheet->setCellValue('F' . ($index + 2), $cash['money']); |
| | | $sheet->setCellValue('G' . ($index + 2), $cash['pay_type']['text']); |
| | | $sheet->setCellValue('H' . ($index + 2), $this->cashInfo($cash)); |
| | | $sheet->setCellValue('I' . ($index + 2), $cash['apply_status']['text']); |
| | | $sheet->setCellValue('J' . ($index + 2), $cash['create_time']); |
| | | $sheet->setCellValue('K' . ($index + 2), $cash['audit_time']); |
| | | $index++; |
| | | } |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '提现明细') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 余额提现订单导出 |
| | | */ |
| | | public function userCashList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //列宽 |
| | | $sheet->getColumnDimension('I')->setWidth(50); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('余额提现明细'); |
| | | |
| | | $sheet->setCellValue('A1', 'ID'); |
| | | $sheet->setCellValue('B1', '用户ID'); |
| | | $sheet->setCellValue('C1', '微信昵称'); |
| | | $sheet->setCellValue('D1', '手机号'); |
| | | $sheet->setCellValue('E1', '提现金额'); |
| | | $sheet->setCellValue('F1', '实际到账'); |
| | | $sheet->setCellValue('G1', '提现比例'); |
| | | $sheet->setCellValue('H1', '提现方式'); |
| | | $sheet->setCellValue('I1', '提现信息'); |
| | | $sheet->setCellValue('J1', '审核状态'); |
| | | $sheet->setCellValue('K1', '申请时间'); |
| | | $sheet->setCellValue('L1', '审核时间'); |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $cash) { |
| | | $sheet->setCellValue('A' . ($index + 2), $cash['id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $cash['user_id']); |
| | | $sheet->setCellValue('C' . ($index + 2), $cash['nickName']); |
| | | $sheet->setCellValue('D' . ($index + 2), "\t" . $cash['mobile'] . "\t"); |
| | | $sheet->setCellValue('E' . ($index + 2), $cash['money']); |
| | | $sheet->setCellValue('F' . ($index + 2), $cash['real_money']); |
| | | $sheet->setCellValue('G' . ($index + 2), $cash['cash_ratio'] . '%'); |
| | | $sheet->setCellValue('H' . ($index + 2), $cash['pay_type']['text']); |
| | | $sheet->setCellValue('I' . ($index + 2), $this->cashInfo($cash)); |
| | | $sheet->setCellValue('J' . ($index + 2), $cash['apply_status']['text']); |
| | | $sheet->setCellValue('K' . ($index + 2), $cash['create_time']); |
| | | $sheet->setCellValue('L' . ($index + 2), $cash['audit_time']); |
| | | $index++; |
| | | } |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '余额提现明细') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 核销订单导出 |
| | | */ |
| | | public function orderStoreList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //列宽 |
| | | $sheet->getColumnDimension('B')->setWidth(30); |
| | | $sheet->getColumnDimension('D')->setWidth(30); |
| | | $sheet->getColumnDimension('E')->setWidth(20); |
| | | $sheet->getColumnDimension('F')->setWidth(20); |
| | | $sheet->getColumnDimension('G')->setWidth(20); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('核销订单明细'); |
| | | |
| | | $sheet->setCellValue('A1', '门店ID'); |
| | | $sheet->setCellValue('B1', '核销门店'); |
| | | $sheet->setCellValue('C1', '核销员'); |
| | | $sheet->setCellValue('D1', '订单号'); |
| | | $sheet->setCellValue('E1', '订单类型'); |
| | | $sheet->setCellValue('F1', '配送类型'); |
| | | $sheet->setCellValue('G1', '核销时间'); |
| | | $sheet->setCellValue('H1', '订单金额'); |
| | | $sheet->setCellValue('I1', '门店提成'); |
| | | $sheet->setCellValue('J1', '配送费'); |
| | | $sheet->setCellValue('K1', '实付金额'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $order) { |
| | | $sheet->setCellValue('A' . ($index + 2), $order['store_id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $order["store"]['store_name']); |
| | | $sheet->setCellValue('C' . ($index + 2), $order["clerk"]['real_name']); |
| | | $sheet->setCellValue('D' . ($index + 2), "\t" . $order["order"]['order_no'] . "\t"); |
| | | $sheet->setCellValue('E' . ($index + 2), $order['order_type']['text']); |
| | | $sheet->setCellValue('F' . ($index + 2), $order['order']['delivery_type']['text']); |
| | | $sheet->setCellValue('G' . ($index + 2), $order['create_time']); |
| | | $sheet->setCellValue('H' . ($index + 2), $order['order']['order_price']); |
| | | $sheet->setCellValue('I' . ($index + 2), $order['commission']); |
| | | $sheet->setCellValue('J' . ($index + 2), $order['delivery_fee']); |
| | | $sheet->setCellValue('K' . ($index + 2), $order['order']['pay_price']); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $writer = new Xlsx($spreadsheet); |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '核销订单') . '-' . date('YmdHis') . '.xlsx'; |
| | | |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 商户数据统计 |
| | | */ |
| | | public function supplierStatisticsList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('商户券数据统计'); |
| | | |
| | | $sheet->setCellValue('A1', '商户ID'); |
| | | $sheet->setCellValue('B1', '商户名称'); |
| | | $sheet->setCellValue('C1', '线上券金额'); |
| | | $sheet->setCellValue('D1', '线上券数量'); |
| | | $sheet->setCellValue('E1', '线下券金额'); |
| | | $sheet->setCellValue('F1', '线下券数量'); |
| | | $sheet->setCellValue('G1', '总金额'); |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $cash) { |
| | | $sheet->setCellValue('A' . ($index + 2), $cash['shop_supplier_id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $cash['name']); |
| | | $sheet->setCellValue('C' . ($index + 2), $cash['coupon_money']); |
| | | $sheet->setCellValue('D' . ($index + 2), $cash['coupon_num']); |
| | | $sheet->setCellValue('E' . ($index + 2), $cash['store_coupon_money']); |
| | | $sheet->setCellValue('F' . ($index + 2), $cash['store_coupon_num']); |
| | | $sheet->setCellValue('G' . ($index + 2), $cash['total_coupon_money']); |
| | | $index++; |
| | | } |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '商户券数据统计') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 商家收入明细导出 |
| | | */ |
| | | public function supplierCapitalList($data) |
| | | { |
| | | $list = $data["list"]; |
| | | $total_money = $data["total_money"]; |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('商家收支记录'); |
| | | |
| | | $sheet->setCellValue('A1', '所属商户'); |
| | | $sheet->setCellValue('B1', '收支类型'); |
| | | $sheet->setCellValue('C1', '金额'); |
| | | $sheet->setCellValue('D1', '时间'); |
| | | $sheet->setCellValue('E1', '说明'); |
| | | $sheet->setCellValue('F1', '总金额'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $cash) { |
| | | $sheet->setCellValue('A' . ($index + 2), $cash['supplier']['name']); |
| | | $sheet->setCellValue('B' . ($index + 2), $cash['flow_type'] == 10 ? '收入' : '支出'); |
| | | $sheet->setCellValue('C' . ($index + 2), $cash['money']); |
| | | $sheet->setCellValue('D' . ($index + 2), $cash['create_time']); |
| | | $sheet->setCellValue('E' . ($index + 2), $cash['describe']); |
| | | $index++; |
| | | } |
| | | $sheet->setCellValue('F2', $total_money); |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '商家收支记录') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 商家收入提现记录导出 |
| | | */ |
| | | public function supplierCashList($data) |
| | | { |
| | | $list = $data["list"]; |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('商家收支提现记录'); |
| | | |
| | | $sheet->setCellValue('A1', '所属商户'); |
| | | $sheet->setCellValue('B1', '金额'); |
| | | $sheet->setCellValue('C1', '时间'); |
| | | $sheet->setCellValue('D1', '说明'); |
| | | $sheet->setCellValue('E1', '状态'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $cash) { |
| | | if($cash["is_settled"] == 1){ |
| | | $status = "提现中"; |
| | | }elseif($cash["is_settled"] == 2){ |
| | | $status = "已提现"; |
| | | }else{ |
| | | $status = "未提现"; |
| | | } |
| | | $sheet->setCellValue('A' . ($index + 2), $cash['supplier']['name']); |
| | | $sheet->setCellValue('B' . ($index + 2), $cash['money']); |
| | | $sheet->setCellValue('C' . ($index + 2), $cash['create_time']); |
| | | $sheet->setCellValue('D' . ($index + 2), $cash['describe']); |
| | | $sheet->setCellValue('E' . ($index + 2), $status); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '商家收支提现记录') . '-' . date('YmdHis') . '.xlsx'; |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 收入统计导出 |
| | | */ |
| | | public function incomeList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('收入统计'); |
| | | |
| | | $sheet->setCellValue('A1', '日期'); |
| | | $sheet->setCellValue('B1', '余额支付'); |
| | | $sheet->setCellValue('C1', '付呗支付'); |
| | | $sheet->setCellValue('D1', '线下支付'); |
| | | $sheet->setCellValue('E1', '其他支付'); |
| | | $sheet->setCellValue('F1', '优惠券'); |
| | | $sheet->setCellValue('G1', '满减金额'); |
| | | $sheet->setCellValue('H1', '积分金额'); |
| | | $sheet->setCellValue('I1', '退款金额'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $item) { |
| | | $sheet->setCellValue('A' . ($index + 2), $item['day']); |
| | | $sheet->setCellValue('B' . ($index + 2), $item['pay_balance']); |
| | | $sheet->setCellValue('C' . ($index + 2), $item['pay_wx']); |
| | | $sheet->setCellValue('D' . ($index + 2), $item['pay_cash']); |
| | | $sheet->setCellValue('E' . ($index + 2), $item['pay_other']); |
| | | $sheet->setCellValue('F' . ($index + 2), $item['coupon']); |
| | | $sheet->setCellValue('G' . ($index + 2), $item['fullreduce']); |
| | | $sheet->setCellValue('H' . ($index + 2), $item['points']); |
| | | $sheet->setCellValue('I' . ($index + 2), $item['refund_money']); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $writer = new Xlsx($spreadsheet); |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '收入统计') . '-' . date('YmdHis') . '.xlsx'; |
| | | |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 用户导出 |
| | | */ |
| | | public function userList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('会员列表'); |
| | | |
| | | $sheet->setCellValue('A1', '用户id'); |
| | | $sheet->setCellValue('B1', '昵称'); |
| | | $sheet->setCellValue('C1', '姓名'); |
| | | $sheet->setCellValue('D1', '会员等级'); |
| | | $sheet->setCellValue('E1', '来源'); |
| | | $sheet->setCellValue('F1', '积分'); |
| | | $sheet->setCellValue('G1', '余额'); |
| | | $sheet->setCellValue('H1', '推荐人'); |
| | | $sheet->setCellValue('I1', '手机号'); |
| | | $sheet->setCellValue('J1', '注册时间'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $item) { |
| | | $reg_source = '小程序'; |
| | | if($item["reg_source"] == 'mp'){ |
| | | $reg_source = '公众号'; |
| | | } |
| | | $nickName = $item['nickName']; |
| | | if(!empty($nickName)){ |
| | | $nickName = $this->cutStr($nickName,10); |
| | | } |
| | | $sheet->setCellValue('A' . ($index + 2), $item['user_id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $nickName); |
| | | $sheet->setCellValue('C' . ($index + 2), $item['real_name']); |
| | | $sheet->setCellValue('D' . ($index + 2), empty($item['grade_id']) ? '无' : $item['grade']['name']); |
| | | $sheet->setCellValue('E' . ($index + 2), $reg_source); |
| | | $sheet->setCellValue('F' . ($index + 2), $item['points']); |
| | | $sheet->setCellValue('G' . ($index + 2), $item['balance']); |
| | | $sheet->setCellValue('H' . ($index + 2), $item['referee_name']); |
| | | $sheet->setCellValue('I' . ($index + 2), $item['mobile']); |
| | | $sheet->setCellValue('J' . ($index + 2), $item['create_time']); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $writer = new Xlsx($spreadsheet); |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '会员') . '-' . date('YmdHis') . '.xlsx'; |
| | | |
| | | |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | /** |
| | | * 连盟活动报名列表导出 |
| | | */ |
| | | public function activityUserList($list) |
| | | { |
| | | $spreadsheet = new Spreadsheet(); |
| | | $sheet = $spreadsheet->getActiveSheet(); |
| | | |
| | | //设置工作表标题名称 |
| | | $sheet->setTitle('活动报名记录表'); |
| | | |
| | | $sheet->setCellValue('A1', '用户id'); |
| | | $sheet->setCellValue('B1', '昵称'); |
| | | $sheet->setCellValue('C1', '姓名'); |
| | | $sheet->setCellValue('D1', '手机号'); |
| | | $sheet->setCellValue('E1', '报名状态'); |
| | | $sheet->setCellValue('F1', '报名时间'); |
| | | $sheet->setCellValue('G1', '活动ID'); |
| | | $sheet->setCellValue('H1', '活动标题'); |
| | | |
| | | //填充数据 |
| | | $index = 0; |
| | | foreach ($list as $item) { |
| | | $sheet->setCellValue('A' . ($index + 2), $item['user_id']); |
| | | $sheet->setCellValue('B' . ($index + 2), $nickName); |
| | | $sheet->setCellValue('C' . ($index + 2), $item['real_name']); |
| | | $sheet->setCellValue('D' . ($index + 2), $item['mobile']); |
| | | $sheet->setCellValue('E' . ($index + 2), $item['status_text']); |
| | | $sheet->setCellValue('F' . ($index + 2), $item['create_time']); |
| | | $sheet->setCellValue('G' . ($index + 2), $item['activity_id']); |
| | | $sheet->setCellValue('H' . ($index + 2), $item['activity']['name']); |
| | | $index++; |
| | | } |
| | | |
| | | //保存文件 |
| | | $writer = new Xlsx($spreadsheet); |
| | | $filename = iconv("UTF-8", "GB2312//IGNORE", '活动报名记录表') . '-' . date('YmdHis') . '.xlsx'; |
| | | |
| | | |
| | | header('Content-Type: application/vnd.ms-excel'); |
| | | header('Content-Disposition: attachment;filename="' . $filename . '"'); |
| | | header('Cache-Control: max-age=0'); |
| | | $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); |
| | | $writer->save('php://output'); |
| | | } |
| | | |
| | | public function cutStr($str, $maxLength) { |
| | | $str=$this->filterEmoji($str); |
| | | if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $str)){ |
| | | return $str; |
| | | }; |
| | | |
| | | $pattern = '/[\x{4e00}-\x{9fa5}]+|[a-zA-Z]+/u'; |
| | | preg_match($pattern, $str, $matches, PREG_OFFSET_CAPTURE); |
| | | if(empty($matches[0])){ |
| | | return ''; |
| | | } |
| | | $start = $matches[0][1]; // 起始位置 |
| | | if(empty($matches[0][0])){ |
| | | return ''; |
| | | } |
| | | $matchLength = strlen($matches[0][0]); // 匹配到的字符长度 |
| | | |
| | | |
| | | $end = $start + $matchLength - 1; |
| | | $cutLength = 0; |
| | | |
| | | for ($i = $start; $i <= $end; $i++) { |
| | | if (($maxLength - $cutLength) >= 2) { |
| | | // 对于非英文字符,长度为2(UTF-8下) |
| | | $cutLength += 2; |
| | | } else if (($maxLength - $cutLength) == 1) { |
| | | // 对于英文字符,长度为1 |
| | | $cutLength += 1; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | $nickname = substr($str, 0, $i); |
| | | return $nickname; |
| | | } |
| | | |
| | | public function filterEmoji($str) |
| | | { |
| | | $str = preg_replace_callback( |
| | | '/./u', |
| | | function (array $match) { |
| | | return strlen($match[0]) >= 4 ? '' : $match[0]; |
| | | }, |
| | | $str); |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 格式化提现信息 |
| | | */ |
| | | private function cashInfo($cash) |
| | | { |
| | | $content = ''; |
| | | if ($cash['pay_type']['value'] == 20) { |
| | | $content .= "支付宝姓名:{$cash['alipay_name']}\n"; |
| | | $content .= " 支付宝账号:{$cash['alipay_account']}\n"; |
| | | } elseif ($cash['pay_type']['value'] == 30) { |
| | | $content .= "开户行:{$cash['bank_name']}\n"; |
| | | $content .= " 姓名:{$cash['bank_account']}\n"; |
| | | $content .= " 卡号:{$cash['bank_account']}\n"; |
| | | } |
| | | return $content; |
| | | } |
| | | |
| | | /** |
| | | * 格式化商品信息 |
| | | */ |
| | | private function filterProductInfo($order) |
| | | { |
| | | $content = ''; |
| | | foreach ($order['product'] as $key => $product) { |
| | | $content .= ($key + 1) . ".商品名称:{$product['product_name']}\n"; |
| | | !empty($product['product_attr']) && $content .= " 商品规格:{$product['product_attr']}\n"; |
| | | $content .= " 购买数量:{$product['total_num']}\n"; |
| | | $content .= " 商品总价:{$product['total_price']}元\n\n"; |
| | | } |
| | | return $content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 日期值过滤 |
| | | */ |
| | | private function filterTime($value) |
| | | { |
| | | if (!$value) return ''; |
| | | return date('Y-m-d H:i:s', $value); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | <?php |
| | | // +---------------------------------------------------------------------- |
| | | // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] |
| | | // +---------------------------------------------------------------------- |
| | | // | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. |
| | | // +---------------------------------------------------------------------- |
| | | // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) |
| | | // +---------------------------------------------------------------------- |
| | | // | Author: liu21st <liu21st@gmail.com> |
| | | // +---------------------------------------------------------------------- |
| | | |
| | | // +---------------------------------------------------------------------- |
| | | // | Workerman设置 仅对 php think worker:gateway 指令有效 |
| | | // +---------------------------------------------------------------------- |
| | | return [ |
| | | // 扩展自身需要的配置 |
| | | 'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text |
| | | 'host' => '0.0.0.0', // 监听地址 |
| | | 'port' => 2349, // 监听端口 |
| | | 'socket' => '', // 完整监听地址 |
| | | 'context' => [], // socket 上下文选项 |
| | | 'register_deploy' => true, // 是否需要部署register |
| | | 'businessWorker_deploy' => true, // 是否需要部署businessWorker |
| | | 'gateway_deploy' => true, // 是否需要部署gateway |
| | | |
| | | // Register配置 |
| | | 'registerAddress' => '127.0.0.1:1237', |
| | | |
| | | // Gateway配置 |
| | | 'name' => 'BusinessChatGateway', |
| | | 'count' => 1, |
| | | 'lanIp' => '127.0.0.1', |
| | | 'startPort' => 2100, |
| | | 'daemonize' => false, |
| | | 'pingInterval' => 30, |
| | | 'pingNotResponseLimit' => 1, |
| | | 'pingData' => '', |
| | | |
| | | // BusinessWorker配置 |
| | | 'businessWorker' => [ |
| | | 'name' => 'BusinessChatWorker', |
| | | 'count' => 1, |
| | | 'eventHandler' => '\app\gateway\BusinessEvents', |
| | | ], |
| | | ]; |
| New file |
| | |
| | | <template> |
| | | <!-- |
| | | 作者:lyzflash |
| | | 时间:2025-11-7 |
| | | 描述:组件-选择连盟会员 |
| | | --> |
| | | <el-dialog title="选择用户" :visible.sync="dialogVisible" @close="cancelFunc" :close-on-click-modal="false" :close-on-press-escape="false" width="800px" :append-to-body='true'> |
| | | <div class="common-seach-wrap"> |
| | | <el-form size="small" :inline="true" :model="formInline" class="demo-form-inline"> |
| | | <el-form-item label="昵称"><el-input placeholder="请输入姓名/微信昵称/电话号码" v-model="formInline.search"></el-input></el-form-item> |
| | | <el-form-item> |
| | | <el-button icon="el-icon-search" @click="search">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | |
| | | <!--内容--> |
| | | <div class="product-content"> |
| | | <div class="table-wrap"> |
| | | <el-table :data="tableData" size="small" border style="width: 100%" v-loading="loading" @selection-change="handleSelectionChange"> |
| | | <el-table-column prop="user_id" label="ID" width="70"></el-table-column> |
| | | <el-table-column prop="" label="头像" width="70"> |
| | | <template slot-scope="scope"> |
| | | <img :src="scope.row.avatarUrl" class="radius" width="30" height="30" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="nickName" label="昵称"></el-table-column> |
| | | <el-table-column prop="real_name" label="姓名"></el-table-column> |
| | | <el-table-column prop="mobile" label="电话号码"></el-table-column> |
| | | <el-table-column prop="create_time" label="创建时间"></el-table-column> |
| | | <el-table-column label="操作" width="80" v-if="!islist"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" @click="SingleFunc(scope.row)">选择</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column type="selection" width="45" v-else></el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <!--分页--> |
| | | <div class="pagination"> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | background |
| | | :current-page="curPage" |
| | | :page-sizes="[2, 10, 20, 50, 100]" |
| | | :page-size="pageSize" |
| | | layout="total, prev, pager, next, jumper" |
| | | :total="totalDataNumber" |
| | | ></el-pagination> |
| | | </div> |
| | | </div> |
| | | |
| | | <div slot="footer" class="dialog-footer" v-if="islist"> |
| | | <el-button size="small" @click="dialogVisible = false">取 消</el-button> |
| | | <el-button size="small" type="primary" @click="confirmFunc">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import DataApi from '@/api/data.js'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | /*是否加载完成*/ |
| | | loading: true, |
| | | /*当前是第几页*/ |
| | | curPage: 1, |
| | | /*一页多少条*/ |
| | | pageSize: 10, |
| | | /*一共多少条数据*/ |
| | | totalDataNumber: 0, |
| | | /*搜索表单对象*/ |
| | | formInline: { |
| | | /*昵称*/ |
| | | search: '', |
| | | }, |
| | | /*会员列表*/ |
| | | tableData: [], |
| | | /*选中的*/ |
| | | multipleSelection: [], |
| | | /*是否显示*/ |
| | | dialogVisible: false |
| | | }; |
| | | }, |
| | | props: { |
| | | is_open: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // 是否多选 |
| | | islist: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | }, |
| | | watch: { |
| | | is_open: function(n, o) { |
| | | if (n != o) { |
| | | this.dialogVisible = n; |
| | | if (n) { |
| | | this.getTableList(); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | created() {}, |
| | | methods: { |
| | | /*选择第几页*/ |
| | | handleCurrentChange(val) { |
| | | this.curPage = val; |
| | | this.getTableList(); |
| | | }, |
| | | |
| | | /*每页多少条*/ |
| | | handleSizeChange(val) { |
| | | this.curPage = 1; |
| | | this.pageSize = val; |
| | | this.getTableList(); |
| | | }, |
| | | |
| | | /*获取数据*/ |
| | | getTableList() { |
| | | let self = this; |
| | | self.loading = true; |
| | | let params = self.formInline; |
| | | params.page = self.curPage; |
| | | params.list_rows = self.pageSize; |
| | | DataApi.getBranchMember(params,true).then(data => { |
| | | self.loading = false; |
| | | self.tableData = data.data.list.data; |
| | | self.totalDataNumber = data.data.list.total; |
| | | self.gradeList = data.data.grade; |
| | | }) |
| | | .catch(error => { |
| | | self.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | /*查询*/ |
| | | search() { |
| | | this.curPage = 1; |
| | | this.tableData = []; |
| | | this.getTableList(); |
| | | }, |
| | | |
| | | /*点击确定*/ |
| | | confirmFunc() { |
| | | let params = this.multipleSelection; |
| | | this.emitFunc(params); |
| | | }, |
| | | |
| | | /*关闭弹窗*/ |
| | | cancelFunc(e) { |
| | | this.emitFunc(); |
| | | }, |
| | | |
| | | /*发送事件*/ |
| | | emitFunc(e) { |
| | | this.dialogVisible = false; |
| | | if (e && typeof e != 'undefined') { |
| | | this.$emit('close', { |
| | | type: 'success', |
| | | params: e |
| | | }); |
| | | } else { |
| | | this.$emit('close', { |
| | | type: 'error' |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /*监听单选按钮选中事件*/ |
| | | selectUser(val) { |
| | | this.multipleSelection = val; |
| | | this.confirmFunc(); |
| | | }, |
| | | |
| | | /*选择用户*/ |
| | | handleSelectionChange(e) { |
| | | this.multipleSelection = e; |
| | | }, |
| | | |
| | | /*单选*/ |
| | | SingleFunc(row){ |
| | | this.multipleSelection=[row]; |
| | | this.confirmFunc(); |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | |
| | | /*当前是第几页*/ |
| | | curPage: 1, |
| | | /*一页多少条*/ |
| | | pageSize: 15, |
| | | pageSize: 10, |
| | | /*一共多少条数据*/ |
| | | totalDataNumber: 0, |
| | | /*搜索表单对象*/ |
| | |
| | | 时间:2019-10-25 |
| | | 描述:权限-管理员列表-添加管理员 |
| | | --> |
| | | <el-dialog title="添加管理员" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body='true'> |
| | | <el-dialog title="添加管理员" :visible.sync="dialogVisible" width="600px" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body='true'> |
| | | <!--form表单--> |
| | | <el-form size="small" ref="form" :model="form" :rules="formRules" :label-width="formLabelWidth"> |
| | | <el-form-item label="用户名" prop="user_name"><el-input v-model="form.user_name" placeholder="请输入用户名"></el-input></el-form-item> |
| | |
| | | <el-form-item label="绑定用户"> |
| | | <el-row> |
| | | <el-button @click="addClick" icon="el-icon-plus">选择会员</el-button> |
| | | <div v-if="form.user_info.user_id!=''" class="img"> |
| | | <img :src="form.user_info.user.avatarUrl" width="100" height="100" /> |
| | | <div v-if="form.user_id" class="img mt10"> |
| | | <img :src="user_info.avatarUrl" width="100" height="100" /> |
| | | <p>{{ user_info.nickName }}<span v-if="user_info.real_name">({{ user_info.real_name }})</span></p> |
| | | </div> |
| | | </el-row> |
| | | </el-form-item> |
| | |
| | | <el-button type="primary" @click="onSubmit" :loading="loading">确 定</el-button> |
| | | </div> |
| | | <!--添加--> |
| | | <GetUser :is_open="open_add" @close="closeDialogFunc"></GetUser> |
| | | <GetMember :is_open="open_add" @close="closeDialogFunc"></GetMember> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import AuthApi from '@/api/auth.js'; |
| | | import GetUser from '@/components/user/GetUser.vue'; |
| | | import GetMember from '@/components/member/GetMember.vue'; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | user_name: '', |
| | | access_id: [], |
| | | user_id: 0, |
| | | user_info:{ |
| | | user:{ |
| | | |
| | | } |
| | | } |
| | | password: '', |
| | | confirm_password: '', |
| | | real_name: '' |
| | | }, |
| | | user_info: {}, |
| | | /*form验证*/ |
| | | formRules: { |
| | | user_name: [ |
| | |
| | | } |
| | | }, |
| | | components:{ |
| | | GetUser |
| | | GetMember |
| | | }, |
| | | watch: { |
| | | open: function(n, o) { |
| | |
| | | /*关闭获取用户弹窗*/ |
| | | closeDialogFunc(e) { |
| | | if (e.type != 'error') { |
| | | this.form.user_info = e.params[0]; |
| | | this.user_info = e.params[0]; |
| | | this.form.user_id = e.params[0].user_id; |
| | | } |
| | | this.open_add = false; |
| | |
| | | </el-form-item> |
| | | <el-form-item label="绑定用户" > |
| | | <el-row> |
| | | <el-button @click="addClick" icon="el-icon-plus">选择会员</el-button> |
| | | <!-- <el-button @click="addClick" icon="el-icon-plus">选择会员</el-button> --> |
| | | <div class="img" v-if="form.user_id > 0"> |
| | | <img :src="form.user.avatarUrl" width="100" height="100" /> |
| | | <p>{{ form.user.nickName }}<span v-if="form.user.real_name">({{ form.user.real_name }})</span></p> |
| | | </div> |
| | | </el-row> |
| | | </el-form-item> |
| | |
| | | if(process.env.NODE_ENV === 'development'){ |
| | | app_url = 'http://lblmh.com'; |
| | | //#ifdef H5 |
| | | app_url = ''; |
| | | app_url = ''; |
| | | //#endif |
| | | } |
| | | // 如果是生产环境,h5环境下直接读取url |
| | |
| | | "navigationBarTitleText": "首页", |
| | | "enablePullDownRefresh": true, |
| | | "app-plus": { |
| | | "titleNView": false ,//禁用原生导航栏 |
| | | "scrollIndicator":"none" |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "navigationBarTitleText": "分类", |
| | | "navigationStyle": "custom", |
| | | "app-plus": { |
| | | "navigationBarTextStyle":"black", |
| | | "navigationBarTextStyle": "black", |
| | | "titleNView": false, |
| | | "animationType": "none" |
| | | } |
| | |
| | | "style": { |
| | | "navigationBarTitleText": "购物车", |
| | | "app-plus": { |
| | | "navigationBarTextStyle":"black", |
| | | "navigationBarTextStyle": "black", |
| | | "titleNView": false, |
| | | "animationType": "none" |
| | | } |
| | |
| | | //#endif |
| | | } |
| | | } |
| | | }/* , { |
| | | "path": "pages/user/my_shop/my_live/notice/notice", |
| | | "style": { |
| | | "navigationBarTitleText": "直播预告", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | /* , { |
| | | "path": "pages/user/my_shop/my_live/notice/notice", |
| | | "style": { |
| | | "navigationBarTitleText": "直播预告", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "直播预告", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/my-live/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "直播商品", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/live/live", |
| | | "style": { |
| | | "navigationBarTitleText": "发起直播", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/my-live/record", |
| | | "style": { |
| | | "navigationBarTitleText": "直播记录", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/my-live/my-live", |
| | | "style": { |
| | | "navigationBarTitleText": "我的直播", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "直播预告", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/my-live/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "直播商品", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/live/live", |
| | | "style": { |
| | | "navigationBarTitleText": "发起直播", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/user/my_shop/my_live/my-live/record", |
| | | "style": { |
| | | "navigationBarTitleText": "直播记录", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/my-live/my-live", |
| | | "style": { |
| | | "navigationBarTitleText": "我的直播", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/live-order/live-order", |
| | | "style": { |
| | | "navigationBarTitleText": "直播订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } */ |
| | | }, { |
| | | "path": "pages/user/my_shop/my_live/live-order/live-order", |
| | | "style": { |
| | | "navigationBarTitleText": "直播订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } */ |
| | | , { |
| | | "path": "pages/order/alipay-h5/alipay-h5", |
| | | "style": { |
| | |
| | | } |
| | | } |
| | | |
| | | },{ |
| | | "path" : "pages/order/cashier", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "收银台", |
| | | "enablePullDownRefresh": false, |
| | | }, { |
| | | "path": "pages/order/cashier", |
| | | "style": { |
| | | "navigationBarTitleText": "收银台", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | }, |
| | | //微信插件配置 |
| | | "mp-weixin":{ |
| | | "usingComponents": { |
| | | "fs-cash-item":"plugin://fshows-cash-plugin/fs-cash-item" |
| | | } |
| | | "mp-weixin": { |
| | | "usingComponents": { |
| | | "fs-cash-item": "plugin://fshows-cash-plugin/fs-cash-item" |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | ,{ |
| | | "path" : "pages/shop/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "pages/shop/index", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | } |
| | | ], |
| | | "subPackages": [ |
| | | { |
| | | "subPackages": [{ |
| | | "root": "pages/branch", |
| | | "pages": [ |
| | | { |
| | | "pages": [{ |
| | | "path": "activity/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "分会活动", |
| | | "navigationBarTitleText": "", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | { |
| | | "path": "activity/product/index", |
| | | "style": { |
| | | "navigationBarTitleText": "活动超值购", |
| | | "navigationBarTitleText": "", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "branch/index/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "分会风采", |
| | | "path": "branch/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "member/index/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "组织架构", |
| | | "path": "member/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "member/detail/detail", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "会员详情", |
| | | "path": "member/detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "会员详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "分会管理中心", |
| | | "path": "admin/index", |
| | | "style": { |
| | | "navigationBarTitleText": "分会管理中心", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/activity/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "活动管理", |
| | | "path": "admin/activity/index", |
| | | "style": { |
| | | "navigationBarTitleText": "活动管理", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/activity/add", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "添加活动", |
| | | "path": "admin/activity/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加活动", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/activity/edit", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "编辑活动", |
| | | "path": "admin/activity/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "编辑活动", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/activity/user", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "报名名单", |
| | | "path": "admin/activity/user", |
| | | "style": { |
| | | "navigationBarTitleText": "报名名单", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/activity/album", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "活动相册", |
| | | "path": "admin/activity/album", |
| | | "style": { |
| | | "navigationBarTitleText": "活动相册", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/member/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "会员管理", |
| | | "path": "admin/member/index", |
| | | "style": { |
| | | "navigationBarTitleText": "会员管理", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/member/add", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "添加会员", |
| | | "path": "admin/member/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加会员", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/member/edit", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "修改会员", |
| | | "path": "admin/member/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "修改会员", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/branch/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "分会管理", |
| | | "path": "admin/branch/index", |
| | | "style": { |
| | | "navigationBarTitleText": "分会管理", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/branch/add", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "添加分会", |
| | | "path": "admin/branch/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加分会", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path" : "admin/branch/edit", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "编辑分会", |
| | | "path": "admin/branch/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "编辑分会", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | |
| | | }, |
| | | { |
| | | "root": "pages/user", |
| | | "pages": [ |
| | | { |
| | | "path": "userinfo/userinfo", |
| | | "style": { |
| | | "navigationBarTitleText": "用户信息", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/address", |
| | | "style": { |
| | | "navigationBarTitleText": "设置地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-wallet", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的钱包", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "钱包明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-supplier-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "商户余额", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加收货地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/edit/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "地址编辑", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "我的优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-qrcode/my-qrcode", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "会员码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "points/points", |
| | | "style": { |
| | | "navigationBarTitleText": "积分", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-bargain/my-bargain", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的砍价", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "set/set", |
| | | "style": { |
| | | "navigationBarTitleText": "设置", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_attention/my_attention", |
| | | "style": { |
| | | "navigationBarTitleText": "我的收藏", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_collect/my_collect", |
| | | "style": { |
| | | "navigationBarTitleText": "我的关注", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的店铺", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "register/register", |
| | | "style": { |
| | | "navigationBarTitleText": "注册", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_order", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/after_sale", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/my_shop_password", |
| | | "style": { |
| | | "navigationBarTitleText": "修改密码", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-phone/modify-phone", |
| | | "style": { |
| | | "navigationBarTitleText": "绑定手机号", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-real", |
| | | "style": { |
| | | "navigationBarTitleText": "实名认证", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-edit", |
| | | "style": { |
| | | "navigationBarTitleText": "修改银行卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/pro_admin", |
| | | "style": { |
| | | "navigationBarTitleText": "商品管理", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_data", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺数据", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_detail", |
| | | "style": { |
| | | "navigationBarTitleText": "订单详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path" : "cash/apply", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path" : "cash/list", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "余额提现", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | }, { |
| | | "path" : "card/card", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "会员卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path" : "card/list", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "会员卡列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path" : "my_activity/index", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "我参与的活动", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path" : "my_activity/detail", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "报名详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | "pages": [{ |
| | | "path": "userinfo/userinfo", |
| | | "style": { |
| | | "navigationBarTitleText": "用户信息", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | ] |
| | | }, { |
| | | "path": "address/address", |
| | | "style": { |
| | | "navigationBarTitleText": "设置地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-wallet", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的钱包", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "钱包明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-wallet/my-supplier-balance", |
| | | "style": { |
| | | "navigationBarTitleText": "商户余额", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/add/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加收货地址", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "address/edit/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "地址编辑", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "我的优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-coupon/my-detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-qrcode/my-qrcode", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "会员码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "points/points", |
| | | "style": { |
| | | "navigationBarTitleText": "积分", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my-bargain/my-bargain", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的砍价", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "set/set", |
| | | "style": { |
| | | "navigationBarTitleText": "设置", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_attention/my_attention", |
| | | "style": { |
| | | "navigationBarTitleText": "我的收藏", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_collect/my_collect", |
| | | "style": { |
| | | "navigationBarTitleText": "我的关注", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "我的店铺", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/member/member", |
| | | "style": { |
| | | "navigationBarTitleText": "年卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "register/register", |
| | | "style": { |
| | | "navigationBarTitleText": "注册", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_order", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺订单", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/after_sale", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/my_shop_password", |
| | | "style": { |
| | | "navigationBarTitleText": "修改密码", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-phone/modify-phone", |
| | | "style": { |
| | | "navigationBarTitleText": "绑定手机号", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-real", |
| | | "style": { |
| | | "navigationBarTitleText": "实名认证", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "modify-real/modify-edit", |
| | | "style": { |
| | | "navigationBarTitleText": "修改银行卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_shop/pro_admin", |
| | | "style": { |
| | | "navigationBarTitleText": "商品管理", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_data", |
| | | "style": { |
| | | "navigationBarTitleText": "店铺数据", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "my_shop/my_shop_detail", |
| | | "style": { |
| | | "navigationBarTitleText": "订单详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "cash/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "cash/list", |
| | | "style": { |
| | | "navigationBarTitleText": "余额提现", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "titleNView": false, //禁用原生导航栏 |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | }, { |
| | | "path": "card/card", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | }, { |
| | | "path": "card/list", |
| | | "style": { |
| | | "navigationBarTitleText": "会员卡列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/index", |
| | | "style": { |
| | | "navigationBarTitleText": "我参与的活动", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "my_activity/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "报名详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }] |
| | | }, |
| | | { |
| | | "root": "pages/store", |
| | | "pages": [ |
| | | { |
| | | "pages": [{ |
| | | "path": "detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "门店详情", |
| | |
| | | }, |
| | | { |
| | | "root": "pages/coupon", |
| | | "pages": [ |
| | | { |
| | | "path": "coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "领券中心", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | "pages": [{ |
| | | "path": "coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "领券中心", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | ] |
| | | }, { |
| | | "path": "detail", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "优惠券详情", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }] |
| | | }, |
| | | { |
| | | "root": "pages/plus", |
| | | "pages": [ |
| | | { |
| | | "pages": [{ |
| | | "path": "signin/signin", |
| | | "style": { |
| | | "navigationBarTitleText": "签到", |
| | |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | |
| | | }, { |
| | | "path": "chat/supplier_chat", |
| | | "style": { |
| | |
| | | //#endif |
| | | } |
| | | } |
| | | |
| | | |
| | | }, { |
| | | "path": "lottery/lottery", |
| | | "style": { |
| | |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | } |
| | | }, { |
| | | "path": "table/table", |
| | | "style": { |
| | | "navigationBarTitleText": "表单", |
| | |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | |
| | | |
| | | } |
| | | },{ |
| | | "path" : "presale/list", |
| | | "style" : |
| | | { |
| | | }, { |
| | | "path": "presale/list", |
| | | "style": { |
| | | "navigationBarTitleText": "预售列表", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | |
| | | "scrollIndicator": "none" |
| | | } |
| | | } |
| | | |
| | | } |
| | | ,{ |
| | | "path" : "task/index", |
| | | "style" : |
| | | { |
| | | |
| | | }, { |
| | | "path": "task/index", |
| | | "style": { |
| | | "navigationBarTitleText": "任务中心", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | |
| | | }, |
| | | { |
| | | "path": "business/index", |
| | | "style" : |
| | | { |
| | | "style": { |
| | | "navigationBarTitleText": "名片", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "business/add", |
| | | "style" : |
| | | { |
| | | "style": { |
| | | "navigationBarTitleText": "添加名片", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "business/detail", |
| | | "style" : |
| | | { |
| | | "style": { |
| | | "navigationBarTitleText": "查看名片", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path" : "business/list", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "名片列表" |
| | | "path": "business/list", |
| | | "style": { |
| | | "navigationBarTitleText": "名片列表" |
| | | } |
| | | }, |
| | | { |
| | | "path" : "business/visitors", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "访客列表" |
| | | "path": "business/visitors", |
| | | "style": { |
| | | "navigationBarTitleText": "访客列表" |
| | | } |
| | | }, |
| | | { |
| | | "path" : "business/cashier", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "收银台" |
| | | "path": "business/cashier", |
| | | "style": { |
| | | "navigationBarTitleText": "收银台" |
| | | } |
| | | }, |
| | | { |
| | | "path" : "business/chat/chat", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "聊天" |
| | | "path": "business/chat/chat", |
| | | "style": { |
| | | "navigationBarTitleText": "聊天" |
| | | } |
| | | }, |
| | | { |
| | | "path" : "business/chat/list", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText" : "聊天列表" |
| | | "path": "business/chat/list", |
| | | "style": { |
| | | "navigationBarTitleText": "聊天列表" |
| | | } |
| | | }, { |
| | | "path": "vip/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "VIP中心", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/apply", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "申请成为VIP", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/team", |
| | | "style": { |
| | | "navigationBarTitleText": "我的团队", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/order", |
| | | "style": { |
| | | "navigationBarTitleText": "VIP订单", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/cash", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/qrcode", |
| | | "style": { |
| | | "navigationBarTitleText": "推广二维码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/cash/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "提现申请", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "vip/cash/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "root": "pages/login", |
| | | "pages": [ |
| | | { |
| | | "pages": [{ |
| | | "path": "openlogin", |
| | | "style": { |
| | | "navigationBarTitleText": "登录", |
| | |
| | | ] |
| | | }, |
| | | { |
| | | "root": "pages2", |
| | | "pages": [{ |
| | | "path": "city/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "选择站点", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为队长", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "team/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "团队分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "team/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/team/team", |
| | | "style": { |
| | | "navigationBarTitleText": "我的团队", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/statistics/statistics", |
| | | "style": { |
| | | "navigationBarTitleText": "分红统计", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | "root": "pages2", |
| | | "pages": [{ |
| | | "path": "city/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "选择站点", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为队长", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "team/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "团队分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "team/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/team/team", |
| | | "style": { |
| | | "navigationBarTitleText": "我的团队", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/statistics/statistics", |
| | | "style": { |
| | | "navigationBarTitleText": "分红统计", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "team/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "team/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为代理", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "region/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "代理区域", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "region/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/bonus/bonus", |
| | | "style": { |
| | | "navigationBarTitleText": "代理分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "region/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为股东", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "shareholder/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "股东分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "shareholder/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/bonus/bonus", |
| | | "style": { |
| | | "navigationBarTitleText": "分红明细", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "shareholder/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "配送点", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "delivery/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送点订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/clerk", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "delivery/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "delivery/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "配送员", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "deliveryclerk/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "活动报名", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "活动详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/rule/rule", |
| | | "style": { |
| | | "navigationBarTitleText": "活动介绍", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证列表", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证上传", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/img/img", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodstore/store", |
| | | "style": { |
| | | "navigationBarTitleText": "我的", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodstore/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "好店详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodcoupon/coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "领好券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "store/order", |
| | | "style": { |
| | | "navigationBarTitleText": "订单核销记录", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "store/couponOrder", |
| | | "style": { |
| | | "navigationBarTitleText": "券核销记录", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "团长", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/deliveryman", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员管理", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加配送员", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "外卖配送员", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "deliveryman/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "bonus/apply/apply", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "申请成为分红用户", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "bonus/index/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "分红中心", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "bonus/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "bonus/qrcode/qrcode", |
| | | "style": { |
| | | "navigationBarTitleText": "推广二维码", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "bonus/team/team", |
| | | "style": { |
| | | "navigationBarTitleText": "成员", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "bonus/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "bonus/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, { |
| | | "path": "team/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为代理", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "region/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "代理区域", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "region/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/bonus/bonus", |
| | | "style": { |
| | | "navigationBarTitleText": "代理分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "region/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "region/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请成为股东", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "shareholder/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "股东分红", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | },{ |
| | | "path": "shareholder/order/order", |
| | | "style": { |
| | | "navigationBarTitleText": "分红订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/bonus/bonus", |
| | | "style": { |
| | | "navigationBarTitleText": "分红明细", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "shareholder/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "shareholder/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "配送点", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | },{ |
| | | "path": "delivery/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送点订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/clerk", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "delivery/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "delivery/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "delivery/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "配送员", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | },{ |
| | | "path": "deliveryclerk/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "deliveryclerk/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryclerk/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "活动报名", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "活动详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "regactivity/rule/rule", |
| | | "style": { |
| | | "navigationBarTitleText": "活动介绍", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/index/index", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证列表", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/detail/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证上传", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "ticket/img/img", |
| | | "style": { |
| | | "navigationBarTitleText": "凭证详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodstore/store", |
| | | "style": { |
| | | "navigationBarTitleText": "我的", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodstore/detail", |
| | | "style": { |
| | | "navigationBarTitleText": "好店详情", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "goodcoupon/coupon", |
| | | "style": { |
| | | "navigationBarTitleText": "领好券", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "store/order", |
| | | "style": { |
| | | "navigationBarTitleText": "订单核销记录", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "store/couponOrder", |
| | | "style": { |
| | | "navigationBarTitleText": "券核销记录", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "团长", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | },{ |
| | | "path": "commander/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/deliveryman", |
| | | "style": { |
| | | "navigationBarTitleText": "配送员管理", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "commander/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "commander/add", |
| | | "style": { |
| | | "navigationBarTitleText": "添加配送员", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/index", |
| | | "style": { |
| | | "navigationStyle": "custom", |
| | | "navigationBarTitleText": "外卖配送员", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | },{ |
| | | "path": "deliveryman/order", |
| | | "style": { |
| | | "navigationBarTitleText": "配送订单", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "deliveryman/cash/apply/apply", |
| | | "style": { |
| | | "navigationBarTitleText": "申请提现", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/cash/list/list", |
| | | "style": { |
| | | "navigationBarTitleText": "提现明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }, { |
| | | "path": "deliveryman/settlement", |
| | | "style": { |
| | | "navigationBarTitleText": "结算明细", |
| | | "app-plus": { |
| | | //#ifdef H5 |
| | | "titleNView": false |
| | | //#endif |
| | | } |
| | | } |
| | | }] |
| | | }], |
| | | ] |
| | | } |
| | | ], |
| | | "globalStyle": { |
| | | "navigationBarTextStyle": "black", |
| | | "navigationBarTitleText": "uni-app", |
| | |
| | | "query": "" //启动参数,在页面的onLoad函数里面得到 |
| | | }] |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | .no-agent { |
| | | // padding-top: 190rpx; |
| | | margin-top: 348rpx; |
| | | } |
| | | |
| | | .no-agent-image { |
| | |
| | | .section-product .icon-jiantou { |
| | | color: #999; |
| | | } |
| | | /* 商品列表样式 */ |
| | | .section-product .item { |
| | | margin: 0 26rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | padding-bottom: 29rpx; |
| | | padding-top: 29rpx; |
| | | } |
| | | |
| | | .section-product .cover { |
| | | width: 150rpx; |
| | | height: 150rpx; |
| | | border-radius: 8px; |
| | | } |
| | | |
| | | .section-product .info { |
| | | flex: 1; |
| | | padding-left: 30rpx; |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .section-product .title { |
| | | width: 100%; |
| | | font-size: 26rpx; |
| | | display: -webkit-box; |
| | | overflow: hidden; |
| | | -webkit-line-clamp: 2; |
| | | -webkit-box-orient: vertical; |
| | | } |
| | | |
| | | .user-info .photo, |
| | | .user-info .photo image { |
| | |
| | | |
| | | onReg(e) { |
| | | this.$refs.regForm.activityData = this.activityData; |
| | | this.$refs.regForm.branch_name = this.activityData.branch.name; |
| | | this.$refs.regForm.formData.branch_id = this.activityData.branch_id; |
| | | this.is_friend = e; |
| | | if (this.activityData.fee > 0 || e) { |
| | | if (this.activityData.fee > 0 || e || !this.activityData.is_member) { |
| | | this.isOpenReg = true; |
| | | } else { |
| | | uni.showModal({ |
| | |
| | | this.isOpenUser = false; |
| | | }, |
| | | |
| | | }, |
| | | onShareAppMessage() { |
| | | if (this.activityData) { |
| | | return { |
| | | title: `${this.activityData.name}`, |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | }; |
| | | } |
| | | return { |
| | | title: '活动详情', |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}` |
| | | }; |
| | | }, |
| | | onShareTimeline() { |
| | | if (this.activityData) { |
| | | return { |
| | | title: `${this.activityData.name}`, |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | }; |
| | | } |
| | | return { |
| | | title: '活动详情', |
| | | path: `/pages/plus/business/detail?activity_id=${this.activity_id}&referee_id=${this.getUserId()}` |
| | | }; |
| | | } |
| | | } |
| | | </script> |
| New file |
| | |
| | | <template> |
| | | <view :class="[Visible ? 'usable-popup branch_open' : 'usable-popup branch_close', theme() || '']" :data-theme='theme()'> |
| | | <view class="popup-bg" @click="closePopup(null)"></view> |
| | | <view class="main pt30" v-on:click.stop> |
| | | <view class="popup-search d-s-c pb30 pr border-b-e"> |
| | | <view class="search-box d-s-c"> |
| | | <text class="icon iconfont icon-sousuo"></text> |
| | | <input type="text" v-model="keyword" class="flex-1 ml10 f26 gray3" value="" placeholder-class="f26 gray9" |
| | | placeholder="请输入分会名称关键词进行搜索" confirm-type="search" @confirm="searchFunc()" /> |
| | | </view> |
| | | <view class="iconfont icon-guanbi" @click="closePopup(null)"></view> |
| | | </view> |
| | | <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" :show-scrollbar="false" lower-threshold="50" @scrolltolower="scrolltolowerFunc"> |
| | | <view class="branch-box"> |
| | | <view class="branch-item d-b-c" v-for="(item, index) in listData" :key="index"> |
| | | <view class="title f28">{{item.name}}</view> |
| | | <view class="select-box" @click="chooseBranch(item)"> |
| | | <i class="iconfont icon-xuanze theme-price" v-if="select_branch['branch_id'] == item.branch_id"></i> |
| | | <view class="round" v-else></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 没有记录 --> |
| | | <view class="none-data-box" v-if="listData.length==0"> |
| | | <image :src="remoteImg('no_thing')" mode="widthFix"></image> |
| | | <text>暂无数据</text> |
| | | </view> |
| | | <uni-load-more v-else :loadingType="loadingType"></uni-load-more> |
| | | </scroll-view> |
| | | <view class="footer-btn bg-white p-0-30 pt20 pb20"> |
| | | <button type="default" @click="onSubmit" class="btn-submit theme-btn">确定</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import uniLoadMore from '@/components/uni-load-more.vue'; |
| | | export default { |
| | | components: { |
| | | uniLoadMore, |
| | | }, |
| | | data() { |
| | | return { |
| | | /*手机高度*/ |
| | | phoneHeight: 0, |
| | | /*可滚动视图区域高度*/ |
| | | scrollviewHigh: 0, |
| | | /*是否可见*/ |
| | | Visible: false, |
| | | listData: [], |
| | | /*最后一页码数*/ |
| | | last_page: 0, |
| | | /*当前页面*/ |
| | | page: 1, |
| | | /*每页条数*/ |
| | | list_rows: 10, |
| | | /*有没有更多*/ |
| | | no_more: false, |
| | | /*是否正在加载*/ |
| | | loading: true, |
| | | select_branch: {}, |
| | | keyword: '', // 搜索关键词 |
| | | }; |
| | | }, |
| | | props: ['isOpenBranch'], |
| | | computed: { |
| | | /*加载中状态*/ |
| | | loadingType() { |
| | | if (this.loading) { |
| | | return 1; |
| | | } else { |
| | | if (this.listData.length != 0 && this.no_more) { |
| | | return 2; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | onLoad() {}, |
| | | mounted() { |
| | | this.init(); |
| | | }, |
| | | watch: { |
| | | isOpenBranch: function(n, o) { |
| | | if (n != o) { |
| | | this.Visible = n; |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | /*初始化*/ |
| | | init() { |
| | | let self = this; |
| | | uni.getSystemInfo({ |
| | | success(res) { |
| | | self.phoneHeight = res.windowHeight; |
| | | self.scrollviewHigh = self.phoneHeight * 0.6 |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /*初始化列表数据*/ |
| | | initData() { |
| | | this.page = 1; |
| | | this.last_page = 0; |
| | | this.listData = []; |
| | | }, |
| | | |
| | | /*获取数据*/ |
| | | getData() { |
| | | let self = this; |
| | | self.loading = true; |
| | | self._get( |
| | | 'branch.branch/index', { |
| | | keyword: self.keyword, |
| | | page: self.page, |
| | | list_rows: self.list_rows, |
| | | }, |
| | | function(res) { |
| | | self.loading = false; |
| | | self.listData = self.listData.concat(res.data.list.data); |
| | | self.last_page = res.data.list.last_page; |
| | | if (res.data.list.last_page <= 1) { |
| | | self.no_more = true; |
| | | } else { |
| | | self.no_more = false; |
| | | } |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | searchFunc() { |
| | | this.listData = []; |
| | | this.page = 1; |
| | | /*获取列表*/ |
| | | this.getData(); |
| | | }, |
| | | |
| | | chooseBranch(item) { |
| | | this.select_branch = { |
| | | name: item.name, |
| | | branch_id: item.branch_id |
| | | }; |
| | | }, |
| | | |
| | | onSubmit() { |
| | | this.closePopup(this.select_branch); |
| | | }, |
| | | |
| | | /*可滚动视图区域到底触发*/ |
| | | scrolltolowerFunc() { |
| | | let self = this; |
| | | if (self.no_more) { |
| | | return; |
| | | } |
| | | self.page++; |
| | | if (self.page <= self.last_page) { |
| | | self.getData(); |
| | | } else { |
| | | self.no_more = true; |
| | | } |
| | | }, |
| | | |
| | | /*关闭弹窗*/ |
| | | closePopup(e) { |
| | | this.$emit('close', e); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .usable-popup .popup-bg { |
| | | position: fixed; |
| | | top: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | background: rgba(0, 0, 0, 0.6); |
| | | z-index: 112; |
| | | } |
| | | |
| | | .usable-popup .main { |
| | | position: fixed; |
| | | width: 100%; |
| | | bottom: 0; |
| | | min-height: 200rpx; |
| | | background-color: #ffffff; |
| | | transform: translate3d(0, 1380rpx, 0); |
| | | transition: transform 0.2s cubic-bezier(0, 0, 0.25, 1); |
| | | bottom: env(safe-area-inset-bottom); |
| | | z-index: 112; |
| | | border-radius: 30rpx 30rpx 0 0; |
| | | } |
| | | |
| | | .usable-popup.branch_open .main { |
| | | transform: translate3d(0, 0, 0); |
| | | } |
| | | |
| | | .usable-popup.branch_close .popup-bg { |
| | | display: none; |
| | | } |
| | | |
| | | // .footer-btn .btn-submit { |
| | | // height: 88rpx; |
| | | // line-height: 88rpx; |
| | | // font-size: 30rpx; |
| | | // border: 1rpx solid #ff5704; |
| | | // border-radius: 88rpx; |
| | | // } |
| | | |
| | | .branch-box { |
| | | padding: 20rpx; |
| | | .branch-item { |
| | | padding: 15rpx 0; |
| | | font-size: 28rpx; |
| | | height: 38rpx; |
| | | .select-box { |
| | | .iconfont { |
| | | font-size: 42rpx; |
| | | } |
| | | .round { |
| | | width: 30rpx; |
| | | height: 30rpx; |
| | | border: 4rpx solid #999999; |
| | | border-radius: 30rpx; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .popup-search { |
| | | .search-box { |
| | | background: #f5f5f5; |
| | | padding: 10rpx 20rpx; |
| | | width: 500rpx; |
| | | border-radius: 60rpx; |
| | | margin-left: 20rpx; |
| | | } |
| | | |
| | | .icon-guanbi { |
| | | position: absolute; |
| | | right: 30rpx; |
| | | top: 15rpx; |
| | | color: #666666; |
| | | } |
| | | } |
| | | |
| | | </style> |
| | |
| | | <view class="tips f28 p20 radius12 friend" v-if="is_friend"><text class="iconfont icon-gantanhao mr10"></text>您正在帮朋友报名,以下信息请填写您朋友的信息</view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">真实姓名</view> |
| | | <input type="text" maxlength="30" class="flex-1" placeholder="请输入真实姓名" v-model="formData.real_name" placeholder-class= |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入真实姓名" v-model="formData.real_name" placeholder-class= |
| | | "placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">手机号码</view> |
| | | <input type="text" maxlength="30" class="flex-1" placeholder="请输入常用的手机号码" v-model="formData.mobile" placeholder-class= |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入常用的手机号码" v-model="formData.mobile" placeholder-class= |
| | | "placeholder" /> |
| | | </view> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">单位/公司名称</view> |
| | | <input type="text" maxlength="30" class="flex-1" placeholder="请输入单位/公司名称" v-model="formData.company" placeholder-class= |
| | | <input type="text" maxlength="30" class="flex-1 f28" placeholder="请输入单位/公司名称" v-model="formData.company" placeholder-class= |
| | | "placeholder" /> |
| | | </view> |
| | | <!-- 加入哪个分会 --> |
| | | <view class="item d-s-c"> |
| | | <view class="item-name">所在分会</view> |
| | | <view class="flex-1 d-s-c f28" @click="openBranch"> |
| | | <text class="flex-1" v-if="formData.branch_id">{{branch_name}}</text> |
| | | <text class="gray6 flex-1" v-else>去选择</text> |
| | | <text class='iconfont icon-jiantou'></text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="reg-section pay-box p30 radius24 bg-white" v-if="activityData.fee > 0"> |
| | |
| | | </view> |
| | | <!-- 积分弹窗 --> |
| | | <PointsForm :isOpenPoints="isOpenPoints" :activityData="activityData" :max_price="onlinePrice+formData.points_money" @close="closePointsFunc"></PointsForm> |
| | | <!-- 分会弹窗 --> |
| | | <Branch :isOpenBranch="isOpenBranch" @close="closeBranchFunc"></Branch> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { pay } from '@/common/pay.js'; |
| | | import PointsForm from './points'; // 积分选择弹窗 |
| | | import Branch from './branch'; // 分会选择弹窗 |
| | | export default { |
| | | components: { |
| | | PointsForm |
| | | PointsForm, |
| | | Branch |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | is_use_balance: 0, // 是否使用余额支付 |
| | | is_combined_pay: 0, // 是否需要组合支付 |
| | | pay_type: 20, // 支付方式,默认微信支付 |
| | | branch_id: '', // 所在分会 |
| | | }, |
| | | /*尺寸比例*/ |
| | | ratio: 1, |
| | |
| | | validate: false, |
| | | payData: [], // 半屏小程序相关 |
| | | isFirst: false, |
| | | branch_name: '', |
| | | isOpenBranch: false, |
| | | }; |
| | | }, |
| | | props: ['isOpenReg', 'in_radius', 'is_friend'], |
| | |
| | | } |
| | | this.isOpenPoints = false; |
| | | }, |
| | | |
| | | openBranch() { |
| | | this.isOpenBranch = true; |
| | | }, |
| | | |
| | | /*关闭分会弹窗*/ |
| | | closeBranchFunc(e) { |
| | | if (e !== null) { |
| | | this.formData.branch_id = e.branch_id; |
| | | this.branch_name = e.name; |
| | | } |
| | | this.isOpenBranch = false; |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | topRefresh: false, |
| | | branch_id: 0, // 分会ID |
| | | is_first_show: true, // 处理授权返回加载数据空白的问题 |
| | | words: {}, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | list_rows: self.list_rows, |
| | | }, |
| | | function(res) { |
| | | self.words = res.data.words; |
| | | self.listData = self.listData.concat(res.data.list.data); |
| | | self.last_page = res.data.list.last_page; |
| | | if (res.data.list.last_page <= 1) { |
| | |
| | | } else { |
| | | self.no_more = false; |
| | | } |
| | | // uni.hideLoading(); |
| | | /*设置标题*/ |
| | | uni.setNavigationBarTitle({ |
| | | title: self.words.activity_list.value |
| | | }); |
| | | self.loading = false; |
| | | self.is_first_show = false; |
| | | } |
| | |
| | | this.gotoPage(url); |
| | | }, |
| | | |
| | | }, |
| | | onShareAppMessage() { |
| | | return { |
| | | title: `活动列表`, |
| | | path: `pages/branch/activity/index/index` |
| | | }; |
| | | }, |
| | | onShareTimeline() { |
| | | return { |
| | | title: '活动列表', |
| | | path: `pages/branch/activity/index/index` |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | latitude:'', |
| | | is_previewing:false, |
| | | activityDetail: [], |
| | | words: {}, |
| | | }; |
| | | }, |
| | | computed: {}, |
| | |
| | | activity_id: self.activity_id, |
| | | }, |
| | | function (res) { |
| | | self.words = res.data.words; |
| | | self.listData = res.data.list; |
| | | self.cart_total_num = res.data.cart_total_num; |
| | | self.activityDetail = res.data.activityDetail; |
| | | uni.hideLoading(); |
| | | /*设置标题*/ |
| | | uni.setNavigationBarTitle({ |
| | | title: self.words.activity_shopping.value |
| | | }); |
| | | self.loading = false; |
| | | } |
| | | ); |
| | |
| | | </view> |
| | | <view class="flex-1 ml20 f24"> |
| | | <view class="item-info d-s-c f28 gray3"> |
| | | <text>{{ item.nickName }}</text> |
| | | <text v-if="item.real_name">({{ item.real_name }})</text> |
| | | <text>{{ item.real_name }}</text> |
| | | <!-- <text v-if="item.real_name">({{ item.real_name }})</text> --> |
| | | <text class="item-position" v-if="item.position_name">{{ item.position_name }}</text> |
| | | </view> |
| | | <view class="gray6 pt10" v-if="item.supplier || item.company"> |
| | |
| | | /*当前页面*/ |
| | | page: 1, |
| | | /*每页条数*/ |
| | | list_rows: 10, |
| | | list_rows: 15, |
| | | /*有没有更多*/ |
| | | no_more: false, |
| | | /*是否正在加载*/ |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | this.getData(); |
| | | //this.getData(); |
| | | }, |
| | | methods: { |
| | | /*初始化*/ |
| | |
| | | <view class="title text-ellipsis-2">{{item.name}}</view> |
| | | <view class="bottom d-b-e"> |
| | | <view class="d-b-c"> |
| | | <view class="item-btn" @click="gotoPage('pages/branch/member/index/index?branch_id='+item.branch_id)">组织架构</view> |
| | | <view class="item-btn" @click="gotoPage('pages/branch/activity/index/index?branch_id='+item.branch_id)">分会活动</view> |
| | | <view class="item-btn" @click="gotoPage('pages/branch/member/index/index?branch_id='+item.branch_id)">{{words.member_list.value}}</view> |
| | | <view class="item-btn" @click="gotoPage('pages/branch/activity/index/index?branch_id='+item.branch_id)">{{words.activity_list.value}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | loading: true, |
| | | /*顶部刷新*/ |
| | | topRefresh: false, |
| | | words: {}, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | page: self.page || 1, |
| | | list_rows: self.list_rows, |
| | | }, function(res) { |
| | | self.words = res.data.words; |
| | | self.listData = self.listData.concat(res.data.list.data); |
| | | self.last_page = res.data.list.last_page; |
| | | if (res.data.list.last_page <= 1) { |
| | |
| | | } else { |
| | | self.no_more = false; |
| | | } |
| | | /*设置标题*/ |
| | | uni.setNavigationBarTitle({ |
| | | title: self.words.branch_list.value |
| | | }); |
| | | // uni.hideLoading(); |
| | | self.loading = false; |
| | | } |
| | |
| | | <view class="pl20"> |
| | | <view class="d-s-c"> |
| | | <view class="f32 fb">{{detail.user.real_name}}</view> |
| | | <view class="position" v-if="detail.position_name">{{detail.position_name}}</view> |
| | | <view class="position" v-if="detail.position_name && setting.show_position=='1'">{{detail.position_name}}</view> |
| | | </view> |
| | | <view class="gray6 pt10 f26" v-if="detail.branch">{{detail.branch.name}}</view> |
| | | <!-- <view class="gray6 pt20">{{detail.region.province}}{{detail.region.city}}{{detail.region.region}}</view> --> |
| | |
| | | <text class="iconfont icon-share1"></text> |
| | | <text class="f24 pt10">分享</text> |
| | | </button> |
| | | <view class="item-icon p-0-30 d-c-c d-c" @click="callPhone"> |
| | | <view class="item-icon p-0-30 d-c-c d-c" @click="callPhone" v-if="setting.show_mobile=='1'"> |
| | | <text class="iconfont icon-002dianhua"></text> |
| | | <text class="f24 pt10">电话</text> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import utils from '@/common/utils'; |
| | | export default { |
| | | components: { |
| | | |
| | |
| | | detail: [], |
| | | user_id: 0, |
| | | wechat_share: false, |
| | | setting: {}, |
| | | }; |
| | | }, |
| | | onLoad(e) { |
| | |
| | | user_id: self.user_id, |
| | | }, function(res) { |
| | | self.detail = res.data.detail; |
| | | self.setting = res.data.setting; |
| | | if (self.setting.show_mobile != '1') { |
| | | self.detail.user.mobile = utils.maskPhoneNumber(self.detail.user.mobile); |
| | | } |
| | | self.loading = false; |
| | | } |
| | | ); |
| | |
| | | <image :src="item.avatarUrl"></image> |
| | | </view> |
| | | <view class="card-bottom tc"> |
| | | <view class="item-position">{{item.position_name}}</view> |
| | | <view class="item-position" v-if="setting.show_position=='1'">{{item.position_name}}</view> |
| | | <view class="title text-ellipsis-2">{{item.real_name}}</view> |
| | | </view> |
| | | </view> |
| | |
| | | /*顶部刷新*/ |
| | | topRefresh: false, |
| | | branch_id: 0, |
| | | words: {}, |
| | | setting: {}, |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | list_rows: self.list_rows, |
| | | branch_id: self.branch_id, |
| | | }, function(res) { |
| | | self.words = res.data.words; |
| | | self.setting = res.data.setting; |
| | | self.listData = self.listData.concat(res.data.list.data); |
| | | self.last_page = res.data.list.last_page; |
| | | if (res.data.list.last_page <= 1) { |
| | |
| | | } else { |
| | | self.no_more = false; |
| | | } |
| | | // uni.hideLoading(); |
| | | /*设置标题*/ |
| | | uni.setNavigationBarTitle({ |
| | | title: self.words.member_list.value |
| | | }); |
| | | self.loading = false; |
| | | } |
| | | ); |
| | |
| | | <view :style="topBarHeight() == 0 ? '': 'height:'+topBarHeight()+'px;padding-top:'+(topBarTop() + 5)+'px'" |
| | | class="ww100"></view> |
| | | <!-- #endif --> |
| | | <diy :diyItems="items"></diy> |
| | | <diy :diyItems="items" :index_open_city="index_open_city"></diy> |
| | | <!--底部弹窗--> |
| | | <share :isMpShare="isMpShare" @close="closeBottmpanel"></share> |
| | | <!--app分享--> |
| | |
| | | isMpShare: false, |
| | | /*app分享*/ |
| | | isAppShare: false, |
| | | index_open_city:0, |
| | | appParams: { |
| | | title: '', |
| | | summary: '', |
| | |
| | | if(self.order_type == 100){ |
| | | url = 'plus.business.Order/pay'; |
| | | } |
| | | // 供应商年卡订单 |
| | | if(self.order_type == 110){ |
| | | url = 'supplier.member/pay'; |
| | | } |
| | | let params = { |
| | | order_id: self.order_id, |
| | | pay_source: self.getPlatform() |
| | |
| | | if(self.order_type == 100){ |
| | | url = 'plus.business.Order/pay'; |
| | | } |
| | | // 供应商年卡订单 |
| | | if(self.order_type == 110){ |
| | | url = 'supplier.member/pay'; |
| | | } |
| | | let use_balance = self.balanceType == true ? 1 : 0; |
| | | if (self.payPrice == 0) { |
| | | use_balance = 1; |
| | |
| | | self._post(url, params, |
| | | function(res) { |
| | | // 半屏小程序支付 by lyzflash |
| | | if (res.data.payment.is_embed) { |
| | | if (res.data.payment && res.data.payment.is_embed) { |
| | | // console.log(res.data.payment); |
| | | self.isFirst = true; |
| | | uni.openEmbeddedMiniProgram({ |
| | |
| | | self.showSuccess("支付成功", function() { |
| | | self.gotoPage('/pages/plus/business/detail?business_card_id=' + result.data.business_card_id, 'reLaunch'); |
| | | }) |
| | | } else if(self.order_type == 110){ |
| | | // 供应商年卡订单支付成功 |
| | | self.showSuccess("支付成功", function() { |
| | | self.gotoPage('/pages/tabBar/user/index', 'reLaunch'); |
| | | }) |
| | | } else { |
| | | self.gotoPage('/pages/order/pay-success/pay-success?order_id=' + self.order_id, |
| | | 'reLaunch'); |
| | |
| | | self.gotoPage('/pages/order/myorder', 'redirect'); |
| | | }else if (self.order_type == 100) { |
| | | self.gotoPage('/pages/plus/business/detail?business_card_id=' + result.data.business_card_id, 'redirect'); |
| | | } else if(self.order_type == 110){ |
| | | // 供应商年卡订单支付失败 |
| | | self.gotoPage('/pages/user/my_shop/my_shop', 'redirect'); |
| | | } else { |
| | | self.gotoPage('/pages/order/myorder', 'redirect'); |
| | | } |
| | |
| | | align-items: center; |
| | | line-height: 116rpx; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <view class="info"> |
| | | <view class="d-b-s"> |
| | | <view class="flex-1"> |
| | | <view class="title f32 gray3">{{ item.product_name }}</view> |
| | | <view class="title f30 gray3 pr20">{{ item.product_name }}</view> |
| | | <view class="theme-price mt10 f18"> |
| | | ¥<text class="f26">{{ item.product_price }}</text> |
| | | </view> |
| | |
| | | delivery_store:{}, |
| | | delivery_store_list: {}, |
| | | verify_data: [] ,//虚拟商品 核销数据 |
| | | branch_activity_id: 0, |
| | | }; |
| | | }, |
| | | onLoad(options) { |
| | | let self = this; |
| | | self.options = options; |
| | | self.room_id = options.room_id ? options.room_id : 0; |
| | | self.branch_activity_id = options.branch_activity_id ? options.branch_activity_id : 0; //分会活动的购物车提交 |
| | | self.$fire.on('selectStoreId', function(e) { |
| | | self.extract_store = e; |
| | | self.choose_store_id = e.store_id; |
| | |
| | | } |
| | | //直接购买 |
| | | if (self.options.order_type === 'buy') { |
| | | self._get( |
| | | 'order.order/buy', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | product_id: self.options.product_id, |
| | | product_num: self.options.product_num, |
| | | product_sku_id: self.options.product_sku_id, |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | if(self.branch_activity_id > 0){ |
| | | self._get( |
| | | 'branch.activityOrder/buy', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | activity_id:self.branch_activity_id, |
| | | product_id: self.options.product_id, |
| | | product_num: self.options.product_num, |
| | | product_sku_id: self.options.product_sku_id, |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | } else { |
| | | self._get( |
| | | 'order.order/buy', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | product_id: self.options.product_id, |
| | | product_num: self.options.product_num, |
| | | product_sku_id: self.options.product_sku_id, |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | //定金 |
| | | else if (self.options.order_type === 'deposit') { |
| | |
| | | } |
| | | // 购物车结算 |
| | | else if (self.options.order_type === 'cart') { |
| | | self._get( |
| | | 'order.order/cart', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | cart_ids: self.options.cart_ids || 0 |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | if(self.branch_activity_id > 0){ |
| | | self._get( |
| | | 'branch.activityOrder/cart', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | activity_id:self.branch_activity_id, |
| | | cart_ids: self.options.cart_ids || 0 |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | } else { |
| | | self._get( |
| | | 'order.order/cart', { |
| | | params: JSON.stringify( |
| | | Object.assign({}, params, { |
| | | cart_ids: self.options.cart_ids || 0 |
| | | }) |
| | | ) |
| | | }, |
| | | function(res) { |
| | | callback(res); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | // 积分兑换结算 |
| | | else if (self.options.order_type == 'points') { |
| | |
| | | }); |
| | | |
| | | let params = { |
| | | activity_id: self.branch_activity_id, // 分会活动购物 |
| | | pay_type: self.pay_type, |
| | | room_id: self.room_id, |
| | | coupon_id: self.coupon_id, |
| | |
| | | let url = ''; |
| | | if (self.options.order_type === 'buy') { |
| | | url = 'order.order/buy'; |
| | | if(self.branch_activity_id > 0){ |
| | | url = 'branch.activityOrder/buy'; |
| | | } |
| | | params = Object.assign(params, { |
| | | product_id: self.options.product_id, |
| | | product_num: self.options.product_num, |
| | |
| | | // 创建订单-购物车结算 |
| | | if (self.options.order_type === 'cart') { |
| | | url = 'order.order/cart'; |
| | | if(self.branch_activity_id > 0){ |
| | | url = 'branch.activityOrder/cart'; |
| | | } |
| | | params = Object.assign(params, { |
| | | cart_ids: self.options.cart_ids || 0, |
| | | // video_id: self.options.video_id || 0, |
| mobile/pages/plus/business/chat/chat.vue
mobile/pages/plus/business/chat/list.vue
mobile/pages/plus/business/detail.vue
mobile/pages/plus/vip/apply.vue
mobile/pages/plus/vip/cash.vue
mobile/pages/plus/vip/cash/apply.vue
mobile/pages/plus/vip/cash/list.vue
mobile/pages/plus/vip/index.vue
mobile/pages/plus/vip/order.vue
mobile/pages/plus/vip/qrcode.vue
mobile/pages/plus/vip/team.vue
mobile/pages/user/my-coupon/my-coupon.vue
mobile/pages/user/my_shop/cash/apply/apply.vue
mobile/pages/user/my_shop/cash/list/list.vue
mobile/pages/user/my_shop/member/member.vue
mobile/pages/user/my_shop/my_shop.vue
mobile/pages2/bonus/apply/apply.vue
mobile/pages2/bonus/cash/apply/apply.vue
mobile/pages2/bonus/cash/list/list.vue
mobile/pages2/bonus/index/index.vue
mobile/pages2/bonus/order/order.vue
mobile/pages2/bonus/qrcode/qrcode.vue
mobile/pages2/bonus/team/team.vue
shop_vue/src/api/plus/bonus.js
shop_vue/src/api/plus/vip.js
shop_vue/src/api/supplier/member.js
shop_vue/src/api/user.js
shop_vue/src/components/map/Getpoint.vue
shop_vue/src/components/setlink/part/Pages.vue
shop_vue/src/views/layout/Head.vue
shop_vue/src/views/plus/agent/grade/part/Add.vue
shop_vue/src/views/plus/agent/grade/part/Edit.vue
shop_vue/src/views/plus/bonus/apply/Apply.vue
shop_vue/src/views/plus/bonus/apply/dialog/Edit.vue
shop_vue/src/views/plus/bonus/architecture/index.vue
shop_vue/src/views/plus/bonus/cash/Cash.vue
shop_vue/src/views/plus/bonus/cash/dialog/Edit.vue
shop_vue/src/views/plus/bonus/grade/Add.vue
shop_vue/src/views/plus/bonus/grade/Edit.vue
shop_vue/src/views/plus/bonus/grade/index.vue
shop_vue/src/views/plus/bonus/index.vue
shop_vue/src/views/plus/bonus/order/Order.vue
shop_vue/src/views/plus/bonus/poster/Poster.vue
shop_vue/src/views/plus/bonus/setting/Setting.vue
shop_vue/src/views/plus/bonus/setting/part/Background.vue
shop_vue/src/views/plus/bonus/setting/part/Basic.vue
shop_vue/src/views/plus/bonus/setting/part/Commission.vue
shop_vue/src/views/plus/bonus/setting/part/Condition.vue
shop_vue/src/views/plus/bonus/setting/part/License.vue
shop_vue/src/views/plus/bonus/setting/part/Settlement.vue
shop_vue/src/views/plus/bonus/setting/part/Words.vue
shop_vue/src/views/plus/bonus/user/User.vue
shop_vue/src/views/plus/bonus/user/dialog/Edit.vue
shop_vue/src/views/plus/bonus/user/dialog/SubUser.vue
shop_vue/src/views/plus/business/template/add.vue
shop_vue/src/views/plus/business/template/edit.vue
shop_vue/src/views/plus/vip/cash/Cash.vue
shop_vue/src/views/plus/vip/grade/Grade.vue
shop_vue/src/views/plus/vip/grade/part/Add.vue
shop_vue/src/views/plus/vip/grade/part/Edit.vue
shop_vue/src/views/plus/vip/grade/part/List.vue
shop_vue/src/views/plus/vip/grade/part/Log.vue
shop_vue/src/views/plus/vip/index.vue
shop_vue/src/views/plus/vip/order/Order.vue
shop_vue/src/views/plus/vip/poster/Poster.vue
shop_vue/src/views/plus/vip/setting/Setting.vue
shop_vue/src/views/plus/vip/setting/part/Background.vue
shop_vue/src/views/plus/vip/setting/part/Basic.vue
shop_vue/src/views/plus/vip/setting/part/Settlement.vue
shop_vue/src/views/plus/vip/setting/part/Words.vue
shop_vue/src/views/plus/vip/user/User.vue
shop_vue/src/views/plus/vip/user/dialog/Edit.vue
shop_vue/src/views/supplier/member/Order.vue
shop_vue/src/views/supplier/member/Plan.vue
shop_vue/src/views/supplier/member/index.vue
shop_vue/src/views/supplier/member/plan/add.vue
shop_vue/src/views/supplier/member/plan/edit.vue
shop_vue/src/views/user/grade/Add.vue (deleted)
shop_vue/src/views/user/grade/Edit.vue (deleted)
shop_vue/src/views/user/grade/add.vue
shop_vue/src/views/user/grade/edit.vue
shop_vue/src/views/user/grade/part/Add.vue
shop_vue/src/views/user/grade/part/Edit.vue
shop_vue/src/views/user/grade/part/list.vue
supplier_vue/src/api/article.js
supplier_vue/src/api/balance.js
supplier_vue/src/api/business.js
supplier_vue/src/api/card.js
supplier_vue/src/api/collection.js
supplier_vue/src/api/giftpackage.js
supplier_vue/src/api/homepush.js
supplier_vue/src/api/invitationgift.js
supplier_vue/src/api/lottery.js
supplier_vue/src/api/officia.js
supplier_vue/src/api/plan.js
supplier_vue/src/api/plus.js
supplier_vue/src/api/plus/agent/grade.js
supplier_vue/src/api/plus/agent/product.js
supplier_vue/src/api/plus/bonus.js
supplier_vue/src/api/plus/fullreduce.js
supplier_vue/src/api/plus/goodcoupon/coupon.js
supplier_vue/src/api/plus/goodstore/store.js
supplier_vue/src/api/plus/region.js
supplier_vue/src/api/plus/region/grade.js
supplier_vue/src/api/plus/shareholder.js
supplier_vue/src/api/plus/shareholder/grade.js
supplier_vue/src/api/plus/table.js
supplier_vue/src/api/plus/team.js
supplier_vue/src/api/plus/team/grade.js
supplier_vue/src/api/plus/vip.js
supplier_vue/src/api/recommend.js
supplier_vue/src/api/regactivity.js
supplier_vue/src/api/sign.js
supplier_vue/src/api/tag.js
supplier_vue/src/api/ticket.js
supplier_vue/src/api/user.js
supplier_vue/src/components/user/EditReferee.vue
supplier_vue/src/components/user/GetAgentUser.vue
supplier_vue/src/views/plus/advance/index.vue
supplier_vue/src/views/plus/advance/product/edit.vue
supplier_vue/src/views/plus/advance/product/index.vue
supplier_vue/src/views/plus/advance/product/part/Info.vue
supplier_vue/src/views/plus/advance/product/part/Other.vue
supplier_vue/src/views/plus/advance/product/part/Spec.vue
supplier_vue/src/views/plus/advance/setting/index.vue
supplier_vue/src/views/plus/agent/apply/Apply.vue
supplier_vue/src/views/plus/agent/apply/dialog/Edit.vue
supplier_vue/src/views/plus/agent/cash/Cash.vue
supplier_vue/src/views/plus/agent/cash/dialog/Edit.vue
supplier_vue/src/views/plus/agent/grade/index.vue
supplier_vue/src/views/plus/agent/grade/part/Add.vue
supplier_vue/src/views/plus/agent/grade/part/Edit.vue
supplier_vue/src/views/plus/agent/grade/part/list.vue
supplier_vue/src/views/plus/agent/grade/part/log.vue
supplier_vue/src/views/plus/agent/index.vue
supplier_vue/src/views/plus/agent/order/Order.vue
supplier_vue/src/views/plus/agent/poster/Poster.vue
supplier_vue/src/views/plus/agent/product/dialog/Agent.vue
supplier_vue/src/views/plus/agent/product/index.vue
supplier_vue/src/views/plus/agent/setting/Setting.vue
supplier_vue/src/views/plus/agent/setting/part/Background.vue
supplier_vue/src/views/plus/agent/setting/part/Basic.vue
supplier_vue/src/views/plus/agent/setting/part/Commission.vue
supplier_vue/src/views/plus/agent/setting/part/Condition.vue
supplier_vue/src/views/plus/agent/setting/part/License.vue
supplier_vue/src/views/plus/agent/setting/part/Settlement.vue
supplier_vue/src/views/plus/agent/setting/part/Words.vue
supplier_vue/src/views/plus/agent/user/User.vue
supplier_vue/src/views/plus/agent/user/dialog/Edit.vue
supplier_vue/src/views/plus/agent/user/dialog/SubUser.vue
supplier_vue/src/views/plus/article/article/Index.vue
supplier_vue/src/views/plus/article/article/add.vue
supplier_vue/src/views/plus/article/article/edit.vue
supplier_vue/src/views/plus/article/category/Category.vue
supplier_vue/src/views/plus/article/category/Index.vue
supplier_vue/src/views/plus/article/category/part/Add.vue
supplier_vue/src/views/plus/article/category/part/Edit.vue
supplier_vue/src/views/plus/article/index.vue
supplier_vue/src/views/plus/assemble/active/add.vue
supplier_vue/src/views/plus/assemble/active/edit.vue
supplier_vue/src/views/plus/assemble/active/index.vue
supplier_vue/src/views/plus/assemble/active/part/Basic.vue
supplier_vue/src/views/plus/assemble/active/part/Datetime.vue
supplier_vue/src/views/plus/assemble/active/part/Other.vue
supplier_vue/src/views/plus/assemble/active/part/Product.vue
supplier_vue/src/views/plus/assemble/audit/edit.vue
supplier_vue/src/views/plus/assemble/audit/index.vue
supplier_vue/src/views/plus/assemble/audit/part/Audit.vue
supplier_vue/src/views/plus/assemble/audit/part/Info.vue
supplier_vue/src/views/plus/assemble/audit/part/Other.vue
supplier_vue/src/views/plus/assemble/audit/part/Spec.vue
supplier_vue/src/views/plus/assemble/index.vue
supplier_vue/src/views/plus/assemble/product/edit.vue
supplier_vue/src/views/plus/assemble/product/index.vue
supplier_vue/src/views/plus/assemble/product/part/Audit.vue
supplier_vue/src/views/plus/assemble/product/part/Info.vue
supplier_vue/src/views/plus/assemble/product/part/Other.vue
supplier_vue/src/views/plus/assemble/product/part/Spec.vue
supplier_vue/src/views/plus/assemble/setting/getSetting.vue
supplier_vue/src/views/plus/assemble/setting/index.vue
supplier_vue/src/views/plus/bargain/active/add.vue
supplier_vue/src/views/plus/bargain/active/edit.vue
supplier_vue/src/views/plus/bargain/active/index.vue
supplier_vue/src/views/plus/bargain/active/part/Basic.vue
supplier_vue/src/views/plus/bargain/active/part/Datetime.vue
supplier_vue/src/views/plus/bargain/active/part/Other.vue
supplier_vue/src/views/plus/bargain/active/part/Product.vue
supplier_vue/src/views/plus/bargain/audit/edit.vue
supplier_vue/src/views/plus/bargain/audit/index.vue
supplier_vue/src/views/plus/bargain/audit/part/Audit.vue
supplier_vue/src/views/plus/bargain/audit/part/Info.vue
supplier_vue/src/views/plus/bargain/audit/part/Other.vue
supplier_vue/src/views/plus/bargain/audit/part/Spec.vue
supplier_vue/src/views/plus/bargain/index.vue
supplier_vue/src/views/plus/bargain/product/edit.vue
supplier_vue/src/views/plus/bargain/product/index.vue
supplier_vue/src/views/plus/bargain/product/part/Audit.vue
supplier_vue/src/views/plus/bargain/product/part/Info.vue
supplier_vue/src/views/plus/bargain/product/part/Other.vue
supplier_vue/src/views/plus/bargain/product/part/Spec.vue
supplier_vue/src/views/plus/bargain/setting/index.vue
supplier_vue/src/views/plus/bargain/task/dialog/detail.vue
supplier_vue/src/views/plus/bargain/task/index.vue
supplier_vue/src/views/plus/bonus/apply/Apply.vue
supplier_vue/src/views/plus/bonus/apply/dialog/Edit.vue
supplier_vue/src/views/plus/bonus/architecture/index.vue
supplier_vue/src/views/plus/bonus/cash/Cash.vue
supplier_vue/src/views/plus/bonus/cash/dialog/Edit.vue
supplier_vue/src/views/plus/bonus/grade/Add.vue
supplier_vue/src/views/plus/bonus/grade/Edit.vue
supplier_vue/src/views/plus/bonus/grade/index.vue
supplier_vue/src/views/plus/bonus/index.vue
supplier_vue/src/views/plus/bonus/order/Order.vue
supplier_vue/src/views/plus/bonus/poster/Poster.vue
supplier_vue/src/views/plus/bonus/setting/Setting.vue
supplier_vue/src/views/plus/bonus/setting/part/Background.vue
supplier_vue/src/views/plus/bonus/setting/part/Basic.vue
supplier_vue/src/views/plus/bonus/setting/part/Commission.vue
supplier_vue/src/views/plus/bonus/setting/part/Condition.vue
supplier_vue/src/views/plus/bonus/setting/part/License.vue
supplier_vue/src/views/plus/bonus/setting/part/Settlement.vue
supplier_vue/src/views/plus/bonus/setting/part/Words.vue
supplier_vue/src/views/plus/bonus/user/User.vue
supplier_vue/src/views/plus/bonus/user/dialog/Edit.vue
supplier_vue/src/views/plus/bonus/user/dialog/SubUser.vue
supplier_vue/src/views/plus/business/business/index.vue
supplier_vue/src/views/plus/business/grade/index.vue
supplier_vue/src/views/plus/business/index.vue
supplier_vue/src/views/plus/business/industry/Add.vue
supplier_vue/src/views/plus/business/industry/Edit.vue
supplier_vue/src/views/plus/business/industry/index.vue
supplier_vue/src/views/plus/business/setting/Setting.vue
supplier_vue/src/views/plus/business/setting/part/Background.vue
supplier_vue/src/views/plus/business/setting/part/Basic.vue
supplier_vue/src/views/plus/business/template/add.vue
supplier_vue/src/views/plus/business/template/edit.vue
supplier_vue/src/views/plus/business/template/index.vue
supplier_vue/src/views/plus/collection/index.vue
supplier_vue/src/views/plus/coupon/coupon/Receive.vue
supplier_vue/src/views/plus/coupon/coupon/SendCoupon.vue
supplier_vue/src/views/plus/coupon/coupon/add.vue
supplier_vue/src/views/plus/coupon/coupon/edit.vue
supplier_vue/src/views/plus/coupon/coupon/index.vue
supplier_vue/src/views/plus/coupon/index.vue
supplier_vue/src/views/plus/fullfree/index.vue
supplier_vue/src/views/plus/fullreduce/Edit.vue
supplier_vue/src/views/plus/fullreduce/index.vue
supplier_vue/src/views/plus/goodcoupon/coupon/dialog/Edit.vue
supplier_vue/src/views/plus/goodcoupon/coupon/index.vue
supplier_vue/src/views/plus/goodcoupon/index.vue
supplier_vue/src/views/plus/goodstore/index.vue
supplier_vue/src/views/plus/goodstore/store/dialog/Edit.vue
supplier_vue/src/views/plus/goodstore/store/index.vue
supplier_vue/src/views/plus/homepush/index.vue
supplier_vue/src/views/plus/invitation/add.vue
supplier_vue/src/views/plus/invitation/edit.vue
supplier_vue/src/views/plus/invitation/index.vue
supplier_vue/src/views/plus/invitation/partake.vue
supplier_vue/src/views/plus/live/gift/dialog/Add.vue
supplier_vue/src/views/plus/live/gift/dialog/Edit.vue
supplier_vue/src/views/plus/live/gift/index.vue
supplier_vue/src/views/plus/live/index.vue
supplier_vue/src/views/plus/live/order/list.vue
supplier_vue/src/views/plus/live/plan/dialog/Add.vue
supplier_vue/src/views/plus/live/plan/dialog/Edit.vue
supplier_vue/src/views/plus/live/plan/log.vue
supplier_vue/src/views/plus/live/plan/setting.vue
supplier_vue/src/views/plus/live/room/dialog/Audit.vue
supplier_vue/src/views/plus/live/room/dialog/Edit.vue
supplier_vue/src/views/plus/live/room/dialog/Gift.vue
supplier_vue/src/views/plus/live/room/dialog/Products.vue
supplier_vue/src/views/plus/live/room/index.vue
supplier_vue/src/views/plus/live/setting/index.vue
supplier_vue/src/views/plus/live/wx/index.vue
supplier_vue/src/views/plus/lottery/award.vue
supplier_vue/src/views/plus/lottery/index.vue
supplier_vue/src/views/plus/lottery/record.vue
supplier_vue/src/views/plus/lottery/setting.vue
supplier_vue/src/views/plus/officia/index.vue
supplier_vue/src/views/plus/package/add.vue
supplier_vue/src/views/plus/package/edit.vue
supplier_vue/src/views/plus/package/index.vue
supplier_vue/src/views/plus/package/orderList.vue
supplier_vue/src/views/plus/plus/index.vue
supplier_vue/src/views/plus/points/dialog/Detail.vue
supplier_vue/src/views/plus/points/index.vue
supplier_vue/src/views/plus/points/product/Record.vue
supplier_vue/src/views/plus/points/product/Settings.vue
supplier_vue/src/views/plus/points/product/edit.vue
supplier_vue/src/views/plus/points/product/index.vue
supplier_vue/src/views/plus/points/product/part/Audit.vue
supplier_vue/src/views/plus/points/product/part/Info.vue
supplier_vue/src/views/plus/points/product/part/Other.vue
supplier_vue/src/views/plus/points/product/part/Spec.vue
supplier_vue/src/views/plus/recommend/index.vue
supplier_vue/src/views/plus/regactivity/category/Category.vue
supplier_vue/src/views/plus/regactivity/category/Index.vue
supplier_vue/src/views/plus/regactivity/category/part/Add.vue
supplier_vue/src/views/plus/regactivity/category/part/Edit.vue
supplier_vue/src/views/plus/regactivity/index.vue
supplier_vue/src/views/plus/regactivity/regactivity/Index.vue
supplier_vue/src/views/plus/regactivity/regactivity/add.vue
supplier_vue/src/views/plus/regactivity/regactivity/edit.vue
supplier_vue/src/views/plus/regactivity/user/user.vue
supplier_vue/src/views/plus/region/apply/Apply.vue
supplier_vue/src/views/plus/region/apply/dialog/Edit.vue
supplier_vue/src/views/plus/region/bonus/Bonus.vue
supplier_vue/src/views/plus/region/bonus/dialog/Add.vue
supplier_vue/src/views/plus/region/bonus/dialog/BonusLog.vue
supplier_vue/src/views/plus/region/cash/Cash.vue
supplier_vue/src/views/plus/region/cash/dialog/Edit.vue
supplier_vue/src/views/plus/region/grade/index.vue
supplier_vue/src/views/plus/region/grade/part/Add.vue
supplier_vue/src/views/plus/region/grade/part/Edit.vue
supplier_vue/src/views/plus/region/grade/part/list.vue
supplier_vue/src/views/plus/region/grade/part/log.vue
supplier_vue/src/views/plus/region/index.vue
supplier_vue/src/views/plus/region/order/Order.vue
supplier_vue/src/views/plus/region/poster/Poster.vue
supplier_vue/src/views/plus/region/setting/Setting.vue
supplier_vue/src/views/plus/region/setting/part/Background.vue
supplier_vue/src/views/plus/region/setting/part/Basic.vue
supplier_vue/src/views/plus/region/setting/part/Bonus.vue
supplier_vue/src/views/plus/region/setting/part/Condition.vue
supplier_vue/src/views/plus/region/setting/part/License.vue
supplier_vue/src/views/plus/region/setting/part/Settlement.vue
supplier_vue/src/views/plus/region/setting/part/Words.vue
supplier_vue/src/views/plus/region/user/User.vue
supplier_vue/src/views/plus/region/user/dialog/Edit.vue
supplier_vue/src/views/plus/region/user/dialog/SubUser.vue
supplier_vue/src/views/plus/seckill/active/add.vue
supplier_vue/src/views/plus/seckill/active/edit.vue
supplier_vue/src/views/plus/seckill/active/index.vue
supplier_vue/src/views/plus/seckill/active/part/Basic.vue
supplier_vue/src/views/plus/seckill/active/part/Datetime.vue
supplier_vue/src/views/plus/seckill/active/part/Other.vue
supplier_vue/src/views/plus/seckill/active/part/Product.vue
supplier_vue/src/views/plus/seckill/audit/edit.vue
supplier_vue/src/views/plus/seckill/audit/index.vue
supplier_vue/src/views/plus/seckill/audit/part/Audit.vue
supplier_vue/src/views/plus/seckill/audit/part/Info.vue
supplier_vue/src/views/plus/seckill/audit/part/Other.vue
supplier_vue/src/views/plus/seckill/audit/part/Spec.vue
supplier_vue/src/views/plus/seckill/index.vue
supplier_vue/src/views/plus/seckill/product/edit.vue
supplier_vue/src/views/plus/seckill/product/index.vue
supplier_vue/src/views/plus/seckill/product/part/Audit.vue
supplier_vue/src/views/plus/seckill/product/part/Info.vue
supplier_vue/src/views/plus/seckill/product/part/Other.vue
supplier_vue/src/views/plus/seckill/product/part/Spec.vue
supplier_vue/src/views/plus/seckill/setting/getSetting.vue
supplier_vue/src/views/plus/shareholder/apply/Apply.vue
supplier_vue/src/views/plus/shareholder/apply/dialog/Edit.vue
supplier_vue/src/views/plus/shareholder/bonus/Bonus.vue
supplier_vue/src/views/plus/shareholder/bonus/dialog/Add.vue
supplier_vue/src/views/plus/shareholder/bonus/dialog/BonusLog.vue
supplier_vue/src/views/plus/shareholder/cash/Cash.vue
supplier_vue/src/views/plus/shareholder/cash/dialog/Edit.vue
supplier_vue/src/views/plus/shareholder/grade/index.vue
supplier_vue/src/views/plus/shareholder/grade/part/Add.vue
supplier_vue/src/views/plus/shareholder/grade/part/Edit.vue
supplier_vue/src/views/plus/shareholder/grade/part/list.vue
supplier_vue/src/views/plus/shareholder/grade/part/log.vue
supplier_vue/src/views/plus/shareholder/index.vue
supplier_vue/src/views/plus/shareholder/order/Order.vue
supplier_vue/src/views/plus/shareholder/poster/Poster.vue
supplier_vue/src/views/plus/shareholder/setting/Setting.vue
supplier_vue/src/views/plus/shareholder/setting/part/Background.vue
supplier_vue/src/views/plus/shareholder/setting/part/Basic.vue
supplier_vue/src/views/plus/shareholder/setting/part/Commission.vue
supplier_vue/src/views/plus/shareholder/setting/part/Condition.vue
supplier_vue/src/views/plus/shareholder/setting/part/License.vue
supplier_vue/src/views/plus/shareholder/setting/part/Settlement.vue
supplier_vue/src/views/plus/shareholder/setting/part/Words.vue
supplier_vue/src/views/plus/shareholder/user/User.vue
supplier_vue/src/views/plus/shareholder/user/dialog/Add.vue
supplier_vue/src/views/plus/shareholder/user/dialog/Edit.vue
supplier_vue/src/views/plus/shareholder/user/dialog/SubUser.vue
supplier_vue/src/views/plus/sign/index.vue
supplier_vue/src/views/plus/sign/receive/Receive.vue
supplier_vue/src/views/plus/sign/setting/Setting.vue
supplier_vue/src/views/plus/table/event.vue
supplier_vue/src/views/plus/table/record/index.vue
supplier_vue/src/views/plus/table/table/add.vue
supplier_vue/src/views/plus/table/table/edit.vue
supplier_vue/src/views/plus/table/table/index.vue
supplier_vue/src/views/plus/table/table/part/Basic.vue
supplier_vue/src/views/plus/table/table/part/Fields.vue
supplier_vue/src/views/plus/task/index.vue
supplier_vue/src/views/plus/team/apply/Apply.vue
supplier_vue/src/views/plus/team/apply/dialog/Edit.vue
supplier_vue/src/views/plus/team/cash/Cash.vue
supplier_vue/src/views/plus/team/cash/dialog/Edit.vue
supplier_vue/src/views/plus/team/grade/Add.vue
supplier_vue/src/views/plus/team/grade/Edit.vue
supplier_vue/src/views/plus/team/grade/index.vue
supplier_vue/src/views/plus/team/grade/part/Add.vue
supplier_vue/src/views/plus/team/grade/part/Edit.vue
supplier_vue/src/views/plus/team/grade/part/list.vue
supplier_vue/src/views/plus/team/grade/part/log.vue
supplier_vue/src/views/plus/team/index.vue
supplier_vue/src/views/plus/team/order/Order.vue
supplier_vue/src/views/plus/team/poster/Poster.vue
supplier_vue/src/views/plus/team/setting/Setting.vue
supplier_vue/src/views/plus/team/setting/part/Background.vue
supplier_vue/src/views/plus/team/setting/part/Basic.vue
supplier_vue/src/views/plus/team/setting/part/Commission.vue
supplier_vue/src/views/plus/team/setting/part/Condition.vue
supplier_vue/src/views/plus/team/setting/part/License.vue
supplier_vue/src/views/plus/team/setting/part/Settlement.vue
supplier_vue/src/views/plus/team/setting/part/Words.vue
supplier_vue/src/views/plus/team/user/User.vue
supplier_vue/src/views/plus/team/user/dialog/Edit.vue
supplier_vue/src/views/plus/team/user/dialog/SubUser.vue
supplier_vue/src/views/plus/ticket/index.vue
supplier_vue/src/views/plus/ticket/ticket/Index.vue
supplier_vue/src/views/plus/ticket/ticket/Settings.vue
supplier_vue/src/views/plus/ticket/ticket/dialog/Recharge.vue
supplier_vue/src/views/plus/ticket/ticket/edit.vue
supplier_vue/src/views/plus/vip/cash/Cash.vue
supplier_vue/src/views/plus/vip/grade/Grade.vue
supplier_vue/src/views/plus/vip/grade/part/Add.vue
supplier_vue/src/views/plus/vip/grade/part/Edit.vue
supplier_vue/src/views/plus/vip/grade/part/List.vue
supplier_vue/src/views/plus/vip/grade/part/Log.vue
supplier_vue/src/views/plus/vip/index.vue
supplier_vue/src/views/plus/vip/order/Order.vue
supplier_vue/src/views/plus/vip/poster/Poster.vue
supplier_vue/src/views/plus/vip/setting/Setting.vue
supplier_vue/src/views/plus/vip/setting/part/Background.vue
supplier_vue/src/views/plus/vip/setting/part/Basic.vue
supplier_vue/src/views/plus/vip/setting/part/Settlement.vue
supplier_vue/src/views/plus/vip/setting/part/Words.vue
supplier_vue/src/views/plus/vip/user/User.vue
supplier_vue/src/views/plus/vip/user/dialog/Edit.vue
supplier_vue/src/views/user/balance/index.vue
supplier_vue/src/views/user/balance/log.vue
supplier_vue/src/views/user/balance/part/Cash.vue
supplier_vue/src/views/user/balance/part/CashSetting.vue
supplier_vue/src/views/user/balance/part/Log.vue
supplier_vue/src/views/user/balance/part/Plan.vue
supplier_vue/src/views/user/balance/part/Record.vue
supplier_vue/src/views/user/balance/part/Setting.vue
supplier_vue/src/views/user/balance/part/dialog/Edit.vue
supplier_vue/src/views/user/balance/part/plan/Add.vue
supplier_vue/src/views/user/balance/part/plan/Edit.vue
supplier_vue/src/views/user/card/card/DeleteRecord.vue
supplier_vue/src/views/user/card/card/List.vue
supplier_vue/src/views/user/card/card/Record.vue
supplier_vue/src/views/user/card/card/Setting.vue
supplier_vue/src/views/user/card/card/add.vue
supplier_vue/src/views/user/card/card/dialog/expire.vue
supplier_vue/src/views/user/card/card/dialog/put.vue
supplier_vue/src/views/user/card/card/edit.vue
supplier_vue/src/views/user/card/card/part/Basic.vue
supplier_vue/src/views/user/card/card/part/set.vue
supplier_vue/src/views/user/card/card/part/spec/Many.vue
supplier_vue/src/views/user/card/card/part/spec/Single.vue
supplier_vue/src/views/user/card/card/part/spec/many/Table.vue
supplier_vue/src/views/user/card/card/part/spec/many/Type.vue
supplier_vue/src/views/user/card/cardtype/add.vue
supplier_vue/src/views/user/card/cardtype/edit.vue
supplier_vue/src/views/user/card/cardtype/index.vue
supplier_vue/src/views/user/card/index.vue
supplier_vue/src/views/user/clerk/add.vue
supplier_vue/src/views/user/clerk/edit.vue
supplier_vue/src/views/user/clerk/index.vue
supplier_vue/src/views/user/grade/add.vue
supplier_vue/src/views/user/grade/edit.vue
supplier_vue/src/views/user/grade/index.vue
supplier_vue/src/views/user/grade/part/Add.vue
supplier_vue/src/views/user/grade/part/Edit.vue
supplier_vue/src/views/user/grade/part/list.vue
supplier_vue/src/views/user/grade/part/log.vue
supplier_vue/src/views/user/points/index.vue
supplier_vue/src/views/user/points/part/Log.vue
supplier_vue/src/views/user/points/part/Setting.vue
supplier_vue/src/views/user/tag/Add.vue
supplier_vue/src/views/user/tag/Edit.vue
supplier_vue/src/views/user/tag/index.vue
supplier_vue/src/views/user/user/dialog/Grade.vue
supplier_vue/src/views/user/user/dialog/Recharge.vue
supplier_vue/src/views/user/user/dialog/Tag.vue
supplier_vue/src/views/user/user/edit.vue
supplier_vue/src/views/user/user/index.vue |