feat: 添加阿里云短信服务支持并优化验证码逻辑
- 引入 alibabacloud/dysmsapi-20170525 依赖,集成阿里云短信服务 - 将短信验证码从6位改为4位,优化用户体验 - 添加聚水潭商品按时间范围同步功能,支持分页拉取 - 增强Cron任务异常处理,添加错误日志记录 - 修复系统附件服务中图片路径处理逻辑 - 更新阿里云SDK相关组件至最新版本 - 添加think-trace调试扩展,便于问题排查 - 优化跨域中间件,使用str_contains替代strpos
This commit is contained in:
@@ -797,6 +797,35 @@ class StoreProductServices extends BaseServices
|
||||
return substr(implode('', array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8) . str_pad((string)mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
protected function createUniqueSpu(): string
|
||||
{
|
||||
$tries = 0;
|
||||
do {
|
||||
$spu = $this->createSpu();
|
||||
$tries++;
|
||||
} while ($tries < 20 && $this->dao->be(['spu' => $spu], 'spu'));
|
||||
return $spu;
|
||||
}
|
||||
|
||||
public function ensureSpu(int $productId): string
|
||||
{
|
||||
$spu = (string)$this->dao->value(['id' => $productId], 'spu');
|
||||
if ($spu !== '') {
|
||||
return $spu;
|
||||
}
|
||||
$spu = $this->createUniqueSpu();
|
||||
$this->update($productId, ['spu' => $spu]);
|
||||
return $spu;
|
||||
}
|
||||
|
||||
public function ErpProductSave(array $data): int
|
||||
{
|
||||
if (!isset($data['spu']) || $data['spu'] === '') {
|
||||
$data['spu'] = $this->createUniqueSpu();
|
||||
}
|
||||
return (int)$this->dao->ErpProductSave($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增编辑商品
|
||||
* @param int $id
|
||||
@@ -1531,7 +1560,7 @@ class StoreProductServices extends BaseServices
|
||||
}
|
||||
}
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$field = ['id,relation_id,type,pid,delivery_type,product_type,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,ot_price,spec_type,recommend_image,unit_name,is_vip,vip_price,is_presale_product,is_vip_product,system_form_id,is_presale_product,presale_start_time,presale_end_time,is_limit,limit_num,video_open,video_link,freight,star,store_label_id,brand_id,min_qty'];
|
||||
$field = ['id,spu,relation_id,type,pid,delivery_type,product_type,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,ot_price,spec_type,recommend_image,unit_name,is_vip,vip_price,is_presale_product,is_vip_product,system_form_id,is_presale_product,presale_start_time,presale_end_time,is_limit,limit_num,video_open,video_link,freight,star,store_label_id,brand_id,min_qty'];
|
||||
$list = $this->dao->getSearchList($where, $page, $limit, $field, 'sales desc,id desc', ['couponId']);
|
||||
if ($list) {
|
||||
/** @var MemberCardServices $memberCardService */
|
||||
|
||||
Reference in New Issue
Block a user