linwu 1 vuosi sitten
vanhempi
commit
298fa10b91

+ 78 - 73
app/admin/controller/Param.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\admin\controller;
 
 use app\admin\BaseController;
@@ -6,77 +7,81 @@ use app\common\model\Param as ParamModel;
 
 class Param extends BaseController
 {
-	
-	public function index()
-	{
-		$param = ParamModel::where(1)->findOrEmpty();
-		if ($param->isEmpty()) {
-		    $param = new ParamModel;
-			$param->save([
-				'indextopbg'		=> request()->domain()."/static/images/indextopbg.png",
-				'telephone'			=> "",
-				'mycodeban'			=> request()->domain()."/static/images/mycodeban.png",
-				'mycodecolor'		=> "#f33714",
-				'mycodetil'			=> "直说吧,我们要人你要钱,那就来看看!!!",
-				'mycodepic'			=> request()->domain()."/static/images/mycodepic.png",
-				'brokerformpic'		=> request()->domain()."/static/images/brokerformpic.png",
-				'agentformpic'		=> request()->domain()."/static/images/agentformpic.png",
-				'workerformpic'		=> request()->domain()."/static/images/workerformpic.png",
-				'addcomjobs'		=> 0,
-				'addcomjobswyp'		=> 0,
-				'topcomjobs'		=> 0,
-				'adddemand'			=> 0,
-				'adddemandwyd'		=> 0,
-				'topdemand'			=> 0,
-				'addsupply'			=> 0,
-				'topsupply'			=> 0,
-				'teldemand'			=> 0,
-				'telsupply'			=> 0,
-				'mpaccount'			=> request()->domain()."/static/images/mpaccount.png",
-				'defviewtol'		=> 0
-			]);
-		}
-		return view('set/param',[
-			'param' => $param 
-		]);
-	}
-	
-	public function editParam()
-	{
-		$param = ParamModel::where(1)->find();
-		$data = array(
-			'indextopbg'		=> input('indextopbg/s', ""),
-			'telephone'			=> input('telephone/s', ""),
-			'mpaccount'			=> input('mpaccount/s', ""),
-			'mycodeban'			=> input('mycodeban/s', ""),
-			'mycodecolor'		=> input('mycodecolor/s', ""),
-			'mycodetil'			=> input('mycodetil/s', ""),
-			'mycodepic'			=> input('mycodepic/s', ""),
-			'brokerformpic'		=> input('brokerformpic/s', ""),
-			'agentformpic'		=> input('agentformpic/s', ""),
-			'workerformpic'		=> input('workerformpic/s', ""),
-			'addcomjobs'		=> input('addcomjobs/d', 0),
-			'addcomjobswyp'		=> input('addcomjobswyp/d', 0),
-			'topcomjobs'		=> input('topcomjobs/d', 0),
-			'adddemand'			=> input('adddemand/d', 0),
-			'adddemandwyd'		=> input('adddemandwyd/d', 0),
-			'topdemand'			=> input('topdemand/d', 0),
-			'addsupply'			=> input('addsupply/d', 0),
-			'topsupply'			=> input('topsupply/d', 0),
-			'teldemand'			=> input('teldemand/d', 0),
-			'telsupply'			=> input('telsupply/d', 0),
-			'defviewtol'		=> input('defviewtol/d', 0) 
-		);
-		if ($param==null){
-			ParamModel::create($data);
-		}else{
-			$data['id'] = $param->id;
-			ParamModel::update($data);
-		}
-		exit(json_encode(array(
-			'code' 	=> 0,
-			'msg'   => ""
-		)));
-	}
-	
+
+    public function index()
+    {
+        $param = ParamModel::where(1)->findOrEmpty();
+        if ($param->isEmpty()) {
+            $param = new ParamModel;
+            $param->save([
+                'indextopbg'         => request()->domain() . "/static/images/indextopbg.png",
+                'telephone'          => "",
+                'mycodeban'          => request()->domain() . "/static/images/mycodeban.png",
+                'mycodecolor'        => "#f33714",
+                'mycodetil'          => "直说吧,我们要人你要钱,那就来看看!!!",
+                'mycodepic'          => request()->domain() . "/static/images/mycodepic.png",
+                'brokerformpic'      => request()->domain() . "/static/images/brokerformpic.png",
+                'agentformpic'       => request()->domain() . "/static/images/agentformpic.png",
+                'workerformpic'      => request()->domain() . "/static/images/workerformpic.png",
+                'addcomjobs'         => 0,
+                'addcomjobswyp'      => 0,
+                'topcomjobs'         => 0,
+                'adddemand'          => 0,
+                'adddemandwyd'       => 0,
+                'topdemand'          => 0,
+                'addsupply'          => 0,
+                'topsupply'          => 0,
+                'teldemand'          => 0,
+                'telsupply'          => 0,
+                'mpaccount'          => request()->domain() . "/static/images/mpaccount.png",
+                'defviewtol'         => 0,
+                'comjobs_commission' => 0,
+                'agent_commission'   => 0,
+            ]);
+        }
+        return view('set/param', [
+            'param' => $param,
+        ]);
+    }
+
+    public function editParam()
+    {
+        $param = ParamModel::where(1)->find();
+        $data  = [
+            'indextopbg'         => input('indextopbg/s', ""),
+            'telephone'          => input('telephone/s', ""),
+            'mpaccount'          => input('mpaccount/s', ""),
+            'mycodeban'          => input('mycodeban/s', ""),
+            'mycodecolor'        => input('mycodecolor/s', ""),
+            'mycodetil'          => input('mycodetil/s', ""),
+            'mycodepic'          => input('mycodepic/s', ""),
+            'brokerformpic'      => input('brokerformpic/s', ""),
+            'agentformpic'       => input('agentformpic/s', ""),
+            'workerformpic'      => input('workerformpic/s', ""),
+            'addcomjobs'         => input('addcomjobs/d', 0),
+            'addcomjobswyp'      => input('addcomjobswyp/d', 0),
+            'topcomjobs'         => input('topcomjobs/d', 0),
+            'adddemand'          => input('adddemand/d', 0),
+            'adddemandwyd'       => input('adddemandwyd/d', 0),
+            'topdemand'          => input('topdemand/d', 0),
+            'addsupply'          => input('addsupply/d', 0),
+            'topsupply'          => input('topsupply/d', 0),
+            'teldemand'          => input('teldemand/d', 0),
+            'telsupply'          => input('telsupply/d', 0),
+            'defviewtol'         => input('defviewtol/d', 0),
+            'comjobs_commission' => input('comjobs_commission', 0),
+            'agent_commission'   => input('agent_commission', 0),
+        ];
+        if ($param == null) {
+            ParamModel::create($data);
+        } else {
+            $data['id'] = $param->id;
+            ParamModel::update($data);
+        }
+        exit(json_encode([
+            'code' => 0,
+            'msg'  => "",
+        ]));
+    }
+
 }

