diff --git a/plugins/area-dividend/src/admin/AgentController.php b/plugins/area-dividend/src/admin/AgentController.php index 08eed35b..65e9a808 100644 --- a/plugins/area-dividend/src/admin/AgentController.php +++ b/plugins/area-dividend/src/admin/AgentController.php @@ -45,8 +45,7 @@ class AgentController extends BaseController $wq_data = \YunShop::request()->wq; if ($agentData) { - $agent = AreaDividendAgent::getAgentByMemberId($agentData['member_id'])->where('status', '<>', -1) - ->first(); + $agent = AreaDividendAgent::getAgentByMemberId($agentData['member_id'])->where('status', '<>', -1)->first(); $set = Setting::get('plugin.area_dividend'); if (!empty($agent)) { if ($agent->status == 0) { @@ -87,8 +86,7 @@ class AgentController extends BaseController if ($hasAgent && in_array($hasAgent->status, [0, 1])) { return $this->errorJson('添加失败,此会员已是该区域代理商'); } elseif ($hasAgent && $hasAgent->status == -1) { - AreaDividendAgent::uniacid() - ->where('id', $hasAgent->id)->delete(); + AreaDividendAgent::uniacid()->where('id', $hasAgent->id)->delete(); } } @@ -171,19 +169,13 @@ class AgentController extends BaseController { $id = \YunShop::request()->id; $agency = AreaDividendAgent::find($id); - if (!$agency) { - return $this->message('无此区域代理或已经删除', '', 'error'); - } - + if (!$agency) return $this->message('无此区域代理或已经删除', '', 'error'); if ($agency->user_id) { $user = WeiQingUsers::getUserByUid($agency->user_id)->first(); - if (!$user) { - return $this->message('微擎账号不存在', '', 'error'); - } + if (!$user) return $this->message('微擎账号不存在', '', 'error'); } if (request()->isMethod('post')) { - $wq_data = \YunShop::request()->wq; if ($wq_data['password'] && $wq_data['password_again']) { if (trim($wq_data['password_again']) != trim($wq_data['password'])) { @@ -248,6 +240,7 @@ class AgentController extends BaseController $agency->manage = request()->order_manage; $agency->ratio = request()->ratio; + $agency->weight_value_ratio = request()->weight_value_ratio; $agency->has_ratio = request()->has_ratio; if (intval(request()->input('agent')['investor_uid'])) { $agency->investor_uid = intval(request()->input('agent')['investor_uid']); diff --git a/plugins/area-dividend/src/services/OrderCreatedNewService.php b/plugins/area-dividend/src/services/OrderCreatedNewService.php index 2ef22adc..c2e280ee 100644 --- a/plugins/area-dividend/src/services/OrderCreatedNewService.php +++ b/plugins/area-dividend/src/services/OrderCreatedNewService.php @@ -163,8 +163,8 @@ class OrderCreatedNewService continue; } - \Log::debug("省公司权重值处理 - 开始处理",['uid'=>$agent['member_id'],'order_id'=>$areaDividendData['order_id']]); - (new WeightValue())->areaGiveInit($agent['member_id'],$this->order); + \Log::debug("省公司权重值处理 - 开始处理",['uid'=>$agent['member_id'],'order_id'=>$areaDividendData['order_id'],'weight_value_ratio'=>$agent['weight_value_ratio']]); + if((float)$agent['weight_value_ratio'] > 0) (new WeightValue())->areaGiveInit($agent['member_id'],$this->order,$agent['weight_value_ratio']); $exist = AreaDividend::where([ diff --git a/plugins/area-dividend/views/admin/change-pwd.blade.php b/plugins/area-dividend/views/admin/change-pwd.blade.php index 565755c1..9982a282 100644 --- a/plugins/area-dividend/views/admin/change-pwd.blade.php +++ b/plugins/area-dividend/views/admin/change-pwd.blade.php @@ -48,6 +48,17 @@ +
+ +
+
+ +
%
+
+
不填或者为0则无权重值奖励。该比例为订单商品奖励权重值的占比例(例如:商品奖励600权重值,这里填写30则该区域代理获得600*30%=180权重值)
+
+
+ {{--招商专员插件--}} @if(app('plugins')->isEnabled('invest-people')) {!! \Yunshop\InvestPeople\services\InvestMemberView::areaDividend($agency->investor_uid) !!} diff --git a/plugins/area-dividend/views/admin/create-agent.blade.php b/plugins/area-dividend/views/admin/create-agent.blade.php index 35f88577..b2bdf688 100644 --- a/plugins/area-dividend/views/admin/create-agent.blade.php +++ b/plugins/area-dividend/views/admin/create-agent.blade.php @@ -97,7 +97,16 @@ - +
+ +
+
+ +
%
+
+
不填或者为0则无权重值奖励。该比例为订单商品奖励权重值的占比例(例如:商品奖励600权重值,这里填写30则该区域代理获得600*30%=180权重值)
+
+
diff --git a/plugins/area-dividend/views/admin/list.blade.php b/plugins/area-dividend/views/admin/list.blade.php index 32849b2e..c99a3be3 100644 --- a/plugins/area-dividend/views/admin/list.blade.php +++ b/plugins/area-dividend/views/admin/list.blade.php @@ -103,86 +103,55 @@ - - - - - - - - - - - - - + + + + + + + + + + + @foreach($list['data'] as $row) - - - + + - - + + - - - - - - - - - - - - + + + - - @endforeach
ID会员Id会员姓名
手机
成为代理时间申请区域申请等级区域消费总额分红比例累计结算金额已结算分红佣金未结算分红佣金操作ID会员ID会员姓名
手机
成为代理时间申请区域申请等级区域消费总额分红比例
权重值比例
+ 累计结算金额
已结算分红佣金
未结算分红佣金 +
操作
{{$row['id']}}{{$row['has_one_member']['uid']}} + {{$row['id']}}{{$row['has_one_member']['uid']}}
{{$row['has_one_member']['nickname']}}
- {{$row['real_name']}}
- {{$row['has_one_profile']['mobile']}} +
{{$row['real_name']}}
{{$row['mobile']}}
{{date("Y-m-d H:i",$row['agent_at'])}} + + + @if($row['province_name']){{$row['province_name']}}@endif + @if($row['city_name'])-{{$row['city_name']}}@endif + @if($row['district_name'])-{{$row['district_name']}}@endif + @if($row['street_name'])-{{$row['street_name']}}@endif + + + - {{date("Y-m-d H:i",$row['agent_at'])}} - - - - @if($row['province_name']) - {{$row['province_name']}} - @endif - @if($row['city_name']) - -{{$row['city_name']}} - @endif - @if($row['district_name']) - -{{$row['district_name']}} - @endif - @if($row['street_name']) - -{{$row['street_name']}} - @endif - - - - - - {{$row['level_name']}} - - {{$row['has_one_dividend']['total_order_amount'] ?: '0.00'}} - - {{$row['rate']}}% - {{--分红比例--}} - - {{$row['has_one_dividend']['total_amount'] ?: '0.00'}} - - {{$row['has_one_dividend']['settle'] ?: '0.00'}} - + {{$row['level_name']}}{{$row['has_one_dividend']['total_order_amount'] ?: '0.00'}}{{$row['rate']}}%
{{$row['weight_value_ratio']}}%
+ {{$row['has_one_dividend']['total_amount'] ?: '0.00'}}
+ {{$row['has_one_dividend']['settle'] ?: '0.00'}}
{{$row['has_one_dividend']['unsettled'] ?: '0.00'}}
+
diff --git a/plugins/collection-room/src/PluginApplication.php b/plugins/collection-room/src/PluginApplication.php index 0795c373..a86bb4c0 100644 --- a/plugins/collection-room/src/PluginApplication.php +++ b/plugins/collection-room/src/PluginApplication.php @@ -105,11 +105,6 @@ class PluginApplication extends \app\common\services\PluginApplication{ ]); } - public function register(){ - CollectionRoomIdentifierModel::createDefaultData(); - - } - public function boot(){ $events = app('events'); diff --git a/plugins/collection-room/src/models/CollectionRoomIdentifierModel.php b/plugins/collection-room/src/models/CollectionRoomIdentifierModel.php index 957b0a3a..0a745b07 100644 --- a/plugins/collection-room/src/models/CollectionRoomIdentifierModel.php +++ b/plugins/collection-room/src/models/CollectionRoomIdentifierModel.php @@ -36,6 +36,7 @@ class CollectionRoomIdentifierModel extends BaseModel{ * @return array */ public function getList($search){ + self::createDefaultData(); // 条件生成 $where = []; if($search['unique_number'] > 0) $where[] = ['yz_collection_room_identifier.unique_number','=',$search['unique_number']]; diff --git a/plugins/weight-value/src/models/WeightValue.php b/plugins/weight-value/src/models/WeightValue.php index 0594722f..3bd81e35 100644 --- a/plugins/weight-value/src/models/WeightValue.php +++ b/plugins/weight-value/src/models/WeightValue.php @@ -380,11 +380,12 @@ class WeightValue extends BaseModel{ /** * Common: 区域代理提成 - 开始处理 * Author: wu-hui - * Time: 2023/10/24 16:57 + * Time: 2023/10/27 11:25 * @param $uid * @param $model + * @param $weightValueRatio */ - public function areaGiveInit($uid,$model){ + public function areaGiveInit($uid,$model,$weightValueRatio){ DB::beginTransaction(); try{ // 当前订单全部商品 @@ -397,7 +398,15 @@ class WeightValue extends BaseModel{ // 循环处理信息 foreach($goodsList as $goodsInfo){ // 获取当前用户应得的权重值 - $totalWeightValue = (float)sprintf("%.2f",$this->getAreaGiveWeightValue($goodsInfo,$currentUser)); + $goodTotalWeightValue = (float)sprintf("%.2f",$this->getAreaGiveWeightValue($goodsInfo,$currentUser)); + $totalWeightValue = (float)sprintf("%.2f",$goodTotalWeightValue * $weightValueRatio / 100); + // \Log::debug('------ 省公司权重值处理 - 计算结果------',[ + // 'goods_id' => $goodsInfo['goods_id'], + // 'order_goods_id' => $goodsInfo['id'], + // '商品总产生权重值' => $goodTotalWeightValue, + // '占比例' => $weightValueRatio, + // '实际获得' => $totalWeightValue + // ]); // 应得权重值大于0 记录改变信息并且修改持有权重值 if((float)$totalWeightValue > 0){ $changeAfter = sprintf("%.2f",($currentAgentHasWeightValue + $totalWeightValue));