微擎微擎应用项目总结表的命名规范 Ims_模块文件名_表名 加入头文件 一般只要不是定制开发的,都要加入下面代码 {template 'common/header'} 内容 {template 'common/footer'} 微擎上传 单图片上传 http://s.we7.cc/index.php?c=wiki&do=view&id=1&list=330 初次 {php ec作者王明昌发布时间2018-07-22最后更新2018-07-22文章目录微擎方法常用表的命名规范 Ims_模块文件名_表名加入头文件 一般只要不是定制开发的,都要加入下面代码复制{template 'common/header'} 内容 {template 'common/footer'} 微擎上传 单图片上传 http://s.we7.cc/index.php?c=wiki&do=view&id=1&list=330 复制初次 {php echo tpl_form_field_image('single-image');} //修改时,文本框内的图片链接地址 图片显示的遍历(19) 复制 form 提交 createWebUrl('Add')&aaa='asa1'} method="POST"> $_W['ispost]更新数据的小技巧 插入数据: pdo_insert($tablename, $data = array(), $replace = false); 更新数据: pdo_insert($tablename, $data = array(), $replace = true);分页 复制public function doWebOrders() { global $_W,$_GPC; $sql="select * from ".tablename('gold_eggs_orders'); $sources=pdo_fetchall($sql); //分页开始 $total=count($sources); $pageindex=max($_GPC['page'],1); $pagesize=6; $pager=pagination($total,$pageindex,$pagesize); $p=($pageindex-1)*6; $sql.=" order by id desc limit ".$p." , ".$pagesize; $orderdata=pdo_fetchall($sql); include $this->template('orders'); {$pager} message http://s.we7.cc/index.php?c=wiki&do=view&id=1&list=281 message($msg, $redirect = '', $type = '') 页面执行中断跳转到另一个页面ajax 复制 $.getJSON("{php echo $this->create******}",function(res){ if(){} }); return json_encode(); 判断用户是否关注公众号 subscribe=1 关注 0未关注 复制$account_api = WeAccount::create(); $token = $account_api->getAccessToken(); $userinfo=mc_oauth_userinfo($_W['uniacid']); $url="https://api.weixin.qq.com/cgi-bin/user/info?access_token={$token}&openid={$userinfo['openid']}&lang=zh_CN"; $response = ihttp_get($url); $json2Array = json_decode($response['content'],true); print_r($json2Array['subscribe']);// 0 1 支付判断与模版消息 复制if(($conf_data['totalamount']-1)>=0){ //5给用户支付到零钱 //更uid等于2的用户的用户名 $cfg_data = array( 'totalamount' => $conf_data['totalamount']-1, ); $result = pdo_update('gold_eggs_configs', $cfg_data, array('id' => 1)); $ordernum=$this->getordernums(); $weixinpay=new Pay();//先引用pay $partner_trade_no=$ordernum; $bonus=1; $res=$weixinpay->weixin_transfer_money($userinfo['openid'],'',$bonus*100,$partner_trade_no,'抽奖红包'); //验证支付结果 if($res['result_code']=="SUCCESS"){ //6创建订单 $order_data = array( 'partner_trade_no' => $ordernum, 'payment_no' => $res['payment_no'], 'price' => 1, 'status' => 1, 'error' => '提现成功', ); pdo_insert('gold_eggs_orders', $order_data); //发送模板消息 $tpl_data = array( 'first' => array( 'value' => "砸金蛋红包提现成功!", 'color' => '#ff510' ), 'orderProductPrice' => array( 'value' => '1元', 'color' => '#ff510' ), 'orderProductName' => array( 'value' => '参加砸金蛋', 'color' => '#ff510' ), 'orderAddress' => array( 'value' => $ordernum, 'color' => '#ff510' ), 'orderName' => array( 'value' => "2018" , 'color' => '#ff510' ), ); $indexurl=$_W['siteroot'].'app/'.$this->createMobileUrl('index'); $url=$indexurl; $account_api = WeAccount::create(); $account_api->sendTplNotice($userinfo['openid'], '***CO3-KS5pZOR1EYfnG7j6o2kcD39nqoSd77pQK0J0', $tpl_data,$url); }else{ //6创建订单 $order_data = array( 'partner_trade_no' => $ordernum, 'payment_no' => '', 'price' => 1, 'status' => 0, 'error' => $res['err_code_des'], ); pdo_insert('gold_eggs_orders', $order_data); } $datas=['status'=>1,'msg'=>'恭喜,获得1元红包']; }else{ $datas=['status'=>0,'msg'=>'活动已结束']; } 微擎方法常用复制产生随机小数 // /** // *产生随机小数的函数 // */ function randomFloat($min, $max) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); } // /** // *获取指定位数的小数 // */ $num=randomFloat(1,8); // echo $num; $newNum = sprintf("%.2f",$num); echo $newNum; jQuery 初始化 $("input[name='newsletter']") 选择所有的name属性等于'newsletter'的input元素 通过 class $('.multiple-del') $(" #test ").val() $(" input[ name='test' ] ").val() $(" input[ type='text' ] ").val() $(" input[ type='text' ]").attr("value") 修改属性 $("#w3s").attr("href","http://www.51cto.com"); 微擎封装获取用户信息的函数 $userinfo=mc_oauth_userinfo($_W['uniacid']); public static boolean isMobileNO(String mobileNums) { /** * 判断字符串是否符合手机号码格式 * 移动号段: 134,135,136,137,138,139,147,150,151,152,157,158,159,170,178,182,183,184,187,188 * 联通号段: 130,131,132,145,155,156,170,171,175,176,185,186 * 电信号段: 133,149,153,170,173,177,180,181,189 * @param str * @return 待检测的字符串 */ String telRegex = "^((13[0-9])|(14[5,7,9])|(15[^4])|(18[0-9])|(17[0,1,3,5,6,7,8]))\\d{8}$";// "[1]"代表第1位为数字1,"[358]"代表第二位可以为3、5、8中的一个,"\\d{9}"代表后面是可以是0〜9的数字,有9位。 if (TextUtils.isEmpty(mobileNums)) return false; else return mobileNums.matches(telRegex); } 发起支付 public function getordernums(){ $danhao = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); return $danhao.mt_rand(1000, 9999); } $weixinpay=new Pay(); $partner_trade_no=date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); $userinfo=mc_oauth_userinfo($_W['uniacid']); $bonus=1; $res=$weixinpay->weixin_transfer_money($userinfo['openid'],'',$bonus*100,$partner_trade_no,'抽奖红包'); 发模板消息 $data = array( 'first' => array( 'value' => "捐赠成功!", 'color' => '#ff510' ), 'orderProductPrice' => array( 'value' => $money, 'color' => '#ff510' ), 'orderProductName' => array( 'value' => '为流浪狗捐款', 'color' => '#ff510' ), 'orderAddress' => array( 'value' => '无', 'color' => '#ff510' ), 'orderName' => array( 'value' => "2018" , 'color' => '#ff510' ), ); $url=$_W['siteroot']."app/index.php?i=2&c=entry&do=create&m=stray_dog&ordernum=".$torder['ordernums']."&openid=".$torder['openid']."&did=".$torder['dogid']; $account_api = WeAccount::create(); $result = $account_api->sendTplNotice($torder['openid'], 'GqqCO3-KS5pZOR1EYfnG7j6o2kcD39nqoSd77pQK0J0', $data,$url);
2018-07-22微擎模块开发流程 http://wq.90ckm.com/app/index.php?i=2&c=entry&eid=15 i:是公众号的站内id c=entry :应用入口 eid:用户安装后的应用id 数据表:
2018-07-21微擎 | 插件应用的安装/自己新建应用模块存放位置/addons 1.在线安装 在应用商城中购买,在绑定的微擎程序中安装 2.线下安装 别人开发的 问题: 云端通信/版权保护  解决方案: 修改打开 \framework\model\c
2018-07-22微擎支付api发起支付并验证 1. 设置微擎上的支付参数 2. 微信商户号配置配置 登录商户号--产品中心--开发配置 3. PHP发起支付 [http://s.we7.cc/index.php?c=wiki&do=view&i
2018-07-22微擎 | 自定义分享到朋友圈获取用户信息 //$_W['uniacid'] 获取当前公众号的id $userinfo = mc_oauth_userinfo($_W['uniacid']) //获取用户的信息 自定义分享 //方
2018-07-22微擎 微信企业付款到用户零钱 目标: 实现企业付款到零钱 步骤 1 下载支付证书 2 配置支付参数 (1 用户微信需要实名认证 2 提现最低要1元) 3 发起支付获取支付结果 企业付款微信官方文档 https://pay.wei