Compare commits

...

29 Commits

Author SHA1 Message Date
44a500df9f fix : date 2025-08-06 17:24:43 +08:00
1a962ecb39 fix : date 2025-08-06 17:22:10 +08:00
24a911d63a fix : user default address 2025-08-06 17:18:36 +08:00
a6bdfa3e4c fix : order pick code box num 2025-08-06 17:10:28 +08:00
5cc59bb505 fix : stat 2025-08-06 16:02:42 +08:00
a3a079edd4 fix : stat 2025-08-06 16:00:58 +08:00
26f58eee32 fix : stat 2025-08-06 15:59:02 +08:00
00aa36c574 fix : stat 2025-08-06 15:38:48 +08:00
ff1ab9a008 fix : good cache 2025-08-06 15:23:06 +08:00
cf4a2d9436 fix : good cache 2025-08-06 15:21:18 +08:00
30bed90d27 fix : good cache 2025-08-06 15:13:08 +08:00
ed4ce5bebe fix : coupon date 2025-08-06 15:10:12 +08:00
eb0ce8a347 fix : coupon date 2025-08-06 12:44:58 +08:00
edf270a6ce fix : coupon date 2025-08-06 11:41:52 +08:00
c4c154cbb9 fix : coupon date 2025-08-06 11:41:35 +08:00
ff36733005 fix : coupon date 2025-08-06 10:40:17 +08:00
f898de515a fix : place order coupon 2025-08-06 10:32:52 +08:00
058b56a348 fix : print data error 2025-08-06 09:57:23 +08:00
42dd168c14 fix : print data error 2025-08-06 09:52:30 +08:00
4f862caa0b fix : print data error 2025-08-06 09:50:05 +08:00
ec60074298 fix : print text 2025-08-06 09:35:29 +08:00
006821188d fix : site 2025-08-05 18:04:43 +08:00
46a305ffe5 fix : api return aop 2025-08-05 17:59:53 +08:00
5bacdc8585 fix : pay config 2025-08-05 17:55:06 +08:00
573aeee8db fix : sku 2025-08-05 15:55:27 +08:00
89797d5bfc fix : sku 2025-08-05 15:51:59 +08:00
ba009f4a9d fix : sku 2025-08-05 15:35:49 +08:00
ae0d0d83ac fix : statement 2025-08-04 16:50:57 +08:00
a1668b60fc fix : change admin user info 2025-08-04 15:58:15 +08:00
24 changed files with 272 additions and 40 deletions

View File

@@ -56,10 +56,10 @@ class ApiReturnAspect extends AbstractAspect
$this->writeResponseLog(json_encode($result));
//正式服加密 测试服不做处理
if (SystemUtil::checkProEnv()) {
$cryptoFactory = $this->CryptoFactory->cryptoClass('api', json_encode($result['data']));
$result['data'] = $cryptoFactory->encrypt();
}
// if (SystemUtil::checkProEnv()) {
// $cryptoFactory = $this->CryptoFactory->cryptoClass('api', json_encode($result['data']));
// $result['data'] = $cryptoFactory->encrypt();
// }
return $result;
}

View File

