/** * 端末マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $terminal_id_arr = $this->af->get('terminal_id_arr'); // get session params $company_id = $this->session->get('company_id'); // dao $terminalDao = DaoFactory::TerminalMst(); $terminalUdidMDao = DaoFactory::TerminalUdidMst(); try { // begin $terminalDao->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $terminalDao->Delete(' company_id = ? ', $params); } else { foreach ($terminal_id_arr as $terminal_id) { $params['terminal_id'] = $terminal_id; $terminalDao->Delete(' company_id = ? AND terminal_id = ? ', $params); $terminalUdidMDao->Delete(' company_id = ? AND terminal_id = ? ', $params); } } $terminalDao->CommitTransaction(); } catch (Exception $e) { $terminalDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
function perform() { //パラメータ取得 $company_name = $this->af->get('company_name'); $address = $this->af->get('address'); $contact = $this->af->get('contact'); $tel = $this->af->get('tel'); $mail = $this->af->get('mail'); $psw = $this->af->get('psw'); $psw2 = $this->af->get('psw2'); $uuid = $this->af->get('uuid'); $locale = $this->af->get('locale'); if ($locale == "zh-Hans") { $default_locale = "zh-Hans-CN"; } elseif ($locale == "ja") { $default_locale = "ja_JP"; } else { $default_locale = "en_US"; } $params = array('company_name' => $company_name, 'address' => $address, 'contact' => $contact, 'company_tel' => $tel, 'mail' => $mail, 'UID' => 'terminal', 'PGM' => get_class()); try { //fixme $dao = DaoFactory::CompanyMst(); $wdao = DaoFactory::WarehouseMst(); $tdao = DaoFactory::TerminalMst(); $sdao = DaoFactory::StaffMst(); $tudao = DaoFactory::TerminalUdidMst(); $dao->BeginTransaction(); $company_id = $dao->getNewCompanyId(); $argu = array('company_id' => $company_id, 'example_id' => $this->config->get('template_company_id'), 'uuid' => $uuid, 'upd_uid' => 'terminal', 'upd_pgm' => get_class()); $dao->addNewCompanyForApi($argu); $where = ' COMPANY_ID = ? '; $bind = array($company_id); $dao->Update($params, $where, $bind); $wdao->Update(array('address' => $address, 'warehouse_tel' => $tel, 'contact' => $contact, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $sdao->Update(array('staff_tel' => $tel, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tdao->Update(array('password' => $psw, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tudao->Update(array('terminal_id' => $terminal_id, 'udid' => $udid, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); DaoFactory::UserMst()->Update(array('user_pwd' => $psw, 'UID' => 'terminal', 'PGM' => get_class(), 'E_MAIL' => $mail, 'DEFAULT_LOCALE' => $default_locale), $where, $bind); $warehouse_id = $wdao->getMaxWarehouseIdByCompany(array('company_id' => $company_id)); $terminal_id = $tdao->getMaxTerminalIdByCompany(array('company_id' => $company_id)); $staff_id = $sdao->getMaxStaffIdByCompany(array('company_id' => $company_id)); //commit $dao->CommitTransaction(); } catch (Exception $e) { // 致命的なエラーが発生 $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } mb_language('uni'); if ($locale == 'ja') { $subject = "{$this->config->get('system_name')}利用開始のご案内"; $message = "\r\n{$company_name} \r\n{$contact} 様\r\n\r\nこの度は「{$this->config->get('system_name')}」サービスにご登録いただきまして、誠にありがとうございます。\r\n本メールは iPhone/iPod touch の {$this->config->get('app_name')}アプリからアカウント申請を行っていただいた方に自動送信されています。\r\n本メールの心当たりがない場合は、本メールの破棄と弊社までご連絡頂ますようお願い申し上げます。\r\n\r\nアカウント申請後は {$this->config->get('app_name')}アプリのログイン画面にて申請時に入力したパスワードでログインが可能です。\r\n新規でご登録していただいたアカウントには端末1台2ヶ月まで無料ご利用いただけます。\r\n別の端末でログインするには、管理画面から端末追加登録とライセンス購入する必要がございます。\r\nライセンスのご購入はライセンスマスタ管理画面の購入リンクを押すか、直接AsShopにて、オンラインにてご購入いただけます。\r\n\r\nアカウント申請に伴い {$this->config->get('system_name')}に下記の情報が登録されています。\r\n-----------------アカウント情報------------------\r\n\t 会社ID:{$company_id}\r\n 初期管理者ユーザID:admin\r\n 管理者パスワード:申請時ご入力いただいたパスワード (端末のログインパスワードも同じです)※セキュリティのためパスワード本メールに含んでいません\r\n WEB管理画面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \r\n------------------デモ情報-------------------------\r\n**登録後すぐに端末からログインし、ご利用いただけるように、上記のアカウント情報以外に\r\n下記必要なデモデータも自動的に作成されています。\r\n 倉庫/場所/発注先 コード:{$warehouse_id}\r\n 端末ID:{$terminal_id}\r\n 担当者ID:{$staff_id}\r\n---------------------------------------------------\r\n\r\n本サービスはiPhone/iPod touch用バーコードリーダー「AsReader」を併用すると更に便利にご利用になれます。\r\n詳しくはホームページまで。\r\nhttp://asreader.com/\r\n\r\n本サービスご利用にあたり、質問などお困りの時がございましたら、下記のサイトまでご参照ください。\r\nサービスホーム http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\n "; } elseif ($locale == 'zh-Hans') { $subject = "{$this->config->get('app_name')}服务使用向导"; $message = "\r\n{$company_name} \r\n{$contact} 您好!\r\n \t\r\n非常感谢您登录{$this->config->get('app_name')}。\r\n这封邮件是在您通过iPhone/iPod touch的{$this->config->get('app_name')}应用程序,申请账号时自动发送给您的。\r\n如果您对该邮件不知情,请销毁本邮件并与我们联系。\r\n \t\r\n账户申请后,您就可以使用申请账号时所设置的密码在 {$this->config->get('app_name')}应用程序的登录画面中登录使用了。\r\n新注册的账号里已自动生成1台终端,可免费使用两个月。\r\n如需新增使用其他终端,需要在管理画面中的“终端管理”进行终端添加并购买证书后方可使用。\r\n \t\r\n以下是您所申请的{$this->config->get('app_name')}账户的相关信息。\r\n-----------------账户信息------------------\r\n\t 公司ID:{$company_id}\r\n \t 管理员ID:admin\r\n\t 管理员密码:申请账户时填写的密码 (与终端登录密码相同)\r\n\t WEB管理页面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \t \r\n------------------模板信息-------------------------\r\n**为了在注册后您可以马上使用终端登录来体验我们的服务,除以上账户信息外,\r\n我们也为你创建了以下必要的基本信息。\r\n\t 仓库/场所/供货方 代码:{$warehouse_id}\r\n\t 终端ID:{$terminal_id}\r\n\t 操作员ID:{$staff_id}\r\n---------------------------------------------------\r\n \t\r\n如在使用本服务中遇到任何问题,请查看以下相关网站。\r\n服务总站 http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net \r\n \t\r\n"; } else { $subject = "Thank you for signing up {$this->config->get('app_name')} service"; $message = "\r\n{$company_name} \r\nHi {$contact} \r\n \t \r\nThank you for signing up our service {$this->config->get('app_name')}. \r\nThis mail is sent to every user who has registered an new account from our iOS app {$this->config->get('app_name')}.\r\nPlease feel free to contact us if you were not aware that you were going to receive it.\r\n \t \r\nYou can login to the app {$this->config->get('app_name')} with the password you have input in the register form upon receipt of this email.\r\n \t \r\nAccount Information:\r\n-----------------Account info------------------\r\n\t Company ID:{$company_id}\r\n\t Admin User ID:admin\r\n\t Password:The password you set in registration form\r\n\t Admin page URL: {$this->config->get('url')}?company_id={$company_id}\r\nEvery new account is assoiated with one preset terminal with a 2month free license.\r\nIf you want more terminals or longer licenses, please create terminal in the back-end admin system and buy license from our online shop.\r\n\r\n------------------demo data-------------------------\r\nBesides the account information above, we have also created some demo datas in order to help you test or learn our system easier.\r\n\t Warehouse/Place/Seller ID:{$warehouse_id}\r\n\t Terminal ID:{$terminal_id}\r\n\t Staff ID:{$staff_id}\r\n---------------------------------------------------\r\n \t \r\nOur app support AsReader 100% internally. AsReader is a series of hardware for iOS devices, they have ability to scan barcode or RFID tags and send the data to iOS devices.\r\nSo, it can easily turn your iPhones/iPods into a powerful handheld termials.\r\nfor more information, please refer to their official site:\r\nhttp://asreader.com/\r\n\r\nIf you have any question during using our service, please consult our following site for more information.\r\nService Home http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\nBest regards,\r\n\r\nAsApps Team\r\n \t \r\n"; } $headers = "From: {$this->config->get('admin_email_address')}"; mb_send_mail($mail, $subject, $message, $headers); $output['company_id'] = $company_id; $output['warehouse_id'] = $warehouse_id; $output['terminal_id'] = $terminal_id; $output['staff_id'] = $staff_id; $output['server_url'] = $this->config->get('url'); return array('json', $output); }