From a4b3ee325c7354579d495bc74a777e494e5ec38c Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 06 Feb 2026 18:18:44 +0800
Subject: [PATCH] 商品可以价格面议 选择走访时显示输入走访企业名 分会添加活动时要总会审核 分类添加人数限制,添加活动选择了填写人数限制的分类时活动名额下显示该分类人数限制为15 同一个企业30天内只能走访一次,在30天内走访同一个企业时提示该企业已被走访xx天后才可以从新走访
---
admin/app/api/model/plus/team/Cash.php | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 153 insertions(+), 1 deletions(-)
diff --git a/admin/app/api/model/plus/team/Cash.php b/admin/app/api/model/plus/team/Cash.php
index 6d5d905..e80a97c 100644
--- a/admin/app/api/model/plus/team/Cash.php
+++ b/admin/app/api/model/plus/team/Cash.php
@@ -1 +1,153 @@
-<?phpnamespace app\api\model\plus\team;use app\common\exception\BaseException;use app\common\model\plus\team\Cash as CashModel;use app\common\model\order\Order as OrderModel;use app\common\model\plus\agent\User as AgentUserModel;use app\api\model\user\UserAuth;/** * 队长提现明细模型 */class Cash extends CashModel{ /** * 隐藏字段 */ protected $hidden = [ 'update_time', ]; /** * 获取队长提现明细 */ 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($team, $data) { // 数据验证 $this->validation($team, $data); // 新增申请记录 $this->save(array_merge($data, [ 'user_id' => $team['user_id'], 'apply_status' => 10, 'app_id' => self::$app_id, ])); // 冻结用户资金 $team->freezeMoney($data['money']); return true; } /** * 数据验证 */ private function validation($team, &$data) { // 结算设置 $settlement = Setting::getItem('settlement'); // 最低提现佣金 if ($data['money'] <= 0) { throw new BaseException(['msg' => '提现金额不正确']); } if ($team['money'] <= 0) { throw new BaseException(['msg' => '当前用户没有可提现佣金']); } if ($data['money'] > $team['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($team['user_id']); if(empty($auth)){ throw new BaseException(['msg' => '请先到个人中心->设置->实名认证']); }elseif(!empty($auth) && $auth["auth_status"] != 1){ throw new BaseException(['msg' => '您的实名认证还未审核通过']); } } // 处理手续费 $data['fee_rate'] = $settlement['fee_rate']; if ($settlement['fee_rate']) { $data['fee_money'] = round($data['money'] * $settlement['fee_rate'] / 100, 2); $data['real_money'] = $data['money'] - $data['fee_money']; } else { $data['real_money'] = $data['money']; } // 提现条件 by lyzflash $this->checkCondition($team); } /** * 提现条件 */ private function checkCondition($team) { if ($team['grade']['cash_condition'] == 10) { return true; } $start_time = date('Y-m-01 00:00:00', time());//月头日期时间 $end_time = date('Y-m-t 23:59:59', time());//月末日期时间 // 获取本月新增的直推 $agent_model = new AgentUserModel; $new_agent = $agent_model->where('referee_id', '=', $team['user_id']) ->where('create_time', '>=', $start_time) ->where('create_time', '<=', $end_time) ->where('is_delete', '=', 0) ->column('user_id'); $user_ids = array_merge([$team['user_id']], $new_agent); $order_model = new OrderModel; $order_model = $order_model->where('user_id', 'IN', $user_ids) ->where('create_time', '>=', $start_time) ->where('create_time', '<=', $end_time) ->where('order_status', '=', 30); // 按当月自购 + 新增直推订单数 if ($team['grade']['cash_condition'] == 20 && $order_model->count() < $team['grade']['cash_order_num']) { throw new BaseException(['msg' => '您需要自购订单或直推订单数满' . $team['grade']['cash_order_num'] . '单才能提现']); } // 按当月自购 + 新增直推订单金额 if ($team['grade']['cash_condition'] == 30 && $order_model->sum('total_price') < $team['grade']['cash_order_money']) { throw new BaseException(['msg' => '您需要自购订单或直推订单金额满' . $team['grade']['cash_order_num'] . '元才能提现']); } }}
\ No newline at end of file
+<?php
+
+namespace app\api\model\plus\team;
+
+use app\common\exception\BaseException;
+use app\common\model\plus\team\Cash as CashModel;
+use app\common\model\order\Order as OrderModel;
+use app\common\model\plus\agent\User as AgentUserModel;
+use app\api\model\user\UserAuth;
+
+/**
+ * 队长提现明细模型
+ */
+class Cash extends CashModel
+{
+ /**
+ * 隐藏字段
+ */
+ protected $hidden = [
+ 'update_time',
+ ];
+
+ /**
+ * 获取队长提现明细
+ */
+ 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($team, $data)
+ {
+ // 数据验证
+ $this->validation($team, $data);
+
+ // 新增申请记录
+ $this->save(array_merge($data, [
+ 'user_id' => $team['user_id'],
+ 'apply_status' => 10,
+ 'app_id' => self::$app_id,
+ ]));
+
+ // 冻结用户资金
+ $team->freezeMoney($data['money']);
+
+ return true;
+ }
+
+ /**
+ * 数据验证
+ */
+ private function validation($team, &$data)
+ {
+ // 结算设置
+ $settlement = Setting::getItem('settlement');
+
+ // 最低提现佣金
+ if ($data['money'] <= 0) {
+ throw new BaseException(['msg' => '提现金额不正确']);
+ }
+
+ if ($team['money'] <= 0) {
+ throw new BaseException(['msg' => '当前用户没有可提现佣金']);
+ }
+
+ if ($data['money'] > $team['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($team['user_id']);
+ if (empty($auth)) {
+ throw new BaseException(['msg' => '请先到个人中心->设置->实名认证']);
+ } elseif (!empty($auth) && $auth["auth_status"] != 1) {
+ throw new BaseException(['msg' => '您的实名认证还未审核通过']);
+ }
+ }
+
+ // 处理手续费
+ $data['fee_rate'] = $settlement['fee_rate'];
+ if ($settlement['fee_rate']) {
+ $data['fee_money'] = round($data['money'] * $settlement['fee_rate'] / 100, 2);
+ $data['real_money'] = $data['money'] - $data['fee_money'];
+ } else {
+ $data['real_money'] = $data['money'];
+ }
+
+ // 提现条件 by lyzflash
+ $this->checkCondition($team);
+ }
+
+ /**
+ * 提现条件
+ */
+ private function checkCondition($team)
+ {
+ if ($team['grade']['cash_condition'] == 10) {
+ return true;
+ }
+
+ $start_time = date('Y-m-01 00:00:00', time()); // 月头日期时间
+ $end_time = date('Y-m-t 23:59:59', time()); // 月末日期时间
+
+ // 获取本月新增的直推
+ $agent_model = new AgentUserModel;
+ $new_agent = $agent_model->where('referee_id', '=', $team['user_id'])
+ ->where('create_time', '>=', $start_time)
+ ->where('create_time', '<=', $end_time)
+ ->where('is_delete', '=', 0)
+ ->column('user_id');
+
+ $user_ids = array_merge([$team['user_id']], $new_agent);
+ $order_model = new OrderModel;
+ $order_model = $order_model->where('user_id', 'IN', $user_ids)
+ ->where('create_time', '>=', $start_time)
+ ->where('create_time', '<=', $end_time)
+ ->where('order_status', '=', 30);
+
+ // 按当月自购 + 新增直推订单数
+ if ($team['grade']['cash_condition'] == 20 && $order_model->count() < $team['grade']['cash_order_num']) {
+ throw new BaseException(['msg' => '您需要自购订单或直推订单数满' . $team['grade']['cash_order_num'] . '单才能提现']);
+ }
+
+ // 按当月自购 + 新增直推订单金额
+ if ($team['grade']['cash_condition'] == 30 && $order_model->sum('total_price') < $team['grade']['cash_order_money']) {
+ throw new BaseException(['msg' => '您需要自购订单或直推订单金额满' . $team['grade']['cash_order_num'] . '元才能提现']);
+ }
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.2