コード例 #1
0
 public function getattenmicroaccountAction()
 {
     $request = $this->getRequest();
     $da = $this->get("we_data_access");
     //访问权限校验
     $api = new \Justsy\OpenAPIBundle\Controller\ApiController();
     $api->setContainer($this->container);
     $isWeFaFaDomain = $api->checkWWWDomain();
     if (!$isWeFaFaDomain) {
         $token = $api->checkAccessToken($request, $da);
         if (!$token) {
             $re = array("returncode" => "9999");
             $re["code"] = "err0105";
             $re["msg"] = "参数Appid或Openid或Access_token未指定或无效.";
             return $this->responseJson($re);
         }
     }
     $re = array("returncode" => ReturnCode::$SUCCESS);
     $baseinfoCtl = new \Justsy\BaseBundle\Management\Staff($da, $this->get("we_data_access_im"), $request->get("openid"), $this->get("logger"), $this->container);
     $currUser = $baseinfoCtl->getSessionUser();
     $mgr = new MicroAccountMgr($da, $this->get("we_data_access_im"), $currUser, $this->get("logger"), $this->container);
     $rows = $mgr->getMy();
     for ($i = 0; $i < count($rows); $i++) {
         $micro_account = $rows[$i]["number"];
         $group = $mgr->getgrouplist($micro_account);
         $rows[$i]["grouplist"] = $group;
     }
     $re["list"] = $rows;
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
コード例 #2
0
 public function add_micro_quantityAction()
 {
     $conn = $this->get('we_data_access');
     $conn_im = $this->get('we_data_access_im');
     $userinfo = $this->get('security.context')->getToken()->getUser();
     $logger = $this->get("logger");
     $ext_count = $this->getRequest()->get("ext_count");
     $int_count = $this->getRequest()->get("int_count");
     $MicroAccountMgr = new MicroAccountMgr($conn, $conn_im, $userinfo, $logger, $this->container);
     $data = $MicroAccountMgr->add_micro_quantity($ext_count, $int_count);
     return $this->res(json_encode($data), 'json');
 }
コード例 #3
0
 public function rightMicroAppAction($network_domain)
 {
     $conn = $this->get('we_data_access');
     $conn_im = $this->get('we_data_access_im');
     $userinfo = $this->get('security.context')->getToken()->getUser();
     $eno = $userinfo->getEno();
     $logger = $this->get("logger");
     $MicroAccountMgr = new MicroAccountMgr($conn, $conn_im, $userinfo, $logger, $this->container);
     $listMA = $MicroAccountMgr->getmicroaccount(false, 1);
     $micro_app_count = count($listMA);
     $EnoParamManager = new EnoParamManager($conn, $logger);
     $micro_app_allow_count = $EnoParamManager->getCountCreateAppMicroAccount($eno);
     $data = array();
     $data['curr_network_domain'] = $network_domain;
     $data["listMA"] = $listMA;
     $data['micro_app_cancount'] = (int) $micro_app_allow_count - (int) $micro_app_count;
     if ($data['micro_app_cancount'] < 0) {
         $data['micro_app_cancount'] = 0;
     }
     $htmlfile = 'JustsyBaseBundle:EnterpriseHome:right_microapp_0.html.twig';
     if ($micro_app_count > 5) {
         $htmlfile = 'JustsyBaseBundle:EnterpriseHome:right_microapp_n.html.twig';
     } else {
         if ($micro_app_count > 0) {
             $htmlfile = 'JustsyBaseBundle:EnterpriseHome:right_microapp_5.html.twig';
         } else {
             $htmlfile = 'JustsyBaseBundle:EnterpriseHome:right_microapp_0.html.twig';
         }
     }
     return $this->render($htmlfile, $data);
 }
コード例 #4
0
 public function getmicroaccountAction()
 {
     $conn = $this->get('we_data_access');
     $conn_im = $this->get('we_data_access_im');
     $userinfo = $this->get('security.context')->getToken()->getUser();
     $logger = $this->get("logger");
     $MicroAccountMgr = new MicroAccountMgr($conn, $conn_im, $userinfo, $logger, $this->container);
     $data = $MicroAccountMgr->getmicroaccount();
     return $this->res(json_encode($data), 'json');
 }
コード例 #5
0
 public function changeattenAction()
 {
     $conn = $this->get('we_data_access');
     $conn_im = $this->get('we_data_access_im');
     $userinfo = $this->get('security.context')->getToken()->getUser();
     $logger = $this->get("logger");
     $request = $this->getRequest();
     $login_account = $userinfo->getUsername();
     $MicroAccountMgr = new MicroAccountMgr($conn, $conn_im, $userinfo, $logger, $this->container);
     $micro_number = $request->get("micro_number");
     $obj = $request->get("obj");
     $obj_type = $request->get("obj_type");
     $array["success"] = 0;
     $array["login_account"] = array();
     $array["msg"] = "";
     switch ($obj_type) {
         case "friend":
             $dataexec = $MicroAccountMgr->invite_micro_fans_friend($micro_number, $obj);
             $array["success"] = $dataexec["success"];
             $array["msg"] = $dataexec["msg"];
             break;
         case "group":
             $dataexec = $MicroAccountMgr->invite_micro_fans_group($micro_number, $obj);
             $array["success"] = $dataexec["success"];
             $array["msg"] = $dataexec["msg"];
             break;
         case "circle":
             $dataexec = $MicroAccountMgr->invite_micro_fans_circle($micro_number, $obj);
             $array["success"] = $dataexec["success"];
             $array["msg"] = $dataexec["msg"];
             break;
         case "enterprise":
             $dataexec = $MicroAccountMgr->micro_fans_enterprise($micro_number, $obj);
             $array["success"] = $dataexec["success"];
             $array["msg"] = $dataexec["msg"];
             break;
         default:
             $array["success"] = $MicroAccountMgr->micro_fans_attention($micro_number, $login_account);
             break;
     }
     return $this->res(json_encode($array), 'json');
 }
コード例 #6
0
ファイル: Service.php プロジェクト: 3116246/haolinju
 public function delete_service($parameter)
 {
     $micro_id = $parameter["micro_id"];
     $login_account = $parameter["login_account"];
     $user = $parameter["user"];
     $MicroAccountMgr = new Staff($this->conn, $this->conn_im, $login_account, $this->container->get("logger"), $this->container);
     $data = $MicroAccountMgr->getInfo();
     if (empty($data)) {
         return array("success" => false);
     }
     $MicroAccountMgr = new MicroAccountMgr($this->conn, $this->conn_im, $login_account, $this->container->get("logger"), $this->container);
     $dataexec = $MicroAccountMgr->removeByID($micro_id);
     $success = true;
     if ($dataexec === false) {
         $success = false;
     } else {
         $sqls = array();
         $paras = array();
         $sqls[] = "delete from im_microaccount_msg where microaccount=?";
         $paras[] = array((string) $data["fafa_jid"]);
         $sqls[] = "delete from im_microaccount_memebr where microaccount=?";
         $paras[] = array((string) $data["fafa_jid"]);
         $this->conn_im->ExecSQLS($sqls, $paras);
         $sql = "delete from we_service where login_account=?;";
         try {
             $this->conn->ExecSQL($sql, array((string) $login_account));
         } catch (\Exception $e) {
             $this->container->get("logger")->err($e->getMessage());
             return Utils::WrapResultError($e->getMessage());
         }
     }
     return Utils::WrapResultOK("");
 }
コード例 #7
0
 public function Add_MicroGroupAction()
 {
     $request = $this->getRequest();
     $da = $this->get("we_data_access");
     $da_im = $this->get("we_data_access_im");
     $currUser = $this->get('security.context')->getToken()->getUser();
     $logger = $this->get("logger");
     $container = $this->container;
     $re["returncode"] = ReturnCode::$SUCCESS;
     $re["msg"] = "";
     $micro_number = $request->get("micronumber");
     //公众号帐号
     $micro_groupname = $request->get("microgroupname");
     //分组名称
     if (!empty($micro_number)) {
         if (!empty($micro_groupname)) {
             $re["returncode"] = ReturnCode::$SYSERROR;
             $re["msg"] = "分组名称不能为空";
         } else {
             $mgr = new MicroAccountMgr($da, $da_im, $currUser, $logger, $container);
             $re = $mgr->insert_micro_group($micro_number, $micro_groupname);
         }
     } else {
         $re["returncode"] = ReturnCode::$SYSERROR;
         $re["msg"] = "公众号帐号不能为空";
     }
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }