shish 2 ani în urmă
părinte
comite
d778c03961

+ 22 - 1
app-ghs/controllers/CashController.php

@@ -30,7 +30,28 @@ class CashController extends BaseController
     //申请提现 ssh 2021.3.14
     public function actionApply()
     {
-        util::fail('自动提现,无需人为操作');
+        //util::fail('系统自动提现,无需人为操作');
+        $get = Yii::$app->request->get();
+        $get['shopAdminId'] = $this->shopAdminId;
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
+            util::fail('超管才能申请提现');
+        }
+        $get['shopAdminName'] = $shopAdmin->name ?? '';
+        $get['shopId'] = $this->shopId;
+        $get['sjId'] = $this->sjId;
+        $get['ptStyle'] = dict::getDict('ptStyle', 'ghs');
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();
+        try {
+            CashClass::addApply($get);
+            $transaction->commit();
+            util::complete('申请成功,第二天到帐');
+        } catch (\Exception $exception) {
+            $transaction->rollBack();
+            Yii::info("提现申请报错:" . $exception->getMessage());
+            util::fail('申请失败');
+        }
     }
 
 }

+ 22 - 1
app-hd/controllers/CashController.php

@@ -21,7 +21,28 @@ class CashController extends BaseController
     //申请提现 ssh 2021.3.14
     public function actionApply()
     {
-        util::fail('自动提现,无需人为操作');
+        //util::fail('系统自动提现,无需人为操作');
+        $get = Yii::$app->request->get();
+        $get['shopAdminId'] = $this->shopAdminId;
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin['super']) == false || $shopAdmin['super'] != 1) {
+            util::fail('超管才能申请提现');
+        }
+        $get['shopAdminName'] = $shopAdmin->name ?? '';
+        $get['shopId'] = $this->shopId;
+        $get['sjId'] = $this->sjId;
+        $get['ptStyle'] = dict::getDict('ptStyle', 'hd');
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();
+        try {
+            CashClass::addApply($get);
+            $transaction->commit();
+            util::success('提交成功,等待审核');
+        } catch (\Exception $exception) {
+            $transaction->rollBack();
+            Yii::info("提现申请报错:" . $exception->getMessage());
+            util::fail('申请失败');
+        }
     }
 
 }