|
|
@@ -321,15 +321,11 @@ class BooksController extends AdminBaseController
|
|
|
$type = $this->request->param('type', 0, 'float');
|
|
|
$remark = $this->request->param('remark', '');
|
|
|
|
|
|
- if ($money <= 0) {
|
|
|
- $this->error("请填写退款金额");
|
|
|
- }
|
|
|
-
|
|
|
$info = Books::alias('b')
|
|
|
->leftJoin('activity a', 'a.id=b.aid')
|
|
|
->leftJoin('user u', 'u.id=b.uid')
|
|
|
->where(['b.id' => $id])
|
|
|
- ->field('u.id as uid, u.real_name,u.user_nickname,u.openid,b.id,b.order_sn,u.balance,b.money,b.credit,a.title,b.refund_credit,b.is_market,b.status')
|
|
|
+ ->field('u.id as uid,b.aid, u.real_name,u.user_nickname,u.openid,b.id,b.order_sn,u.balance,b.money,b.credit,a.title,b.refund_credit,b.is_market,b.status')
|
|
|
->find();
|
|
|
|
|
|
if (empty($info)) {
|
|
|
@@ -346,8 +342,11 @@ class BooksController extends AdminBaseController
|
|
|
$bMoney = isset($info['money']) ? floatval($info['money']) : 0.00;
|
|
|
$bCredit = isset($info['credit']) ? floatval($info['credit']) : 0.00;
|
|
|
$userId = isset($info['uid']) ? intval($info['uid']) : 0;
|
|
|
+ $aid = isset($info['aid']) ? intval($info['aid']) : 0;
|
|
|
// 退全款
|
|
|
if ($type == 1) {
|
|
|
+
|
|
|
+
|
|
|
if (!in_array($status, [2, 3])) {
|
|
|
$this->error($status == 1 ? '报名订单未支付' : ($status == 4 ? '报名订单已取消' : '报名订单已退款处理'));
|
|
|
}
|
|
|
@@ -356,6 +355,17 @@ class BooksController extends AdminBaseController
|
|
|
$this->error("退款金额超出支付金额");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ if($money<=0){
|
|
|
+ Books::where(['id' => $id])->update(['status'=> 5]);
|
|
|
+ if($aid == 15){
|
|
|
+ Db::name('user')->where('id', $userId)->update(['is_tuijian' => 0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('活动退款处理成功,退款金额0');
|
|
|
+ }
|
|
|
+
|
|
|
$remark = $remark ? $remark : "平台活动报名费用退款{$money}元,报名单号:{$info['order_sn']}";
|
|
|
} else if ($type == 2) {
|
|
|
|
|
|
@@ -434,6 +444,11 @@ class BooksController extends AdminBaseController
|
|
|
$data['refund_credit'] = 1;
|
|
|
}
|
|
|
Books::where(['id' => $id])->update($data);
|
|
|
+
|
|
|
+ // 推荐用户取消
|
|
|
+ if($type == 1 && $aid == 15){
|
|
|
+ Db::name('user')->where('id', $userId)->update(['is_tuijian' => 0]);
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
|
|
|
// 发送消息
|