$last_updated = isset($_POST["last_updated"]) ? strip_tags($_POST["last_updated"]) : null; /// proceed submission // proceed for $nickname $object->setNickname($nickname); // proceed for $wechat_id $object->setWechatId($wechat_id); // proceed for $openid $object->setOpenid($openid); // proceed for $introduction $object->setIntroduction($introduction); // proceed for $cirtification $object->setCirtification($cirtification); // proceed for $qr_code $object->setQrCode($qr_code); // proceed for $logo $object->setLogo($logo); // proceed for $active $object->setActive($active); // proceed for $last_updated $object->setLastUpdated($last_updated); if ($error_flag == false) { if ($object->save()) { Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功")))); HTML::forwardBackToReferer(); } else { Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败")))); } } } $html = new HTML(); $html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Wechat Account', 'zh' => 'Create 微信公共账号'))));
$openid = isset($_POST['openid']) ? strip_tags($_POST['openid']) : null; $wechatid = isset($_POST['wechatid']) ? strip_tags($_POST['wechatid']) : null; $description = isset($_POST['description']) ? strip_tags($_POST['description']) : null; $certification = isset($_POST['certification']) ? strip_tags($_POST['certification']) : null; $nickname = isset($_POST['nickname']) ? strip_tags($_POST['nickname']) : null; $qrcode = isset($_POST['qrcode']) ? strip_tags($_POST['qrcode']) : null; $logo = isset($_POST['logo']) ? strip_tags($_POST['logo']) : null; // if wechat account hasn't been added globally, we add it $wechat_account = WechatAccount::findByOpenid($openid); if ($wechat_account == null) { $wechat_account = new WechatAccount(); $wechat_account->setDescription($description); $wechat_account->setCertification($certification); $wechat_account->setOpenid($openid); $wechat_account->setWechatId($wechatid); $wechat_account->setLogo($logo); $wechat_account->setQrCode($qrcode); $wechat_account->setNickname($nickname); $wechat_account->save(); } $user_wechat_account = UserWechatAccount::findByWechatAccountId($wechat_account->getId()); if ($user_wechat_account) { $response->status = 'error'; $response->message = '此公众号已添加'; } else { $user_wechat_account = new UserWechatAccount(); $user_wechat_account->setAccountId($wechat_account->getId()); $user_wechat_account->setCategoryId(1); if ($user_wechat_account->save()) { $response->status = 'success'; } else {