+ 15 - 1
app/admin/view/set/param.html

@@ -250,7 +250,21 @@
 								<input type="text" name="defviewtol" value="{$param.defviewtol}" placeholder="请输入..." autocomplete="off" class="layui-input">
 								<div class="layui-form-mid layui-word-aux">每天初始浏览量</div> 
 							</div>
-						</div> 
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">悬赏手续费</label>
+							<div class="layui-input-block">
+								<input type="text" name="comjobs_commission" value="{$param.comjobs_commission}" placeholder="请输入..." autocomplete="off" class="layui-input">
+								<div class="layui-form-mid layui-word-aux">悬赏金手续费,基数为悬赏金总额,单位是%,最低为0,最高为100,最多保留两位小数</div>
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">悬赏门店费</label>
+							<div class="layui-input-block">
+								<input type="text" name="agent_commission" value="{$param.agent_commission}" placeholder="请输入..." autocomplete="off" class="layui-input">
+								<div class="layui-form-mid layui-word-aux">悬赏金门店分成,基数为悬赏金总额,单位是%,最低为0,最高为100,最多保留两位小数,将从悬赏金手续费中扣</div>
+							</div>
+						</div>
 						<div class="layui-form-item">
 							<div class="layui-input-block">
 								<button class="layui-btn" lay-submit lay-filter="LAY-set-param-form-submit">确认修改</button>

+ 2 - 2
app/agent/controller/Broker.php

@@ -180,7 +180,7 @@ class Broker extends BaseController
         if (!empty($status)) {
             $map[] = ['status', '=', $status];
         }
