优化下单,优化赠送付费会员

This commit is contained in:
吴昊天 2023-03-01 14:57:42 +08:00
parent 998b363d9c
commit 746206401f
4 changed files with 39 additions and 12 deletions

View File

@ -234,7 +234,7 @@ class StoreOrderController
// }
// }
// $virtual_type = $cartGroup['cartInfo'][0]['productInfo']['virtual_type'] ?? 0;
$order = $createServices->createOrder($uid, $key, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $customForm, $invoice_id);
$order = $createServices->createOrder($uid, $key, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckillId, $bargainId, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $customForm, $invoice_id);
// if ($order === false) {
// if ($seckill_id || $combinationId || $advanceId || $bargainId) {
// foreach ($cartInfo as $item) {
@ -339,7 +339,7 @@ class StoreOrderController
if ($payPriceStatus)//0元支付成功
return app('json')->status('success', 410195, ['order_id' => $orderInfo['order_id'], 'key' => $orderInfo['unique']]);
else
return app('json')->status('pay_error');
return app('json')->status('pay_error', 410216);
}
switch ($paytype) {

View File

@ -81,6 +81,12 @@ class StoreOrderStoreOrderStatusDao extends BaseDao
* @param array $where
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/01
*/
public function getTakeOrderIds(array $where, int $limit = 0)
{

View File

@ -119,11 +119,10 @@ class StoreOrderCreateServices extends BaseServices
* 创建订单
* @param $uid
* @param $key
* @param $cartGroup
* @param $userInfo
* @param $addressId
* @param $payType
* @param bool $useIntegral
* @param false $useIntegral
* @param int $couponId
* @param string $mark
* @param int $combinationId
@ -134,15 +133,19 @@ class StoreOrderCreateServices extends BaseServices
* @param string $real_name
* @param string $phone
* @param int $storeId
* @param bool $news
* @param false $news
* @param int $advanceId
* @param int $virtual_type
* @param array $customForm
* @param int $invoice_id
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \Throwable
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/01
*/
public function createOrder($uid, $key, $userInfo, $addressId, $payType, $useIntegral = false, $couponId = 0, $mark = '', $combinationId = 0, $pinkId = 0, $seckillId = 0, $bargainId = 0, $shippingType = 1, $real_name = '', $phone = '', $storeId = 0, $news = false, $advanceId = 0, $customForm = [], $invoice_id = 0)
{

View File

@ -68,8 +68,15 @@ class UserServices extends BaseServices
/**
* 获取用户信息
* @param $id
* @param $field
* @param int $uid
* @param string $field
* @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/01
*/
public function getUserInfo(int $uid, $field = '*')
{
@ -1014,14 +1021,25 @@ class UserServices extends BaseServices
/**
* 赠送付费会员时长
* @param int $uid
* @return mixed
* */
* @param $id
* @return array
* @throws \FormBuilder\Exception\FormBuilderException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/03/01
*/
public function giveLevelTime($id)
{
if (!$this->getUserInfo($id)) {
$userInfo = $this->getUserInfo($id);
if (!$userInfo) {
throw new AdminException(400214);
}
$timeDiff = $userInfo['is_ever_level'] == 1 ? '永久' : date('Y-m-d H:i:s', $userInfo['overdue_time']);
$dayDiff = intval(($userInfo['overdue_time'] - time()) / 86400);
$field[] = Form::input('time_diff', '到期时间', $timeDiff)->style(['width' => '200px'])->readonly(true);
if ($userInfo['is_ever_level'] == 0) {
$field[] = Form::input('day_diff', '剩余天数', $dayDiff)->style(['width' => '200px'])->readonly(true);
}
$field[] = Form::number('days', '增加时长(天)')->precision(0)->style(['width' => '200px'])->required();
return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT');
}