master
wangxinglong 2022-05-27 14:25:49 +08:00
parent 0542ef85a6
commit 205a5ff105
2 changed files with 32 additions and 21 deletions

View File

@ -149,35 +149,46 @@ class OrderRepository extends Repository
throw new RepositoryException('商品不能为空'); throw new RepositoryException('商品不能为空');
} }
if (!isset($data['pick_self']) || if (!isset($data['address']) || empty($data['address'])) {
!isset($data['freight'])) { throw new RepositoryException('收货地址不能为空');
throw new RepositoryException('订单参数错误');
} }
$data['coupon_id'] = $data['coupon_id'] ?? 0; if (!isset($data['phone']) || empty($data['phone'])) {
$data['coupon_price'] = $data['coupon_price'] ?? 0; throw new RepositoryException('收货联系电话不能为空');
$data['is_score'] = $data['is_score'] ?? 0; }
if (!isset($data['contacts']) || empty($data['contacts'])) {
if ($data['pick_self'] == Order::COMMON_OFF && !isset($data['address_id'])) { throw new RepositoryException('收货联系人不能为空');
throw new RepositoryException('请选择收货地址');
} }
if ($data['pick_self'] == Order::COMMON_ON && !isset($data['pick_self_phone'])) { // if (!isset($data['pick_self']) ||
throw new RepositoryException('自提时请填写联系人方式'); // !isset($data['freight'])) {
} // throw new RepositoryException('订单参数错误');
// }
if (isset($data['express_code']) && !empty($data['express_code'])) { // $data['coupon_id'] = $data['coupon_id'] ?? 0;
if (!$express = Express::where('code', $data['express_code'])->find()) { // $data['coupon_price'] = $data['coupon_price'] ?? 0;
throw new RepositoryException('快递公司不存在'); // $data['is_score'] = $data['is_score'] ?? 0;
}
$data['express_name'] = $express['name'] ?? ''; // if ($data['pick_self'] == Order::COMMON_OFF && !isset($data['address_id'])) {
} // throw new RepositoryException('请选择收货地址');
// }
// if ($data['pick_self'] == Order::COMMON_ON && !isset($data['pick_self_phone'])) {
// throw new RepositoryException('自提时请填写联系人方式');
// }
// if (isset($data['express_code']) && !empty($data['express_code'])) {
// if (!$express = Express::where('code', $data['express_code'])->find()) {
// throw new RepositoryException('快递公司不存在');
// }
// $data['express_name'] = $express['name'] ?? '';
// }
$skuList = $this->handleSku($data['sku_list']); $skuList = $this->handleSku($data['sku_list']);
$groupList = $this->handleGroup($data['sku_list']); //$groupList = $this->handleGroup($data['sku_list']);
$data['sku_list'] = $skuList; $data['sku_list'] = $skuList;
$data['group_list'] = $groupList; //$data['group_list'] = $groupList;
return $data; return $data;
} }

View File

@ -22,7 +22,7 @@ return [
// 数据库类型 // 数据库类型
'type' => Env::get('database.type', 'mysql'), 'type' => Env::get('database.type', 'mysql'),
// 服务器地址 // 服务器地址
'hostname' => Env::get('database.hostname', '183.221.101.89'), 'hostname' => Env::get('database.hostname', '211.149.224.171'),
// 数据库名 // 数据库名
'database' => Env::get('database.database', 'cai_project_shop'), 'database' => Env::get('database.database', 'cai_project_shop'),
// 用户名 // 用户名