From 8a6ea46752574ae14961f44c2021a6d6961751ab Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Sun, 24 Dec 2023 20:53:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E5=91=BD=E5=80=BC=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/jobs/OrderPartnerJob.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index 90c4098..7475cd1 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -28,6 +28,7 @@ use app\common\model\store\product\Spu; use app\common\model\user\ValueContributionLog; use app\common\model\store\order\StoreOrderContribute; use app\common\repositories\user\UserAddressRepository; +use app\common\model\store\order\StoreOrderLevel; class OrderPartnerJob implements JobInterface { @@ -41,6 +42,7 @@ class OrderPartnerJob implements JobInterface $bao_flowing = $mian_flowing = $ping_flowing = 0; $brand_ids = $trade_ids = $user_log_data = []; $admin_id = config('partner.gongxian_admin_id') ?? ''; + //查询商品类型 -报单区 100% 免单区66.7% 平价区66.7% $order_product = StoreOrderProduct::getDB() ->where('order_id', $data['order_id']) @@ -95,6 +97,7 @@ class OrderPartnerJob implements JobInterface if ($has_contribute == false) { throw new Exception('订单没有指定三种类型商品,不计入贡献值统计'); } + //读取品牌所属分类 if (!empty($brand_ids)) { $brand_ids = array_unique($brand_ids); @@ -137,11 +140,26 @@ class OrderPartnerJob implements JobInterface 'ping_liushui' => $ping_flowing, ]; StoreOrderContribute::getDB()->insert($contribute_insert); + + //读取消费等级增加生命值 + $user_hb = 0; + $order_level = StoreOrderLevel::getDB()->order('level asc')->select(); + if(!empty($order_level)){ + foreach($order_level as $k=>$v){ + if($total_price >= $v->min_price){ + $user_hb = bcmul($total_price,$v->pay_hp,2); + } + } + } //订单角色贡献值-30% $user_value = bcmul($total_price, 0.3, 2); $user = User::getDB()->where('uid', $data['uid'])->find(); $user->all_value = bcadd($user->all_value, $user_value, 2); + //增加生命值 + if(!empty($user_hb)){ + $user->hp_value = bcadd($user->hp_value, $user_hb, 2); + } $user->save(); $user_log_data[] = [ 'type' => 6, @@ -374,4 +392,10 @@ class OrderPartnerJob implements JobInterface { // TODO: Implement failed() method. } + + //贡献值转增值积分 + public function addValue($uid,$num) + { + + } }