|
|
@@ -15,6 +15,31 @@ class CgRefundController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['list', 'get-refund-data'];
|
|
|
|
|
|
+ //取消退款申请 ssh 20230808
|
|
|
+ public function actionCancelRefund()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = isset($get['id']) ? $get['id'] : 0;
|
|
|
+ $refund = CgRefundClass::getById($id, true);
|
|
|
+ if (empty($refund)) {
|
|
|
+ util::fail('没有找到退款单');
|
|
|
+ }
|
|
|
+ if ($refund->mainId != $this->mainId) {
|
|
|
+ util::fail('没有权限操作');
|
|
|
+ }
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ CgRefundService::cancelRefundApply($refund);
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('取消成功');
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::info("取消出错了,报错信息:" . $exception->getMessage());
|
|
|
+ util::fail('取消失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//申请退款 ssh 20230807
|
|
|
public function actionCreateRefund()
|
|
|
{
|
|
|
@@ -95,14 +120,35 @@ class CgRefundController extends BaseController
|
|
|
public function actionGetRefundData()
|
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
- $refund = CgRefundClass::getById($id, true);
|
|
|
+ $refund = CgRefundClass::getById($id);
|
|
|
+ if (empty($refund)) {
|
|
|
+ util::fail('没有找到退款信息');
|
|
|
+ }
|
|
|
+ $imgString = $refund['imgList'] ?? '';
|
|
|
+ if (!empty($imgString)) {
|
|
|
+ $imgArr = json_decode($imgString, true);
|
|
|
+ $smallImgList = [];
|
|
|
+ $bigImgList = [];
|
|
|
+ if (!empty($imgArr)) {
|
|
|
+ foreach ($imgArr as $image) {
|
|
|
+ $smallImg = imgUtil::groupImg($image) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
|
|
|
+ $bigImg = imgUtil::groupImg($image) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
|
|
|
+ $smallImgList[] = $smallImg;
|
|
|
+ $bigImgList[] = $bigImg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $refund['imgList'] = $imgArr;
|
|
|
+ $refund['smallImgList'] = $smallImgList;
|
|
|
+ $refund['bigImgList'] = $bigImgList;
|
|
|
+ }
|
|
|
+ //未登录用户也需要查看,暂时先注释
|
|
|
//CgRefundClass::valid($refund, $this->mainId);
|
|
|
- $cgId = $refund->cgId ?? 0;
|
|
|
- $cg = PurchaseClass::getById($cgId, true);
|
|
|
+ $cgId = $refund['cgId'] ?? 0;
|
|
|
+ $cg = PurchaseClass::getById($cgId);
|
|
|
if (empty($refund)) {
|
|
|
util::fail('没有退款信息');
|
|
|
}
|
|
|
- $orderSn = $refund->orderSn ?? '';
|
|
|
+ $orderSn = $refund['orderSn'] ?? '';
|
|
|
$cgItemList = CgRefundItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
if (!empty($cgItemList)) {
|
|
|
foreach ($cgItemList as $key => $item) {
|