|
@@ -14,6 +14,7 @@ use backend\models\UserMember;
|
|
|
use common\helpers\MtKit;
|
|
use common\helpers\MtKit;
|
|
|
use common\helpers\Utils;
|
|
use common\helpers\Utils;
|
|
|
use common\pay\PayForm;
|
|
use common\pay\PayForm;
|
|
|
|
|
+use common\lib\Mt4ManagerApi;
|
|
|
use Yii;
|
|
use Yii;
|
|
|
|
|
|
|
|
class DepositController extends BaseController
|
|
class DepositController extends BaseController
|
|
@@ -160,6 +161,59 @@ class DepositController extends BaseController
|
|
|
return $this->outJson(1, [], '操作成功');
|
|
return $this->outJson(1, [], '操作成功');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 撤销入金
|
|
|
|
|
+ */
|
|
|
|
|
+ public function actionRevokegold(){
|
|
|
|
|
+
|
|
|
|
|
+ $id = (int) Yii::$app->request->post('id'); //获取入金id
|
|
|
|
|
+ $mt4_id = (int) Yii::$app->request->post('mt4_id'); //获取mt4的订单号
|
|
|
|
|
+
|
|
|
|
|
+ file_put_contents('goldentry_id.txt',$id);
|
|
|
|
|
+ file_put_contents('goldentry_mt4_id.txt',$mt4_id);
|
|
|
|
|
+
|
|
|
|
|
+ if ($id <= 0) {
|
|
|
|
|
+ return $this->outJson(0, [], '未指定数据对象');
|
|
|
|
|
+ }
|
|
|
|
|
+ $login = Deposit::findOne($id)['login']; //获取login参数
|
|
|
|
|
+ $res = Deposit::updateAll(['type' => 0], "id = $id"); //更新入金表的状态(等待) 后续还需要更改什么
|
|
|
|
|
+
|
|
|
|
|
+ if($res){
|
|
|
|
|
+
|
|
|
|
|
+ //调用mt4的撤销入金接口
|
|
|
|
|
+ $api = new Mt4ManagerApi();
|
|
|
|
|
+ $result = $api->revokeOrder($mt4_id);
|
|
|
|
|
+ if(empty($result)){
|
|
|
|
|
+ return $this->outJson(0, [], '更新失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ $result = json_decode($result,true);
|
|
|
|
|
+ $tt = print_r($result,true);
|
|
|
|
|
+ file_put_contents('goldentry1.txt',$tt);
|
|
|
|
|
+ if(!$result['ret']){
|
|
|
|
|
+ $result2 = $api->fixbalance($login);
|
|
|
|
|
+ if(empty($result2)){
|
|
|
|
|
+ return $this->outJson(0, [], '更新失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ $res2 = json_decode($result2,true);
|
|
|
|
|
+ $tt = print_r($res2,true);
|
|
|
|
|
+ file_put_contents('goldentry2.txt',$tt);
|
|
|
|
|
+ if(!$res2['ret']){
|
|
|
|
|
+ $res3 = Deposit::updateAll(['mt4_status' => 0], "id = $id"); //更新出金表的状态(mt4未扣减)
|
|
|
|
|
+ if($res3){
|
|
|
|
|
+ return $this->outJson(1, [], '操作成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return $this->outJson(0, [], '更新失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return $this->outJson(0, [], '更新失败');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return $this->outJson(0, [], '更新失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取入金配置
|
|
* 获取入金配置
|
|
|
* @return \yii\web\Response
|
|
* @return \yii\web\Response
|