1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace huolib\queue\job;
- use huo\controller\pay\ApplePay;
- use huo\logic\member\AccountLogic;
- use huo\model\account\AccountGoodsModel;
- use huo\model\account\AccountOrderModel;
- use huolib\constant\AccountConst;
- use huolib\constant\OrderConst;
- use think\Log;
- use think\queue\Job;
- class AccountOrderFire extends Fire {
-
- public function fire(Job $job, $data) {
- $_is_job_done = $this->doJob($data);
- if ($_is_job_done) {
-
- $job->delete();
- } else {
- if ($job->attempts() > 3) {
-
- Log::write(
- "func=".__FUNCTION__."&class=".__CLASS__.'&queue='.$job->getQueue().'&name='.$job->getName()
- .'&data='.json_encode($data).'&error',
- LOG::QUEUE
- );
- $job->delete();
- }
- }
- }
-
- public function doJob($data) {
- if (!isset($data['order_info'])) {
- return false;
- }
- $_order_info = $data['order_info'];
- if (!isset($_order_info['id'])) {
- return false;
- }
- if (!isset($_order_info['ags_id'])) {
- return false;
- }
-
- (new AccountOrderModel())->updateData([
- 'status' => OrderConst::PAY_STATUS_FAIL,
- ], $_order_info['id']);
-
- (new AccountGoodsModel())->updateData([
- 'status' => AccountConst::STATUS_PULL_ON_SHELVES,
- ], $_order_info['ags_id']);
- return true;
- }
- }
|