优化代码

main
home.fengxinyhyl 8 months ago
parent ee85a8eb38
commit fd5f112ea9
  1. 4
      app/common/repositories/store/order/StoreOrderRepository.php
  2. 3
      app/common/repositories/user/UserRepository.php
  3. 2
      app/common/repositories/wechat/RoutineQrcodeRepository.php
  4. 3
      app/controller/api/store/order/StoreOrder.php
  5. 4
      crmeb/services/ExpressService.php

@ -1709,7 +1709,9 @@ class StoreOrderRepository extends BaseRepository
$order = $this->dao->get($orderId); $order = $this->dao->get($orderId);
if ($merId && $order['mer_id'] != $merId) throw new ValidateException('订单信息不存在'); if ($merId && $order['mer_id'] != $merId) throw new ValidateException('订单信息不存在');
if (!in_array($order['delivery_type'], [1, 4])) throw new ValidateException('订单状态错误'); if (!in_array($order['delivery_type'], [1, 4])) throw new ValidateException('订单状态错误');
return ExpressService::express($order->delivery_id, $order->delivery_name, $order->user_phone); Log::info('DDDDDD');
return [];
// return ExpressService::express($order->delivery_id, $order->delivery_name, $order->user_phone);
} }
public function checkPrinterConfig(int $merId) public function checkPrinterConfig(int $merId)

@ -39,6 +39,7 @@ use think\exception\ValidateException;
use think\facade\Cache; use think\facade\Cache;
use think\facade\Config; use think\facade\Config;
use think\facade\Db; use think\facade\Db;
use think\facade\Log;
use think\facade\Queue; use think\facade\Queue;
use think\facade\Route; use think\facade\Route;
use think\Model; use think\Model;
@ -788,7 +789,7 @@ class UserRepository extends BaseRepository
public function mpQrcode(User $user) public function mpQrcode(User $user)
{ {
$name = md5('surt_i' . $user['uid'] . $user['is_promoter'] . date('Ymd')) . '.jpg'; $name = md5('surt_i' . $user['uid'] . $user['is_promoter'] . date('Ymd')) . '.jpg';
Log::info("mpQrcode name is ".$name);
return app()->make(QrcodeService::class)->getRoutineQrcodePath($name, 'pages/index/index', 'spid=' . $user['uid']); return app()->make(QrcodeService::class)->getRoutineQrcodePath($name, 'pages/index/index', 'spid=' . $user['uid']);
} }

@ -17,6 +17,7 @@ namespace app\common\repositories\wechat;
use app\common\dao\wechat\RoutineQrcodeDao; use app\common\dao\wechat\RoutineQrcodeDao;
use app\common\repositories\BaseRepository; use app\common\repositories\BaseRepository;
use crmeb\services\MiniProgramService; use crmeb\services\MiniProgramService;
use think\facade\Log;
/** /**
* Class RoutineQrcodeRepository * Class RoutineQrcodeRepository
@ -66,6 +67,7 @@ class RoutineQrcodeRepository extends BaseRepository
*/ */
public function getPageCode($page = '', $pramam = "", $width = 280) public function getPageCode($page = '', $pramam = "", $width = 280)
{ {
Log::info("getPageCode ". json_encode(array('page' => $page, 'pramam' => $pramam), JSON_UNESCAPED_UNICODE));
return MiniProgramService::create()->qrcodeService()->appCodeUnlimit($pramam, $page, $width); return MiniProgramService::create()->qrcodeService()->appCodeUnlimit($pramam, $page, $width);
} }
} }

@ -257,13 +257,16 @@ class StoreOrder extends BaseController
public function express($id) public function express($id)
{ {
Log::info("111111");
$order = $this->repository->getWhere(['order_id' => $id, 'is_del' => 0]); $order = $this->repository->getWhere(['order_id' => $id, 'is_del' => 0]);
if (!$order) if (!$order)
return app('json')->fail('订单不存在'); return app('json')->fail('订单不存在');
if (!$order->delivery_type || !$order->delivery_id) if (!$order->delivery_type || !$order->delivery_id)
return app('json')->fail('订单未发货'); return app('json')->fail('订单未发货');
Log::info("aaaaa");
$express = $this->repository->express($id,null); $express = $this->repository->express($id,null);
$order->append(['orderProduct']); $order->append(['orderProduct']);
Log::info("bbbb");
return app('json')->success(compact('express', 'order')); return app('json')->success(compact('express', 'order'));
} }

@ -19,6 +19,7 @@ use app\common\repositories\store\shipping\ExpressRepository;
use think\exception\ValidateException; use think\exception\ValidateException;
use think\facade\Cache; use think\facade\Cache;
use think\facade\Config; use think\facade\Config;
use think\facade\Log;
class ExpressService class ExpressService
{ {
@ -111,12 +112,15 @@ class ExpressService
if ($is_shunfeng == 'SF') { if ($is_shunfeng == 'SF') {
$suffix = ':'.substr($phone,7); $suffix = ':'.substr($phone,7);
} }
Log::info('EEEEEE');
$com = app()->make(ExpressRepository::class)->getSearch(['name' => $name])->value('code'); $com = app()->make(ExpressRepository::class)->getSearch(['name' => $name])->value('code');
Log::info('ffff');
$result = self::query($sn.$suffix, $com, ['phone' => $phone]); $result = self::query($sn.$suffix, $com, ['phone' => $phone]);
if(!empty($result['list'])){ if(!empty($result['list'])){
Cache::set('express_' . $sn, $result['list'], $result['cacheTime']); Cache::set('express_' . $sn, $result['list'], $result['cacheTime']);
$result = $result['list']; $result = $result['list'];
} }
Log::info('gggg');
} }
return $result ?? []; return $result ?? [];
} }

Loading…
Cancel
Save