| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * @package merchant
- *
- * @author xaboy
- * @day 2020/7/1
- *
- *
- */
- namespace app\jobs;
- use app\common\repositories\merchant\apply\MerchantHaikeApplyRepository;
- use crmeb\interfaces\JobInterface;
- use think\facade\Log;
- class MerchantApplyJob implements JobInterface
- {
- public function fire($job, $data)
- {
- $haikeRepository = app()->make(MerchantHaikeApplyRepository::class);
- try {
- $isJobDone = $haikeRepository->createOrder($data);
- if ($isJobDone) {
- // 如果任务执行成功, 记得删除任务
- $job->delete();
- } else {
- if ($job->attempts() > 3) {
- //通过这个方法可以检查这个任务已经重试了几次了
- $job->delete();
- }
- }
- } catch (\Exception $e) {
- Log::info('申请海科商户失败' . var_export($data, 1) . $e->getMessage());
- }
- $job->delete();
- }
- public function failed($data)
- {
- // TODO: Implement failed() method.
- }
- }
|