public function Create() { $this->LogInfo("company create ..."); $obj = $this->GetCommonData(); //创建公司 $companyDao = $this->GetModel(); $condition['company_name'] = $obj->company_name; $companyID = $companyDao->where($condition)->getField('company_id'); if ($companyID != '') { $this->LogWarn("Create company failed, company has exist. Company_name is " . $obj->company_name); $this->errorCode = MispErrorCode::COMPANY_EXISTED; $this->ReturnJson(); return; } $object = $this->objectToArray($obj); $object['company_status'] = CompanyEnum::STATUS_NORMAL; try { $companyID = MispCommonService::Create($companyDao, $object); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } //创建公司基本角色 try { $roleID = $this->CreateBasicRole($companyID); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } //创建System user $systemUserDao = MispDaoContext::SystemUser(); $user['user_name'] = $obj->user_name; $user['password'] = "******"; $user['role_id'] = $roleID; //增加公司时,同时增加了一个企业管理员账户 $user['reg_date'] = date('Y-m-d H:i:s', time()); $user['company_id'] = $companyID; $this->LogInfo("Create first admin of company, user info is " . json_encode($user)); try { $userID = MispCommonUserService::Create($user); } catch (FuegoException $e) { $this->errorCode = $e->getCode(); $this->ReturnJson(); return; } //创建admin $admin['user_id'] = $userID; $admin['user_name'] = $obj->user_name; $admin['company_id'] = $companyID; $this->LogInfo("Create first admin of company, admin info is " . json_encode($admin)); $this->errorCode = MispServiceContext::UserManage()->CreateAdmin($admin); $this->ReturnJson(); }
public function GetNotify() { //基础信息配置 $this->LogInfo("Alipay notify ..."); $alipay_config['partner'] = '2088811061975475'; //合作身份者id,以2088开头的16位纯数字 $alipay_config['private_key_path'] = 'C:/software/xampps/htdocs/Laundry/MISP/Lib/Action/key/rsa_private_key.pem'; //商户的私钥(后缀是.pen)文件相对路径 $alipay_config['ali_public_key_path'] = 'C:/software/xampps/htdocs/Laundry/MISP/Lib/Action/key/alipay_public_key.pem'; //支付宝公钥(后缀是.pen)文件相对路径 $alipay_config['sign_type'] = strtoupper('RSA'); //签名方式 不需修改 $alipay_config['input_charset'] = strtolower('utf-8'); //字符编码格式 目前支持 gbk 或 utf-8 $alipay_config['cacert'] = getcwd() . '\\cacert.pem'; //ca证书路径地址,用于curl中ssl校验,请保证cacert.pem文件在当前文件夹目录中 $alipay_config['transport'] = 'http'; //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http //计算得出通知验证结果 $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyNotify(); if ($verify_result) { $this->LogInfo("alipayNotify success."); $orderCode = $_POST['out_trade_no']; //商户订单号 $trade_no = $_POST['trade_no']; //支付宝交易号 $trade_status = $_POST['trade_status']; //交易状态 $this->LogInfo("trade status is " . $trade_status . ". order code is " . $orderCode . ". trade no is " . $trade_no); if ($trade_status == 'TRADE_FINISHED') { MispServiceContext::AlipayNotify()->UpdateOrderStatus($trade_status, $orderCode); //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 //注意: //该种交易状态只在两种情况下出现 //1、开通了普通即时到账,买家付款成功后。 //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } else { if ($trade_status == 'TRADE_SUCCESS') { MispServiceContext::AlipayNotify()->UpdateOrderStatus($trade_status, $orderCode); //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 //注意: //该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。 //调试用,写文本函数记录程序运行情况是否正常 //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录"); } } echo "success"; //请不要修改或删除 } else { $this->LogInfo("Alipay notify failed."); //验证失败 echo "fail"; } }
public function ModifyPassword() { $req = $this->GetReqObj(); $reqType = $this->GetReqType(); $this->LogInfo("Modify password,client type is " . $reqType); if ($reqType == ClientTypeEnum::IOS || $reqType == ClientTypeEnum::ANDROID) { //修改密码 $condition['company_id'] = $req->app_id; $condition['user_name'] = $req->user_name; $this->errorCode = MispServiceContext::UserManage()->ModifyPassword($condition, $req); } if ($reqType == "WEB") { $condition['user_name'] = $_SESSION['user']['user_name']; $this->errorCode = MispServiceContext::UserManage()->ModifyPassword($condition, $req); if ($this->errorCode == MispErrorCode::SUCCESS) { session_destroy(); } } $this->ReturnJson(); }