mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update RebateCurrentService.php
This commit is contained in:
parent
c7bc5460f1
commit
b5e0fe7101
@ -144,7 +144,7 @@ class RebateCurrentService extends Service
|
||||
// 批量发放配置奖励
|
||||
foreach (self::PRIZES as $vo) {
|
||||
if (method_exists($this, $vo['func'])) {
|
||||
$this->app->log->notice("订单{$orderNo}发放{$vo['func']}奖励");
|
||||
$this->app->log->notice("订单 {$orderNo} 发放 [{$vo['func']}] {$vo['name']}");
|
||||
$this->{$vo['func']}();
|
||||
}
|
||||
}
|
||||
@ -299,12 +299,11 @@ class RebateCurrentService extends Service
|
||||
*/
|
||||
private function _prize05(): bool
|
||||
{
|
||||
return false;
|
||||
$puids = array_reverse(explode('-', trim($this->user['path'], '-')));
|
||||
if (empty($puids) || $this->order['amount_total'] <= 0) return false;
|
||||
// 获取可以参与奖励的代理
|
||||
$sql = $this->app->db->name('DataUserUpgrade')->field('number')->whereLike('rebate_rule', '%,' . self::PRIZE_05 . ',%')->buildSql(true);
|
||||
$users = $this->app->db->name('DataUser')->where("vip_code in {$sql}")->whereIn('id', $puids)->orderField('id', $puids)->select()->toArray();
|
||||
$users = $this->app->db->name('DataUser')->whereRaw("vip_code in {$sql}")->whereIn('id', $puids)->orderField('id', $puids)->select()->toArray();
|
||||
// 查询需要计算奖励的商品
|
||||
$map = [['order_no', '=', $this->order['order_no']], ['discount_rate', '<', 100]];
|
||||
foreach ($this->app->db->name('StoreOrderItem')->where($map)->cursor() as $item) {
|
||||
@ -345,14 +344,13 @@ class RebateCurrentService extends Service
|
||||
*/
|
||||
private function _prize06(): bool
|
||||
{
|
||||
return false;
|
||||
$puids = array_reverse(explode('-', trim($this->user['path'], '-')));
|
||||
if (empty($puids) || $this->order['amount_total'] <= 0) return false;
|
||||
// 记录原始等级
|
||||
$prevLevel = $this->user['vip_code'];
|
||||
// 获取可以参与奖励的代理
|
||||
$subsql = $this->app->db->name('DataUserUpgrade')->field('number')->whereLike('rebate_rule', '%,' . self::PRIZE_06 . ',%')->buildSql(true);
|
||||
foreach ($this->app->db->name('DataUser')->where("vip_code in {$subsql}")->whereIn('id', $puids)->orderField('id', $puids)->cursor() as $user) {
|
||||
foreach ($this->app->db->name('DataUser')->whereRaw("vip_code in {$subsql}")->whereIn('id', $puids)->orderField('id', $puids)->cursor() as $user) {
|
||||
if ($user['vip_code'] > $prevLevel) {
|
||||
if (($amount = $this->_prize06amount($prevLevel, $user['vip_code'])) > 0.00) {
|
||||
$map = ['type' => self::PRIZE_06, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']];
|
||||
|
Loading…
x
Reference in New Issue
Block a user