-        $list  = BrokerModel::with(['agent', 'muser'])->withCount(['user'])->where($map)->order('id', 'DESC')->limit($limit)->page($page)->append(['status_text', 'powerreport_text','type_text'])->select();
+        $list  = BrokerModel::with(['agent', 'muser'])->withCount(['user'])->where($map)->order('id', 'DESC')->limit($limit)->page($page)->append(['status_text', 'powerreport_text', 'type_text'])->select();
         $count = BrokerModel::where($map)->count();
         if ($count == 0) {
             exit(json_encode([
@@ -316,7 +316,7 @@ class Broker extends BaseController
         }
 
         $incomeService = new IncomeService();
-        $incomeService->add($brokerid, -$value, '商家结算', '劳务公司与经纪人线下结算');
+        $incomeService->add($brokerid, -$value, '门店结算', '门店与经纪人线下结算');
 
         exit(json_encode([
             'code' => 0,

+ 28 - 33
app/common/model/Param.php

@@ -1,43 +1,38 @@
 <?php
+
 namespace app\common\model;
 
 use think\Model;
 
 class Param extends Model
 {
-	// 设置字段信息
+    // 设置字段信息
     protected $schema = [
-        'id'			=> 'int',
-		'indextopbg'	=> 'string',
-		'telephone'		=> 'string',
-		
-		'mycodeban'		=> 'string',
-		'mycodecolor'	=> 'string',
-		'mycodetil'		=> 'string',
-		'mycodepic'		=> 'string',
-		
-		'brokerformpic'	=> 'string',
-		'agentformpic'	=> 'string',
-		'workerformpic'	=> 'string',
-		
-		'addcomjobs'	=> 'int',
-		'addcomjobswyp'	=> 'int',
-		'topcomjobs'	=> 'int',
-		
-		'adddemand'		=> 'int',
-		'adddemandwyd'		=> 'int',
-		'topdemand'		=> 'int',
-		
-		'addsupply'		=> 'int',
-		'topsupply'		=> 'int',
-		
-		'teldemand'		=> 'int',
-		'telsupply'		=> 'int',
-		
-		'mpaccount'	=> 'string',
-		
-		'defviewtol'	=> 'int'
-    ];	
-	
+        'id'                 => 'int',
+        'indextopbg'         => 'string',
+        'telephone'          => 'string',
+        'mycodeban'          => 'string',
+        'mycodecolor'        => 'string',
+        'mycodetil'          => 'string',
+        'mycodepic'          => 'string',
+        'brokerformpic'      => 'string',
+        'agentformpic'       => 'string',
+        'workerformpic'      => 'string',
+        'addcomjobs'         => 'int',
+        'addcomjobswyp'      => 'int',
+        'topcomjobs'         => 'int',
+        'adddemand'          => 'int',
+        'adddemandwyd'       => 'int',
+        'topdemand'          => 'int',
+        'addsupply'          => 'int',
+        'topsupply'          => 'int',
+        'teldemand'          => 'int',
+        'telsupply'          => 'int',
+        'mpaccount'          => 'string',
+        'defviewtol'         => 'int',
+        'comjobs_commission' => 'float',
+        'agent_commission'   => 'float',
+    ];
+
 
 }

+ 19 - 0
app/common/service/ComjobsService.php

@@ -3,6 +3,7 @@
 namespace app\common\service;
 
 
+use app\common\model\Param;
 use app\common\model\RensheCode;
 use app\common\model\Comjobs as ComjobsModel;
 use app\common\model\ComjobsCate as ComjobsCateModel;
@@ -100,4 +101,22 @@ class ComjobsService extends BaseService
 
         return $this->success('导入成功');
     }
+
+    public function dealCommission($broker_id, $value)
+    {
+        //门店抽成
+        $agent_commission_percent = Param::value('agent_commission');
+        $agent_commission         = $value * $agent_commission_percent / 100;
+        $agent_commission         = round($agent_commission, 2);
+        $agentMoney               = new AgentMoneyService();
+        $agentMoney->add($broker_id, $agent_commission, '悬赏招聘', '悬赏招聘推荐入职成功后奖励');
+
+        //经纪人抽成
+        $comjobs_commission_percent = Param::value('comjobs_commission');
+        $comjobs_commission         = $value * (1 - $comjobs_commission_percent / 100);
+        $comjobs_commission         = round($comjobs_commission, 2);
+        $comjobs_commission         -= $agent_commission;
+        $incomeService              = new IncomeService();
+        $incomeService->add($broker_id, $comjobs_commission, '悬赏招聘', '悬赏招聘推荐入职成功后奖励');
+    }
 }

+ 12 - 10
app/mainapp/controller/Comjobs.php

@@ -3,7 +3,6 @@
 namespace app\mainapp\controller;
 
 use app\common\model\WorkerThird;
-use app\common\service\IntegralService;
 use app\mainapp\BaseController;
 
 use app\common\model\User as UserModel;
@@ -19,6 +18,7 @@ use app\common\model\ComjobsReport as ComjobsReportModel;
 use app\common\model\UserParam as UserParamModel;
 use app\common\model\UserIntegral as UserIntegralModel;
 use app\common\model\UserFollow as UserFollowModel;
+use app\common\model\Param as ParamModel;
 
 use chuanglan\Chuanglan;
 use echowx\WxProgram;
@@ -237,12 +237,14 @@ class Comjobs extends BaseController
         } else {
             $brokertol = BrokerModel::where('userid', '=', $userid)->where('status', '=', 1)->where('powerreport', '=', 1)->count();
         }
+        $comjobs_commission = $comjobs_commission = ParamModel::value('comjobs_commission');
         page_result(0, "", [
-            'comjobs'      => $comjobs,
-            'comjobslist'  => $comjobslist,
-            'comjobsstar'  => $comjobsstar,
-            'comjobsshare' => $comjobsshare,
-            'brokertol'    => $brokertol,
+            'comjobs'            => $comjobs,
+            'comjobslist'        => $comjobslist,
+            'comjobsstar'        => $comjobsstar,
+            'comjobsshare'       => $comjobsshare,
+            'brokertol'          => $brokertol,
+            'comjobs_commission' => $comjobs_commission,
         ]);
     }
 
@@ -531,10 +533,10 @@ class Comjobs extends BaseController
 
         $param = UserParamModel::where(1)->findOrEmpty();
         if (!empty($param['sharejobnum'])) {
-            $check = UserIntegralModel::where('createtime','>=',strtotime(date('Y-m-d')))
-                ->where('createtime','<=',strtotime(date('Y-m-d 23:59:59')))
-                ->where('userid',$userid)
-                ->where('itype',10)
+            $check = UserIntegralModel::where('createtime', '>=', strtotime(date('Y-m-d')))
+                ->where('createtime', '<=', strtotime(date('Y-m-d 23:59:59')))
+                ->where('userid', $userid)
+                ->where('itype', 10)
                 ->count();
             if ($check >= $param['sharejobnum']) {
                 page_result(0, "已超过次数");

+ 3 - 2
app/mainapp/controller/Resident.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\mainapp\controller;
 
+use app\common\service\ComjobsService;
 use app\common\service\IncomeService;
 use app\mainapp\BaseController;
 
@@ -53,8 +54,8 @@ class Resident extends BaseController
             page_result(1, "状态只能往后选。");
         }
         if ($status == 3) {
-            $incomeService = new IncomeService();
-            $incomeService->add($report['brokerid'], $report['comjobs']['retmoney'], '悬赏招聘', '悬赏招聘推荐入职成功后奖励');
+            $comjobsService = new ComjobsService();
+            $comjobsService->dealCommission($report['brokerid'], $report['comjobs']['retmoney']);
         }
 
         //更改状态

+ 3 - 2
app/mainapp/controller/Wcomjobs.php

@@ -4,6 +4,7 @@ namespace app\mainapp\controller;
 
 use app\common\model\WorkerThird;
 use app\common\service\BalanceService;
+use app\common\service\ComjobsService;
 use app\common\service\IncomeService;
 use app\common\service\SmsService;
 use app\mainapp\BaseController;
@@ -77,8 +78,8 @@ class Wcomjobs extends BaseController
 
         //悬赏金
         if ($status == 3) {
-            $incomeService = new IncomeService();
-            $incomeService->add($report['brokerid'], $report['comjobs']['retmoney'], '悬赏招聘', '悬赏招聘推荐入职成功后奖励');
+            $comjobsService = new ComjobsService();
+            $comjobsService->dealCommission($report['brokerid'], $report['comjobs']['retmoney']);
         }
 
         page_result(0, "", [

+ 3 - 2
app/worker/controller/Comjobsreport.php

@@ -2,6 +2,7 @@
 
 namespace app\worker\controller;
 
+use app\common\service\ComjobsService;
 use app\common\service\IncomeService;
 use app\worker\BaseController;
 use app\common\model\ComjobsReport as ComjobsReportModel;
@@ -375,8 +376,8 @@ class Comjobsreport extends BaseController
             }
             //悬赏金
             if ($report['status'] != 3 && $data['status'] == 3) {
-                $incomeService = new IncomeService();
-                $incomeService->add($report['brokerid'], $report['comjobs']['retmoney'], '悬赏招聘', '悬赏招聘推荐入职成功后奖励');
+                $comjobsService = new ComjobsService();
+                $comjobsService->dealCommission($report['brokerid'], $report['comjobs']['retmoney']);
             }
             $report->save($data);
         }