|
|
@@ -7,6 +7,7 @@ use think\Db;
|
|
|
use app\job\InsertDataJob;
|
|
|
use think\Queue;
|
|
|
use think\Cache;
|
|
|
+use think\cache\driver\Redis;
|
|
|
/**
|
|
|
* 员工计件工资核算
|
|
|
*/
|
|
|
@@ -38,6 +39,21 @@ class StaffSalary extends Api
|
|
|
if (Request::instance()->isPost() == false){
|
|
|
$this->error('非法请求');
|
|
|
}
|
|
|
+ $options = [
|
|
|
+ 'host' => '127.0.0.1',
|
|
|
+ 'port' => 6379,
|
|
|
+ 'password' => '',
|
|
|
+ 'select' => 15,
|
|
|
+ 'timeout' => 0,
|
|
|
+ 'expire' => 0,
|
|
|
+ 'persistent' => false,
|
|
|
+ 'prefix' => '',
|
|
|
+ ];
|
|
|
+ $redis = new Redis($options);
|
|
|
+ $queueKey = $redis->handler()->llen('queues:default');
|
|
|
+ if ($queueKey){
|
|
|
+ $this->success('数据正在处理中,请等待...');
|
|
|
+ }
|
|
|
$params = Request::instance()->param();
|
|
|
if (!isset($params['start_date']) || !isset($params['end_date']) || empty($params['start_date']) || empty($params['end_date']) || !isset($params['date']) || empty($params['date']))
|
|
|
{
|
|
|
@@ -479,19 +495,10 @@ class StaffSalary extends Api
|
|
|
$data[$key]['法定天数'] = $params['days'];
|
|
|
$data[$key]['sczl_type'] = trim($item['sczl_type']);
|
|
|
}
|
|
|
-// $num = round(count($data)/10000);
|
|
|
-// for ($i = 0; $i <= $num; $i++){
|
|
|
-// $start = $i * 10000;
|
|
|
-// $res = array_slice($data,$start,10000);
|
|
|
-// $job = new InsertDataJob($res); // 创建任务实例
|
|
|
-// Queue::push($job,'','default'.$i); // 推送任务到队列
|
|
|
-// }
|
|
|
|
|
|
$job = new InsertDataJob($data); // 创建任务实例
|
|
|
Queue::push($job,'','default'); // 推送任务到队列
|
|
|
$this->success('数据正在处理中,请等待...');
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|