From b631520f575ddbaef61c65a48bfb135b2a55dc0e Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Fri, 15 Dec 2023 21:43:42 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=93=81=E7=89=8C=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/StoreCategoryRepository.php | 1 + app/controller/admin/store/StoreBrand.php | 25 ++++++++++++------- route/admin/product.php | 3 +++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/common/repositories/store/StoreCategoryRepository.php b/app/common/repositories/store/StoreCategoryRepository.php index 461d789..ad5a38b 100644 --- a/app/common/repositories/store/StoreCategoryRepository.php +++ b/app/common/repositories/store/StoreCategoryRepository.php @@ -107,6 +107,7 @@ class StoreCategoryRepository extends BaseRepository */ public function getBrandList() { + return app()->make(StoreBrandRepository::class)->getAll(); } diff --git a/app/controller/admin/store/StoreBrand.php b/app/controller/admin/store/StoreBrand.php index 3065060..3d4558a 100644 --- a/app/controller/admin/store/StoreBrand.php +++ b/app/controller/admin/store/StoreBrand.php @@ -40,8 +40,8 @@ class StoreBrand extends BaseController */ public function lst() { - [$page , $limit] = $this->getPage(); - $where = $this->request->params(['brand_category_id','brand_name']); + [$page, $limit] = $this->getPage(); + $where = $this->request->params(['brand_category_id', 'brand_name']); return app('json')->success($this->repository->getList($where, $page, $limit)); } @@ -57,23 +57,23 @@ class StoreBrand extends BaseController return app('json')->success('添加成功'); } - public function update($id,validate $validate) + public function update($id, validate $validate) { $data = $this->checkParams($validate); - if(!$this->repository->meExists($id)) + if (!$this->repository->meExists($id)) return app('json')->fail('数据不存在'); if (!$this->repository->parentExists($data['brand_category_id'])) return app('json')->fail('上级分类不存在'); - $this->repository->update($id,$data); + $this->repository->update($id, $data); return app('json')->success('编辑成功'); } public function delete($id) { - if(!$this->repository->meExists($id)) + if (!$this->repository->meExists($id)) return app('json')->fail('数据不存在'); - if($this->repository->getBrandHasProduct($id)) + if ($this->repository->getBrandHasProduct($id)) return app('json')->fail('该品牌下存在商品'); $this->repository->delete($id); return app('json')->success('删除成功'); @@ -85,16 +85,17 @@ class StoreBrand extends BaseController return app('json')->fail('数据不存在'); return app('json')->success($this->repository->get($id)); } + /** * 验证 - * @param validate $validate + * @param validate $validate * @param bool $isCreate * @return array * @author Qinii */ public function checkParams(validate $validate) { - $data = $this->request->params(['brand_category_id','brand_name','is_show','sort','pic']); + $data = $this->request->params(['brand_category_id', 'brand_name', 'is_show', 'sort', 'pic']); $validate->check($data); return $data; } @@ -137,4 +138,10 @@ class StoreBrand extends BaseController $this->repository->update($id, ['is_show' => $status]); return app('json')->success('修改成功'); } + + public function all() + { + $data = $this->repository->getAll(); + return app('json')->success($data); + } } diff --git a/route/admin/product.php b/route/admin/product.php index 6c64907..0da4320 100644 --- a/route/admin/product.php +++ b/route/admin/product.php @@ -150,6 +150,9 @@ Route::group(function () { Route::get('lst', '/lst')->name('systemStoreBrandLst')->option([ '_alias' => '列表', ]); + Route::get('brandList', '/all')->name('systemStoreBrandAll')->option([ + '_alias' => '列表', + ]); Route::post('status/:id', '/switchStatus')->name('systemStoreBrandSwithStatus')->option([ '_alias' => '修改状态', ]); From 6964f16a1fdec1078e447937e2bc747c54c1fee1 Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Fri, 15 Dec 2023 22:07:15 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=9C=81=E5=B8=82=E5=8C=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/store/StoreBrand.php | 9 ++++++++- route/admin/product.php | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controller/admin/store/StoreBrand.php b/app/controller/admin/store/StoreBrand.php index 3d4558a..bec0814 100644 --- a/app/controller/admin/store/StoreBrand.php +++ b/app/controller/admin/store/StoreBrand.php @@ -16,6 +16,7 @@ use think\App; use crmeb\basic\BaseController; use app\validate\admin\StoreBrandValidate as validate; use app\common\repositories\store\StoreBrandRepository; +use app\common\repositories\store\CityAreaRepository; class StoreBrand extends BaseController { @@ -141,7 +142,13 @@ class StoreBrand extends BaseController public function all() { - $data = $this->repository->getAll(); + $data = $this->repository->getAll(); return app('json')->success($data); } + + public function getCitylist($id,CityAreaRepository $repository) + { + $where['parent_id'] = $id; + return app('json')->success($repository->getList($where)); + } } diff --git a/route/admin/product.php b/route/admin/product.php index 0da4320..39b71d4 100644 --- a/route/admin/product.php +++ b/route/admin/product.php @@ -153,6 +153,9 @@ Route::group(function () { Route::get('brandList', '/all')->name('systemStoreBrandAll')->option([ '_alias' => '列表', ]); + Route::get('city/:id', '/getCitylist')->name('systemStoreCity')->option([ + '_alias' => '列表', + ]); Route::post('status/:id', '/switchStatus')->name('systemStoreBrandSwithStatus')->option([ '_alias' => '修改状态', ]); From c4a78b46c8b7cee68bf031cbd991d6a72f6527ba Mon Sep 17 00:00:00 2001 From: limu Date: Mon, 18 Dec 2023 16:11:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/dayValue.php | 42 ++++++++++++++++++ config/console.php | 2 + config/partner.php | 78 +++++++++++++++++----------------- crmeb/jobs/OrderPartnerJob.php | 7 ++- 4 files changed, 88 insertions(+), 41 deletions(-) create mode 100644 app/command/dayValue.php diff --git a/app/command/dayValue.php b/app/command/dayValue.php new file mode 100644 index 0000000..3a4f543 --- /dev/null +++ b/app/command/dayValue.php @@ -0,0 +1,42 @@ +setName('dayValue') + ->addArgument('dayValue', Argument::OPTIONAL, 'php think menu [1] / [2]') + ->setDescription('社区等级结算'); + } + + protected function execute(Input $input, Output $output) + { + + } + + +} diff --git a/config/console.php b/config/console.php index a85141c..5f51478 100644 --- a/config/console.php +++ b/config/console.php @@ -39,5 +39,7 @@ return [ 'change:hotTop' => 'app\command\changeHotTop', //各种积分转换 'brand' => 'app\command\brand', + //社区贡献值结算 + 'dayValue' => 'app\command\dayValue', ], ]; diff --git a/config/partner.php b/config/partner.php index 4c20e0d..92b3727 100644 --- a/config/partner.php +++ b/config/partner.php @@ -16,21 +16,20 @@ return [ // 社区等级配置 'community_level' => [ [ - 'alias' => '一星社区服务商 ', - 'level_name' => 'S1', - 'min_price' => '30000', + 'alias' => '七星社区服务商 ', + 'level_name' => 'S7', + 'min_price' => '100000000', 'pay_community' => '0.03', - ], - [ - 'alias' => '二星社区服务商 ', - 'level_name' => 'S2', - 'min_price' => '300000', + ], [ + 'alias' => '六星社区服务商 ', + 'level_name' => 'S6', + 'min_price' => '10000000', 'pay_community' => '0.03', ], [ - 'alias' => '三星社区服务商 ', - 'level_name' => 'S3', - 'min_price' => '100000', + 'alias' => '五星社区服务商 ', + 'level_name' => 'S5', + 'min_price' => '10000000', 'pay_community' => '0.03', ], [ @@ -38,46 +37,45 @@ return [ 'level_name' => 'S4', 'min_price' => '3000000', 'pay_community' => '0.03', - ], - [ - 'alias' => '五星社区服务商 ', - 'level_name' => 'S5', - 'min_price' => '10000000', + ], [ + 'alias' => '三星社区服务商 ', + 'level_name' => 'S3', + 'min_price' => '100000', 'pay_community' => '0.03', ], [ - 'alias' => '六星社区服务商 ', - 'level_name' => 'S6', - 'min_price' => '10000000', + 'alias' => '二星社区服务商 ', + 'level_name' => 'S2', + 'min_price' => '300000', 'pay_community' => '0.03', ], [ - 'alias' => '七星社区服务商 ', - 'level_name' => 'S7', - 'min_price' => '100000000', + 'alias' => '一星社区服务商 ', + 'level_name' => 'S1', + 'min_price' => '30000', 'pay_community' => '0.03', ], ], //品牌代理商等级配置 'brand_level' => [ [ - 'alias' => '品牌体验官', - 'level_name' => 'B1', - 'min_price' => '10000', + 'alias' => '全球品牌代言人', + 'level_name' => 'B7', + 'min_price' => '1000000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], [ - 'alias' => '品牌推荐官', - 'level_name' => 'B2', - 'min_price' => '30000', + 'alias' => '亚太区品牌代言人', + 'level_name' => 'B6', + 'min_price' => '500000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], [ - 'alias' => '品牌推广大使', - 'level_name' => 'B3', - 'min_price' => '50000', + 'alias' => '中国区品牌代言人', + 'level_name' => 'B5', + 'min_price' => '300000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], @@ -89,23 +87,23 @@ return [ 'promotion_community' => '0.1' ], [ - 'alias' => '中国区品牌代言人', - 'level_name' => 'B5', - 'min_price' => '300000', + 'alias' => '品牌推广大使', + 'level_name' => 'B3', + 'min_price' => '50000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], [ - 'alias' => '亚太区品牌代言人', - 'level_name' => 'B6', - 'min_price' => '500000', + 'alias' => '品牌推荐官', + 'level_name' => 'B2', + 'min_price' => '30000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], [ - 'alias' => '全球品牌代言人', - 'level_name' => 'B7', - 'min_price' => '1000000', + 'alias' => '品牌体验官', + 'level_name' => 'B1', + 'min_price' => '10000', 'pay_community' => '0.3', 'promotion_community' => '0.1' ], diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index 1050cf5..57ffe17 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -72,6 +72,7 @@ class OrderPartnerJob implements JobInterface $mian_flowing = bcadd($mian_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2); $mian_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3); $mian_price = bcmul($data['commission_rate'], $mian_rate, 2); + $mian_flowing = bcadd($mian_flowing, $mian_price, 2); $mian_price = bcmul($mian_price, 0.667, 2); $total_price = bcadd($total_price, $mian_price, 2); } @@ -82,6 +83,7 @@ class OrderPartnerJob implements JobInterface $ping_flowing = bcadd($ping_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2); $ping_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3); $ping_price = bcmul($data['commission_rate'], $ping_rate, 2); + $ping_flowing = bcadd($ping_flowing, $ping_price, 2); $ping_price = bcmul($ping_price, 0.667, 2); $total_price = bcadd($total_price, $ping_price, 2); } @@ -132,6 +134,8 @@ class OrderPartnerJob implements JobInterface 'street_id' => $address['street_id'] ?? '', 'created_time' => date('Y-m-d H:i:s'), 'baodan_liushui' => $bao_flowing, + 'miandan_liushui' => $mian_flowing, + 'ping_liushui' => $ping_flowing, ]; StoreOrderContribute::getDB()->insert($contribute_insert); //订单角色贡献值-30% @@ -275,7 +279,7 @@ class OrderPartnerJob implements JobInterface ->where('is_area', 0) ->where('status', 1) ->select()->toArray(); - $role_ids = array_column($common_roles, 'id', ); + $role_ids = array_column($common_roles, 'id'); $common_trade_data = array_column($common_roles, null,'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') @@ -310,6 +314,7 @@ class OrderPartnerJob implements JobInterface //批量增加用户贡献值日志 ValueContributionLog::getDB()->insertAll($user_log_data); + //社区等级判断 echo 'ok'; } catch (\Exception $e) { Log::info('订单角色贡献值处理失败; error : ' . $e->getMessage()); From 38be24aaa267951cfca84927e216a205b412f783 Mon Sep 17 00:00:00 2001 From: limu Date: Mon, 18 Dec 2023 16:36:47 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E5=80=BC=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderCreateRepository.php | 3 ++- .../store/order/StoreOrderRepository.php | 2 +- crmeb/jobs/OrderPartnerJob.php | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index c70250f..315fbd5 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -1058,6 +1058,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $rate = bcmul($merchantCart['merchantCategory']['commission_rate'], 100, 4); } $user_address = isset($address) ? ($address['province'] . $address['city'] . $address['district'] . $address['street'] . $address['detail']) : ''; + //整理订单数据 $_order = [ 'cartInfo' => $merchantCart, @@ -1093,7 +1094,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2), 'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'], 'pay_type' => $pay_type, - 'user_address_id' => $user_address['address_id'] ?? 0, + 'user_address_id' => $address['address_id'] ?? 0, ]; $allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']); $orderList[] = $_order; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index a847aa9..949b02e 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -745,7 +745,7 @@ class StoreOrderRepository extends BaseRepository $storeOrderStatusRepository->{$func}($orderStatus); }); //推送到贡献值结算队列 - Queue::push(OrderPartnerJob::class, compact('order')); + Queue::push(OrderPartnerJob::class, $order->toArray()); event('order.take', compact('order')); diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index 57ffe17..da90160 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -32,8 +32,9 @@ use app\common\repositories\user\UserAddressRepository; class OrderPartnerJob implements JobInterface { - public function fire($job,$data) + public function fire($job, $data) { + file_put_contents('/tmp/debug_partner', '开始处理贡献值订单:'.var_export($data, 1), 8); try { //初始化贡献值 $bao_price = $mian_price = $ping_price = $total_price = 0; @@ -201,7 +202,7 @@ class OrderPartnerJob implements JobInterface ->select()->toArray(); $role_ids = array_column($trade_roles, 'id'); - $trade_trade_data = array_column($trade_roles,null, 'id'); + $trade_trade_data = array_column($trade_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->whereIn('p.partner_id', $role_ids) @@ -244,8 +245,8 @@ class OrderPartnerJob implements JobInterface ->whereIn('area_id', $area_ids) ->select()->toArray(); - $role_ids = array_column($area_roles, 'id'); - $trade_trade_data = array_column($area_roles, null,'id'); + $role_ids = array_column($area_roles, 'id'); + $trade_trade_data = array_column($area_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->whereIn('p.partner_id', $role_ids) @@ -280,7 +281,7 @@ class OrderPartnerJob implements JobInterface ->where('status', 1) ->select()->toArray(); $role_ids = array_column($common_roles, 'id'); - $common_trade_data = array_column($common_roles, null,'id'); + $common_trade_data = array_column($common_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->field('u.*,p.partner_id') @@ -288,7 +289,7 @@ class OrderPartnerJob implements JobInterface ->where('u.uid', '<>', $data['uid']) ->select(); - if(!empty($user_list)){ + if (!empty($user_list)) { $user_list = $user_list->toArray(); $user_count = count($user_list); foreach ($user_list as $cuk => $cuv) { From 878ebc88735965980d229c117e1ed2d7fc540a03 Mon Sep 17 00:00:00 2001 From: limu Date: Mon, 18 Dec 2023 16:52:16 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E5=80=BC=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/jobs/OrderPartnerJob.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index da90160..9e177a7 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -73,7 +73,6 @@ class OrderPartnerJob implements JobInterface $mian_flowing = bcadd($mian_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2); $mian_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3); $mian_price = bcmul($data['commission_rate'], $mian_rate, 2); - $mian_flowing = bcadd($mian_flowing, $mian_price, 2); $mian_price = bcmul($mian_price, 0.667, 2); $total_price = bcadd($total_price, $mian_price, 2); } @@ -84,7 +83,6 @@ class OrderPartnerJob implements JobInterface $ping_flowing = bcadd($ping_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2); $ping_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3); $ping_price = bcmul($data['commission_rate'], $ping_rate, 2); - $ping_flowing = bcadd($ping_flowing, $ping_price, 2); $ping_price = bcmul($ping_price, 0.667, 2); $total_price = bcadd($total_price, $ping_price, 2); }