store_id . $this->action; if($this->action){ $event = new OrderEvent(); $event->store_id = $this->store_id; $action = $this->action; $event->$action(); } if($this->in_action){ $action = $this->in_action; $this->$action(); } } public function executeLevel() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->level(); } catch(\Throwable $e) { // \Yii::error($e); \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeLevel--end', time() - $time], 'debug_task_execute.log'); } public function executeUserLevelExpiresHandle() { try { // 定时任务 $event = new OrderEvent(); $event->userLevelExpiresHandle(); } catch(\Throwable $e) { // \Yii::error($e); \Yii::error('--------auto-execute-error---- ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } public function executeOrder() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->onLoad(); } catch(\Throwable $e) { // \Yii::error($e); \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeOrder--end', time() - $time], 'debug_task_execute.log'); } public function executeStoreWxOrderShipping() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->storeWxOrderShipping(); } catch(\Throwable $e) { // \Yii::error($e); \Yii::error('--------auto-executeStoreWxOrderShipping-error---- '.$store->id.' ----auto-executeStoreWxOrderShipping-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeStoreWxOrderShipping--end', time() - $time], 'debug_task_execute.log'); } public function executeOtherThird() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->otherThird(); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeOtherThird--end', time() - $time], 'debug_task_execute.log'); } /** * 奖金池自动发放 * @return void */ public function executeReportPool() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->reportPool(); } catch(\Exception $e) { \Yii::error('--------auto-execute-report-pool-error---- '.$store->id.' ----auto-execute-report-pool-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeReportPool--end', time() - $time], 'debug_task_execute.log'); } public function executeAdapayShareToSelf() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->adapayShareToSelf(); } catch(\Exception $e) { \Yii::error($e); \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeAdapayShareToSelf--end', time() - $time], 'debug_task_execute.log'); } public function executeBonusPool() { $time = time(); $newVer = cache()->get('executeBonusPool'); if($newVer != $this->version){ debug_log(['executeBonusPool $newVer', time(), $this->version, $newVer], 'debug_task_execute.log'); return; } $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 $event = new OrderEvent(); $event->store_id = $store->id; $event->bonusPool(); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeBonusPool--end', time() - $time], 'debug_task_execute.log'); if(time() - $this->version > 55){ debug_log(['executeBonusPool 55', time(), $this->version], 'debug_task_execute.log'); return; } // $queue = queue_push(new \app\jobs\OrderEventJob([ // 'in_action' => 'executeBonusPool', // 'version' => $this->version, // ]), 5); } public function executeJuShuiTanToken() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 JuShuiTanForm::refreshToken($store->id); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } sleep(1); } debug_log(['executeJuShuiTanToken--end', time() - $time], 'debug_task_execute.log'); } public function executeJuShuiTanTokenSupplier() { $time = time(); $supplier_list = \app\models\Supplier::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($supplier_list as $upplier) { try { // 定时任务 JuShuiTanForm::initStoreType(JuShuiTanForm::STORE_TYPE_SUPPLIER); JuShuiTanForm::refreshToken($upplier->id); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$upplier->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } sleep(1); } debug_log(['executeJuShuiTanTokenSupplier--end', time() - $time], 'debug_task_execute.log'); } public function executeOrder2JstSupplier() { $time = time(); $supplier_list = \app\models\Supplier::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($supplier_list as $upplier) { try { // 定时任务 JuShuiTanForm::initStoreType(JuShuiTanForm::STORE_TYPE_SUPPLIER); JuShuiTanForm::supplierOrder2Jst($upplier->id); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$upplier->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } } debug_log(['executeOrder2JstSupplier--end', time() - $time], 'debug_task_execute.log'); } public function executeMaiyatianToken() { $time = time(); $store_list = Store::find()->where(['is_delete' => 0])->select('id, name')->all(); foreach($store_list as $store) { try { // 定时任务 \app\modules\admin\models\maiyatian\MaiyatianForm::refreshToken($store->id); } catch(\Exception $e) { \Yii::error('--------auto-execute-error---- '.$store->id.' ----auto-execute-error--------' . $e->getMessage() . $e->getFile() . $e->getLine()); } sleep(1); } debug_log(['executeMaiyatianToken--end', time() - $time], 'debug_task_execute.log'); } public function executeActivityOrderRebateSelfRebate() { $time = time(); $res = \app\modules\admin\models\ActivityOrderRebateSelfForm::rebate($this->time); if($res['code'] != 0) { \Yii::error('--------auto-execute-error---- ' . $res['msg']); } debug_log(['executeActivityOrderRebateSelfRebate--end', time() - $time], 'debug_task_execute.log'); } }