diff --git a/application/admin/controller/school/activity/order/Order.php b/application/admin/controller/school/activity/order/Order.php index c8ce152..62d35aa 100644 --- a/application/admin/controller/school/activity/order/Order.php +++ b/application/admin/controller/school/activity/order/Order.php @@ -70,7 +70,7 @@ class Order extends Backend $row->getRelation('user')->visible(['nickname','realname','mobile','avatar']); $row->getRelation('activity')->visible(['title','images']); - $row->getRelation('detail')->visible(['title',"feel"]); + $row->getRelation('detail')->visible(['title',"feel","price"]); } $result = array("total" => $list->total(), "rows" => $list->items()); diff --git a/application/admin/view/school/activity/activity/add.html b/application/admin/view/school/activity/activity/add.html index 926b152..1ee9842 100644 --- a/application/admin/view/school/activity/activity/add.html +++ b/application/admin/view/school/activity/activity/add.html @@ -22,10 +22,10 @@
- +
- - + +
diff --git a/application/admin/view/school/activity/activity/copy.html b/application/admin/view/school/activity/activity/copy.html index 6f14a3b..b878552 100644 --- a/application/admin/view/school/activity/activity/copy.html +++ b/application/admin/view/school/activity/activity/copy.html @@ -27,8 +27,8 @@
- - + +
diff --git a/application/admin/view/school/activity/activity/edit.html b/application/admin/view/school/activity/activity/edit.html index e12c44b..f91a36f 100644 --- a/application/admin/view/school/activity/activity/edit.html +++ b/application/admin/view/school/activity/activity/edit.html @@ -27,8 +27,8 @@
- - + +
diff --git a/application/admin/view/school/activity/order/order/shop_confirmation.html b/application/admin/view/school/activity/order/order/shop_confirmation.html index b8b4d82..e6f012d 100644 --- a/application/admin/view/school/activity/order/order/shop_confirmation.html +++ b/application/admin/view/school/activity/order/order/shop_confirmation.html @@ -19,10 +19,10 @@
- +
- - ( 当前订单损耗比为 {$row.loss_proportion|htmlentities}% | 忽略损耗应退全额为 {$row.auto_price|htmlentities} [若为0说明课时已用完或计算应退金额小于0.01,请自行决定是否退全款] | 退款金额不能超过订单应退全额{$row.sub_refundprice|htmlentities} ) + + ( 当前订单手续费为 {$row.fee_price|htmlentities} | 未退全额为 {$row.sub_refundprice|htmlentities} , 退款金额不能超过订单剩余未退额)
diff --git a/application/api/controller/Crontab.php b/application/api/controller/Crontab.php index 49e1f3e..f3343f7 100644 --- a/application/api/controller/Crontab.php +++ b/application/api/controller/Crontab.php @@ -112,9 +112,10 @@ class Crontab extends Api // $res = Order::timeoutCheck(true); // $res = \app\common\model\school\classes\activity\order\Order::timeoutCheck(true); + \app\common\model\school\activity\order\Order::timeoutCheck(0,true); Activity::timeoutCheck(true); SettleLog::timeoutCheck(null,null,true); - \app\common\model\school\activity\order\Order::timeoutCheck(0,true); +// \app\common\model\school\activity\order\Order::timeoutCheck(0,true); // $lock = new UrlLock(2,"mock-lock-suffix",5,"您的请求过于频繁,请您稍后再试!"); // $lock->lock(); diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 6e5a1ec..95a27a4 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -108,7 +108,12 @@ class Index extends Api ]; $upload_config = config('upload'); - $this->success('',["customer_service"=>$customer_service,"upload_config"=>$upload_config,"base_info"=>$base_info,"home_data"=>$home_data]); + $withdrawal_info = [ + "withdrawal_confirmation"=>config("site.withdrawal_confirmation"), + "withdrawal_min"=>config("site.withdrawal_min"), + ]; + + $this->success('',["withdrawal_info"=>$withdrawal_info,"customer_service"=>$customer_service,"upload_config"=>$upload_config,"base_info"=>$base_info,"home_data"=>$home_data]); } /** diff --git a/application/common/model/school/activity/Activity.php b/application/common/model/school/activity/Activity.php index 9c874cb..e89e65d 100644 --- a/application/common/model/school/activity/Activity.php +++ b/application/common/model/school/activity/Activity.php @@ -486,6 +486,13 @@ class Activity extends BaseModel self::check($params,$rule,$rule_msg); + $images = is_array($params["images"]) ? $params["images"] : explode(",",$params["images"]); + //轮播图至少3张 + if(count($images) < 3 || count($images) > 5){ + throw new \Exception("轮播图至少3张,最多5张"); + } + + if($params["price"]>0){ if(empty($params["refund_id"])) throw new \Exception("退款策略必填"); $refund_id = $params["refund_id"]; diff --git a/application/common/model/school/activity/order/Order.php b/application/common/model/school/activity/order/Order.php index 4f57ff1..e71e605 100644 --- a/application/common/model/school/activity/order/Order.php +++ b/application/common/model/school/activity/order/Order.php @@ -49,11 +49,25 @@ class Order extends BaseModel 'finishtime_text', 'refundtime_text', 'auth_status_text', - 'refundsendtime_text' + 'refundsendtime_text', + 'cancel_last_seconds', ]; - - + + public function getCancelLastSecondsAttr($value, $data) + { + $value = $value ? $value : (isset($data['createtime']) ? $data['createtime'] : ''); + if(!$value) return 0; + //活动未支付超时取消(秒) + $unpaid_activity_cancel_time = config("site.unpaid_activity_cancel_time"); + //得到倒计时剩余秒数 + $cancel_last_seconds = $unpaid_activity_cancel_time - (time() - $value); + return $cancel_last_seconds > 0 ? $cancel_last_seconds : 0; + } + + + + public function getPayTypeList() { return ['yue' => __('Pay_type yue'), 'wechat' => __('Pay_type wechat')]; @@ -279,8 +293,8 @@ class Order extends BaseModel } - if (isset($whereData['status'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']); - if (isset($whereData['not_status'])) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); + if (isset($whereData['status']) && $whereData['status']!=="") $model = $model->where("{$alisa}status", 'in', $whereData['status']); + if (isset($whereData['not_status']) && $whereData['not_status']!=="") $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); if (isset($whereData['server_status']) && $whereData['server_status']!=="") $model = $model->where("{$alisa}server_status", 'in', $whereData['server_status']); if (isset($whereData['not_server_status'])&& $whereData['not_server_status']!=="") $model = $model->where("{$alisa}server_status", 'not in', $whereData['not_server_status']); @@ -444,19 +458,21 @@ class Order extends BaseModel * @param $order_no */ public static function getDetail($order_no,$activity_id = []){ + //超时检测 + self::timeoutCheck($order_no); + + $model = self::where('order_no|id|pay_no',$order_no); if($activity_id)$model = $model->where("activity_id","in",$activity_id); $data = $model->find(); - if(!$data) return $data; + if(!$data) return $data; //加载订单详情 $data->detail; //订单用户 // $data->user; $data->user->visible(['id','nickname','mobile','avatar','realname']); - //超时检测 - self::timeoutCheck($data["id"]); //规格信息 $data->ordercode; @@ -1371,7 +1387,7 @@ class Order extends BaseModel $unpaid_order_expire_time = time() - $unpaid_order_expire_time; //得到所有过期的队列 $model = self::where("status",'in',['0'])->where("createtime","<=",$unpaid_order_expire_time); - if($order_id)$model = $model->where("id",$order_id); + if($order_id)$model = $model->where("id|order_no",$order_id); $list = $model->select(); if ($trans) { @@ -1441,7 +1457,19 @@ class Order extends BaseModel case "5": //随时退 if ($detail['start_time'] < $time) throw new \Exception("活动开始后不可取消,请走售后流程!"); break; - default: + case "7": //前12小时退 + + if ($detail['start_time'] < $time) throw new \Exception("活动开始后不可取消,请走售后流程!"); + + break; + case "9": //前24小时退 + if ($detail['start_time'] < $time) throw new \Exception("活动开始后不可取消,请走售后流程!"); + break; + case "11": //前24小时退 + if ($detail['start_time'] < $time) throw new \Exception("活动开始后不可取消,请走售后流程!"); + + break; + default: throw new \Exception("不支持的退款策略,请走售后流程!"); } @@ -1628,6 +1656,38 @@ class Order extends BaseModel case "3": //开始前退 case "5": //随时退 退全款 $price = $order["sub_refundprice"]; + break; + case "7": //前12小时退 + //还没到开始前12小时退100% + //过了开始前12小时退50% + if($time < ($detail["start_time"]-(12*3600))){ + $price = $order["sub_refundprice"]; + }else{ + $price = bcdiv($order["sub_refundprice"],2,2); + } + break; + case "9": //前24小时退 + //还没到开始前24小时退100% + //过了开始前24小时退50% + + if($time < ($detail["start_time"]-(24*3600))){ + $price = $order["sub_refundprice"]; + }else{ + $price = bcdiv($order["sub_refundprice"],2,2); + } + + break; + case "11": //前48小时退 + //还没到开始前48小时退100% + //过了开始前48小时退50% + + if($time < ($detail["start_time"]-(48*3600))){ + $price = $order["sub_refundprice"]; + }else{ + $price = bcdiv($order["sub_refundprice"],2,2); + } + + break; default: throw new \Exception("不支持的退款策略,请走售后流程!"); diff --git a/application/common/model/school/classes/activity/order/Order.php b/application/common/model/school/classes/activity/order/Order.php index 421adb5..ad4f68f 100644 --- a/application/common/model/school/classes/activity/order/Order.php +++ b/application/common/model/school/classes/activity/order/Order.php @@ -315,10 +315,10 @@ class Order extends BaseModel } - if (isset($whereData['status'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']); - if (isset($whereData['not_status'])) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); + if (isset($whereData['status']) && $whereData['status']!=="") $model = $model->where("{$alisa}status", 'in', $whereData['status']); + if (isset($whereData['not_status']) && $whereData['status']!=="") $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); - if (isset($whereData['auth_status']) && $whereData['auth_status']!=="") $model = $model->where("{$alisa}auth_status", 'in', $whereData['auth_status']); + if (isset($whereData['auth_status'] ) && $whereData['auth_status']!=="") $model = $model->where("{$alisa}auth_status", 'in', $whereData['auth_status']); if (isset($whereData['not_auth_status'])&& $whereData['not_auth_status']!=="") $model = $model->where("{$alisa}auth_status", 'not in', $whereData['not_auth_status']); diff --git a/application/common/model/user/withdrawal/UserwithdrawalLog.php b/application/common/model/user/withdrawal/UserwithdrawalLog.php index 2744071..255168d 100644 --- a/application/common/model/user/withdrawal/UserwithdrawalLog.php +++ b/application/common/model/user/withdrawal/UserwithdrawalLog.php @@ -208,6 +208,9 @@ class UserwithdrawalLog extends BaseModel $price = bcadd($real_price,$fee_price,2); $status = '1'; + $min_price = config("site.withdrawal_min"); + if( $real_price < $min_price)throw new \Exception("最低提现金额为".$min_price); + //查询是否有提现银行卡信息 $userWithdrawal = Userwithdrawal::where('user_id',$user_id)->find(); diff --git a/public/assets/js/backend/school/activity/order/order.js b/public/assets/js/backend/school/activity/order/order.js index 995e751..98ae6d9 100644 --- a/public/assets/js/backend/school/activity/order/order.js +++ b/public/assets/js/backend/school/activity/order/order.js @@ -58,6 +58,8 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde {field: 'beforeprice', title: __('Beforeprice'), operate:'BETWEEN'}, {field: 'totalprice', title: __('Totalprice'), operate:'BETWEEN'}, {field: 'num', title: __('购买人数'), operate:'BETWEEN'}, + {field: 'detail.price', title: __('购买单价'), operate:'BETWEEN'}, + {field: 'payprice', title: __('Payprice'), operate:'BETWEEN'}, {field: 'pay_type', title: __('Pay_type'), searchList: {"yue":__('Pay_type yue'),"wechat":__('Pay_type wechat')}, formatter: Table.api.formatter.normal}, {field: 'before_status',visible:false, title: __('Before_status'), searchList: {"-3":__('Before_status -3'),"0":__('Before_status 0'),"2":__('Before_status 2'),"3":__('Before_status 3'),"4":__('Before_status 4'),"6":__('Before_status 6'),"9":__('Before_status 9')}, formatter: Table.api.formatter.status},