功能强大的appshiny 怎么集成进自己的APP

后使用快捷导航没有帐号?
查看: 508|回复: 0
强大的shiny 怎么集成进自己的APP呢
高级会员, 积分 682, 距离下一级还需 318 积分
论坛徽章:13
这两周一直在学习shiny。
强大的功能,简单易用的代码,令人印象深刻。
老师也讲解了如何share shiny package with others by GitHub & ShinyApps.
但是怎么才能集成进自己的APP呢~
扫一扫加入本版微信群面对20位女生的贴心祝福,围观男生无比羡慕嫉妒恨。
女司机:粉丝会说你还是很厉害。我觉得会很掉粉。
声明:本文由入驻搜狐公众平台的作者撰写,除搜狐官方账号外,观点仅代表作者本人,不代表搜狐立场。
  1、后端使用nutz(nutz是什么看另一个帖子:
  2、两个数据表:customer、customerSrv
  3、customer表:用户表,app的用户,用户登录需要这张表
  4、customerSrv表:客服表,客服也可以登录铛铛,暂时客服只设置一人,客户只能pc端登录,app端暂时没有支持。一般情况客服用pc端更合适。
  5、loginByWx5:铛铛用户登录,由于用app自己的用户登录,不需要铛铛的登录界面,app用户登录后把铛铛需要的信息保存到localStroge中
  6、重点关注localStorage的chat_loginData,app登录成功后,按照铛铛的规则要求把用户、密码信息加密后保存到chat_loginData中
  7、铛铛自己的登录代码要注释掉,不能弹出铛铛的登录界面,涉及的地方比较多,不贴代码了,一步步调试可以解决
  /chat/wex5/js/im.wex5.impl.js
  代码片段:
  loginByWx5
  var loginByWex5 = function(params) {
  var userParams = {};
  userParams.CurrentPersonID = &&;
  userParams.CurrentPersonName = &&;
  userParams.CurrentPersonFID = &&;
  userParams.CurrentPersonFName = &&;
  userParams.CurrentOgnID = &&;
  userParams.CurrentOgnName = &&;
  userParams.CurrentDeptID = &&;
  userParams.CurrentDeptName = &&;
  userParams.CurrentDeptFID = &&;
  userParams.CurrentDeptFName = &&;
  userParams.CurrentOgnFID = &&;
  userParams.CurrentOgnFName = &&;
  userParams.CurrentFunRole = &3&;// 默认为3:普通员工。(1:公司领导;2:部门主管;3:普通员工)
  justep.Baas.sendRequest({
  //&url& : &/org/login&,
  &url& : &/ecoolper/chat&,
  //&action& : &loginAction&,
  &action& : &login&,
  &async& : false,
  &params& : {
  &userName& : params.username,
  &password& : params.password
  &success& : function(data) {
  if (ret.flag) {
  userParams.CurrentPersonID = ret.personID;
  userParams.CurrentPersonName = ret.personN
  //wjw(),注释。。。
  // userParams.CurrentPersonFID = ret.CurrentFID;
  // userParams.CurrentPersonFName = ret.CurrentFN
  // userParams.CurrentOgnID = ret.CurrentOgnID;
  // userParams.CurrentOgnName = ret.CurrentOgnN
  // userParams.CurrentFunRole = ret.CurrentFunR
  // userParams.CurrentOgnFID = &/& + ret.CurrentFID.split(&/&)[1];
  // userParams.CurrentOgnFName = &/& + ret.CurrentFName.split(&/&)[1];
  // if (ret.CurrentFID.indexOf(&dpt&) & 0) {
  // userParams.CurrentDeptID = ret.CurrentDeptID;
  // userParams.CurrentDeptName = ret.CurrentDeptN
  // userParams.CurrentDeptFID = ret.CurrentFID.substring(0, ret.CurrentFID.indexOf(&dpt&) + 3);
  // userParams.CurrentDeptFName = ret.CurrentFName.substring(0, ret.CurrentFName.indexOf(&/&, ret.CurrentFName.indexOf(&/&, 2) + 1));
  saveLoginDataToStore(userParams);
  loadPerson
  loadPerson : function(persons, pid) {
  var deferred = $.Deferred();
  justep.Baas.sendRequest({
  //&url& : &/org/loadPerson&,
  &url& : &/ecoolper/chat&,
  &action& : &loadPerson&,
  &async& : false,
  &params& : {
  &sPersonID& : pid
  &success& : function(data) {
  //客户id
  localStorage.setItem(&customerSrv&, data.customerSrv);
  $.each(data.persons, function(i, v) {
  var p = {
  id : v.sPersonID,
  name : v.sName,
  uid : v.sNumb,
  avatar : getPersonAvatar(v.sPhoto),
  nick : '',
  phones : [],
  about : ''
  persons[v.sPersonID] = new Person(p);
  deferred.resolve(persons);
  return deferred.promise();
  updatePersonUid:更新数据库中的sNumb字段
  updatePersonUid : function(uid, pid) {
  var self =
  var deferred = $.Deferred();
  justep.Baas.sendRequest({
  &url& : &/zlz/crm/person&,
  &action& : &updateUid&,
  &async& : false,
  &params& : {
  &uid& : uid,
  &pid& : pid
  &success& : function(data) {
  if (data.state) {
  var person = self._getPerson(pid);
  if (person) {
  person.uid =
  deferred.resolve();
  return deferred.promise();
  后端java代码片段,用nutz实现对应js中的loginByWx5
  @At(&/login&)
  @Ok(&json&)
  @AdaptBy(type = JsonAdaptor.class)
  public JSONObject login(@Param(&..&) JSONObject params) {
  String userName = params.getString(&userName&);
  String password = params.getString(&password&);
  JSONObject ret = new JSONObject();
  if (Strings.isBlank(userName)) {
  ret.put(&flag&, false);
  ret.put(&message&, &登录名不能为空&);
  } else {
  Cnd cnd = Cnd.NEW();
  cnd.and(&phone&, &=&, userName);
  cnd.and(&password&, &=&, password);
  Customer customer = dao.fetch(Customer.class, cnd);
  if (customer == null) {
  ret.put(&flag&, false);
  ret.put(&message&, &登录名或密码错误&);
  } else {
  ret.put(&flag&, true);
  ret.put(&personID&, customer.getId());
  ret.put(&personName&, customer.getNickname());
  ret.put(&message&, &&);
  ret.put(&CurrentFunRole&, &&);
  ret.put(&CurrentOgnID&, &&);
  ret.put(&CurrentOgnName&, &&);
  ret.put(&CurrentDeptID&, &&);
  ret.put(&CurrentDeptName&, &&);
  ret.put(&CurrentFID&, &&);
  ret.put(&CurrentFName&, &&);
  ret.put(&isInOrg&, true);
  对应js中的loadPerson
  @At(&/loadPerson&)
  @Ok(&json&)
  @AdaptBy(type = JsonAdaptor.class)
  public JSONObject loadPerson(@Param(&..&) JSONObject params) throws SQLException, NamingException {
  String id = params.getString(&sPersonID&);
  JSONObject ret = new JSONObject();
  JSONArray jArray = new JSONArray();
  // 本人
  Customer customer = dao.fetch(Customer.class, id);
  if (customer != null) {
  JSONObject json = new JSONObject();
  json.put(&sID&, customer.getId());
  json.put(&sChineseFirstPY&, &&);
  json.put(&sFID&, &&);
  json.put(&sCode&, &&);
  json.put(&sFCode&, &&);
  json.put(&sFName&, customer.getNickname());
  json.put(&sName&, customer.getNickname());
  json.put(&sNumb&, customer.getNumb());
  json.put(&sOrgKindID&, &&);
  json.put(&sPersonID&, customer.getId());
  json.put(&sPhoto&, &&);
  json.put(&sSequence&, &&);
  json.put(&sValidState&, &&);
  jArray.add(json);
  // 客服
  CustomerSrv cusSrv = dao.fetch(CustomerSrv.class);
  if (cusSrv != null) {
  JSONObject json = new JSONObject();
  json.put(&sID&, cusSrv.getId());
  json.put(&sChineseFirstPY&, &&);
  json.put(&sFID&, &&);
  json.put(&sCode&, &&);
  json.put(&sFCode&, &&);
  json.put(&sFName&, cusSrv.getName());
  json.put(&sName&, cusSrv.getName());
  json.put(&sNumb&, cusSrv.getNumb());
  json.put(&sOrgKindID&, &&);
  json.put(&sPersonID&, cusSrv.getId());
  json.put(&sPhoto&, &&);
  json.put(&sSequence&, &&);
  json.put(&sValidState&, &&);
  jArray.add(json);
  ret.put(&customerSrv&, cusSrv.getId());
  ret.put(&persons&, jArray);
  对应js中的:updatePersonUid
  @At(&/updateUid&)
  @Ok(&json&)
  @AdaptBy(type=JsonAdaptor.class)
  public JSONObject updatePersoUid(JSONObject params) {
  JSONObject ret = new JSONObject();
  ret.put(&flag&, false);
  String pid = params.getString(&pid&);
  int uid =Integer.parseInt(params.getString(&uid&) == null ? &0& : params.getString(&uid&).toString()); ;
  //客服表
  CustomerSrv customerSrv =dao.fetch(CustomerSrv.class, pid);
  if(customerSrv !=null){
  customerSrv.setNumb(uid);
  dao.update(customerSrv);
  ret.put(&flag&, true);
  //客户表
  Customer customer =dao.fetch(Customer.class, pid);
  if(customer !=null){
  customer.setNumb(uid);
  ret.put(&flag&, true);
欢迎举报抄袭、转载、暴力色情及含有欺诈和虚假信息的不良文章。
请先登录再操作
请先登录再操作
微信扫一扫分享至朋友圈
搜狐公众平台官方账号
生活时尚&搭配博主 /生活时尚自媒体 /时尚类书籍作者
搜狐网教育频道官方账号
全球最大华文占星网站-专业研究星座命理及测算服务机构
资深前端开发从业者分享纯干货、及犀利的观点!
主演:黄晓明/陈乔恩/乔任梁/谢君豪/吕佳容/戚迹
主演:陈晓/陈妍希/张馨予/杨明娜/毛晓彤/孙耀琦
主演:陈键锋/李依晓/张迪/郑亦桐/张明明/何彦霓
主演:尚格?云顿/乔?弗拉尼甘/Bianca Bree
主演:艾斯?库珀/ 查宁?塔图姆/ 乔纳?希尔
baby14岁写真曝光
李冰冰向成龙撒娇争宠
李湘遭闺蜜曝光旧爱
美女模特教老板走秀
曝搬砖男神奇葩择偶观
柳岩被迫成赚钱工具
大屁小P虐心恋
匆匆那年大结局
乔杉遭粉丝骚扰
男闺蜜的尴尬初夜
客服热线:86-10-
客服邮箱:假设你的App脚本已经写好了(里面至少包含Server.R和ui.R)
一,Windows下通过cmd执行App
只需两个步骤:
1. 在系统变量Path中添加:E:\你的R安装路径\bin
2. 运行cmd,执行:R -e “shiny::runApp(‘C:\Windows下你的App路径\你的App名称’)”
这个时候呢,cmd会提示里进入到一个网站:127.0.0.1:XXXX,在浏览器点进去就OK啦,
然并卵,这并不算部署到网上=。=
二,使用Windows通过shinyapps.io部署到网上
对,这TM就是个坑QAQ
1, 这需要使用到rsconnect包,关于怎么用rsconnect,请点这个链接:
《Getting started with shinyapps.io》
2, 如果我的推理没错的话,你应该会采用如下步骤:
library(rsconnect)
rsconnect::setAccountInfo(name='你注册时取的名字', token='一长串字符', secret='一长串字符')
rsconnect::deployApp('C:\\Windows下你的App路径\\你的App名称')
3,然后就无情的报错了:
Failed to lint file 'Server.R'
The linter failed with message:
invalid multibyte string at '&8d&'&2c&','乱码')'
4,卧槽,multibyte string是什么鬼 ?_?
在网上查了一下,这个错误应该是数据编码的问题。我读取数据用的是read.csv(),但在Windows下无论怎么改encoding和fileEncoding参数都没有卵用。另外,如果用cmd执行,read.csv()建议使用相对路径(在你的App文件夹下再创建一个data文件夹,把用到的数据放进去,然后read.csv(“.\数据.csv”))。
总而言之我(作为一个菜鸡)感觉,用Windows部署ShinyApp就是一个大坑。没办法,只能改换Linux。
三、使用Linux(CentOS 6)部署
Linux的好处是,只要我在Rstudio里面能执行这个App,也就是shinyApp(ui, Server)能执行,跳出来一个网页,那么它保存成Server.R和ui.R之后通过rsconnect就一定能部署到网上。
然后你以为这样就解决问题了?
并没有,还是read.csv()出错,在Windows下,我的命令如下,不会报错
tree=read.csv('数据.csv',header = T)
但是在Linux下,需要改encoding和fileEncoding参数。如果数据里面包含中文,建议将encoding 设为’UTF-8’,fileEncoding 设为 ‘GB2312’(有时候得设成GBK),然后就可以正常使用和展示数据了。
tree=read.csv('数据.csv',header = T,encoding = 'UTF-8', fileEncoding = 'GB2312')
App成品网址在下方,测试用的所以做的很简陋:
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:534次
排名:千里之外Shiny The Firefly:在 App Store 上的内容
正在打开 iTunes Store。如果 iTunes 不自动打开,在 Dock 或 Windows 桌面上点击 iTunes 图标。进度指示器
正在打开 iBooks Store。如果 iBooks 未打开,请在 Dock 中打开 iBooks App。进度指示器
如要轻松整理及新增数码媒体收藏,iTunes 是全世界最简单的工具。
我们在您的电脑上找不到 iTunes。 要购买和下载Headup Games GmbH & Co KG的Shiny The Firefly,请立即获取 iTunes。
已经有 iTunes 了? 现在点击「我有 iTunes」以打开 iTunes。
Shiny The Firefly
开发者:Headup Games GmbH & Co KG
打开 iTunes 以购买和下载 App。
+++ "Beautiful as a Pixar movie" [elmundo.es] ++++++ "Shiny The Firefly is a diamond, a small collector's piece that can be considered one of the best AppStore games. [9.5/10]" [] ++++++ "Bugtastic" [] ++++++ "The game is excellent, well-thought and with an addictive gameplay. [...] One of the best games we've tried out recently. [5/5]" [] ++++++ "This game is excellent. [4.5/5]" [] ++++++ ,,[…] a brilliant Game for in between. [8/10]“ [gamersplatform.de] ++++++ “The game is definitely one of the most felicitous releases of the week. Conclusion: BUY!” [appgefahren.de] ++++++ “Shiny The Firefly easily impresses by its wonderful overall concept and the lovely execution right down to the last detail. [9/10]” [iplayapps.de] +++This adorable game, set in the middle of a picturesque garden, has you helping Shiny, the cute little firefly, to find his babies. You’ll have to fly, run, hide and defend yourself against a legion of enemies. Stubborn mosquitoes, hungry toads, mischievous plants, sneaky wasps, endlessly long centipedes and lots of other little, dangerous garden dwellers are going to get in your way and make your life difficult.Your reflexes will be tested, as well as your wit and intellect as you navigate through this beautiful, colorful world helping Shiny in his search. All kinds of different animations let you know how Shiny’s feeling. So you’ll always know if he’s feeling happy, concerned, tired or angry. That will help you solve the trickiest situations in the game. Use your ability to shine skillfully: the babies can only follow Shiny when he is lit up, but that also makes him visible to his enemies…Can you reunite Shiny with his family?FEATURES:o Unique “Light on, light off” feature o Great, high-quality graphicso A charismatic character with numerous animationso Three different worlds with a total of 33 levels, teeming with enemies, bosses, puzzles and other game elementso An all-round fully developed and intuitive game experience for everybodyo Game Center integration
这游戏闪退
玩到第三大局后面几局闪退,无法玩了,搞不明白不完善好就上商店
其实游戏好是挺好耍的。
但是里面的那些动物实在是太恐怖太恶心了。
看看能不能变一些
画面很漂亮
闪退,尤其是选重玩时。
用户购买的还有
此 App 专为 iPhone 和 iPad 设计?12.00类别: 版本: 1.0大小: 220 MB语言: 德语, 法语, 英语, 荷兰文, 西班牙语开发商: Headup Games GmbH & Co. KG兼容性: 需要 iOS 4.2 或更高版本。与 iPhone 3GS、iPhone 4、iPhone 4s、iPhone 5、iPhone 5c、iPhone 5s、iPhone 6、iPhone 6 Plus、iPhone 6s、iPhone 6s Plus、iPhone SE、iPhone 7、iPhone 7 Plus、iPad、iPod touch(第 3 代)、iPod touch(第 4 代)、iPod touch(第 5 代) 和 iPod touch(第 6 代) 兼容。
4.23076&&&&&26 份评分
热门 App 内购买项目
Unlock All Levels?6.00
更多Headup Games GmbH & Co KG的产品主题:48560
最新软件应用技术尽在掌握
My first Shiny App: control charts
立即注册会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!
才可以下载或查看,没有帐号?
(This article was first published on
The Beginner Programmer
, and kindly contributed toR-bloggers)
& &After having carefully followed the online official Shiny tutorial , I decided to make a quick try at making my very first Shiny App. I should say that I found myself very well with the explanation given and Shiny was definitely one of the libraries that took the less time for me to start using it. Of course I’m still not a master of Shiny by no means, but I feel more confident on how to use it and on what can be done with it.
& &I’m working on an R project related to control charts and I was hinted to get to know Shiny, since it is very likely that the project will involve an interactive interface and Shiny fits the bill perfectly for this assignment. For this reason I took an afternoon for getting familiar with Shiny and build this App. Enough talk, let’s get to the App.
&&App description
& &The App is designed with one objective only: let me learn Shiny :D. I think this is quite obvious to the expert developer, however, the main idea is to allow the user to upload a .csv file of ungrouped observations, select the control chart to plot, group size, variable to plot, and then display the control chart and the results of the calculation as a data table.
&&Input data structure
&&The input file must be a .csv. So far I have not allowed other formats. The .csv can contain as many variables as you like, there is no limit, but bear in mind that Shiny (the free version at least) limits the size of files that can be uploaded to 5 MB. The file should have no row names, however, in case row names are present, do not reserve a free spot (“ ”) in the columns name row at the beginning of the file and everything should work fine. The data should be a series of consecutive measurements at a given constant frequency. For instance, if you took 2 measures of a certain variable y each day for 3 days, your data should be in the following format:
&&day_id,y_measurement
& &Of course, the day_id variable is not necessary. In this case the group size would be 2. For more information and an example of the allowed .csv format please check the readme .
&&Available charts
& &Only charts for quantitative variables are available. So far, the xbar-s and s charts are the only two supported. You can choose how many $\sigma$ you would like your control limits to be wide, 3 is the default but you can choose a higher or lower margin. The parameters of the control chart are showed in a table below the graph for further inspection.
&&Where to find the App
& &The App is available here . By default, the mtcars dataset is used, although it is not the exact fit it is needed just for show until you upload your data.
&&The application seems to run smoothly and overall I’m quite happy with how it turned out. This was just a test application for myself, so I did not take that much care of the graphical side of the application. Any comment is welcomed, thank you.
上一篇:下一篇:酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。本帖标题:本帖地址:
帖子永久地址:&<button type="submit" class="pn" onclick="setCopy('My first Shiny App: control charts\n/thread--1.html', '帖子地址已经复制到剪贴板您可以用快捷键 Ctrl + V 粘贴到 QQ、MSN 里。')">推荐给好友
width:100%">
一觉醒来,天都黑了。
width:100%">
支持,楼下的跟上哈~
width:100%">
如果有一双眼睛陪我一同哭泣,就值得我为生命受苦。&&
width:100%">
速度,火钳刘明!
width:100%">
发表于 4&天前
太过艳眼要成为整个酷辣虫最为脸熟之人!
width:100%">
12345678910
打开手机扫一扫
Comsenz Inc. Design: Dean. DiscuzFans.}

我要回帖

更多关于 安卓机最强大的app 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信