@@ -180,7 +180,7 @@ class GoodCache
$imageList = $this->getOssObjects(array_merge($spuImage,$imageIdArr));
$chefIds = array_column($skuList,'chef_id');
$chefList = $this->adminUserModel->getDataByIds($chefIds);
$chefList = $this->adminUserModel->getChefNameByIds($chefIds);
$skuListArr = [];
$imageArr = [];
@@ -210,7 +210,7 @@ class GoodCache
foreach ($list as &$item) {
$item['sku_list'] = $skuListArr[$item['id']] ?? [];
$item['spu_image_url'] = $imageList[$item['image_id']] ?? '';
$item['spu_image_url']['url'] = $imageList[$item['image_id']]['url'] ?? '';
$item['image_list'] = $imageArr[$item['id']] ?? [];
$item['price'] = !empty($price[$item['id']]) ? (min($price[$item['id']]) ?? 0) : 0;
}
@@ -349,7 +349,10 @@ class GoodCache
*/
private function buildStockData(&$data): mixed
{
if (empty($data)) return $data;
foreach ($data as &$spu) {
if (empty($spu['sku_list'])) continue;
foreach ($spu['sku_list'] as &$sku) {
$sku['stock'] = $this->getStock($sku['id']);
}

View File

@@ -12,6 +12,7 @@ use App\Service\Api\System\GetLeaderboardService;
use App\Service\Api\System\MiniWxConfigService;
use App\Service\Api\System\SiteListService;
use App\Service\Api\System\SystemConfigService;
use App\Service\Api\System\TestService;
use App\Service\Api\User\IndexService;
use DateMalformedStringException;
use Hyperf\HttpServer\Annotation\Controller;
@@ -87,4 +88,10 @@ class SystemController extends AbstractController
{
return (new GetLeaderboardService)->handle();
}
#[RequestMapping(path: "test", methods: "GET")]
public function test()
{
return (new TestService)->handle();
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* This crontab file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Cron\Coupon;
use App\Constants\Common\CouponCode;
use App\Lib\Log;
use App\Model\UserCoupon;
use Exception;
use Hyperf\Crontab\Annotation\Crontab;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
#[Crontab(rule: "* * * * *", name: "UserCouponTask", singleton: true , callback: "execute", memo: "每秒执行优惠券过期")]
class UserCouponTask
{
/**
* @var Log
*/
#[Inject]
protected Log $log;
/**
* @var UserCoupon
*/
#[Inject]
protected UserCoupon $userCouponModel;
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function execute(): void
{
try {
$this->userCouponModel
->where('status', CouponCode::COUPON_STATUS_UNUSED)
->where('validity_end_time', '<', date('Y-m-d H:i:s'))
->update(['status' => CouponCode::COUPON_STATUS_EXPIRE]);
}catch (Exception $e){
$this->log->error(__CLASS__.$e->getMessage());
}
}
}

View File

@@ -107,6 +107,32 @@ class AdminUser extends Model
return $res;
}
/**
* @param array $ids
* @return array
*/
public function getChefNameByIds(array $ids): array
{
$data = $this
->join('chef', function ($join) use ($ids) {
$join->on('chef.user_id', '=', 'admin_user.id')
->whereIn('chef.id', $ids)
->where('admin_user.is_del',UserCode::IS_NO_DEL)
->select([
'admin_user.chinese_name',
'chef.id',
'admin_user.username',
]);
})
->get();
if ($data->isEmpty()) return [];
$data = $data->toArray();
return array_column($data,null,'id');
}
/**
* @param array $ids
* @return array

View File

@@ -40,8 +40,8 @@ class UserCoupon extends Model
*/
protected array $casts = ['id' => 'integer', 'coupon_template_id' => 'integer', 'coupon_dispense_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer'];
const string CREATED_AT = 'created_time';
const string UPDATED_AT = 'updated_time';
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';
public function getReceiveCountByUserIds(int $user_id,array $couponIdArr): array
{

View File

@@ -91,6 +91,6 @@ class UserSite extends Model
*/
public function getUserDefaultInfoByUserId(int $userId)
{
return $this->where('user_id', $userId)->where('is_default',SiteCode::USER_NO_DEFAULT)->first();
return $this->where('user_id', $userId)->where('is_default',SiteCode::USER_DEFAULT)->first();
}
}

View File

@@ -92,7 +92,7 @@ class PrintService extends CateringBaseService
*/
public function cancel(): array
{
$service = $this->printOrderFactory->handle($this->request->input('type'));
$service = $this->printOrderFactory->handle((int)$this->request->input('type'));
$service->printId = (int)$this->request->input('print_id');
$service->handle();
$service->printCancel();

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace App\Service\Admin\Catering\Print;
use App\Exception\ErrException;
use App\Lib\Log;
use App\Lib\Print\YlyBasicsLib;
use App\Model\Printer;
use Hyperf\Di\Annotation\Inject;
@@ -58,6 +59,12 @@ class YlyPrintService implements PrintOrderInterface
#[Inject]
protected Printer $printerModel;
/**
* @var Log
*/
#[Inject]
protected Log $log;
/**
* @return void
* @throws ContainerExceptionInterface
@@ -108,9 +115,12 @@ class YlyPrintService implements PrintOrderInterface
empty($this->data['order_sno']) ||
empty($this->data['username']) ||
empty($this->data['mobile']) ||
empty($this->data['date']) ||
empty($this->data['heapsort'])
) throw new ErrException('打印数据丢失');
empty($this->data['date'])
// empty($this->data['heapsort'])
) {
$this->log->error('打印数据'.json_encode($this->data));
throw new ErrException('打印数据丢失');
}
}
/**
@@ -126,9 +136,6 @@ class YlyPrintService implements PrintOrderInterface
//设置宽度
$this->content .= "<PW>048</PW>";
$this->content .= "\n";
$this->content .= "\n";
//取餐号
$this->content .= "<FS3><CA>{$this->data['pickup_code']}</CA></FS3>\n";
@@ -190,7 +197,7 @@ class YlyPrintService implements PrintOrderInterface
$contentEdibleTimeTips = config('print.yly.content_edible_time_tips');
$this->content .= "<LR2>保质期,$contentEdibleTimeTips</LR2>";
$this->content .= "<FS3><CA>{$this->data['heapsort']}</CA></FS3>";
$this->content .= "<FS3><CA>{$this->data['pickup_code']}</CA></FS3>\n";
}
/**
@@ -231,6 +238,8 @@ class YlyPrintService implements PrintOrderInterface
/**
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function checkBoxLabelData(): void
{
@@ -244,7 +253,10 @@ class YlyPrintService implements PrintOrderInterface
empty($this->data['driver_name']) ||
empty($this->data['current_num']) ||
empty($this->data['date_text'])
) throw new ErrException('打印数据丢失');
) {
$this->log->error('打印数据'.json_encode($this->data));
throw new ErrException('打印数据丢失-01');
}
}
/**

View File

@@ -261,7 +261,7 @@ class SkuService extends BaseService
$spuInfo = $this->spuModel->getInfoById($skuInfo->spu_id);
if (empty($spuInfo)) throw new ErrException('数据出错');
$purchaseInfo = $this->purchaseModel->getListByCycleIdAndKitchenId($skuInfo->cycle_id,$spuInfo->kitchen_id);
$purchaseInfo = $this->purchaseModel->getListByCycleIdAndKitchenId($spuInfo->cycle_id,$spuInfo->kitchen_id);
$purchaseIds = [];
if (!empty($purchaseInfo)) {
foreach ($purchaseInfo->toArray() as $one) {

View File

@@ -87,11 +87,17 @@ class ChefService extends BaseService
$skuIds = array_column($list['data'], 'sku_id');
$chefIds = array_column($list['data'], 'chef_id');
$skuList = $this->skuModel->whereIn('id', $skuIds)->pluck('title', 'id')->toArray();
$chefList = $this->adminUserModel->whereIn('id',$chefIds)->pluck('chinese_name','id')->toArray();
$skuList = $this->skuModel->whereIn('id', $skuIds)->select('price','title','id')->get();
if ($skuList->isNotEmpty()) {
$skuList = array_column($skuList->toArray(), null,'id');
}
$chefList = $this->adminUserModel->getChefNameByIds($chefIds);
foreach ($list['data'] as &$v) {
$v['sku_title'] = $skuList[$v['sku_id']] ?? '';
$v['chef_name'] = $chefList[$v['chef_id']] ?? '';
$v['sku_title'] = $skuList[$v['sku_id']]['title'] ?? '';
$v['sku_price'] = $skuList[$v['sku_id']]['price'] ?? '0.00';
$v['total_price'] = bcmul($skuList[$v['sku_id']]['price'],(string)$v['sale'],2);
$v['chef_name'] = $chefList[$v['chef_id']]['chinese_name'] ?? '';
}
return $this->return->success('success', ['list' => $list]);

View File

@@ -41,7 +41,7 @@ class DriverService extends BaseService
$list = $this->siteDriverStatementModel
->when($searchCityId, function ($query) use ($searchCityId) {
$query->whereIn('city_id', $searchCityId);
$query->where('city_id', $searchCityId);
})
->when($searchDriverId, function ($query) use ($searchDriverId) {
$query->where('driver_id', $searchDriverId);

View File

@@ -47,7 +47,7 @@ class FinancesService extends BaseService
->when($searchKitchenId, function ($query) use ($searchKitchenId) {
$query->where('kitchen_id', $searchKitchenId);
})
->groupBy('cycle_id')
->groupBy('cycle_id','date')
->orderByDesc('cycle_id')
->select(
'date',

View File

@@ -41,7 +41,7 @@ class SiteService extends BaseService
$list = $this->siteDriverStatementModel
->when($searchCityId, function ($query) use ($searchCityId) {
$query->whereIn('city_id', $searchCityId);
$query->where('city_id', $searchCityId);
})
->when($searchSiteId, function ($query) use ($searchSiteId) {
$query->where('site_id', $searchSiteId);

View File

@@ -61,7 +61,7 @@ class EmployeeService extends BaseService
/**
* @var array|string[]
*/
private array $filed = ['id','username','avatar','chinese_name','mobile','status','last_login_ip','last_login_time','role_id'];
private array $filed = ['id','username','avatar','chinese_name','mobile','status','last_login_ip','last_login_time','role_id','bind_user_id'];
/**
* 列表
@@ -160,8 +160,8 @@ class EmployeeService extends BaseService
$bindUserId = (int)$this->request->input('bind_user_id', 0);
if ($bindUserId > 0) {
$oldBindUserId = $this->adminUserModel->getAdminInfoByBindUserId($bindUserId);
if (!empty($oldBindUserId) && $info->bind_user_id != $oldBindUserId) throw new ErrException('绑定用户已存在');
$oldInfo = $this->adminUserModel->getAdminInfoByBindUserId($bindUserId);
if (!empty($oldBindUserId) && $info->bind_user_id != $oldInfo->bind_user_id) throw new ErrException('绑定用户已存在');
}

View File

@@ -114,9 +114,11 @@ class OptionalListService extends BaseService
$favorable = [];
$skuList = [];
foreach ($data as &$item) {
foreach ($item['sku_list'] as &$v) {
$v['surplus_stock'] = $this->redisCache->zScore($stockKey,$v['id']) ?? 0;
$v['category_id'] = $item['category_id'];
if (!empty($item['sku_list'])) {
foreach ($item['sku_list'] as &$v) {
$v['surplus_stock'] = $this->redisCache->zScore($stockKey,$v['id']) ?? 0;
$v['category_id'] = $item['category_id'];
}
}
if ($item['favorable'] == GoodCode::IS_FAVORABLE) {
@@ -136,10 +138,10 @@ class OptionalListService extends BaseService
}
$res[$item['category_id']]['spu_list'][] = $item;
$skuList = array_merge($skuList, $item['sku_list']);
$skuList = array_merge($skuList, $item['sku_list'] ?? []);
}
if (empty($skuList)) throw new ErrException('数据错误');
if (empty($skuList)) return array_values($res);
$skuList = array_column($skuList,null,'id');
if (!empty($purchaseData)) {

View File

@@ -16,6 +16,7 @@ use App\Model\CouponTemplate;
use App\Model\UserCoupon;
use App\Service\Api\BaseService;
use App\Service\ServiceTrait\Admin\Catering\PrintTrait;
use App\Service\ServiceTrait\Api\CouponTrait;
use App\Service\ServiceTrait\Api\OrderTrait;
use App\Service\ServiceTrait\Common\CycleTrait;
use Hyperf\Di\Annotation\Inject;
@@ -24,7 +25,7 @@ use Psr\Container\NotFoundExceptionInterface;
abstract class BaseOrderService extends BaseService
{
use CycleTrait,OrderTrait,PrintTrait;
use CycleTrait,OrderTrait,PrintTrait,CouponTrait;
/**
* @var int 周期id
@@ -100,7 +101,7 @@ abstract class BaseOrderService extends BaseService
* 优惠券id
* @var int
*/
protected int $couponId;
protected int $couponId = 0;
/**
* 地点id

View File

@@ -11,8 +11,10 @@ declare(strict_types=1);
namespace App\Service\Api\Order;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\Common\ConfigCache;
use App\Constants\Common\GoodCode;
use App\Constants\Common\OrderCode;
use App\Constants\ConfigCode;
use App\Exception\ErrException;
use App\Model\AdminUser;
use App\Model\Chef;
@@ -69,6 +71,12 @@ class OrderInfoService extends BaseService
#[Inject]
protected SiteCache $siteCache;
/**
* @var ConfigCache
*/
#[Inject]
protected ConfigCache $configCache;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -147,11 +155,20 @@ class OrderInfoService extends BaseService
}
for ($i = 1; $i <= (count($newOrderSkuList) ?? 0); $i++) {
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
$boxNum = 0;
if (!empty($pickupCodeOneCopies)) {
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? 0 / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
}
$oneCopiesInfo = [
'total_price' => '0.00',
'total_quantity' => 0,
'sku_list' => [],
'pickup_code' => $pickupCodeList[$i] ?? '', //取餐码
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
'box_num' => $boxNum,
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
];

View File

@@ -11,8 +11,10 @@ declare(strict_types=1);
namespace App\Service\Api\Order;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\Common\ConfigCache;
use App\Constants\Common\GoodCode;
use App\Constants\Common\OrderCode;
use App\Constants\ConfigCode;
use App\Model\Order;
use App\Model\OrderGood;
use App\Model\PickupCode;
@@ -61,6 +63,12 @@ class OrderListService extends BaseService
#[Inject]
protected SiteCache $siteCache;
/**
* @var ConfigCache
*/
#[Inject]
protected ConfigCache $configCache;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -164,6 +172,7 @@ class OrderListService extends BaseService
'total_price' => '0.00',
'total_quantity' => 0,
'pickup_code' => '', //这个没有取餐码
'box_num' => 0,
'image_list' => [],
'is_add_staple_food' => GoodCode::IS_ADD_STAPLE_FOOD,
];
@@ -171,11 +180,18 @@ class OrderListService extends BaseService
for ($i = 1; $i <= (count($newOrderSkuList[$order['id']]) ?? 0); $i++) {
$breakFlag = 0;
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
$boxNum = 0;
if (!empty($pickupCodeOneCopies)) {
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? 0 / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
}
$oneCopiesInfo = [
'total_price' => '0.00',
'total_quantity' => 0,
'image_list' => [],
'pickup_code' => $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? '', // 取餐码
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
'box_num' => $boxNum,
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
];

View File

@@ -121,6 +121,7 @@ class PlaceOrderService extends BaseOrderService
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ErrException
*/
private function placeOrder(): void
{
@@ -133,12 +134,16 @@ class PlaceOrderService extends BaseOrderService
$this->insertOrderGoods();
$this->couponLock();
Db::commit();
} catch (Exception $e){
echo $e->getMessage();
//回滚数据库 和 缓存
Db::rollBack();
$this->rollbackStock();
// $this->rollbackCouponLock();
//意外抛出
throw new ErrException($e->getMessage());
}
@@ -207,7 +212,7 @@ class PlaceOrderService extends BaseOrderService
$orderInsertModel->is_refund_all = OrderCode::REFUND_NULL;
$orderInsertModel->order_json = json_encode($this->orderRes);
if (!$orderInsertModel->save()) throw new Exception('下单失败');
if (!$orderInsertModel->save()) throw new Exception('下单失败-01');
$this->orderId = $orderInsertModel->id;
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace App\Service\Api\System;
use App\Cache\Redis\Api\SiteCache;
use App\Constants\Common\SiteCode;
use App\Extend\SystemUtil;
use App\Model\Site;
use App\Service\Api\BaseService;
@@ -36,6 +37,7 @@ class SiteListService extends BaseService
$query->where('name', 'like', "%$name%");
})
// ->where('name', 'like', '%'.$this->request->input('search_value').'%')
->where('is_del',SiteCode::SITE_NO_DEL)
->paginate($limit)
->toArray();

View File

@@ -0,0 +1,39 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\System;
use App\Constants\Common\CouponCode;
use App\Model\UserCoupon;
use App\Service\Api\BaseService;
use Hyperf\Di\Annotation\Inject;
class TestService extends BaseService
{
/**
* @var UserCoupon
*/
#[Inject]
protected UserCoupon $userCouponModel;
public function handle()
{
var_dump(date('Y-m-d H:i:s'));
$data = $this->userCouponModel
->where('status', CouponCode::COUPON_STATUS_UNUSED)
->where('validity_end_time', '<', date('Y-m-d H:i:s'))
->get();
$data = $data->toArray();
var_dump($data);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Service\ServiceTrait\Api;
use App\Constants\Common\CouponCode;
use App\Constants\Common\OrderCode;
use App\Exception\ErrException;
use App\Extend\DateUtil;
use App\Model\UserCoupon;
use Exception;
@@ -32,14 +33,56 @@ trait CouponTrait
$couponInfo = $this->userCouponModel->where('id', $orderInfo->coupon_id)->where('user_id',$orderInfo->user_id)->first();
if (empty($couponInfo)) return;
if ($couponInfo->status != CouponCode::COUPON_STATUS_USED) return;
$couponInfo->status = CouponCode::COUPON_STATUS_UNUSED;
$couponInfo->use_time = null;
if (date('Y-m-d H:i:s') > $couponInfo->validity_end_time) $couponInfo->status = CouponCode::COUPON_STATUS_EXPIRE;
if (!$couponInfo->save()) throw new Exception('CancelOrderConsumer:error:couponStatusUpdateError:'.json_encode($orderInfo->toArray()));
}
/**
* @return void
* @throws Exception
*/
protected function couponLock(): void
{
if ($this->couponId <= 0) return;
$couponInfo = $this->userCouponModel->where('id', $this->couponId)->where('user_id',$this->userId)->first();
if (empty($couponInfo)) return;
$couponInfo->status = CouponCode::COUPON_STATUS_USED;
$couponInfo->use_time = date('Y-m-d H:i:s');
if (date('Y-m-d H:i:s') > $couponInfo->validity_end_time) throw new Exception('优惠券已过期');
if (!$couponInfo->save()) throw new Exception('couponLock:error:couponLockUpdateError:'.json_encode($couponInfo->toArray()));
}
/**
* @return void
* @throws ErrException
*/
protected function rollbackCouponLock(): void
{
if ($this->couponId <= 0) return;
$couponInfo = $this->userCouponModel->where('id', $this->couponId)->where('user_id',$this->userId)->first();
if (empty($couponInfo)) return;
if ($couponInfo->status != CouponCode::COUPON_STATUS_USED) return;
$couponInfo->status = CouponCode::COUPON_STATUS_UNUSED;
$couponInfo->use_time = '1970-01-01 00:00:00';
if (!$couponInfo->save()) throw new ErrException('系统错误-rollback_coupon失败');
}
/**
* @param int $type
* @param string $value

View File

@@ -1,6 +1,6 @@
# [app] -- 集群配置需一致
APP_NAME=hhl_meal
APP_ENV=dev
APP_ENV=prod
API_RETURN_KEY=hch@shenzhen
JWT_KEY=hch@shenzhen
JWT_EXPIRE=2592000