From b0891ee4a0272b83860fab3f56a0d280e1ad4d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 12 Mar 2021 17:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=88=A9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/UserRebate.php | 38 ++++ app/data/service/RebateCurrentService.php | 2 + app/data/service/UserUpgradeService.php | 17 +- app/data/view/user_rebate/config.html | 263 ++++++++++++++++++++++ config/view.php | 2 +- 5 files changed, 319 insertions(+), 3 deletions(-) create mode 100644 app/data/controller/UserRebate.php create mode 100644 app/data/view/user_rebate/config.html diff --git a/app/data/controller/UserRebate.php b/app/data/controller/UserRebate.php new file mode 100644 index 000000000..f7b5837ce --- /dev/null +++ b/app/data/controller/UserRebate.php @@ -0,0 +1,38 @@ +skey = 'RebateRule'; + $this->title = '返利奖励配置'; + if ($this->request->isGet()) { + $this->data = sysdata($this->skey); + $this->levels = UserUpgradeService::instance()->levels(); + $this->fetch(); + } else { + sysdata($this->skey, $this->request->post()); + $this->success('奖励修改成功'); + } + } + +} \ No newline at end of file diff --git a/app/data/service/RebateCurrentService.php b/app/data/service/RebateCurrentService.php index 9ea1263b6..e2e263b63 100644 --- a/app/data/service/RebateCurrentService.php +++ b/app/data/service/RebateCurrentService.php @@ -18,6 +18,7 @@ class RebateCurrentService extends Service const PRIZE_04 = 'PRIZE04'; const PRIZE_05 = 'PRIZE05'; const PRIZE_06 = 'PRIZE06'; + const PRIZE_07 = 'PRIZE07'; const PRIZES = [ self::PRIZE_01 => ['code' => self::PRIZE_01, 'name' => '首推奖励', 'func' => '_prize01'], @@ -26,6 +27,7 @@ class RebateCurrentService extends Service self::PRIZE_04 => ['code' => self::PRIZE_04, 'name' => '间接团队', 'func' => '_prize04'], self::PRIZE_05 => ['code' => self::PRIZE_05, 'name' => '差额奖励', 'func' => '_prize05'], self::PRIZE_06 => ['code' => self::PRIZE_06, 'name' => '管理奖励', 'func' => '_prize06'], + self::PRIZE_07 => ['code' => self::PRIZE_07, 'name' => '升级奖励', 'func' => '_prize07'], ]; /** diff --git a/app/data/service/UserUpgradeService.php b/app/data/service/UserUpgradeService.php index 6c7d50355..10714c0b0 100644 --- a/app/data/service/UserUpgradeService.php +++ b/app/data/service/UserUpgradeService.php @@ -70,7 +70,20 @@ class UserUpgradeService extends Service } /** - * 同步计算用户级别 + * 获取用户等级数据 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function levels(): array + { + $query = $this->app->db->name('DataUserUpgrade'); + return $query->where(['status' => 1])->order('number asc')->select()->toArray(); + } + + /** + * 同步计算用户等级 * @param integer $uid 指定用户UID * @param boolean $parent 同步计算上级 * @return boolean @@ -88,7 +101,7 @@ class UserUpgradeService extends Service $teamsIndirect = $this->app->db->name('DataUser')->where(['pid2' => $uid])->count(); $teamsUsers = $this->app->db->name('DataUser')->where(['pid1|pid2' => $uid])->count(); $orderAmount = $this->app->db->name('ShopOrder')->where("uid={$uid} and status>=4")->sum('amount_total'); - // 计算用户级别 + // 计算用户等级 foreach ($this->app->db->name('DataUserUpgrade')->where(['status' => 1])->order('number desc')->cursor() as $item) { $l1 = empty($item['goods_vip_status']) || $user['buy_vip_entry'] > 0; $l2 = empty($item['teams_users_status']) || $item['teams_users_number'] <= $teamsUsers; diff --git a/app/data/view/user_rebate/config.html b/app/data/view/user_rebate/config.html new file mode 100644 index 000000000..3fd9b9905 --- /dev/null +++ b/app/data/view/user_rebate/config.html @@ -0,0 +1,263 @@ +{extend name="../../admin/view/main"} + +{block name='content'} +
+
+
+ + +
+
+
+
+ 结算到账 +
+ {php} $data['settl_type'] = $data['settl_type'] ?? 0; {/php} + {foreach ['支付后立即到账', '确认收货后到账'] as $key => $val}{if $data.settl_type eq $key} + + {else} + + {/if}{/foreach} +
+
+
+
+
+ 团队结算 +
+ {php}$data['teams_type'] = $data['teams_type'] ?? 1;{/php} + {foreach [1 => '实时结算',2 => '次月结算'] as $key=>$val}{if $data.teams_type eq $key} + + {else} + + {/if}{/foreach} +
+
+
+
+
+ + +
+
+ 平推奖励 +
+
+ {foreach $levels as $level} +
+
+ + {php} $key = 'equal_state_vip_'.$level['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+
+
+ +
+
+ +
+
+
+
+
+ {/foreach} +
+
+
+
+ +
+
+
    + {foreach $levels as $level} +
  • {$level.name|default=''}
  • + {/foreach} +
+
+ {foreach $levels as $level} +
+ + + + + {foreach $levels as $l} + + + + + {/foreach} +
+ {$level.name} {$l.name} + +
+
+
+ + {php} $key = 'frist_state_vip_'.$level['number'].'_'.$l['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+ {php} $key = 'frist_type_vip_'.$level['number'].'_'.$l['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 1; {/php} + {foreach [1 => '奖励固定金额 / 每人',2 => '按订单交易金额比例'] as $k => $v} + {if isset($data[$key]) and $data[$key] eq $k} + + {else} + + {/if}{/foreach} + {php} $key = 'frist_value_vip_'.$level['number'].'_'.$l['number']; {/php} + + +
+
+
+
+
+ + {php} $key = 'repeat_state_vip_'.$level['number'].'_'.$l['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+ {php} $key = 'repeat_type_vip_'.$level['number'].'_'.$l['number']; {/php} + {php} $data[$key] = $data[$key] ?? 1; {/php} + {foreach [1 => '奖励固定金额 / 每人',2 => '按订单交易金额比例'] as $k => $v} + {if isset($data[$key]) and $data[$key] eq $k} + + {else} + + {/if}{/foreach} + {php} $key = 'repeat_value_vip_'.$level['number'].'_'.$l['number']; {/php} + +
+
+
+
+
+
+
+
+
+ + {php} $key = 'direct_state_vip_'.$level['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+ {php} $key = 'direct_value_vip_'.$level['number']; {/php} + + +
+
+
+
+
+ + {php} $key = 'indirect_state_vip_'.$level['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+ {php} $key = 'direct_value_vip_'.$level['number']; {/php} + + +
+
+
+
+
+ + {php} $key = 'upgrade_state_vip_'.$level['number']; {/php} + + {php} $data[$key] = $data[$key] ?? 0; {/php} + {if isset($data[$key]) and $data[$key] eq 1} + + {else} + + {/if} + +
+ {php} $key = 'direct_value_vip_'.$level['number']; {/php} + + +
+
+
+
+
+
+ {/foreach} +
+
+
+ + {if auth('save')} +
+ +
+ {/if} + +
+
+ + +
+{/block} \ No newline at end of file diff --git a/config/view.php b/config/view.php index 93621cb6f..a24ab1c70 100644 --- a/config/view.php +++ b/config/view.php @@ -25,7 +25,7 @@ return [ // 模板文件名分隔符 'view_depr' => DIRECTORY_SEPARATOR, // 去除HTML空格换行 - 'strip_space' => true, + 'strip_space' => false, // 模板缓存配置 'tpl_cache' => !app()->isDebug(), // 模板引擎普通标签开始标记