处理代码缺失

This commit is contained in:
liu 2024-03-21 15:46:46 +08:00
parent 473314def9
commit b3408a8ff5
2 changed files with 33 additions and 2 deletions

View File

@ -212,6 +212,14 @@ class StoreOrderDao extends BaseDao
$query->whereLike('StoreOrder.real_name|StoreOrder.user_phone|order_sn', "%" . $where['keywords'] . "%"); $query->whereLike('StoreOrder.real_name|StoreOrder.user_phone|order_sn', "%" . $where['keywords'] . "%");
}); });
}) })
->when(isset($where['order_search']) && $where['order_search'] !== '', function ($query) use ($where) {
// 对 order_sn 进行模糊搜索
$query->where(function ($q) use ($where) {
$q->whereLike('StoreOrder.order_sn', '%' . $where['order_search'] . '%')
->whereOr('StoreOrder.user_phone', 'like', '%' . $where['order_search'] . '%');
});
})
->when(isset($where['filter_delivery']) && $where['filter_delivery'] !== '', function ($query) use ($where) { ->when(isset($where['filter_delivery']) && $where['filter_delivery'] !== '', function ($query) use ($where) {
//1 快递 2 配送 3 虚拟 //1 快递 2 配送 3 虚拟
//按发货方式1快递订单、2配送订单、4核销订单、3虚拟发货、6自动发货 //按发货方式1快递订单、2配送订单、4核销订单、3虚拟发货、6自动发货
@ -252,6 +260,8 @@ class StoreOrderDao extends BaseDao
}) })
->order('StoreOrder.create_time DESC'); ->order('StoreOrder.create_time DESC');
return $query; return $query;
} }

View File

@ -15,6 +15,7 @@ namespace app\controller\api\store\merchant;
use app\common\model\system\merchant\MerchantType; use app\common\model\system\merchant\MerchantType;
use app\common\repositories\store\MerchantTakeRepository; use app\common\repositories\store\MerchantTakeRepository;
use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\system\attachment\AttachmentRepository;
use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\financial\FinancialRepository; use app\common\repositories\system\financial\FinancialRepository;
use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\system\merchant\MerchantRepository;
@ -24,6 +25,7 @@ use app\validate\merchant\MerchantFinancialAccountValidate;
use app\validate\merchant\MerchantTakeValidate; use app\validate\merchant\MerchantTakeValidate;
use app\validate\merchant\MerchantUpdateValidate; use app\validate\merchant\MerchantUpdateValidate;
use crmeb\jobs\ChangeMerchantStatusJob; use crmeb\jobs\ChangeMerchantStatusJob;
use crmeb\services\QrcodeService;
use think\App; use think\App;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository as repository; use app\common\repositories\system\merchant\MerchantRepository as repository;
@ -128,9 +130,28 @@ class Merchant extends BaseController
public function qrcode($id) public function qrcode($id)
{ {
if(!$this->repository->merExists((int)$id)) if (!$this->repository->merExists($id))
return app('json')->fail('店铺已打烊'); return app('json')->fail('店铺已打烊');
$url = $this->request->param('type') == 'routine' ? $this->repository->routineQrcode(intval($id)) : $this->repository->wxQrcode(intval($id)); if ($this->request->param('type') == 'routine') {
$url = $this->repository->routineQrcode(intval($id));
} elseif ($this->request->param('type') == 'app') {
$attachmentRepository = app()->make(AttachmentRepository::class);
$name = 'merchant_code_' . $id . '.png';
$imageInfo = $attachmentRepository->getWhere(['attachment_name' => $name]);
if ($imageInfo) {
$url = $imageInfo['attachment_src'];
} else {
$info = app()->make(QrcodeService::class)->getQRCodePath(systemConfig('site_url') . 'pages/store/home/index?id=' . $id, $name);
$attachmentRepository->create(systemConfig('upload_type') ?: 1, -2, $id, [
'attachment_category_id' => 0,
'attachment_name' => $info['name'],
'attachment_src' => $info['dir']
]);
$url = $info['dir'];
}
} else {
$url = $this->repository->wxQrcode(intval($id));
}
return app('json')->success(compact('url')); return app('json')->success(compact('url'));
} }