<?php

namespace app\product\controller;

use fastphp\base\Controller;
use app\product\model\ProductAccount as AccountModel;

class OpenAccountLimit extends Controller
{
    public function openTxLimit(){
        $data = json_decode(file_get_contents("php://input"),true);
        if(!$data){
            die;
        }

        $where = [
            'ProductId' => $data['productId'],
            'DeleteTag' => 0,
            'Account' => $data['account']
        ];

        $account_model = new AccountModel;

        $account_model->updateOne($where, ['im' => '1']);

        // dump($data);die;
        if ($data['productId'] == 18) {
            $url = "http://rds-api.juip.com/api/agent/openIM/account/".$data['account'];
        } elseif ($data['productId'] == 29) {
            $url = "http://124.236.113.166:18702/api/agent/openIM/apikey/80cf4f64e990b78a9fc5eb/account/".$data['account'];
        } elseif ($data['productId'] == 3 || $data['productId'] == 26) {
            $url = "http://106.119.166.87:18702/api/agent/openIM/apikey/80cf4f64e990b78a9fc5eb/account/".$data['account'];
        }
        linkcurl($url,'GET',[],[],0);
        echo  json_encode(['Code'=>30000,]);
    }
}
