|
@@ -15,6 +15,7 @@ use app\common\model\BrokerForm as BrokerFormModel;
|
|
use app\common\model\DemandSnatch as DemandSnatchModel;
|
|
use app\common\model\DemandSnatch as DemandSnatchModel;
|
|
use app\common\model\DemandReport as DemandReportModel;
|
|
use app\common\model\DemandReport as DemandReportModel;
|
|
use app\common\model\Agent as AgentModel;
|
|
use app\common\model\Agent as AgentModel;
|
|
|
|
+use app\common\model\Worker as WorkerModel;
|
|
|
|
|
|
use app\common\validate\DemandReport as DemandReportValidate;
|
|
use app\common\validate\DemandReport as DemandReportValidate;
|
|
use think\exception\ValidateException;
|
|
use think\exception\ValidateException;
|
|
@@ -446,6 +447,10 @@ class Broker extends BaseController
|
|
if (!empty($followstatus)) {
|
|
if (!empty($followstatus)) {
|
|
$map[] = ['followstatus', '=', $followstatus];
|
|
$map[] = ['followstatus', '=', $followstatus];
|
|
}
|
|
}
|
|
|
|
+ $keyword = input('keyword', '');
|
|
|
|
+ if (!empty($keyword)) {
|
|
|
|
+ $map[] = ['nickname|mobile', 'like', "%{$keyword}%"];
|
|
|
|
+ }
|
|
$plist = UserModel::with(['userFollow'])->where($map)->order(['id' => 'desc'])->page($ppage)->limit($psize)->select();
|
|
$plist = UserModel::with(['userFollow'])->where($map)->order(['id' => 'desc'])->page($ppage)->limit($psize)->select();
|
|
page_result(0, "", [
|
|
page_result(0, "", [
|
|
'plist' => $plist,
|
|
'plist' => $plist,
|
|
@@ -524,4 +529,52 @@ class Broker extends BaseController
|
|
|
|
|
|
page_result(0, '', $agent);
|
|
page_result(0, '', $agent);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function center()
|
|
|
|
+ {
|
|
|
|
+ $brokerid = input('brokerid/d', 0);
|
|
|
|
+ empty($brokerid) && page_result(1, "用户不存在。");
|
|
|
|
+
|
|
|
|
+ $broker = BrokerModel::find($brokerid);
|
|
|
|
+ empty($broker) && page_result(1, "用户不存在。");
|
|
|
|
+
|
|
|
|
+ $user_ids = UserModel::where('brokerid', $brokerid)->column('id');
|
|
|
|
+ $worker_count = WorkerModel::where('userid', 'in', $user_ids)->where('status', 5)->count();
|
|
|
|
+
|
|
|
|
+ $statistics = [
|
|
|
|
+ 'income_total' => $broker['income_total'],
|
|
|
|
+ 'income' => $broker['income'],
|
|
|
|
+ 'user' => count($user_ids),
|
|
|
|
+ 'worker' => $worker_count,
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ page_result(0, '', $statistics);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function listWorker()
|
|
|
|
+ {
|
|
|
|
+ $ppage = input('ppage/d', 1);
|
|
|
|
+ $psize = input('psize/d', 20);
|
|
|
|
+ $map = [];
|
|
|
|
+ $brokerid = input('brokerid/d', 0);
|
|
|
|
+ $user_ids = UserModel::where('brokerid', $brokerid)->column('id');
|
|
|
|
+ if (empty($user_ids)) {
|
|
|
|
+ page_result(0, "", [
|
|
|
|
+ 'plist' => [],
|
|
|
|
+ 'pstatus' => 'noMore',
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $map[] = ['userid', 'in', $user_ids];
|
|
|
|
+ $map[] = ['status', '=', 5];
|
|
|
|
+ $keyword = input('keyword', '');
|
|
|
|
+ if (!empty($keyword)) {
|
|
|
|
+ $map[] = ['title|mobile', 'like', "%{$keyword}%"];
|
|
|
|
+ }
|
|
|
|
+ $plist = WorkerModel::where($map)->page($ppage)->limit($psize)->select();
|
|
|
|
+ page_result(0, "", [
|
|
|
|
+ 'plist' => $plist,
|
|
|
|
+ 'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
}
|
|
}
|