|
|
@@ -6,6 +6,11 @@ use think\console\Input;
|
|
|
use think\console\Output;
|
|
|
use app\admin\model\OperationData as OperationDataModel;
|
|
|
use app\admin\model\KefuTime;
|
|
|
+use app\admin\model\KefuWork;
|
|
|
+use app\admin\model\User;
|
|
|
+use app\manage\model\Config;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Worker 命令行类
|
|
|
@@ -20,12 +25,26 @@ class OperationData extends Command
|
|
|
|
|
|
public function execute(Input $input, Output $output)
|
|
|
{
|
|
|
+ //创建机器人客服的数据
|
|
|
+ $autoTask=Config::autoTask();
|
|
|
+ if ($autoTask &&!empty($autoTask['user_id'])) {
|
|
|
+ $admin_id = User::getAdminId($autoTask['user_id']);
|
|
|
+ $exists = KefuWork::where('admin_id', $admin_id)->where("created_at", '>=', date('Y-m-d'))->find();
|
|
|
+ if (!$exists) {
|
|
|
+ KefuWork::create([
|
|
|
+ 'admin_id'=>$admin_id,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
//统计前一天的接线总数
|
|
|
- OperationDataModel::create([
|
|
|
- 'type' => 1,
|
|
|
- 'num' => $this->chatNum(),
|
|
|
- 'date' => date('Y-m-d', strtotime('-1 day')),
|
|
|
- ]);
|
|
|
+ $exists = OperationDataModel::where('type', 1)->where("date", date("Y-m-d", strtotime("-1 day")))->find();
|
|
|
+ if (!$exists) {
|
|
|
+ OperationDataModel::create([
|
|
|
+ 'type' => 1,
|
|
|
+ 'num' => $this->chatNum(),
|
|
|
+ 'date' => date('Y-m-d', strtotime('-1 day')),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|